function post_install() { kernel::single('base_application_manage')->sync(); kernel::set_online(true); $rpc_server = array('node_id' => '1', 'node_url' => MATRIX_URL, 'node_name' => 'Global Matrix', 'node_api' => '/matrix', 'link_status' => 'active'); app::get('base')->model('network')->replace($rpc_server, array('node_id' => 1)); }
private function get_active_node_id() { kernel::set_online(true); if (file_exists(ROOT_DIR . '/config/config.php')) { $obj_buildin = kernel::single('base_shell_buildin'); $obj_buildin->command_active_node_id('ceti_node_id'); } else { echo 'config file?'; } }
function post_install() { kernel::single('base_application_manage')->sync(); kernel::set_online(true); $rpc_global_server = array('node_id' => base_mdl_network::MATRIX_ASYNC, 'node_url' => config::get('link.matrix_async_url'), 'node_name' => 'Global Matrix', 'node_api' => '', 'link_status' => 'active'); app::get('base')->model('network')->replace($rpc_global_server, array('node_id' => base_mdl_network::MATRIX_ASYNC), true); $rpc_realtime_server = array('node_id' => base_mdl_network::MATRIX_REALTIME, 'node_url' => config::get('link.matrix_realtime_url'), 'node_name' => 'Realtime Matrix', 'node_api' => '', 'link_status' => 'active'); app::get('base')->model('network')->replace($rpc_realtime_server, array('node_id' => base_mdl_network::MATRIX_REALTIME), true); $rpc_service_server = array('node_id' => base_mdl_network::MATRIX_SERVICE, 'node_url' => config::get('link.matrix_service_url'), 'node_name' => 'Service Matrix', 'node_api' => '', 'link_status' => 'active'); app::get('base')->model('network')->replace($rpc_service_server, array('node_id' => base_mdl_network::MATRIX_SERVICE), true); }
public function install($app_id, $options = null, $auto_enable = 1) { $app = app::get($app_id); if (!file_exists(APP_DIR . '/' . $app_id . '/app.xml')) { if (!$this->download($app_id)) { logger::info('Application package can not be download.'); return false; } } $rows = kernel::database()->select('select * from sdb_base_apps where app_id="' . $app_id . '"'); if (isset($rows[0]) && $rows[0]['status'] != "uninstalled") { logger::info('Application package Already installed'); return false; } $app_info = $app->define('main_app'); $app_exclusion = app::get('base')->getConf('system.main_app'); if ($app_info['value'] == 'true') { if ($app_info['exclusion'] == 'true') { if ($app_exclusion['value'] == 'true' && $app_exclusion['exclusion'] == 'true' && $app_exclusion['app_id'] != $app_id) { logger::info('Application ' . $app_id . ' exclusioned ' . $app_exclusion['app_id'] . '.'); return false; } } $app_info['app_id'] = $app_id; $app_exclusion = app::get('base')->setConf('system.main_app', $app_info); } $app_self_detector = null; kernel::database()->exec('update sdb_base_apps set status="installing" where app_id="' . $app_id . '" and status="uninstalled" '); $app->runtask('pre_install', $options); kernel::single('base_application_dbtable')->clear_by_app($app_id); //清除冗余表信息 foreach ($this->content_detector($app_id) as $detector) { foreach ($detector->detect($app) as $name => $item) { $item->install(); } kernel::set_online(true); base_kvstore::instance('system')->store('service_last_modified.' . get_class($detector) . '.' . $app_id, $detector->last_modified($app_id)); } //todo:clear service cache... 如果以后做了缓存的话... //用自己新安装的资源探测器,安装自己的资源 foreach (kernel::servicelist('app_content_detector') as $k => $detector) { if ($detector->app->app_id == $app_id) { //遍历所有已经安装的app foreach ($detector->detect($app) as $name => $item) { $item->install(); } base_kvstore::instance('system')->store('service_last_modified.' . get_class($detector) . '.' . $app_id, $detector->last_modified($app_id)); } } app::get('base')->model('apps')->replace(array('status' => 'installed', 'app_id' => $app_id, 'dbver' => $app->define('version')), array('app_id' => $app_id)); $deploy_info = base_setup_config::deploy_info(); foreach ((array) $deploy_info['setting'] as $set) { if ($set['app'] == $app_id) { $app->setConf($set['key'], $set['value']); } } $app->runtask('post_install', $options); if ($auto_enable) { $this->enable($app_id); } //app submit servicelist $params['certificate_id'] = $app_id; $params['app_id'] = $app_id; // $rst = app::get($app_id)->matrix()->set_callback('dev_sandbox','show',array(1,2,3,'aa'=>time())) // ->call('node.addshop',$app_id); logger::info('Application ' . $app_id . ' installed... ok.'); }
public function install_app() { kernel::set_online(true); $app = $_GET['app']; if (file_exists(ROOT_DIR . '/config/config.php')) { $shell = new base_shell_webproxy(); $shell->input = $_POST['options']; $shell->exec_command('install -r ' . $app); } else { echo 'config file?'; } }
public function install_demodata() { kernel::set_online(true); //todo: config check $shell = new base_shell_webproxy(); $shell->input = $_POST['options']; $shell->exec_command('install_demodata -r demodata'); }
private function get_active_node_id() { kernel::set_online(true); $obj_buildin = kernel::single('base_shell_buildin'); $obj_buildin->command_active_node_id('ceti_node_id'); }