예제 #1
0
파일: Main.php 프로젝트: phpffcms/ffcms
 /**
  * Index page of admin dashboard
  * @return string
  * @throws \Ffcms\Core\Exception\SyntaxException
  * @throws \Ffcms\Core\Exception\NativeException
  */
 public function actionIndex()
 {
     // cache some data
     $rootSize = App::$Cache->get('root.size');
     if ($rootSize === null) {
         $rootSize = round(Directory::getSize('/') / (1024 * 1000), 2) . ' mb';
         App::$Cache->set('root.size', $rootSize, 86400);
         // 24 hours caching = 60 * 60 * 24
     }
     $loadAvg = App::$Cache->get('load.average');
     if ($loadAvg === null) {
         $loadAvg = Environment::loadAverage();
         App::$Cache->set('load.average', $loadAvg, 60 * 5);
         // 5 min cache
     }
     // prepare system statistic
     $stats = ['ff_version' => Version::VERSION . ' (' . Version::DATE . ')', 'php_version' => Environment::phpVersion() . ' (' . Environment::phpSAPI() . ')', 'os_name' => Environment::osName(), 'database_name' => App::$Database->connection()->getDatabaseName() . ' (' . App::$Database->connection()->getDriverName() . ')', 'file_size' => $rootSize, 'load_avg' => $loadAvg];
     // check directory chmods and other environment features
     $model = new EntityCheck();
     // render view output
     return $this->view->render('index', ['stats' => $stats, 'check' => $model]);
 }