Changeset 8339

Show
Ignore:
Timestamp:
09/07/09 05:05:08 (4 years ago)
Author:
mbrevda
Message:

Merged revisions 8040,8071-8076,8253,8271-8272 via svnmerge from
http://svn.freepbx.org/freepbx/trunk

........

r8040 | mbrevda | 2009-08-14 15:52:22 +0300 (Fri, 14 Aug 2009) | 1 line


include freepbx js libraries in ARI

........

r8071 | mbrevda | 2009-08-16 13:26:47 +0300 (Sun, 16 Aug 2009) | 1 line


add module name to messages

........

r8072 | mbrevda | 2009-08-16 16:20:38 +0300 (Sun, 16 Aug 2009) | 1 line


closes #3807, Cant uninstall modules from command line due to missing functions

........

r8073 | mbrevda | 2009-08-16 19:42:44 +0300 (Sun, 16 Aug 2009) | 1 line


added installall, removeall, mirrorrepo

........

r8074 | mbrevda | 2009-08-16 19:52:17 +0300 (Sun, 16 Aug 2009) | 1 line


_modules_doinclude should include_once (not include) incase the file was already included elsewhere

........

r8075 | mbrevda | 2009-08-17 13:19:12 +0300 (Mon, 17 Aug 2009) | 1 line


reverting r8072, re: #3807, implemented in module_admin instead

........

r8076 | mbrevda | 2009-08-17 14:30:47 +0300 (Mon, 17 Aug 2009) | 1 line


perfect r8073, order module alphabeticaly - ALMOST NO CODE CHANGE

........

r8253 | mbrevda | 2009-08-30 18:07:37 +0300 (Sun, 30 Aug 2009) | 1 line


closes #3843, check for apply_conf.sh befor running

........

r8271 | mbrevda | 2009-09-04 16:33:13 +0300 (Fri, 04 Sep 2009) | 1 line


closes #3856, #3857. Nicer messages, includes when using module_admin

........

r8272 | mbrevda | 2009-09-04 16:36:38 +0300 (Fri, 04 Sep 2009) | 1 line


revert accidental ci's in r8271

........

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.6

    • Property svnmerge-blocked changed from /freepbx/branches/2.3:4130,4132,4135,4997,5002,5004,5020,5028,5035-5037,5043,5077,5096,5101-5102,5108,5118,5123,5133-5134,5152,5154,5216,5236,5248,5295,5489 /freepbx/trunk:4134,4137-4139 to /freepbx/trunk:4134,4137-4139 /freepbx/branches/2.3:4130,4132,4135,4997,5002,5004,5020,5028,5035-5037,5043,5077,5096,5101-5102,5108,5118,5123,5133-5134,5152,5154,5216,5236,5248,5295,5489
    • Property svnmerge-integrated changed from /freepbx/branches/2.5:1-7770 /freepbx/trunk:1-7909,8094-8166 to /freepbx/trunk:1-8338 /freepbx/branches/2.5:1-7770
  • freepbx/branches/2.6/amp_conf/astetc/cdr_mysql.conf

    r5723 r8339  
    22; Note - if the database server is hosted on the same machine as the  
    33; asterisk server, you can achieve a local Unix socket connection by  
    4 ; setting hostname=localhost  
     4; setting hostname = localhost 
    55;  
    66; port and sock are both optional parameters.  If hostname is specified  
     
    1212;  
    1313[global]  
    14 hostname=localhost  
     14hostname = localhost 
    1515dbname=asteriskcdrdb  
    16 password=AMPDBPASS 
    17 user=AMPDBUSER 
     16password = AMPDBPASS 
     17user = AMPDBUSER 
    1818userfield=1 
    1919;port=3306  
  • freepbx/branches/2.6/amp_conf/bin/module_admin

    r7646 r8339  
    9090} 
    9191 
     92function doReload() { 
     93  $result = do_reload(); 
     94 
     95  if ($result['status'] != true) { 
     96    out("Error(s) have occured, the following is the retrieve_conf output:"); 
     97    $retrieve_array = explode('<br/>',$result['retrieve_conf']); 
     98    foreach ($retrieve_array as $line) { 
     99      out($line); 
     100    }; 
     101  } else { 
     102    out($result['message']); 
     103  } 
     104} 
     105 
     106function doDisable($modulename, $force) { 
     107  getIncludes(); 
     108  if (is_array($errors = module_disable($modulename, $force))) { 
     109    out("The following error(s) occured:"); 
     110    out(' - '.implode("\n - ",$errors)); 
     111    exit(2); 
     112  } else { 
     113    out("Module ".$modulename." successfully disabled"); 
     114  } 
     115} 
     116 
     117function doEnable($modulename, $force) { 
     118  getIncludes(); 
     119  if (is_array($errors = module_enable($modulename, $force))) { 
     120    out("The following error(s) occured:"); 
     121    out(' - '.implode("\n - ",$errors)); 
     122    exit(2); 
     123  } else { 
     124    out("Module ".$modulename." successfully enabled"); 
     125  } 
     126} 
     127 
     128function doInstall($modulename, $force) { 
     129  getIncludes(); 
     130  if (is_array($errors = module_install($modulename, $force))) { 
     131    out("The following error(s) occured:"); 
     132    out(' - '.implode("\n - ",$errors)); 
     133    exit(2); 
     134  } else { 
     135    out("Module ".$modulename." successfully installed"); 
     136  } 
     137} 
     138 
     139function doDelete($modulename, $force) { 
     140  getIncludes(); 
     141  if (is_array($errors = module_delete($modulename, $force))) { 
     142    out("The following error(s) occured:"); 
     143    out(' - '.implode("\n - ",$errors)); 
     144    exit(2); 
     145  } else { 
     146    out("Module ".$modulename." successfully deleted"); 
     147  } 
     148} 
     149 
     150function doDeleteAll($force=true) { 
     151  getIncludes(); //get functions from other modules, in case we need them here 
     152  $modules = module_getinfo(false, false, true); 
     153  unset($modules['builtin']);//builtin never gets deleted, so remove it from the list 
     154  $temp = array(); 
     155  if (isset($modules['core'])){ //move core to the end 
     156    $temp['core']=$modules['core']; 
     157    unset($modules['core']);  
     158    $modules['core']=$temp['core']; 
     159  } 
     160  unset($temp); 
     161    foreach ($modules as $module){ 
     162      if (is_array($errors = module_delete($module['rawname'], true))) { 
     163        out("The following error(s) occured:"); 
     164        out(' - '.implode("\n - ",$errors)); 
     165        //exit(2); 
     166      } else { 
     167        out("Module ".$module['rawname']." successfully deleted"); 
     168      }  
     169  } 
     170    out('All modules successfully removed'); 
     171} 
     172 
     173function doDownload($modulename, $force) { 
     174 
     175  global $modulexml_path; 
     176  global $modulerepository_path; 
     177 
     178  if (is_array($errors = module_download($modulename, $force, 'download_progress', $modulerepository_path, $modulexml_path))) { 
     179    out("The following error(s) occured:"); 
     180    out(' - '.implode("\n - ",$errors)); 
     181    exit(2); 
     182  } else { 
     183    out("Module ".$modulename." successfully downloaded"); 
     184  } 
     185} 
     186 
     187 
     188function download_progress($action, $params) { 
     189  switch ($action) { 
     190    case 'untar': 
     191      outn("\nUntaring.."); 
     192    break; 
     193    case 'downloading': 
     194      outn("\rDownloading ".$params['read'].' of '.$params['total'].' ('.($params['total'] ? round($params['read']/$params['total']*100) : '0').'%)            '); 
     195      if ($params['read'] == $params['total']) { 
     196        out(''); 
     197      } 
     198    break; 
     199    case 'done'; 
     200      out('Done'); 
     201    break; 
     202  } 
     203} 
     204 
     205function doUninstall($modulename, $force) { 
     206  getIncludes(); 
     207  if (is_array($errors = module_uninstall($modulename, $force))) { 
     208    out("The following error(s) occured:"); 
     209    out(' - '.implode("\n - ",$errors)); 
     210    exit(2); 
     211  } else { 
     212    out("Module ".$modulename." successfully uninstalled"); 
     213  } 
     214} 
     215 
     216function doUpgrade($modulename, $force) { 
     217  // either will exit() if there's a problem 
     218  doDownload($modulename, $force); 
     219  doInstall($modulename, $force); 
     220} 
     221 
     222function doInstallAll($force) { 
     223  doUpgradeAll(true); 
     224  $modules = getInstallableModules(); 
     225  if (in_array('core', $modules)){ 
     226    out("Installing core..."); 
     227    doDownload('core', $force); 
     228    doInstall('core', $force); 
     229  } 
     230  if (count($modules) > 0) { 
     231    out("Installing: ".implode(', ',$modules)); 
     232    sleep(1); // a bit of time to ^C abort.. 
     233    foreach ($modules as $module => $name) { 
     234      if (($name != 'core')){//we dont want to reinstall core 
     235        getIncludes(); //get functions from other modules, in case we need them here 
     236        out("Installing $name..."); 
     237        doDownload($name, $force); 
     238        doInstall($name, $force); 
     239      } 
     240    }  
     241    out("Done. All modules installed."); 
     242  } else { 
     243    out("All modules up to date."); 
     244  } 
     245} 
     246 
     247function getIncludes(){ 
     248  $active_modules = module_getinfo(false, MODULE_STATUS_ENABLED); 
     249  if(is_array($active_modules)){ 
     250    foreach($active_modules as $key => $module) { 
     251      //include module functions 
     252      if (is_file("modules/{$key}/functions.inc.php")) { 
     253        require_once("modules/{$key}/functions.inc.php"); 
     254      } 
     255    } 
     256  } 
     257} 
     258 
     259/**  
     260 * @param bool Controls if a simple (names only) or extended (array of name,versions) array is returned 
     261 */ 
     262function getInstallableModules($extarray = false) { 
     263  $modules_online = module_getonlinexml(); 
     264  $module_info=module_getinfo(false); 
     265  $modules_installable = array(); 
     266 
     267  foreach ($modules_online as $name) { 
     268    if ((!isset($module_info[$name['rawname']]['status'])) || ($module_info[$name['rawname']]['status'] == MODULE_STATUS_NEEDUPGRADE)){ 
     269      $modules_installable[]=$name['rawname']; 
     270    } 
     271  } 
     272  return $modules_installable; 
     273} 
     274 
     275/**  
     276 * @param bool Controls if a simple (names only) or extended (array of name,versions) array is returned 
     277 */ 
     278function getUpgradableModules($extarray = false) { 
     279  $modules_local = module_getinfo(false, MODULE_STATUS_ENABLED); 
     280  $modules_online = module_getonlinexml(); 
     281  $modules_upgradable = array(); 
     282   
     283  foreach (array_keys($modules_local) as $name) { 
     284    if (isset($modules_online[$name])) { 
     285      if (version_compare_freepbx($modules_local[$name]['version'], $modules_online[$name]['version']) < 0) { 
     286        if ($extarray) { 
     287          $modules_upgradable[] = array( 
     288            'name' => $name, 
     289            'local_version' => $modules_local[$name]['version'], 
     290            'online_version' => $modules_online[$name]['version'], 
     291          ); 
     292        } else { 
     293          $modules_upgradable[] = $name; 
     294        } 
     295      } 
     296    } 
     297  } 
     298  return $modules_upgradable; 
     299} 
     300 
     301function doUpgradeAll($force) { 
     302  $modules = getUpgradableModules(); 
     303  if (count($modules) > 0) { 
     304    out("Upgrading: ".implode(', ',$modules)); 
     305    sleep(1); // a bit of time to ^C abort.. 
     306    foreach ($modules as $modulename) { 
     307      out("Upgrading $modulename.."); 
     308      doUpgrade($modulename, $force); 
     309    } 
     310    out("All upgrades done!"); 
     311  } else { 
     312    out("Up to date."); 
     313  } 
     314} 
     315 
     316function mirrorrepo(){ 
     317  doInstallAll(true); 
     318  $modules_online = module_getonlinexml(); 
     319  $modules_local = module_getinfo(); 
     320  unset($modules_local['builtin']); //builtin never gets deleted, so remove it from the list 
     321  foreach ($modules_local as $localmod){ 
     322    if (!module_getonlinexml($localmod['rawname'])){ 
     323      doDelete($localmod['rawname'],1); 
     324    } 
     325  } 
     326} 
     327 
     328function showi18n($modulename) { 
     329  $modules = module_getinfo($modulename); 
     330  if (!isset($modules[$modulename])) { 
     331    fatal($modulename.' not found'); 
     332  } 
     333 
     334  if (isset($modules[$modulename]['name'])) { 
     335    echo "# name:\n_(\"".$modules[$modulename]['name']."\")\n"; 
     336  } 
     337  if (isset($modules[$modulename]['category'])) { 
     338    echo "# category:\n_(\"".$modules[$modulename]['category']."\")\n"; 
     339  } 
     340  if (isset($modules[$modulename]['description'])) { 
     341    echo "# description:\n_(\"".trim(str_replace("\n","",$modules[$modulename]['description']))."\")\n"; 
     342  } 
     343  if (isset($modules[$modulename]['menuitems'])) { 
     344    foreach ($modules[$modulename]['menuitems'] as $key => $menuitem) { 
     345      echo "# $key:\n_(\"$menuitem\")\n"; 
     346    } 
     347  } 
     348} 
     349 
     350function showCheckDepends($modulename) { 
     351  $modules = module_getinfo($modulename); 
     352  if (!isset($modules[$modulename])) { 
     353    fatal($modulename.' not found'); 
     354  } 
     355  if (($errors = module_checkdepends($modules[$modulename])) !== true) { 
     356    out("The following dependencies are not met:"); 
     357    out(' - '.implode("\n - ",$errors)); 
     358    exit(1); 
     359  } else { 
     360    out("All dependencies met for module ".$modulename); 
     361  } 
     362} 
     363 
     364function showEngine() { 
     365  $engine = engine_getinfo(); 
     366  foreach ($engine as $key=>$value) { 
     367    out(str_pad($key,15,' ',STR_PAD_LEFT).': '.$value); 
     368  } 
     369} 
     370 
    92371function showHelp() { 
    93372  global $argv; 
     
    102381  out("  delete <module>"); 
    103382  out("      Disable, uninstall, and delete the specified module"); 
     383  out("  deleteall"); 
     384  out("      Disable, uninstall, and delete ALL MODULES"); 
     385  out("      WARNING: Use at your own risk, this will remove ALL MODULES from your system!"); 
    104386  out("  disable <module>"); 
    105387  out("      Disable the specified module"); 
     
    115397  out("  install <module>"); 
    116398  out("      Install the module (must exist in the modules directory)"); 
     399  out("  installall"); 
     400  out("      Installs all module that exist in the repository"); 
    117401  out("  list"); 
    118402  out("      List all local modules and their current status"); 
     
    125409  out("  showupgrades"); 
    126410  out("      Show a list of upgradable modules"); 
     411  out("  showannounce"); 
     412  out("      Shows any annoucements that maybe displayed at freepbx.org for this version"); 
    127413  out("  uninstall <module>"); 
    128414  out("      Disable and uninstall the specified module"); 
     
    131417  out("  upgradeall"); 
    132418  out("      Downloads and upgrades all modules with pending updates"); 
    133   out("  showannounce"); 
    134   out("      Shows any annoucements that maybe displayed at freepbx.org for this version"); 
    135  
     419   
    136420  out("  --help, -h, -?           Show this help"); 
     421} 
     422 
     423function showInfo($modulename) { 
     424  function recursive_print($array, $parentkey = '', $level=0) { 
     425    foreach ($array as $key => $value) { 
     426      if (is_array($value)) { 
     427        // check if there is a numeric key in the sub-array, if so, we don't print the title 
     428        if (!isset($value[0])) { 
     429          out(str_pad($key,15+($level * 3),' ',STR_PAD_LEFT).': '); 
     430        } 
     431        recursive_print($value, $key, $level + 1); 
     432      } else { 
     433        if (is_numeric($key)) { 
     434          // its just multiple parent keys, so we don't indent, and print the parentkey instead 
     435          out(str_pad($parentkey,15+(($level-1) * 3),' ',STR_PAD_LEFT).': '.$value); 
     436        } else { 
     437          if ($key == 'status') { 
     438            switch ($value) { 
     439              case MODULE_STATUS_NOTINSTALLED: $value = 'Not Installed'; break; 
     440              case MODULE_STATUS_NEEDUPGRADE: $value = 'Disabled; Needs Upgrade'; break; 
     441              case MODULE_STATUS_ENABLED: $value = 'Enabled'; break; 
     442              case MODULE_STATUS_DISABLED: $value = 'Disabled'; break; 
     443              case MODULE_STATUS_BROKEN: $value = 'Broken'; break; 
     444            } 
     445          } 
     446          out(str_pad($key,15+($level * 3),' ',STR_PAD_LEFT).': '.$value); 
     447        } 
     448      } 
     449    } 
     450  } 
     451  $modules = module_getinfo($modulename); 
     452  if (!isset($modules[$modulename])) { 
     453    fatal($modulename.' not found'); 
     454  } 
     455   
     456  recursive_print($modules[$modulename]); 
     457   
    137458} 
    138459 
     
    216537  } 
    217538} 
    218 function showCheckDepends($modulename) { 
    219   $modules = module_getinfo($modulename); 
    220   if (!isset($modules[$modulename])) { 
    221     fatal($modulename.' not found'); 
    222   } 
    223   if (($errors = module_checkdepends($modules[$modulename])) !== true) { 
    224     out("The following dependencies are not met:"); 
    225     out(' - '.implode("\n - ",$errors)); 
    226     exit(1); 
    227   } else { 
    228     out("All dependencies met for this module."); 
    229   } 
    230 } 
    231  
    232 function showInfo($modulename) { 
    233   function recursive_print($array, $parentkey = '', $level=0) { 
    234     foreach ($array as $key => $value) { 
    235       if (is_array($value)) { 
    236         // check if there is a numeric key in the sub-array, if so, we don't print the title 
    237         if (!isset($value[0])) { 
    238           out(str_pad($key,15+($level * 3),' ',STR_PAD_LEFT).': '); 
    239         } 
    240         recursive_print($value, $key, $level + 1); 
    241       } else { 
    242         if (is_numeric($key)) { 
    243           // its just multiple parent keys, so we don't indent, and print the parentkey instead 
    244           out(str_pad($parentkey,15+(($level-1) * 3),' ',STR_PAD_LEFT).': '.$value); 
    245         } else { 
    246           if ($key == 'status') { 
    247             switch ($value) { 
    248               case MODULE_STATUS_NOTINSTALLED: $value = 'Not Installed'; break; 
    249               case MODULE_STATUS_NEEDUPGRADE: $value = 'Disabled; Needs Upgrade'; break; 
    250               case MODULE_STATUS_ENABLED: $value = 'Enabled'; break; 
    251               case MODULE_STATUS_DISABLED: $value = 'Disabled'; break; 
    252               case MODULE_STATUS_BROKEN: $value = 'Broken'; break; 
    253             } 
    254           } 
    255           out(str_pad($key,15+($level * 3),' ',STR_PAD_LEFT).': '.$value); 
    256         } 
    257       } 
    258     } 
    259   } 
    260   $modules = module_getinfo($modulename); 
    261   if (!isset($modules[$modulename])) { 
    262     fatal($modulename.' not found'); 
    263   } 
    264    
    265   recursive_print($modules[$modulename]); 
    266    
    267 } 
    268  
    269 function showi18n($modulename) { 
    270   $modules = module_getinfo($modulename); 
    271   if (!isset($modules[$modulename])) { 
    272     fatal($modulename.' not found'); 
    273   } 
    274  
    275   if (isset($modules[$modulename]['name'])) { 
    276     echo "# name:\n_(\"".$modules[$modulename]['name']."\")\n"; 
    277   } 
    278   if (isset($modules[$modulename]['category'])) { 
    279     echo "# category:\n_(\"".$modules[$modulename]['category']."\")\n"; 
    280   } 
    281   if (isset($modules[$modulename]['description'])) { 
    282     echo "# description:\n_(\"".trim(str_replace("\n","",$modules[$modulename]['description']))."\")\n"; 
    283   } 
    284   if (isset($modules[$modulename]['menuitems'])) { 
    285     foreach ($modules[$modulename]['menuitems'] as $key => $menuitem) { 
    286       echo "# $key:\n_(\"$menuitem\")\n"; 
    287     } 
    288   } 
    289 } 
    290  
    291 function doReload() { 
    292   $result = do_reload(); 
    293  
    294   if ($result['status'] != true) { 
    295     out("Error(s) have occured, the following is the retrieve_conf output:"); 
    296     $retrieve_array = explode('<br/>',$result['retrieve_conf']); 
    297     foreach ($retrieve_array as $line) { 
    298       out($line); 
    299     }; 
    300   } else { 
    301     out($result['message']); 
    302   } 
    303 } 
    304  
    305 function doDisable($modulename, $force) { 
    306   if (is_array($errors = module_disable($modulename, $force))) { 
    307     out("The following error(s) occured:"); 
    308     out(' - '.implode("\n - ",$errors)); 
    309     exit(2); 
    310   } else { 
    311     out("Module successfully disabled"); 
    312   } 
    313 } 
    314  
    315 function doEnable($modulename, $force) { 
    316   if (is_array($errors = module_enable($modulename, $force))) { 
    317     out("The following error(s) occured:"); 
    318     out(' - '.implode("\n - ",$errors)); 
    319     exit(2); 
    320   } else { 
    321     out("Module successfully enabled"); 
    322   } 
    323 } 
    324  
    325 function doInstall($modulename, $force) { 
    326   if (is_array($errors = module_install($modulename, $force))) { 
    327     out("The following error(s) occured:"); 
    328     out(' - '.implode("\n - ",$errors)); 
    329     exit(2); 
    330   } else { 
    331     out("Module successfully installed"); 
    332   } 
    333 } 
    334  
    335 function doUninstall($modulename, $force) { 
    336   if (is_array($errors = module_uninstall($modulename, $force))) { 
    337     out("The following error(s) occured:"); 
    338     out(' - '.implode("\n - ",$errors)); 
    339     exit(2); 
    340   } else { 
    341     out("Module successfully uninstalled"); 
    342   } 
    343 } 
    344  
    345 function doDelete($modulename, $force) { 
    346   if (is_array($errors = module_delete($modulename, $force))) { 
    347     out("The following error(s) occured:"); 
    348     out(' - '.implode("\n - ",$errors)); 
    349     exit(2); 
    350   } else { 
    351     out("Module successfully deleted"); 
    352   } 
    353 } 
    354  
    355 function doDownload($modulename, $force) { 
    356  
    357   global $modulexml_path; 
    358   global $modulerepository_path; 
    359  
    360   if (is_array($errors = module_download($modulename, $force, 'download_progress', $modulerepository_path, $modulexml_path))) { 
    361     out("The following error(s) occured:"); 
    362     out(' - '.implode("\n - ",$errors)); 
    363     exit(2); 
    364   } else { 
    365     out("Module successfully downloaded"); 
    366   } 
    367 } 
    368  
    369 function download_progress($action, $params) { 
    370   switch ($action) { 
    371     case 'untar': 
    372       outn("\nUntaring.."); 
    373     break; 
    374     case 'downloading': 
    375       outn("\rDownloading ".$params['read'].' of '.$params['total'].' ('.($params['total'] ? round($params['read']/$params['total']*100) : '0').'%)            '); 
    376       if ($params['read'] == $params['total']) { 
    377         out(''); 
    378       } 
    379     break; 
    380     case 'done'; 
    381       out('Done'); 
    382     break; 
    383   } 
    384 } 
    385  
    386  
    387 function doUpgrade($modulename, $force) { 
    388   // either will exit() if there's a problem 
    389   doDownload($modulename, $force); 
    390   doInstall($modulename, $force); 
    391 } 
    392  
    393 /**  
    394  * @param bool Controls if a simple (names only) or extended (array of name,versions) array is returned 
    395  */ 
    396 function getUpgradableModules($extarray = false) { 
    397   $modules_local = module_getinfo(false, MODULE_STATUS_ENABLED); 
    398   $modules_online = module_getonlinexml(); 
    399   $modules_upgradable = array(); 
    400    
    401   foreach (array_keys($modules_local) as $name) { 
    402     if (isset($modules_online[$name])) { 
    403       if (version_compare_freepbx($modules_local[$name]['version'], $modules_online[$name]['version']) < 0) { 
    404         if ($extarray) { 
    405           $modules_upgradable[] = array( 
    406             'name' => $name, 
    407             'local_version' => $modules_local[$name]['version'], 
    408             'online_version' => $modules_online[$name]['version'], 
    409           ); 
    410         } else { 
    411           $modules_upgradable[] = $name; 
    412         } 
    413       } 
    414     } 
    415   } 
    416   return $modules_upgradable; 
    417 } 
    418  
    419 function doUpgradeAll($force) { 
    420   $modules = getUpgradableModules(); 
    421   if (count($modules) > 0) { 
    422     out("Upgrading: ".implode(', ',$modules)); 
    423     sleep(1); // a bit of time to ^C abort.. 
    424     foreach ($modules as $modulename) { 
    425       out("Upgrading $modulename.."); 
    426       doUpgrade($modulename, $force); 
    427     } 
    428     out("Done all upgrades."); 
    429   } else { 
    430     out("Up to date."); 
    431   } 
    432 } 
    433539 
    434540function showUpgrades() { 
     
    444550  } 
    445551} 
    446  
    447 function showEngine() { 
    448   $engine = engine_getinfo(); 
    449   foreach ($engine as $key=>$value) { 
    450     out(str_pad($key,15,' ',STR_PAD_LEFT).': '.$value); 
    451   } 
    452 } 
    453  
    454552/**************************************************************************************************** 
    455553 ****************************************************************************************************/ 
     
    546644chdir ( $amp_conf["AMPWEBROOT"] . "/admin/" ); 
    547645 
    548 // Get annoucment information to use if needed 
    549 // 
    550  
    551646 
    552647switch ($operation ) { 
     648  case 'checkdepends': 
     649    if (empty($param)) { 
     650      fatal("Missing module name"); 
     651    } 
     652    showCheckDepends($param); 
     653  break; 
     654  case 'delete': 
     655    if (empty($param)) { 
     656      fatal("Missing module name"); 
     657    } 
     658    doDelete($param, $force); 
     659  break; 
     660  case 'deleteall': case 'removeall': 
     661    doDeleteAll(); 
     662  break; 
     663  case 'disable': 
     664    if (empty($param)) { 
     665      fatal("Missing module name"); 
     666    } 
     667    doDisable($param, $force); 
     668  break; 
     669  case 'download': 
     670    $announcements = module_get_annoucements(); 
     671    if (empty($param)) { 
     672      fatal("Missing module name"); 
     673    } 
     674    doDownload($param, $force); 
     675  break; 
     676  case 'enable': 
     677    if (empty($param)) { 
     678      fatal("Missing module name"); 
     679    } 
     680    doEnable($param, $force); 
     681  break; 
     682  case 'i18n': 
     683    if (empty($param)) { 
     684      fatal("Missing module name"); 
     685    } 
     686    showi18n($param); 
     687  break;   
     688  case 'info': 
     689    if (empty($param)) { 
     690      fatal("Missing module name"); 
     691    } 
     692    showInfo($param); 
     693  break; 
     694  case 'install': 
     695    if (empty($param)) { 
     696      fatal("Missing module name"); 
     697    } 
     698    doInstall($param, $force); 
     699  break; 
     700  case 'installall': 
     701    doInstallAll(true); 
     702  break;   
    553703  case 'list': 
    554704    showList(); 
     
    558708    showList(true); 
    559709  break; 
     710  case 'mirrorrepo': case 'mirrorrepro': 
     711    mirrorrepo(); 
     712  break; 
    560713  case 'reload': 
    561714    doReload(); 
    562715  break; 
    563   case 'checkdepends': 
    564     if (empty($param)) { 
    565       fatal("Missing module name"); 
    566     } 
    567     showCheckDepends($param); 
    568   break; 
    569716  case 'reversedepends': 
    570717    if (empty($param)) { 
     
    572719    } 
    573720    showReverseDepends($param); 
    574   break; 
    575   case 'info': 
    576     if (empty($param)) { 
    577       fatal("Missing module name"); 
    578     } 
    579     showInfo($param); 
    580   break; 
    581   case 'i18n': 
    582     if (empty($param)) { 
    583       fatal("Missing module name"); 
    584     } 
    585     showi18n($param); 
    586   break; 
    587   case 'download': 
    588     $announcements = module_get_annoucements(); 
    589     if (empty($param)) { 
    590       fatal("Missing module name"); 
    591     } 
    592     doDownload($param, $force); 
    593   break; 
    594   case 'install': 
    595     if (empty($param)) { 
    596       fatal("Missing module name"); 
    597     } 
    598     doInstall($param, $force); 
    599   break; 
    600   case 'enable': 
    601     if (empty($param)) { 
    602       fatal("Missing module name"); 
    603     } 
    604     doEnable($param, $force); 
    605   break; 
    606   case 'disable': 
    607     if (empty($param)) { 
    608       fatal("Missing module name"); 
    609     } 
    610     doDisable($param, $force); 
    611   break; 
    612   case 'uninstall': 
    613     if (empty($param)) { 
    614       fatal("Missing module name"); 
    615     } 
    616     doUninstall($param, $force); 
    617   break; 
    618   case 'delete': 
    619     if (empty($param)) { 
    620       fatal("Missing module name"); 
    621     } 
    622     doDelete($param, $force); 
    623   break; 
    624   case 'upgrade': 
    625     doUpgrade($param, $force); 
    626   break; 
    627   case 'upgradeall': 
    628     doUpgradeAll($force); 
    629   break; 
    630   case 'showupgrade': 
    631   case 'showupgrades': 
    632     showUpgrades(); 
    633   break; 
    634   case 'showengine': 
    635     showEngine(); 
    636721  break; 
    637722  case 'showannounce'; 
     
    645730 
    646731  break; 
     732  case 'showengine': 
     733    showEngine(); 
     734  break; 
     735  case 'showupgrade': 
     736  case 'showupgrades': 
     737    showUpgrades(); 
     738  break; 
     739  case 'uninstall': 
     740    if (empty($param)) { 
     741      fatal("Missing module name"); 
     742    } 
     743    doUninstall($param, $force); 
     744  break; 
     745  case 'upgrade': 
     746    doUpgrade($param, $force); 
     747  break; 
     748  case 'upgradeall': 
     749    doUpgradeAll($force); 
     750  break; 
    647751  default: 
    648752  case 'help': 
  • freepbx/branches/2.6/amp_conf/htdocs/admin/functions.inc.php

    r8280 r8339  
    27912791   
    27922792  if ($modules[$modulename]['status'] == MODULE_STATUS_ENABLED) { 
    2793     return array(_("Module is already enabled")); 
     2793    return array(_("Module ".$modulename." is already enabled")); 
    27942794  } 
    27952795   
    27962796  // doesn't make sense to skip this on $force - eg, we can't enable a non-installed or broken module 
    27972797  if ($modules[$modulename]['status'] != MODULE_STATUS_DISABLED) { 
    2798     return array(_("Module cannot be enabled")); 
     2798    return array(_("Module ".$modulename." cannot be enabled")); 
    27992799  } 
    28002800   
     
    31073107  // don't force this bit - we can't install a broken module (missing files)  
    31083108  if ($modules[$modulename]['status'] == MODULE_STATUS_BROKEN) { 
    3109     return array(_("This module is broken and cannot be installed. You should try to download it again.")); 
     3109    return array(_("Module ".$modules[$modulename]['rawname']." is broken and cannot be installed. You should try to download it again.")); 
    31103110  } 
    31113111   
     
    34523452   
    34533453  if (file_exists($filename) && is_file($filename)) { 
    3454     include($filename); 
     3454    include_once($filename); 
    34553455  } 
    34563456} 
  • freepbx/branches/2.6/amp_conf/htdocs/recordings/theme/page.tpl.php

    r6289 r8339  
    55    <link rel="stylesheet" href="theme/main.css" type="text/css"> 
    66    <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
     7    <script  type="text/javascript" src="../../admin/common/libfreepbx.javascripts.js"></script> 
    78  </head> 
    89  <body> 
  • freepbx/branches/2.6/install_amp

    r7750 r8339  
    10421042 
    10431043// **** Apply amportal.conf configuration to files 
    1044 debug("Running ".dirname(__FILE__)."/apply_conf.sh"); 
     1044if (file_exists(dirname(__FILE__)."/apply_conf.sh")) {  
     1045  debug("Running ".dirname(__FILE__)."/apply_conf.sh"); 
     1046
     1047 
    10451048outn("Configuring install for your environment.."); 
    10461049if (!$dryrun) { 
     
    10621065  // 
    10631066  outn("apply username/password changes to conf files.."); 
    1064   exec(dirname(__FILE__)."/apply_conf.sh"); 
     1067  if (file_exists(dirname(__FILE__)."/apply_conf.sh")) {  
     1068    exec(dirname(__FILE__)."/apply_conf.sh"); 
     1069  } 
    10651070  out("done"); 
    10661071 
    1067   /* As of Asterisk 1.4.16 or there abouts, a missing #include file will make the reload fail. So 
     1072  /* As of Asterisk 1.4.16 or there about, a missing #include file will make the reload fail. So 
    10681073    we need to make sure that we have such for everything that is in our configs. We will simply 
    10691074    look for the #include statements and touch the files vs. trying to inventory everything we may