/** * Enter description here . * * * .. * * @param unknown_type $type * @param PwInstallApplication $install * @return PwError boolean */ protected function _install($type, $install) { $manifest = $install->getManifest(); if (!$this->link) { $this->link = 'index.php?m=app&app=' . $manifest->getApplication('alias'); } $dm = new PwNavDm(); $dm->setLink($this->link)->setType($type); if ($type == 'my') { $prefix = Wind::getComponent('i18n')->getMessage('ADMIN:nav.my.prefix'); $dm->setName($prefix . $manifest->getApplication('name'))->setSign($manifest->getApplication('alias')); } else { $dm->setName($manifest->getApplication('name')); } $id = $this->_navDs()->addNav($dm); if ($id instanceof PwError) { return $id; } $install->addInstallLog('nav', $id); $this->update(); file_put_contents(DATA_PATH . 'tmp/log', 'nav!', FILE_APPEND); return true; }
/** * * @param PwInstallApplication $install */ protected function getStyleType($install) { $allow_style_type = $install->getConfig('style-type'); $style_type = $install->getManifest()->getApplication('style-type'); if (!$style_type || !isset($allow_style_type[$style_type])) { $style_type = key($allow_style_type); } return array($style_type, $allow_style_type[$style_type][1]); }
/** * 注册静态资源 * * @param PwInstallApplication $install * @return PwError true */ public function registeResource($install) { $manifest = $install->getManifest()->getManifest(); if (!isset($manifest['res']) || !$manifest['res']) { return true; } $name = $install->getManifest()->getApplication('alias'); $source = $install->getTmpPackage() . '/' . str_replace('.', '/', $manifest['res']); $targetPath = Wind::getRealDir('THEMES:extres', true); if (!is_dir($source)) { return true; } $writable = PwSystemHelper::checkWriteAble($targetPath . '/'); if (!$writable) { return new PwError('APPCENTER:install.mv.fail', array('{{error}}' => 'THEMES:extres.' . $name)); } PwApplicationHelper::copyRecursive($source, $targetPath . '/' . $name); $install->addInstallLog('packs', $targetPath . '/' . $name); file_put_contents(DATA_PATH . 'tmp/log', 'res!', FILE_APPEND); }