Example #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));
 }
Example #2
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);
 }
Example #3
0
// this causes lots of memory usage in debug mode, so stop that
$dependencies = new XenForo_Dependencies_Install();
$dependencies->preLoadData();
/** @var $upgradeModel XenForo_Install_Model_Upgrade */
$upgradeModel = XenForo_Model::create('XenForo_Install_Model_Upgrade');
/** @var $installModel XenForo_Install_Model_Install */
$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();
Example #4
0
 public function getDefaultSchemaErrors()
 {
     if (class_exists('XenForo_Install_Data_FileSums')) {
         $fileLookup = XenForo_Install_Data_FileSums::getHashes();
     } else {
         $fileLookup = null;
     }
     return $this->runSchemaCompare('XenForo_DataWriter', XenForo_Autoloader::getInstance()->getRootDir() . '/XenForo/DataWriter', $fileLookup);
 }