yupe\components\WebModule::getActivate PHP Method

getActivate() public method

Метод включает модуль - копирует файл с конфигурацией
Since: 0.5
public getActivate ( boolean $noDependent = false ) : boolean
$noDependent boolean - не проверять на зависимости от других модулей
return boolean статус включения модуля
    public function getActivate($noDependent = false)
    {
        Yii::app()->getCache()->flush();
        Yii::app()->configManager->flushDump();
        $fileConfig = Yii::app()->moduleManager->getModulesConfig($this->getId());
        if (is_file($fileConfig) && $this->id != ModuleManager::INSTALL_MODULE) {
            return true;
        } else {
            // Проверка модулей от которых зависит данный
            if (!$noDependent) {
                $dependencies = $this->getDependencies();
                if (!empty($dependencies) && is_array($dependencies)) {
                    foreach ($dependencies as $dependency) {
                        if (Yii::app()->getModule($dependency) == null) {
                            //установить все зависимости @since 0.8
                            $module = Yii::app()->moduleManager->getCreateModule($dependency);
                            if (null === $module) {
                                throw new CException(Yii::t('YupeModule.yupe', 'Error. Modules which depends from this module is disabled. First please enable this modules.'));
                            }
                            if ($module->getIsInstalled()) {
                                $this->getActivate();
                            } else {
                                $module->getInstall();
                            }
                        }
                    }
                }
            }
            if (Yii::app()->moduleManager->updateModuleConfig($this)) {
                return true;
            } else {
                throw new CException(Yii::t('YupeModule.yupe', 'Error when trying to enable the module. Configuration file is corrupted or access to "config" folder is forbidden!'));
            }
        }
    }