예제 #1
0
 /**
  * 调试应用
  *
  * @param unknown_type $alias        	
  * @param unknown_type $manifest        	
  */
 private function _upgrade($alias, $manifest)
 {
     // 更新基本信息
     Wind::import('APPCENTER:service.dm.PwApplicationDm');
     $man_array = $this->manifest->getManifest();
     $dm = new PwApplicationDm();
     $dm->setAppId($this->app_id);
     $dm->setName($man_array['application']['name']);
     $dm->setDescription($man_array['application']['description']);
     $dm->setVersion($man_array['application']['version']);
     $dm->setPwVersion($man_array['application']['pw-version']);
     $dm->setAuthorName($man_array['application']['author-name']);
     $dm->setAuthorEmail($man_array['application']['author-email']);
     $dm->setWebsite($man_array['application']['website']);
     $dm->setLogo($man_array['application']['logo']);
     Wekit::load('APPCENTER:service.PwApplication')->update($dm);
     $this->_loadPwHooks()->delByAppId($this->app_id);
     $this->_loadPwHookInject()->deleteByAppId($alias);
     $hooks = $this->manifest->getHooks();
     $log = array();
     if ($hooks) {
         foreach ($hooks as $key => $hook) {
             $hook['app_id'] = $this->app_id;
             $hook['app_name'] = $this->app['app_name'];
             $hooks[$key] = $hook;
         }
         $this->_loadPwHooks()->batchAdd($hooks);
         $log[] = array('app_id' => $this->app_id, 'log_type' => 'hook', 'data' => array_keys($hooks), 'created_time' => WEKIT_TIMESTAMP, 'modified_time' => WEKIT_TIMESTAMP);
     }
     $inject = $this->manifest->getInjectServices();
     if ($inject) {
         $inject_ids = array();
         foreach ($inject as $key => &$value) {
             $value['app_id'] = $alias;
             $value['app_name'] = $this->app['app_name'];
         }
         $this->_loadPwHookInject()->batchAdd($inject);
         $injects = $this->_loadPwHookInject()->findByAppId($alias);
         $log[] = array('app_id' => $this->app_id, 'log_type' => 'inject', 'data' => array_keys($injects), 'created_time' => WEKIT_TIMESTAMP, 'modified_time' => WEKIT_TIMESTAMP);
     }
     $log && $this->_loadInstallLog()->batchAdd($log);
 }
예제 #2
0
 /**
  * 获取扩展信息
  */
 public function hookAction()
 {
     $alias = $this->getInput('alias');
     $manifest = Wind::getRealPath('EXT:' . $alias . '.Manifest.xml', true);
     $hooks = $injectors = array();
     if (is_file($manifest)) {
         $man = new PwManifest($manifest);
         $hooks = $man->getHooks();
         $injectors = $man->getInjectServices();
     }
     $this->setOutput(array('hooks' => $hooks, 'injectors' => $injectors));
 }