Changeset 9059

Show
Ignore:
Timestamp:
03/01/10 15:55:27 (3 years ago)
Author:
mickecarlsson
Message:

Made versionupgrade generic. All that need to be changed between releases are four global variables in functions.inc.php, the rest of the code is is using these globals.

Files:

Legend:

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

    r8874 r9059  
    44 * 
    55 */ 
     6 
     7// Change the version numbers and text and publish 
     8$alpha_version   = "2.7.0alpha0"; 
     9$beta1_version   = "2.7.0beta1"; 
     10$beta1_0_version = "2.7.0beta1.0"; 
     11$upgrade_ver     = "2.7"; 
     12$upgrade_final   = "2.7.0 Final"; 
    613 
    714function versionupgrade_setversion($version) { 
     
    2330function versionupgrade_configprocess() { 
    2431  global $db; 
     32  global $alpha_version; 
     33  global $beta1_version; 
     34  global $beta1_0_version; 
    2535 
    2636  $moduleinfo = module_getinfo('core'); 
    2737  $mainversion = getversion(); 
    2838 
    29   if (version_compare_freepbx($mainversion,"2.7.0alpha0","ge") && version_compare_freepbx($moduleinfo['core']['version'], "2.7.0alpha0", "lt")) { 
     39  if (version_compare_freepbx($mainversion,$alpha_version,"ge") && version_compare_freepbx($moduleinfo['core']['version'], $alpha_version, "lt")) { 
    3040    $sql = "UPDATE admin SET value = 'false' WHERE variable = 'need_reload'";  
    3141    $result = $db->query($sql); 
     
    3343      //can't do much? 
    3444    } 
    35   } else if (version_compare_freepbx($mainversion,"2.7.0beta1","ge") && version_compare_freepbx($moduleinfo['core']['version'], "2.7.0beta1.0", "ge")) { 
     45  } else if (version_compare_freepbx($mainversion,$beta1_version,"ge") && version_compare_freepbx($moduleinfo['core']['version'], $beta1_0_version, "ge")) { 
    3646    $results = module_delete('versionupgrade'); 
    3747  } 
  • modules/branches/2.6/versionupgrade/page.versionupgrade.php

    r9050 r9059  
    2727$core_version = $core_xml['core']['version']; 
    2828 
    29 if (version_compare_freepbx($version, "2.7.0alpha0","lt") && $upgraderequest == "UPGRADE") { 
    30   versionupgrade_setversion("2.7.0alpha0"); 
     29// These are from functions.inc.php, set all versions there 
     30global $alpha_version; 
     31global $upgrade_ver; 
     32global $upgrade_final; 
     33global $beta_version; 
     34 
     35if (version_compare_freepbx($version, $alpha_version,"lt") && $upgraderequest == "UPGRADE") { 
     36        versionupgrade_setversion($alpha_version); 
    3137  $version = getversion(); 
    3238} 
    3339 
    34 echo "<h2>"._("2.7 Upgrade Module")."</h2>"; 
     40echo "<h2>".sprintf(_("%s Upgrade Module"),$upgrade_ver)."</h2>"; 
    3541echo "<p><b>"._("Current Version Info (Updated each stage of upgrade process):")."</b></p>"; 
    3642?> 
     
    6268</table> 
    6369<?php 
    64  
    65 if (version_compare_freepbx($version, "2.7.0alpha0","lt")) { 
    66   echo sprintf(_("<h2 align='center' style='color:red'>WARNING - YOU WILL BE UPGRADED TO VERSION 2.7.0 Final</h2><p>This module will allow you to upgrade to FreePBX version 2.7 from the current version, %s, that you are running.</p><p>The upgrade process is a simple but multi-step process that you should complete all at one time. As always when upgrading a system, it is advisable that you complete this process when the system is not actively being used.</p>The steps you will take are:<ol><li>Press the upgrade button below.</li><li>Go to Module Admin, check for online updates, and upgrade the <b>FreePBX Framework</b> module ONLY from the online repository which will now be connected to version 2.7.</li><li>Now, Check for online updates again and upgrade all other modules that have upgrades available. If you get dependency warnings, just repeat the process until all your modules have been upgraded.</li><li>Now press the Apply Configuration bar.</li></ol><p>Once you have completed these step you will be upgraded to the new 2.7 version and you may disable or remove this module if it does not do so automatically.</p>"),$version); 
     70if (version_compare_freepbx($version, $alpha_version,"lt")) { 
     71       echo sprintf(_("<h2 align='center' style='color:red'>WARNING - YOU WILL BE UPGRADED TO VERSION %s</h2><p>This module will allow you to upgrade to FreePBX version %s from the current version, %s, that you are running.</p><p>The upgrade process is a simple but multi-step process that you should complete all at one time. As always when upgrading a system, it is advisable that you complete this process when the system is not actively being used.</p>The steps you will take are:<ol><li>Press the upgrade button below.</li><li>Go to Module Admin, check for online updates, and upgrade the <b>FreePBX Framework</b> module ONLY from the online repository which will now be connected to version %s.</li><li>Now, Check for online updates again and upgrade all other modules that have upgrades available. If you get dependency warnings, just repeat the process until all your modules have been upgraded.</li><li>Now press the Apply Configuration bar.</li></ol><p>   Once you have completed these step you will be upgraded to the new %s version and you may disable or remove this module if it does not do so automatically.</p>"),$upgrade_final,$upgrade_ver,$version,$upgrade_ver,$upgrade_ver); 
    6772?> 
    6873 
     
    8994  var theForm = document.upgrade; 
    9095  function upgrade_onsubmit() { 
    91     var msgConfirmUpgrade = "<?php echo _("You are about to upgrade your system to FreePBX 2.7.0 Final. You can not reverse this process. Do you want to continue?"); ?>"; 
     96    var msgConfirmUpgrade = "<?php echo sprintf(_("You are about to upgrade your system to FreePBX %s. You can not reverse this process. Do you want to continue?"),$upgrade_final); ?>"; 
    9297   
    9398    if (!confirm(msgConfirmUpgrade)) { 
     
    100105 
    101106<?php 
    102 } else if (version_compare_freepbx($version, "2.7.0beta1","lt")) { 
     107} else if (version_compare_freepbx($version, $beta_version,"lt")) { 
    103108 
    104   echo "<br />".sprintf(_("<p>You appear to have partially upgraded to version 2.7, your current version number is %s. The remaining steps you should take are:</p><ol><li>Go to Module Admin, press check for online updates, and upgrade the <b>FreePBX Framework</b> module from the online repository. Do not upgrade other modules.</li><li>Check for online updates again and upgrade all other modules that have upgrades available. If you get dependency warnings, simply repeat the process until all modules are upgraded.</li><li>Press the Apply Configuration Changes bar.</li></ol><p>Once you have completed these steps you will be upgraded to the new 2.7 version and you may disable or remove this module if it it does not do so automatically.</p>"),$version); 
     109  echo "<br />".sprintf(_("<p>You appear to have partially upgraded to version %s, your current version number is %s. The remaining steps you should take are:</p><ol><li>Go to Module Admin, press check for online updates, and upgrade the <b>FreePBX Framework</b> module from the online repository. Do not upgrade other modules.</li><li>Check for online updates again and upgrade all other modules that have upgrades available. If you get dependency warnings, simply repeat the process until all modules are upgraded.</li><li>Press the Apply Configuration Changes bar.</li></ol><p>Once you have completed these steps you will be upgraded to the new %s version and you may disable or remove this module if it it does not do so automatically.</p>"),$upgrade_ver,$version,$upgrade_ver); 
    105110 
    106 } else if (version_compare_freepbx($core_version, "2.7.0alpha0", "lt")) { 
     111} else if (version_compare_freepbx($core_version, $alpha_version, "lt")) { 
    107112 
    108   echo "<br />".sprintf(_("<p>You appear to have upgraded Framework to version 2.7, your current version number is %s. You still need to upgrade the Core Module and any other modules that show upgrades available. The remaining steps you should take are:</p><ol><li>Check for online updates again and upgrade all other modules that have upgrades available including Core. If you get dependency warnings simply repeat the process until all modules are upgraded.</li><li>Press the Apply Configuration Changes bar.</li></ol><p>Once you have completed these steps you will be upgraded to the new 2.7 version and you may disable or remove this module if it it does not do so automatically.</p>"),$version); 
     113  echo "<br />".sprintf(_("<p>You appear to have upgraded Framework to version %s, your current version number is %s. You still need to upgrade the Core Module and any other modules that show upgrades available. The remaining steps you should take are:</p><ol><li>Check for online updates again and upgrade all other modules that have upgrades available including Core. If you get dependency warnings simply repeat the process until all modules are upgraded.</li><li>Press the Apply Configuration Changes bar.</li></ol><p>Once you have completed these steps you will be upgraded to the new %s version and you may disable or remove this module if it it does not do so automatically.</p>"),$upgrade_ver,$version,$upgrade_ver); 
    109114 
    110115} else {