yupe\components\WebModule::installDB PHP Method

installDB() public method

Метод установки БД модуля
Since: 0.5
public installDB ( $installed = [] ) : boolean
return boolean статус установки БД модуля
    public function installDB($installed = [])
    {
        $log = [];
        Yii::log(Yii::t('YupeModule.yupe', "{id}->installDB() : Requested DB installation of module {m}", ['{m}' => $this->getName(), '{id}' => $this->getId()]));
        Yii::app()->getCache()->clear('installedModules', 'getModulesDisabled', 'modulesDisabled', $this->getId());
        Yii::app()->configManager->flushDump();
        if ($this->getDependencies() !== []) {
            foreach ($this->getDependencies() as $dep) {
                Yii::log(Yii::t('YupeModule.yupe', 'First will be installed DB from module {m2} as a relation for {module}', ['{module}' => $this->getId(), '{m2}' => $dep]));
                if (($m = Yii::app()->getModule($dep)) === null) {
                    //установить зависимости @since 0.8
                    $module = Yii::app()->moduleManager->getCreateModule($dep);
                    if (null === $module) {
                        throw new CException(Yii::t('YupeModule.yupe', "Module {dm} required for install was not found", ['{dm}' => $dep]));
                    }
                    if ($module->getIsInstalled()) {
                        $this->getActivate();
                    } else {
                        $module->getInstall();
                    }
                } else {
                    $i = $m->installDB($installed);
                    if (!isset($installed[$dep]) && !$i) {
                        return false;
                    }
                    $log = array_merge($log, $i);
                }
            }
        }
        $log[] = $this->getId();
        return Yii::app()->migrator->updateToLatest($this->id) && ($installed[$this->id] = true) ? $log : false;
    }