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); }
public function uninstall() { \app\config\ConfigManager::set(['components', 'user', 'identityClass'], ''); }
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; }
public function install() { $config = ['class' => $this->class]; $modules = Yii::$app->modules; if ($module = self::getModuleByClassName($this->class)) { $moduleInstalled = true; if ($this->moduleName == $module->id) { return true; } $config['params'] = $module->params; if (method_exists($module, 'uninstall')) { $module->uninstall($module->id); } unset($modules[$module->id]); ConfigManager::remove(['modules', $module->id], $config); } else { $moduleInstalled = false; } ConfigManager::set(['modules', $this->moduleName], $config); $modules[$this->moduleName] = $config; Yii::configure(Yii::$app, compact('modules')); if (!$moduleInstalled) { self::migrate([['module-up', [$this->moduleName]]]); $module = self::getModuleByClassName($this->class); if (method_exists($module, 'install')) { $module->install($this->moduleName); } } }
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)]); }