コード例 #1
0
ファイル: upgrade.php プロジェクト: Advanture/Online-RolePlay
 /**
  * Runs the upgrade specific file
  *
  * @return void
  */
 public function install_appclass()
 {
     /* INIT */
     $continue = 0;
     $customHTML = '';
     $file = '';
     /* Reset Errors */
     $this->_resetErrors();
     /* IPB 2.0.0+ Upgrade file */
     $fileNewer = IPSLib::getAppDir($this->_currentApp) . '/setup/versions/upg_' . $this->_uipLong . '/version_upgrade.php';
     /* Older files */
     $fileLegacy = IPSLib::getAppDir($this->_currentApp) . '/setup/versions/upg_' . $this->_uipLong . '/version_upgrade_' . $this->_dbDriver . '.php';
     /* Got any file? */
     if (is_file($fileNewer)) {
         $file = $fileNewer;
     } else {
         if (is_file($fileLegacy)) {
             $file = $fileLegacy;
         }
     }
     /* Do we have a file? */
     if ($file) {
         require_once $file;
         /*noLibHook*/
         $upgrade = new version_upgrade();
         $result = $upgrade->doExecute($this->registry);
         if (count($this->registry->output->fetchWarnings()) > 0) {
             if (!$result) {
                 $this->registry->output->setNextAction('upgrade&do=appclass');
             } elseif ($this->_uipLong >= $this->_latestLong || $this->_uipLong == 0) {
                 /* Got another app to do? */
                 $this->runCustomScript($this->_currentApp);
                 $next = IPSSetUp::fetchNextApplication($this->_currentApp, '', $this->settings['gb_char_set']);
                 if ($next['key']) {
                     $this->registry->output->setNextAction('upgrade&do=sql&appdir=' . $next['key']);
                 } else {
                     $this->registry->output->setNextAction('upgrade&do=checkdb');
                 }
             } else {
                 $this->registry->output->setNextAction('upgrade&do=sql');
             }
             $this->registry->output->setTitle("Обновление: Обновление версии");
             $this->registry->output->sendOutput();
         }
         /* App specific version upgrade is done */
         if ($result) {
             /* The individual upgrade files all shoot you to 2.0... */
             if ($this->_currentApp == 'core' and $this->_uipLong < 20000) {
                 //$this->_uipLong = '10004';
             }
             /* Update version history */
             if (IPSSetUp::is300plus() === TRUE) {
                 $this->DB->insert('upgrade_history', array('upgrade_version_id' => $this->_uipLong, 'upgrade_version_human' => $this->_uipHuman, 'upgrade_date' => time(), 'upgrade_app' => $this->_currentApp, 'upgrade_notes' => '', 'upgrade_mid' => 0));
                 /* Update app */
                 $_in = $this->_currentApp == 'core' ? "'core', 'forums', 'members'" : "'" . $this->_currentApp . "'";
                 $this->DB->update('core_applications', array('app_long_version' => $this->_uipLong, 'app_version' => $this->_uipHuman, 'app_website' => $this->_appData['website'], 'app_update_check' => $this->_appData['update_check']), 'app_directory IN (' . $_in . ')');
             } else {
                 $this->DB->insert('upgrade_history', array('upgrade_version_id' => $this->_uipLong, 'upgrade_version_human' => $this->_uipHuman, 'upgrade_date' => time(), 'upgrade_notes' => '', 'upgrade_mid' => 0));
             }
             if ($upgrade->fetchOutput()) {
                 $customHTML = $upgrade->fetchOutput();
             } else {
                 $output[] = "Успешно обновлено до версии {$this->_uipHuman}";
             }
         } else {
             if ($upgrade->fetchOutput()) {
                 $customHTML = $upgrade->fetchOutput();
             } else {
                 $output[] = "Продолжение обновления";
             }
             $continue = 1;
         }
     } else {
         /* Nothing to run */
         if ($this->_uipLong) {
             /* Update version history */
             if (IPSSetUp::is300plus() === TRUE) {
                 $this->DB->insert('upgrade_history', array('upgrade_version_id' => $this->_uipLong, 'upgrade_version_human' => $this->_uipHuman, 'upgrade_date' => time(), 'upgrade_app' => $this->_currentApp, 'upgrade_notes' => '', 'upgrade_mid' => 0));
                 /* Update app */
                 $_in = $this->_currentApp == 'core' ? "'core', 'forums', 'members'" : "'" . $this->_currentApp . "'";
                 $updateApp = array('app_long_version' => $this->_uipLong, 'app_version' => $this->_uipHuman);
                 /* Check only 1 field since we add both at the same time anyway */
                 if ($this->DB->checkForField('app_website', 'core_applications')) {
                     $updateApp['app_website'] = $this->_appData['website'];
                     $updateApp['app_update_check'] = $this->_appData['update_check'];
                 }
                 $this->DB->update('core_applications', $updateApp, 'app_directory IN (' . $_in . ')');
             } else {
                 $this->DB->insert('upgrade_history', array('upgrade_version_id' => $this->_uipLong, 'upgrade_version_human' => $this->_uipHuman, 'upgrade_date' => time(), 'upgrade_notes' => '', 'upgrade_mid' => 0));
             }
             $output[] = "Успешно обновлено до версии {$this->_uipHuman}";
         }
     }
     //-----------------------------------------
     // Next...
     //-----------------------------------------
     if ($continue) {
         $this->registry->output->setNextAction('upgrade&do=appclass');
     } elseif ($this->_uipLong >= $this->_latestLong || $this->_uipLong == 0) {
         /* Got another app to do? */
         $this->runCustomScript($this->_currentApp);
         $next = IPSSetUp::fetchNextApplication($this->_currentApp, '', $this->settings['gb_char_set']);
         if ($next['key']) {
             $this->registry->output->setNextAction('upgrade&do=sql&appdir=' . $next['key']);
         } else {
             $this->registry->output->setNextAction('upgrade&do=checkdb');
         }
     } else {
         $this->registry->output->setNextAction('upgrade&do=sql');
     }
     $this->registry->output->setTitle("Обновление: Обновление версии");
     if ($customHTML) {
         $this->registry->output->addContent($customHTML);
     } else {
         $this->registry->output->addContent($this->registry->output->template()->page_refresh($output));
     }
     $this->registry->output->setInstallStep($this->_stepCount, $this->_totalSteps);
     $this->registry->output->sendOutput();
 }
コード例 #2
0
 /**
  * Runs the upgrade specific file
  *
  * @return void
  */
 public function install_appclass()
 {
     /* INIT */
     $continue = 0;
     $customHTML = '';
     $file = '';
     /* Reset Errors */
     $this->_resetErrors();
     /* IPB 2.0.0+ Upgrade file */
     $fileNewer = IPSLib::getAppDir($this->_currentApp) . '/setup/versions/upg_' . $this->_uipLong . '/version_upgrade.php';
     /* Older files */
     $fileLegacy = IPSLib::getAppDir($this->_currentApp) . '/setup/versions/upg_' . $this->_uipLong . '/version_upgrade_' . $this->_dbDriver . '.php';
     /* Got any file? */
     if (file_exists($fileNewer)) {
         $file = $fileNewer;
     } else {
         if (file_exists($fileLegacy)) {
             $file = $fileLegacy;
         }
     }
     /* Do we have a file? */
     if ($file) {
         require_once $file;
         $upgrade = new version_upgrade();
         $result = $upgrade->doExecute($this->registry);
         if (count($this->registry->output->fetchWarnings()) > 0) {
             if (!$result) {
                 $this->registry->output->setNextAction('upgrade&do=appclass');
             } elseif ($this->_uipLong >= $this->_latestLong || $this->_uipLong == 0) {
                 /* Got another app to do? */
                 $next = IPSSetUp::fetchNextApplication($this->_currentApp);
                 if ($next['key']) {
                     $this->registry->output->setNextAction('upgrade&do=sql&appdir=' . $next['key']);
                 } else {
                     $this->registry->output->setNextAction('upgrade&do=checkdb');
                 }
             } else {
                 $this->registry->output->setNextAction('upgrade&do=sql');
             }
             $this->registry->output->setTitle("Upgrade: Version Upgrade");
             $this->registry->output->sendOutput();
         }
         /* App specific version upgrade is done */
         if ($result) {
             /* The individual upgrade files all shoot you to 2.0... */
             if ($this->_currentApp == 'core' and $this->_uipLong < 20000) {
                 //$this->_uipLong = '10004';
             }
             /* Update version history */
             if (IPSSetUp::is300plus() === TRUE) {
                 $this->DB->insert('upgrade_history', array('upgrade_version_id' => $this->_uipLong, 'upgrade_version_human' => $this->_uipHuman, 'upgrade_date' => time(), 'upgrade_app' => $this->_currentApp, 'upgrade_mid' => 0));
                 /* Update app */
                 $_in = $this->_currentApp == 'core' ? "'core', 'forums', 'members'" : "'" . $this->_currentApp . "'";
                 $this->DB->update('core_applications', array('app_long_version' => $this->_uipLong, 'app_version' => $this->_uipHuman), 'app_directory IN (' . $_in . ')');
             } else {
                 $this->DB->insert('upgrade_history', array('upgrade_version_id' => $this->_uipLong, 'upgrade_version_human' => $this->_uipHuman, 'upgrade_date' => time(), 'upgrade_mid' => 0));
             }
             if ($upgrade->fetchOutput()) {
                 $customHTML = $upgrade->fetchOutput();
             } else {
                 $output[] = "Successfully upgraded to version {$this->_uipHuman}";
             }
         } else {
             if ($upgrade->fetchOutput()) {
                 $customHTML = $upgrade->fetchOutput();
             } else {
                 $output[] = "Proceeding with update...";
             }
             $continue = 1;
         }
     } else {
         /* Nothing to run */
         if ($this->_uipLong) {
             /* Update version history */
             if (IPSSetUp::is300plus() === TRUE) {
                 $this->DB->insert('upgrade_history', array('upgrade_version_id' => $this->_uipLong, 'upgrade_version_human' => $this->_uipHuman, 'upgrade_date' => time(), 'upgrade_app' => $this->_currentApp, 'upgrade_mid' => 0));
                 /* Update app */
                 $_in = $this->_currentApp == 'core' ? "'core', 'forums', 'members'" : "'" . $this->_currentApp . "'";
                 $this->DB->update('core_applications', array('app_long_version' => $this->_uipLong, 'app_version' => $this->_uipHuman), 'app_directory IN (' . $_in . ')');
             } else {
                 $this->DB->insert('upgrade_history', array('upgrade_version_id' => $this->_uipLong, 'upgrade_version_human' => $this->_uipHuman, 'upgrade_date' => time(), 'upgrade_mid' => 0));
             }
             $output[] = "Successfully upgraded to version {$this->_uipHuman}";
         }
     }
     //-----------------------------------------
     // Next...
     //-----------------------------------------
     if ($continue) {
         $this->registry->output->setNextAction('upgrade&do=appclass');
     } elseif ($this->_uipLong >= $this->_latestLong || $this->_uipLong == 0) {
         /* Got another app to do? */
         $next = IPSSetUp::fetchNextApplication($this->_currentApp);
         if ($next['key']) {
             $this->registry->output->setNextAction('upgrade&do=sql&appdir=' . $next['key']);
         } else {
             $this->registry->output->setNextAction('upgrade&do=checkdb');
         }
     } else {
         $this->registry->output->setNextAction('upgrade&do=sql');
     }
     $this->registry->output->setTitle("Upgrade: Version Upgrade");
     if ($customHTML) {
         $this->registry->output->addContent($customHTML);
     } else {
         $this->registry->output->addContent($this->registry->output->template()->page_refresh($output));
     }
     $this->registry->output->setInstallStep($this->_stepCount, $this->_totalSteps);
     $this->registry->output->sendOutput();
 }