Changeset 11443

Show
Ignore:
Timestamp:
02/18/11 15:03:44 (2 years ago)
Author:
p_lindheimer
Message:

copy versionupgrade from 2.7 to 2.8 and updated for 2.9 tool, also closes #4727

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.8/versionupgrade/functions.inc.php

    r10134 r11443  
    66 
    77// Change the version numbers and text and publish 
    8 $versionupgrade_upgrade_ver     = '2.8'; 
     8$versionupgrade_upgrade_ver     = '2.9'; 
    99$versionupgrade_status = 'Final'; 
    1010 
  • modules/branches/2.8/versionupgrade/install.php

    r9488 r11443  
    11<?php 
     2global $amp_conf; 
     3global $asterisk_conf; 
    24 
    35// HELPER FUNCTIONS: 
    4  
    5 function framework_print_errors($src, $dst, $errors) { 
    6   echo "error copying framework files:<br />'cp -rf' from src: '$src' to dst: '$dst'...details follow<br />"; 
    7   foreach ($errors as $error) { 
    8     echo "$error<br />"; 
    9   } 
    10 } 
    116 
    127if (! function_exists('out')) { 
     
    2217} 
    2318 
    24 if (! function_exists('error')) { 
    25   function error($text) { 
    26     echo "[ERROR] ".$text."<br>"; 
    27   } 
     19/* If Blacklist module version less than 2.7.0.2 is not present then 
     20 * upgrading to 2.9 will result in a crash. The module MUST be updated 
     21 * even if it is currenlty disabled. 
     22 * We don't check this in the module.xml dependencies because if they 
     23 * don't have blacklist installed then it is ok for them to upgrade and 
     24 * there is no dependency mode that can express that. 
     25 */ 
     26$ver = modules_getversion('blacklist'); 
     27if ($ver !== null && version_compare($ver,'2.7.0.2','lt')) { 
     28  out(_("Blacklist Module MUST be updated before installing.")); 
     29  out(sprintf(_("You have %s installed, 2.7.0.2 or higher is required.."),$ver); 
     30  return false; 
    2831} 
    29  
    30 if (! function_exists('fatal')) { 
    31   function fatal($text) { 
    32     echo "[FATAL] ".$text."<br>"; 
    33     exit(1); 
    34   } 
    35 } 
    36  
    37 if (! function_exists('debug')) { 
    38   function debug($text) { 
    39     global $debug; 
    40      
    41     if ($debug) echo "[DEBUG-preDB] ".$text."<br>"; 
    42   } 
    43 } 
    44  
    45 include dirname(__FILE__)."/libfreepbx.install.php"; 
    46  
    47 global $amp_conf; 
    48 global $asterisk_conf; 
    49  
    50 $debug = false; 
    51 $dryrun = false; 
    52  
    53 /** verison_compare that works with freePBX version numbers 
    54  *  included here because there are some older versions of functions.inc.php that do not have 
    55  *  it included as it was added during 2.3.0beta1 
    56  */ 
    57 if (!function_exists('version_compare_freepbx')) { 
    58   function version_compare_freepbx($version1, $version2, $op = null) { 
    59     $version1 = str_replace("rc","RC", strtolower($version1)); 
    60     $version2 = str_replace("rc","RC", strtolower($version2)); 
    61     if (!is_null($op)) { 
    62       return version_compare($version1, $version2, $op); 
    63     } else { 
    64       return version_compare($version1, $version2); 
    65     } 
    66   } 
    67 } 
    68  
    69 /* 
    70  * Framework install script 
    71  */ 
    72  
    73   $htdocs_source = dirname(__FILE__)."/htdocs/*"; 
    74   $bin_source = dirname(__FILE__)."/bin/*"; 
    75   $agibin_source = dirname(__FILE__)."/agi-bin/*"; 
    76  
    77   if (!file_exists(dirname($htdocs_source))) { 
    78     out(sprintf(_("No directory %s, install script not needed"),dirname($htdocs_source))); 
    79     return true; 
    80   } 
    81  
    82   // These are required by libfreepbx.install.php library for upgrade routines 
    83   // 
    84   define("UPGRADE_DIR", dirname(__FILE__)."/upgrades/"); 
    85   define("MODULE_DIR",  $amp_conf['AMPWEBROOT'].'/modules/'); 
    86  
    87   $htdocs_dest = $amp_conf['AMPWEBROOT']; 
    88   $bin_dest    = isset($amp_conf['AMPBIN']) ? $amp_conf['AMPBIN'] : '/var/lib/asterisk/bin'; 
    89   $agibin_dest = isset($asterisk_conf['astagidir']) ? $asterisk_conf['astagidir']:'/var/lib/asterisk/agi-bin'; 
    90  
    91   exec("cp -rf $htdocs_source $htdocs_dest 2>&1",$out,$ret); 
    92   if ($ret != 0) { 
    93     framework_print_errors($htdocs_source, $htdocs_dest, $out); 
    94   } 
    95  
    96   exec("cp -rf $bin_source $bin_dest 2>&1",$out,$ret); 
    97   if ($ret != 0) { 
    98     framework_print_errors($bin_source, $bin_dest, $out); 
    99   } 
    100  
    101   exec("cp -rf $agibin_source $agibin_dest 2>&1",$out,$ret); 
    102   if ($ret != 0) { 
    103     framework_print_errors($agibin_source, $agibin_dest, $out); 
    104   } 
    105  
    106   if (function_exists('upgrade_all')) { 
    107     upgrade_all(getversion()); 
    108   } else { 
    109     echo ("[ERROR] Function: 'upgrade_all' not present, libfreepbx.install.php seems not to be installed<br>"); 
    110   } 
    111  
    11232?> 
  • modules/branches/2.8/versionupgrade/module.xml

    r10135 r11443  
    11<module> 
    22  <rawname>versionupgrade</rawname> 
    3   <name>2.8 Upgrade Tool</name> 
    4   <version>2.7.0.5</version> 
     3  <name>2.9 Upgrade Tool</name> 
     4  <version>2.8.0beta0.0</version> 
    55  <changelog> 
    6     *2.7.0.5* change to 2.8 Final 
    7     *2.7.0.4* display proper final version in upgrade 
    8     *2.7.0.3* changed to release candidate status 
    9     *2.7.0.2* remove Custom Context restrictions, prepare for online 
    10     *2.7.0.1* #4308, Added detection of Custom Context modules 
    11     *2.7.0.0* 2.8 Beta1 Upgrade Tool 
     6    *2.8.0beta0.0* update for 2.9 upgrade 
    127  </changelog> 
    138  <description> 
     
    1611  <type>tool</type> 
    1712  <menuitems> 
    18     <versionupgrade1 display="versionupgrade" type="tool" category="Admin" sort="10">2.8 Upgrade Tool</versionupgrade1> 
    19     <versionupgrade2 display="versionupgrade" type="setup" category="Admin" sort="10">2.8 Upgrade Tool</versionupgrade2> 
     13    <versionupgrade1 display="versionupgrade" type="tool" category="Admin" sort="10">2.9 Upgrade Tool</versionupgrade1> 
     14    <versionupgrade2 display="versionupgrade" type="setup" category="Admin" sort="10">2.9 Upgrade Tool</versionupgrade2> 
    2015  </menuitems> 
    2116  <depends> 
    22     <version>lt 2.8.0alpha1</version> 
    23     <version>ge 2.7.0alpha1</version> 
     17    <version>lt 2.9.0alpha1</version> 
     18    <version>ge 2.8.0alpha1</version> 
    2419  </depends> 
    2520  <category>Basic</category>