/** * 获取安装流程注入 * * @return array */ protected function resolvedInstallation($file) { $install = null; if ($this->_step && is_file($file)) { $service = PwApplicationHelper::readInstallLog($file, 'services'); $rollback = PwApplicationHelper::readInstallLog($file, 'rollback'); $install = PwApplicationHelper::readInstallLog($file, 'installation'); $install = unserialize(base64_decode($install)); } else { $service = $rollback = array(); $conf = $this->getConfig('install-type', $this->getManifest()->getApplication('type', 'app')); if (!empty($conf['step']['before'])) { foreach ($conf['step']['before'] as $var) { $var['class'] = $conf['class']; $service[] = $var; } } else { $service[] = $conf; } $rollback[] = $conf; foreach ($this->getManifest()->getInstallationService() as $var) { // TODO 从钩子中获取 $_tmp = $this->getConfig('installation-service', $var); if (!$_tmp) { continue; } $_tmp['_key'] = $var; $rollback[] = $service[] = $_tmp; $this->addInstallLog('service', $_tmp); } if (!empty($conf['step']['after'])) { foreach ($conf['step']['after'] as $var) { $var['class'] = $conf['class']; $service[] = $var; } } $manifest = $this->getManifest()->getManifest(); if (isset($manifest['install']) && $manifest['install']) { $_tmp = array('class' => $manifest['install']); $service[] = $_tmp; $this->addInstallLog('service', $_tmp); } $this->addInstallLog('service', $conf); if ($this->_step) { PwApplicationHelper::writeInstallLog($file, array('services' => $service, 'rollback' => $rollback, 'installation' => base64_encode(serialize($this)))); } $install = $this; } return array($service, $rollback, $install); }