Exemplo n.º 1
0
 /**
  * System checkup
  * @return void
  * @uses MeCms\Core\Plugin::all()
  * @uses MeCms\Core\Plugin::path()
  * @uses MeTools\Utility\Apache::module()
  * @uses MeTools\Utility\Apache::version()
  */
 public function checkup()
 {
     $checkup['apache'] = ['expires' => Apache::module('mod_expires'), 'rewrite' => Apache::module('mod_rewrite'), 'version' => Apache::version()];
     $checkup['backups'] = ['path' => rtr(Configure::read('MysqlBackup.target') . DS), 'writeable' => folderIsWriteable(Configure::read('MysqlBackup.target'))];
     $checkup['cache'] = Cache::enabled();
     //Checks for PHP's extensions
     foreach (['exif', 'imagick', 'mcrypt', 'zip'] as $extension) {
         $checkup['phpExtensions'][$extension] = extension_loaded($extension);
     }
     $checkup['plugins'] = ['cakephp' => Configure::version(), 'mecms' => trim(file_get_contents(Plugin::path(MECMS, 'version')))];
     //Gets plugins versions
     foreach (Plugin::all(['exclude' => MECMS]) as $plugin) {
         $file = Plugin::path($plugin, 'version', true);
         if ($file) {
             $checkup['plugins']['plugins'][$plugin] = trim(file_get_contents($file));
         } else {
             $checkup['plugins']['plugins'][$plugin] = __d('me_cms', 'n.a.');
         }
     }
     //Checks for temporary directories
     foreach ([LOGS, TMP, Configure::read('Assets.target'), CACHE, LOGIN_LOGS, Configure::read('Thumbs.target')] as $path) {
         $checkup['temporary'][] = ['path' => rtr($path), 'writeable' => folderIsWriteable($path)];
     }
     //Checks for webroot directories
     foreach ([BANNERS, PHOTOS, WWW_ROOT . 'files', WWW_ROOT . 'fonts'] as $path) {
         $checkup['webroot'][] = ['path' => rtr($path), 'writeable' => folderIsWriteable($path)];
     }
     array_walk($checkup, function ($value, $key) {
         $this->set($key, $value);
     });
 }