/**
  * Server info
  *
  * @return null
  */
 public function actionServerInfo()
 {
     // Run the requirements checker
     $reqCheck = new RequirementsChecker();
     $reqCheck->run();
     $this->renderTemplate('utils/serverinfo', array('requirements' => $reqCheck->getRequirements()));
 }
 public function actionRequirementsCheck()
 {
     // Run the requirements checker
     $reqCheck = new RequirementsChecker();
     $reqCheck->run();
     if ($reqCheck->getResult() == InstallStatus::Failure) {
         // Coming from Updater.php
         if (craft()->request->isAjaxRequest()) {
             $message = '<br /><br />';
             foreach ($reqCheck->getRequirements() as $req) {
                 if ($req->result == 'failed') {
                     $message .= $req->notes . '<br />';
                 }
             }
             throw new Exception(Craft::t('The update can’t be installed. :( {message}', array('message' => $message)));
         } else {
             $this->_render('_special/cantrun', array('reqCheck' => $reqCheck));
             craft()->end();
         }
     } else {
         // Cache the app path.
         craft()->fileCache->set('appPath', craft()->path->getAppPath());
     }
 }
Esempio n. 3
0
 /**
  * @param string $unzipFolder
  *
  * @throws Exception
  * @return array
  */
 private function _validateNewRequirements($unzipFolder)
 {
     $requirementsFolderPath = $unzipFolder . '/app/etc/requirements/';
     $requirementsFile = $requirementsFolderPath . 'Requirements.php';
     $errors = array();
     if (!IOHelper::fileExists($requirementsFile)) {
         throw new Exception(Craft::t('The Requirements file is required and it does not exist at {path}.', array('path' => $requirementsFile)));
     }
     // Make sure we can write to craft/app/requirements
     if (!IOHelper::isWritable(craft()->path->getAppPath() . 'etc/requirements/')) {
         throw new Exception(StringHelper::parseMarkdown(Craft::t('Craft CMS needs to be able to write to your craft/app/etc/requirements folder and cannot. Please check your [permissions]({url}).', array('url' => 'http://craftcms.com/docs/updating#one-click-updating'))));
     }
     $tempFileName = StringHelper::UUID() . '.php';
     // Make a dupe of the requirements file and give it a random file name.
     IOHelper::copyFile($requirementsFile, $requirementsFolderPath . $tempFileName);
     $newTempFilePath = craft()->path->getAppPath() . 'etc/requirements/' . $tempFileName;
     // Copy the random file name requirements to the requirements folder.
     // We don't want to execute any PHP from the storage folder.
     IOHelper::copyFile($requirementsFolderPath . $tempFileName, $newTempFilePath);
     require_once $newTempFilePath;
     $checker = new RequirementsChecker();
     $checker->run();
     if ($checker->getResult() == RequirementResult::Failed) {
         foreach ($checker->getRequirements() as $requirement) {
             if ($requirement->getResult() == InstallStatus::Failed) {
                 Craft::log('Requirement "' . $requirement->getName() . '" failed with the message: ' . $requirement->getNotes(), LogLevel::Error, true);
                 $errors[] = $requirement->getNotes();
             }
         }
     }
     // Cleanup
     IOHelper::deleteFile($newTempFilePath);
     return $errors;
 }
Esempio n. 4
0
        } else {
            return sprintf('<h%d>', $level) . $text . sprintf('</h%d>', $level) . PHP_EOL;
        }
    }
    /**
     * Show a newline character with a <br> HTML element.
     * If in CLI, just show a newline character.
     * 
     * @return processed message to show
     */
    public function nl()
    {
        return $this->isCli() ? PHP_EOL : '<br>' . PHP_EOL;
    }
}
$r = new RequirementsChecker();
$f = new RequirementsFormatter();
if (isset($_SERVER['HTTP_HOST'])) {
    echo '<html>' . PHP_EOL;
    echo '<head>' . PHP_EOL;
    echo '<title>SilverStripe Requirements</title>' . PHP_EOL;
    echo '<style type="text/css">' . PHP_EOL;
    echo '@import url("styles.css");' . PHP_EOL;
    echo '</style>' . PHP_EOL;
    echo '</head>' . PHP_EOL;
    echo '<body>' . PHP_EOL;
}
echo $f->heading('SilverStripe Requirements Checker', 1);
echo $f->heading('System information', 2);
echo $f->show(sprintf('System: %s', $r->getSystemInformation()));
echo $f->show(sprintf('Webserver Software: %s', isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown'));