本文整理汇总了PHP中kernel::log方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::log方法的具体用法?PHP kernel::log怎么用?PHP kernel::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel
的用法示例。
在下文中一共展示了kernel::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($app)
{
$this->app = $app;
$this->sitemap = app::get('site')->getConf('sitemaps');
if (!is_array($this->sitemap)) {
$sitemap_config = kernel::single('site_module_base')->assemble_config();
if (is_array($sitemap_config)) {
$this->sitemap = $sitemap_config;
//todo:兼容kvstroe出错的情况下
if (!kernel::single('site_module_base')->write_config($sitemap_config)) {
kernel::log('Error: sitemap can\'t save to kvstore');
//todo:如果写入失败,记录于系统日志中,前台不报错,保证网站运行正常
}
} else {
//if false
trigger_error('sitemap is lost!', E_USER_ERROR);
//todo:无sitemap时报错
}
}
foreach ($this->sitemap as $part => $controller) {
$urlmap[$controller[0] . ':' . $controller[1]] = $part;
}
$this->urlmap = $urlmap;
$this->_request = kernel::single('base_component_request');
$this->_response = kernel::single('base_component_response');
}
示例2: __call
public function __call($method, $params)
{
//api 版本历史
$apiv_history = array('2.0', '1.0');
$api_info = base_rpc_service::$api_info;
$api_obj = NULL;
$flag = false;
foreach ($apiv_history as $v) {
if ($this->apiv == $v) {
$flag = true;
}
if ($flag) {
$service = 'apiv_' . $v . '_' . $api_info['api_name'];
$api_obj = kernel::service($service);
if (method_exists($api_obj, $method)) {
break;
} else {
kernel::log('apiv service:' . $service . ', method:' . $method . ' not found!');
}
}
}
if (!$api_obj || !method_exists($api_obj, $method)) {
trigger_error('server reject!', E_USER_ERROR);
}
//return call_user_func_array(array( &$api_obj, $method ), $params);
return $api_obj->{$method}($params[0], $params[1]);
}
示例3: parse_app
private function parse_app($app_id)
{
$app = app::get($app_id);
$dir = $app->lang_dir . '/' . $lang;
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
}
$file = $dir . '/convert.php';
$array = array();
$this->parse_php($app, $app->app_dir . '/controller', $array);
$this->parse_php($app, $app->app_dir . '/dbschema', $array);
$this->parse_php($app, $app->app_dir . '/model', $array);
$this->parse_php($app, $app->app_dir . '/lib', $array);
$this->parse_html($app, $app->app_dir . '/view', $array);
$this->parse_html($app, $app->app_dir . '/lang/js', $array);
if (!empty($array)) {
$content = '<?php' . "\n";
$content .= 'return ' . var_export($array, true) . ';';
$content .= "\n" . '//' . count($array) . ' items';
$content .= "\n" . '?>';
file_put_contents($file, $content);
kernel::log(sprintf('%s 语言包转换文件生成成功,共 %d items', $app->app_id, count($array)));
} else {
kernel::log(sprintf('%s 没有语言包', $app->app_id));
}
}
示例4: post_install
function post_install()
{
kernel::log('Initial themes');
kernel::single('site_theme_base')->set_last_modify();
kernel::single('site_theme_install')->initthemes();
$themes = kernel::single('site_theme_install')->check_install();
}
示例5: post_install
public function post_install()
{
kernel::log('Initial ectools');
kernel::single('base_initial', 'ectools')->init();
kernel::log('Initial Regions');
kernel::single('ectools_regions_mainland')->install();
}
示例6: command_sync_user
public function command_sync_user()
{
//kernel::console_output = false;
$http = kernel::single('base_httpclient');
$response = $http->get(app::get('suitclient')->getConf('syncuser'));
if ($response) {
$server_users = json_decode($response);
$model = app::get('pam')->model('account');
$result = $model->getList('login_name', array('account_type' => 'shopadmin'));
$client_user = array();
foreach ($result as $value) {
$client_user[] = $value['login_name'];
}
$model2 = app::get('desktop')->model('users');
foreach ($server_users as $server_user) {
if (!in_array($server_user, $client_user)) {
$user = array('name' => $server_user, 'status' => 1, 'super' => 0, 'disabled' => false, 'pam_account' => array('login_name' => $server_user, 'login_password' => md5(time() . rand()), 'account_type' => 'shopadmin'), 'roles' => array(array('role_id' => 1)));
$model2->save($user);
}
}
kernel::log('同步成功');
kernel::log('ok.');
//不加 "ok."则会弹提示信息并不能自动关闭@lujy
} else {
kernel::log('同步失败或套件里没有用户');
kernel::log('ok.');
}
exit;
}
示例7: trigger
function trigger()
{
set_time_limit(0);
ignore_user_abort(1);
//检查计划任务有没有增减
$status = $this->status();
$service = (array) kernel::servicelist('autotask');
$servicelist = array_values($service['iterator']->getArrayCopy());
$exists_class = array_keys($status);
$diff_class = array_diff($servicelist, $exists_class);
$add = $delete = array();
foreach ($diff_class as $class_name) {
if (in_array($class_name, $exists_class)) {
//app::get('base')->model('task')->delete('task'=>$class_name);
} else {
$class = new $class_name();
if ($class instanceof base_interface_task) {
$data = array('task' => $class_name, 'description' => $class->description(), 'rule' => $class->rule(), 'last' => time());
app::get('base')->model('task')->insert($data);
}
}
}
//根据规则执行计划任务
$status = $this->status();
$now = time();
foreach ($status as $cron) {
if ($cron['enabled'] && $now >= base_crontabparser::parse($cron['rule'], $cron['last'])) {
$cron_class = new $cron['task']();
$cron_class->exec();
app::get('base')->model('task')->update(array('last' => $now), array('task' => $cron['task']));
kernel::log('crontab ' . $cron['task'] . ' run at ' . date('Y-m-d H:m:i', $now));
}
}
}
示例8: install
public function install()
{
$widgets_name = basename($this->getPathname());
$widgets_app = $this->target_app->app_id;
kernel::log('Installing Widgets ' . $widgets_app . ':' . $widgets_name);
$data['app'] = $widgets_app;
$data['name'] = $widgets_name;
app::get('site')->model('widgets')->insert($data);
}
示例9: active
static function active()
{
if (self::get()) {
kernel::log('Using exists certificate: config/certi.php');
} else {
kernel::log('Request new certificate');
self::register();
}
}
示例10: active
static function active($app_id = 'b2c')
{
if (self::get('node_id', $app_id)) {
kernel::log('Using exists shopnode: kvstore shop_site_node_id');
} else {
kernel::log('Request new shopnode');
self::register($app_id);
}
}
示例11: install
public function install()
{
kernel::log('Installing ' . $this->content_typename() . ' ' . $this->key());
$data = $this->row();
$data['content_type'] = 'service_category';
if ($this->current['optname']) {
$data['content_title'] = $this->current['optname'];
}
if ($this->current['opttype']) {
$data['content_path'] = $this->current['opttype'];
}
$obj_app_content = app::get('base')->model('app_content');
$obj_app_content->insert($data);
//base_kvstore::instance('service')->fetch($this->key,$service_define);
$index = 0;
$time = time();
$service_define = array();
foreach ((array) $this->current['class'] as $class) {
$row = $this->row();
$row['content_path'] = $class['value'];
if ($class['orderby']) {
$row['ordernum'] = $class['orderby'];
} else {
$row['ordernum'] = 50;
}
$row['input_time'] = $time + $index;
$obj_app_content->insert($row);
//$service_define['list'][$class['value']] = $class['value'];
//todo: interface... check
$index++;
}
$arr_servicelist = $obj_app_content->getList('content_path', array('content_name' => $this->key, 'content_type' => 'service'), 0, -1, 'ordernum ASC, input_time DESC');
foreach ((array) $arr_servicelist as $arr) {
$service_define['list'][$arr['content_path']] = $arr['content_path'];
}
/*if(is_array($service_define['list']) && count($service_define['list'])){
foreach($service_define['list'] AS $service_name){
$strpos = strpos($service_name, "_");
if($strpos){
$app_id = substr($service_name, 0, $strpos);
}else{
$app_id = 'base';
}
$level = $this->check_service_level($app_id);
$service_orders[$level][] = $service_name;
}
unset($service_define['list']);
ksort($service_orders);
foreach($service_orders AS $service_order){
foreach($service_order AS $service_name){
$service_define['list'][$service_name] = $service_name;
}
}
}//todo: depends order*/
base_kvstore::instance('service')->store($this->key, $service_define);
}
示例12: install
function install()
{
kernel::log('Installing ' . $this->content_typename() . ' ' . $this->current['id']);
$row = app::get('desktop')->model('menus')->dump(array('menu_type' => 'workground', 'workground' => $this->current['id']));
if ($row['menu_id']) {
return $row['menu_id'];
} else {
return app::get('desktop')->model('menus')->insert($this->row());
}
}
示例13: install
public function install()
{
$dir = $this->getPathname();
if (is_dir($dir) && realpath($dir) == realpath($this->target_app->res_dir . '/bundle')) {
$spriteinfo = kernel::single('base_application_imgbundle_factory')->reset()->set_app($this->target_app->app_id)->set_directory('bundle')->set_output('ex_' . $this->target_app->app_id . '.png')->create();
kernel::log(sprintf('%s bundle create Ok!', $this->target_app->app_id));
base_kvstore::instance('imgbundle')->store('imgbundle_' . $this->target_app->app_id, $spriteinfo);
kernel::log(sprintf('%s spriteinfo save Ok!', $this->target_app->app_id));
}
}
示例14: install
public function install()
{
if (is_dir($this->getPathname())) {
$widgets_name = basename($this->getPathname());
$theme = $this->target_theme;
kernel::log('Installing Theme Widgets ' . $theme . ':' . $widgets_name);
$data['theme'] = $theme;
$data['name'] = $widgets_name;
app::get('site')->model('widgets')->insert($data);
}
}
示例15: runtask
function runtask($task_id)
{
$http = kernel::single('base_httpclient');
$_POST['task_id'] = $task_id;
$url = kernel::api_url('api.queue', 'worker', array('task_id' => $task_id));
kernel::log('Spawn [Task-' . $task_id . '] ' . $url);
//99%概率不会有问题
$http->hostaddr = $_SERVER["SERVER_ADDR"] ? $_SERVER["SERVER_ADDR"] : '127.0.0.1';
$http->hostport = $_SERVER["SERVER_PORT"] ? $_SERVER["SERVER_PORT"] : '80';
$ret = $http->post($url, $_POST, null, null, true);
}