Пример #1
0
 /**
  * Perform installation.
  */
 function install()
 {
     $installer = new Install($this->params);
     $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 (!$installer->wroteConfig()) {
             printf("\nNew config.inc.php:\n");
             printf("----------------------------------------\n");
             echo $installer->getConfigContents();
             printf("----------------------------------------\n");
         }
         if ($this->params['manualInstall']) {
             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 installed version %s\n", $newVersion->getVersionString());
         }
     } else {
         printf("ERROR: Installation failed: %s\n", $installer->getErrorString());
     }
 }
Пример #2
0
 /**
  * Perform installation.
  */
 function execute()
 {
     $templateMgr =& TemplateManager::getManager();
     $installer = new Install($this->_data);
     // FIXME Use logger?
     if ($installer->execute()) {
         if ($this->getData('manualInstall')) {
             // Display SQL statements that would have been executed during installation
             $templateMgr->assign(array('manualInstall' => true, 'installSql' => $installer->getSQL()));
         }
         if (!$installer->wroteConfig()) {
             // Display config file contents for manual replacement
             $templateMgr->assign(array('writeConfigFailed' => true, 'configFileContents' => $installer->getConfigContents()));
         }
         $templateMgr->display('install/installComplete.tpl');
     } else {
         switch ($installer->getErrorType()) {
             case INSTALLER_ERROR_DB:
                 $this->dbInstallError($installer->getErrorMsg());
                 break;
             default:
                 $this->installError($installer->getErrorMsg());
                 break;
         }
     }
     $installer->destroy();
 }