Пример #1
1
 /**
  * Perform installation.
  */
 function execute()
 {
     define('RUNNING_UPGRADE', 1);
     $templateMgr = TemplateManager::getManager($this->_request);
     $installer = new Upgrade($this->_data);
     // FIXME Use logger?
     // FIXME Mostly common with InstallForm
     if ($installer->execute()) {
         if (!$installer->wroteConfig()) {
             // Display config file contents for manual replacement
             $templateMgr->assign(array('writeConfigFailed' => true, 'configFileContents' => $installer->getConfigContents()));
         }
         $templateMgr->assign('notes', $installer->getNotes());
         $templateMgr->assign('newVersion', $installer->getNewVersion());
         $templateMgr->display('install/upgradeComplete.tpl');
     } else {
         switch ($installer->getErrorType()) {
             case INSTALLER_ERROR_DB:
                 $this->dbInstallError($installer->getErrorMsg());
                 break;
             default:
                 $this->installError($installer->getErrorMsg());
                 break;
         }
     }
     $installer->destroy();
 }
 /**
  * Run upgrade script.
  */
 function upgrade()
 {
     $installer = new Upgrade(array());
     $installer->setLogger($this);
     if ($installer->execute()) {
         if (count($installer->getNotes()) > 0) {
             printf("\nRelease Notes\n");
             printf("----------------------------------------\n");
             foreach ($installer->getNotes() as $note) {
                 printf("%s\n\n", $note);
             }
         }
         $newVersion =& $installer->getNewVersion();
         printf("Successfully upgraded to version %s\n", $newVersion->getVersionString());
     } else {
         printf("ERROR: Upgrade failed: %s\n", $installer->getErrorString());
     }
 }
Пример #3
0
 /**
  * Run upgrade script.
  */
 function upgrade()
 {
     $pretend = false;
     // isset($this->argv[1]) && $this->argv[1] == 'pretend';
     $installer = new Upgrade(array('manualInstall' => $pretend));
     $installer->setLogger($this);
     if ($installer->execute()) {
         if (count($installer->getNotes()) > 0) {
             printf("\nRelease Notes\n");
             printf("----------------------------------------\n");
             foreach ($installer->getNotes() as $note) {
                 printf("%s\n\n", $note);
             }
         }
         if ($pretend) {
             if (count($installer->getSQL()) > 0) {
                 printf("\nSQL\n");
                 printf("----------------------------------------\n");
                 foreach ($installer->getSQL() as $sql) {
                     printf("%s\n\n", $sql);
                 }
             }
         } else {
             $newVersion =& $installer->getNewVersion();
             printf("Successfully upgraded to version %s\n", $newVersion->getVersionString());
         }
     } else {
         printf("ERROR: Upgrade failed: %s\n", $installer->getErrorString());
     }
 }