.

gyro/install/check_preconditions.php File Reference

Go to the source code of this file.

Functions

  core_check_preconditions ()

Function Documentation

core_check_preconditions (  ) 

Definition at line 2 of file check_preconditions.php.

00002                                     {
00003         $ret = new Status();
00004         
00005         $tempdir = Config::get_value(Config::TEMP_DIR) . '/';
00006 
00007         $subdirs = array(
00008                 '',
00009                 'log', 
00010                 'view', 'view/templates_c'
00011         );
00012         foreach($subdirs as $subdir) {
00013                 $dir = rtrim($tempdir . $subdir, '/');
00014                 if (!file_exists($dir)) {
00015                         $cmd = 'mkdir -p ' . $dir;
00016                         if (shell_exec($cmd)) { 
00017                                 $ret->append('Could not create temporary directory ' . $dir);                   
00018                         }
00019                         else {
00020                                 chmod($dir, 0777);
00021                         }
00022                 }
00023                 // Try to place file into temp dir
00024                 $file = $dir . '/test' . md5(uniqid());
00025                 if (touch($file)) {
00026                         unlink($file);
00027                 }
00028                 else {
00029                         $ret->append('Could not create file in temporary directory ' . $dir);
00030                 }
00031         }
00032         
00033         return $ret;
00034 }