Esempio n. 1
0
 /**
  * Make update actions
  */
 public function make()
 {
     // make query to ClassController::update(version)
     @forward_static_call_array([$this->_callback, 'update'], [$this->_record->version]);
     // update version in db
     $this->_record->version = $this->_record->getScriptVersion();
     $this->_record->save();
 }
Esempio n. 2
0
 /**
  * Make app installation
  * @return bool
  */
 public function make()
 {
     $cName = ucfirst(Str::lowerCase($this->sysname));
     $cPath = 'Apps\\Controller\\Admin\\' . $cName;
     // if object class is not loaded - prevent install
     if (!class_exists($cPath) || !defined($cPath . '::VERSION')) {
         return false;
     }
     // get ext version
     $cVersion = constant($cPath . '::VERSION');
     if ($cVersion === null || Str::likeEmpty($cVersion)) {
         $cVersion = '1.0.0';
     }
     // save row to db
     $record = new AppRecord();
     $record->type = $this->_type;
     $record->sys_name = $cName;
     $record->name = '';
     $record->disabled = 1;
     $record->version = $cVersion;
     $record->save();
     // callback to install method in extension
     if (method_exists($cPath, 'install')) {
         call_user_func($cPath . '::install');
     }
     return true;
 }