Beispiel #1
0
 /**
  * 
  * @access public
  * @author "Lionel Lecaque, <*****@*****.**>"
  * @param string $script
  */
 public function scriptRunner($script)
 {
     $error = false;
     $errorStack = array();
     set_time_limit(300);
     if ($script != null) {
         $parameters = array();
         $options = array('argv' => array(0 => 'Script ' . $script), 'output_mode' => 'log_only');
         try {
             $scriptName = 'app\\scripts\\' . $script;
             new $scriptName(array('parameters' => $parameters), $options);
             $error = false;
         } catch (\Exception $e) {
             Logger::e('Error occurs during update ' . $e->getMessage());
             $error = true;
             $errorStack[] = 'Error in script ' . $script . ' ' . $e->getMessage();
         }
         if ($error) {
             echo json_encode(array('success' => 0, 'failed' => $errorStack));
         } else {
             echo json_encode(array('success' => 1, 'failed' => array()));
         }
     } else {
         echo json_encode(array('success' => 0, 'failed' => array('not scriptname provided')));
     }
 }
 /**
  * Short description of method err
  *
  * @access protected
  * @author firstname and lastname of author, <*****@*****.**>
  * @param  string message
  * @param  boolean stopExec
  */
 protected function err($message, $stopExec = false)
 {
     // section 127-0-1-1--39e3a8dd:12e33ba6c22:-8000:0000000000002D5B begin
     Logger::e($message);
     echo $this->out($message, array('color' => 'light_red'));
     if ($stopExec == true) {
         if ($this->isCli) {
             exit(1);
             //exit the program with an error
         } else {
             throw new Exception($message);
         }
     }
     // section 127-0-1-1--39e3a8dd:12e33ba6c22:-8000:0000000000002D5B end
 }
 /**
  *
  * @access
  * @author "Lionel Lecaque, <*****@*****.**>"
  * @param unknown $ext
  * @return boolean
  */
 public function unShield($ext)
 {
     $releaseManifest = $this->getReleaseManifest();
     $extFolder = $releaseManifest['old_root_path'] . $ext;
     if (!is_file($extFolder . '/htaccess.1')) {
         Logger::d('Previous lock, htaccess.1 do not exits something new extension');
         return true;
     }
     if (unlink($extFolder . '/.htaccess')) {
         return File::move($extFolder . '/htaccess.1', $extFolder . '/.htaccess', false);
     } else {
         Logger::e('Fail to remove htaccess in ' . $ext . ' . You may copy by hand file htaccess.1');
         return false;
     }
 }