Example #1
0
 public function save()
 {
     if (!$this->validate()) {
         return false;
     }
     $attributes = [];
     foreach ($this->_attributes as $attribute => $value) {
         $attributes[$attribute] = $this->isSerializable($attribute) ? json_decode($value, true) : $value;
     }
     return ConfigManager::set(['modules', $this->item->moduleName, 'params'], $attributes);
 }
Example #2
0
 public function uninstall()
 {
     \app\config\ConfigManager::set(['components', 'user', 'identityClass'], '');
 }
Example #3
0
 public function save()
 {
     if (!$this->validate()) {
         return false;
     }
     if (!$this->beforeSave()) {
         $this->encodeJsonAttributes();
         return false;
     }
     if ($result = ConfigManager::set(self::getKey(), $this->attributes)) {
         $this->afterSave();
     }
     $this->encodeJsonAttributes();
     return $result;
 }
Example #4
0
 public function uninstall()
 {
     if (!($module = self::getModuleByClassName($this->class))) {
         return true;
     }
     if (method_exists($module, 'uninstall')) {
         $module->uninstall($this->moduleName);
     }
     $config = ConfigManager::getWriteData();
     unset($config['modules'][$this->moduleName]);
     $config['bootstrap'] = array_diff($config['bootstrap'], [$this->moduleName]);
     ConfigManager::remove(['modules', $this->moduleName]);
     ConfigManager::put(['bootstrap' => array_unique($config['bootstrap'])]);
     self::migrate([['module-down', [$this->moduleName]]]);
 }
Example #5
0
 public function select()
 {
     $themePath = self::$themePath . "/{$this->id}";
     $config = \app\config\ConfigManager::getWriteData();
     \app\config\ConfigManager::set(['components', 'view', 'theme'], ['pathMap' => ['@app/views' => $themePath, '@app/modules' => $themePath], 'basePath' => $themePath, 'baseUrl' => str_replace('@app', '@web', $themePath)]);
 }