Ejemplo n.º 1
0
 public function get_step_3()
 {
     Session::put('step_3_passed', false);
     Session::put('step_4_passed', false);
     Session::put('step_complete', false);
     if (!Session::get('step_1_passed')) {
         return Redirect::to('install/step_1');
     }
     if (!Session::get('step_2_passed')) {
         return Redirect::to('install/step_2');
     }
     $this->layout->nav_step = 3;
     $data = new stdClass();
     $app_path = explode(DS, path('app'));
     foreach ($app_path as $key => $value) {
         if (empty($value)) {
             unset($app_path[$key]);
         }
     }
     array_pop($app_path);
     $app_path = implode(DS, $app_path);
     // Get the write permissions for the folders
     foreach ($this->writeable_directories as $dir) {
         // Try CHMOD if the operation is permited will to automatically
         @chmod(DS . $app_path . DS . $dir, 0777);
         $permissions['directories'][$dir] = Installer::is_really_writable(DS . $app_path . DS . $dir);
     }
     foreach ($this->writeable_files as $file) {
         // Try CHMOD if the operation is permited will to automatically
         @chmod(DS . $app_path . DS . $file, 0666);
         $permissions['files'][$file] = Installer::is_really_writable(DS . $app_path . DS . $file);
     }
     // we are asking to read file1
     // but if mod_rewrite is enable it will
     // return file2 content (true) the .htaccess file is
     // in the public folder /bundles/install/test_mod_rewrite/.htaccess
     $file = @file_get_contents(URL::base() . DS . 'bundles' . DS . 'install' . DS . 'test_mod_rewrite' . DS . 'file1.txt');
     if ($file == 'true') {
         Installer::set_app_index();
     }
     // If all permissions are TRUE, go ahead
     $data->step_passed = !in_array(FALSE, $permissions['directories']) && !in_array(FALSE, $permissions['files']);
     Session::put('step_3_passed', $data->step_passed);
     // Skip Step 2 if it passes
     // if ($data->step_passed)
     // {
     //     Session::put('step_3_passed', true);
     //     return Redirect::to('admin/installer/step_4');
     // }
     $this->layout->content = View::make('install::step_3')->with('permissions', $permissions)->with('all_passed', $data->step_passed);
 }