Пример #1
0
 public function actionIndex()
 {
     if ($this->_getUpgradeModel()->getNewestUpgradeVersionId() > XenForo_Application::$versionId) {
         return $this->responseError(new XenForo_Phrase('upgrade_found_newer_than_version'));
     }
     if ($this->_getUpgradeModel()->getLatestUpgradeVersionId() === XenForo_Application::$versionId && XenForo_Application::get('options')->currentVersionId >= XenForo_Application::$versionId) {
         return $this->responseView('XenForo_Install_View_Upgrade_Current', 'upgrade_current');
     }
     if (class_exists('XenForo_Install_Data_FileSums')) {
         $hashes = XenForo_Install_Data_FileSums::getHashes();
         foreach ($hashes as $key => $hash) {
             if (!preg_match('#^(\\./)?(install/|library/XenForo/Install/|library/XenForo/Application.php)#', $key)) {
                 unset($hashes[$key]);
             }
         }
         $fileErrors = XenForo_Helper_Hash::compareHashes($hashes);
         $hashesExist = true;
     } else {
         $fileErrors = array();
         $hashesExist = false;
     }
     $db = XenForo_Application::getDb();
     return $this->responseView('XenForo_Install_View_Upgrade_Start', 'upgrade_start', array('targetVersion' => XenForo_Application::$version, 'errors' => $this->_getInstallModel()->getRequirementErrors($db), 'warnings' => $this->_getInstallModel()->getRequirementWarnings($db), 'isCliRecommended' => $this->_getUpgradeModel()->isCliUpgradeRecommended(), 'cliCommand' => $this->_getUpgradeModel()->getCliCommand(), 'fileErrors' => $fileErrors, 'hashesExist' => $hashesExist));
 }
Пример #2
0
$installModel = XenForo_Model::create('XenForo_Install_Model_Install');
$cliHelper = new XenForo_Install_CliHelper();
if ($upgradeModel->getNewestUpgradeVersionId() > XenForo_Application::$versionId) {
    $cliHelper->triggerFatalError('An upgrade was found for a version of XenForo that is newer than the uploaded files. Please reupload all of the files for the new version and reload this page.');
}
if ($upgradeModel->getLatestUpgradeVersionId() === XenForo_Application::$versionId && XenForo_Application::get('options')->currentVersionId >= XenForo_Application::$versionId) {
    //$cliHelper->triggerFatalError('You are already running the latest version.');
}
if (class_exists('XenForo_Install_Data_FileSums')) {
    $hashes = XenForo_Install_Data_FileSums::getHashes();
    foreach ($hashes as $key => $hash) {
        if (!preg_match('#^(\\./)?(install/|library/XenForo/Install/|library/XenForo/Application.php)#', $key)) {
            unset($hashes[$key]);
        }
    }
    $fileErrors = XenForo_Helper_Hash::compareHashes($hashes);
    $hashesExist = true;
} else {
    $fileErrors = array();
    $hashesExist = false;
}
if ($fileErrors) {
    $cliHelper->printWarning("Some files do not contain the expected contents:\n\t" . implode("\n\t", array_keys($fileErrors)) . "\nContinue only if you're sure.");
}
$lastCompletedVersion = $upgradeModel->getLatestUpgradeVersionId();
$cliHelper->printMessage(sprintf("Current version: %s\nUpgrade target: %s (%s)", $lastCompletedVersion, XenForo_Application::$versionId, XenForo_Application::$version), 2);
do {
    $response = $cliHelper->askQuestion('Are you sure you want to upgrade? [y/n]');
    if ($cliHelper->validateYesNoAnswer($response, $continue)) {
        if (!$continue) {
            $cliHelper->triggerFatalError("You chose to not continue with the upgrade. Process terminated.");
Пример #3
0
 public function actionFileCheck()
 {
     if ($this->_request->isPost()) {
         $hashes = XenForo_Install_Data_FileSums::getHashes();
         XenForo_CodeEvent::fire('file_health_check', array($this, &$hashes));
         $errors = XenForo_Helper_Hash::compareHashes($hashes);
         $viewParams = array('errors' => $errors, 'hashes' => $hashes);
     } else {
         $viewParams = array('form' => true);
     }
     return $this->responseView('XenForo_ViewAdmin_Tools_FileCheck', 'tools_file_check', $viewParams);
 }