<?php final class PHPCheck extends Check { public function __construct() { $this->caption = 'PHP Version'; } public function performCheck() { if (version_compare(PHP_VERSION, '5.3.2', '<')) { $this->message = '<p>Your PHP Version (' . PHP_VERSION . ') is too old. You must update at least to PHP 5.3.2.</p>'; $this->result = CheckResult::FAIL; } elseif (version_compare(PHP_VERSION, '5.4.0', '<')) { $this->message = '<p>Your PHP Version (' . PHP_VERSION . ') is old but you can keep it. You should update to PHP 5.4.0 or higher.</p>'; $this->result = CheckResult::OK; } elseif (version_compare(PHP_VERSION, '5.4.0', '>=')) { $this->message = '<p>Your running PHP Version: ' . PHP_VERSION . '.</p>'; $this->result = CheckResult::OK; } } } ConfigurationChecks::addCheck(new PHPCheck());
$this->result = CheckResult::FAIL; $this->message = '<p>Please specify a database name</p>'; return; } try { $db = new Database('mysql:host=' . DATABASE_HOST, DATABASE_USER, DATABASE_PASS); // Does the database already exist? $sql = $db->prepare('SHOW DATABASES LIKE \'' . DATABASE_NAME . '\''); $sql->execute(); if ($sql->rowCount() == 0) { $this->result = CheckResult::FAIL; $this->message = '<p>Database ' . DATABASE_NAME . ' is not available</p>'; } else { $this->result = CheckResult::OK; $this->message = '<p>Database connection works fine.</p>'; } } catch (PDOException $e) { $this->result = CheckResult::FAIL; $this->message = '<p>Connection Error to MySQL. Host: ' . DATABASE_HOST . ' User: '******'') { // empty() does not seem to work with constants -.- $this->message .= ' used Password: NO (Password is empty).'; } else { $this->message .= ' used Password: YES.'; } $this->message .= '</p>'; } } } ConfigurationChecks::addCheck(new DatabaseCheck());
<?php final class ConfigCheck extends Check { public function __construct() { $this->caption = 'Configuration file'; } public function performCheck() { if (!file_exists(SYSTEM_ROOT . '/system/config.php')) { $this->message = '<p>Please move</p><code>' . SYSTEM_ROOT . '/system/config.php.sample</code><p>to</p><code>' . SYSTEM_ROOT . '/system/config.php</code><p>and prepare it with your data</p>'; $this->result = CheckResult::FAIL; } else { $this->result = CheckResult::OK; } } } ConfigurationChecks::addCheck(new ConfigCheck());
$this->result = CheckResult::OK; } else { if (!@chmod(SYSTEM_ROOT . '/uploads', 0600)) { // Try to make directory writeable $this->message = '<p>Please make the folder</p><code>' . SYSTEM_ROOT . '/uploads</code><p>writable.</p>'; $this->result = CheckResult::FAIL; } else { $this->result = CheckResult::OK; } } } else { $this->message = '<p>Please create the folder</p><code>' . SYSTEM_ROOT . '/uploads</code><p>and make it writable.</p>'; $this->result = CheckResult::FAIL; } } else { // Check permissions if (is_writeable($dir)) { $this->result = CheckResult::OK; } else { if (!@chmod(SYSTEM_ROOT . '/uploads', 0600)) { $this->result = '<p>Please make the folder</p><code>' . SYSTEM_ROOT . '/uploads</code><p>writable.</p>'; $this->result = CheckResult::FAIL; } else { $this->result = CheckResult::OK; } } } } } ConfigurationChecks::addCheck(new UploadDirCheck());
<?php final class SmartyDirCheck extends Check { public function __construct() { $this->caption = 'Smarty template_c folder is writable'; } public function performCheck() { $dir = SYSTEM_ROOT . '/classes/smarty/templates_c/'; if (!is_writable($dir)) { die("<html><body>It's required to make " . $dir . " writeable!<br />On Linux try <code>chmod 777 " . $dir . "</code><br />Don't worry! After this, installation get's much more prettier!</body></html>"); } $this->result = CheckResult::OK; } } ConfigurationChecks::addCheck(new SmartyDirCheck());
<?php final class RARCheck extends Check { public function __construct() { $this->caption = 'RAR'; } public function performCheck() { if (extension_loaded('rar') && class_exists('RarArchive')) { $this->result = CheckResult::OK; } else { $this->result = CheckResult::POOR; $this->message = '<p>RarArchive is not installed. Please install RarArchive for the full experience.</p>On Linux run</p><code>pecl -v install rar</code><p>to install RarArchive. You might add</p><code>extension=rar.so</code><p>to your <code class="inline">php.ini</code> file.</p>'; } } } ConfigurationChecks::addCheck(new RARCheck(), true);
<?php final class MaxPOSTSize extends Check { const MIN_VALUE = 52428800; // 50 MB public function __construct() { $this->caption = 'Max. HTTP POST size'; } public function performCheck() { $value = Utils::parseInteger(ini_get('post_max_size')); if ($value < self::MIN_VALUE && $value != 0) { $this->result = CheckResult::POOR; $this->message = '<p>An max HTTP post size of ' . ini_get('post_max_size') . ' (' . Utils::formatBytes($value) . ') is too small for a file hoster. It MUST be greater or equal to <code class="inline">upload_max_filesize</code>. Change <code class="inline">post_max_size</code> in your <code>php.ini</code>. ' . Utils::formatBytes(self::MIN_VALUE) . ' or more are recommend.</p>'; } else { if ($value == 0) { $this->result = CheckResult::OK; $this->message = '<p>You don\'t set a limit</p>'; $this->message .= '<p>Change <code class="inline">post_max_size</code> in your <cody>php.ini</code> to modify this value.</p>'; } else { $this->result = CheckResult::OK; $this->message = '<p>Your current value: ' . ini_get('post_max_size') . ' (' . Utils::formatBytes($value) . ')</p>'; $this->message .= '<p>Change <code class="inline">post_max_size</code> in your <cody>php.ini</code> to modify this value.</p>'; } } } } ConfigurationChecks::addCheck(new MaxPOSTSize());
<?php final class ImagickCheck extends Check { public function __construct() { $this->caption = 'Imagick'; } public function performCheck() { if (extension_loaded('imagick') && class_exists('Imagick')) { $this->result = CheckResult::OK; } else { $this->result = CheckResult::POOR; $this->message = '<p>Imagick is not installed. Please install Imagick for the full experience.</p><p>On Ubuntu run</p><code>sudo apt-get update && sudo apt-get install imagemagick libmagickwand-dev libmagickcore4 libmagickwand4 php5-imagick</code><p>to install Imagick.</p>'; } } } ConfigurationChecks::addCheck(new ImagickCheck(), true);