本文整理汇总了PHP中kernel::is_online方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::is_online方法的具体用法?PHP kernel::is_online怎么用?PHP kernel::is_online使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel
的用法示例。
在下文中一共展示了kernel::is_online方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
if (!kernel::is_online()) {
die('error');
}
cacheobject::init();
self::$is_start = true;
}
示例2: __construct
function __construct()
{
if (!kernel::is_online()) {
die('error');
} else {
@(include APP_DIR . '/base/defined.php');
}
cachemgr::init();
cacheobject::init();
self::$is_start = true;
}
示例3: __construct
function __construct()
{
if (!kernel::is_online()) {
die('error');
} else {
require ROOT_DIR . '/config/config.php';
@(include APP_DIR . '/base/defined.php');
}
cachemgr::init();
cacheobject::init();
}
示例4: process
public function process($path)
{
if (!kernel::is_online()) {
die('error');
} else {
require ROOT_DIR . '/config/config.php';
@(include APP_DIR . '/base/defined.php');
}
if ($path == '/api') {
$this->process_rpc();
} else {
$args = explode('/', substr($path, 5));
$service_name = 'api.' . array_shift($args);
$method = array_shift($args);
foreach ($args as $i => $v) {
if ($i % 2) {
$params[$k] = str_replace('%2F', '/', $v);
} else {
$k = $v;
}
}
kernel::service($service_name)->{$method}($params);
}
}
示例5: has_conflict_apps
public function has_conflict_apps($apps, &$conflict_apps)
{
if (!kernel::is_online()) {
return false;
}
if (is_string($apps)) {
$apps = array($apps);
}
$queue = array();
$installed_queue = array();
$install_apps = array();
$installed_apps = array();
foreach ($apps as $app_id) {
$install_apps[$app_id] = array();
$this->check_conflicts_install($app_id, $queue);
}
$rows = kernel::database()->select('select app_id from sdb_base_apps where status != "uninstalled"');
foreach ($rows as $row) {
$installed_apps[$row['app_id']] = array();
$this->check_conflicts_install($row['app_id'], $installed_queue);
}
$conflict_one = array_intersect_key($queue, $installed_apps);
$conflict_two = array_intersect_key($installed_queue, $install_apps);
$conflict_apps = array_merge($conflict_one, $conflict_two);
return count($conflict_apps) ? true : false;
}
示例6: input_element
function input_element($type, $params = false)
{
if (!base_component_ui::$inputer) {
if (kernel::is_online()) {
base_component_ui::$inputer = kernel::servicelist('html_input');
} else {
base_component_ui::$inputer = array('base_view_input' => new base_view_input());
}
}
if ($params === false) {
foreach (base_component_ui::$inputer as $inputer) {
$inputer->app = $this->app;
if (method_exists($inputer, 'input_' . $type)) {
return true;
}
}
} else {
foreach (base_component_ui::$inputer as $inputer) {
$inputer->app = $this->app;
if (method_exists($inputer, 'input_' . $type)) {
$html = $inputer->{'input_' . $type}($params);
}
}
return $html;
}
return false;
}
示例7: filemtime
function &load($check_lastmodified = true)
{
$real_table_name = $this->real_table_name();
if ($this->_define[$real_table_name]) {
return $this->_define[$real_table_name];
}
if (kernel::is_online() && !($this->target_app->app_id == 'base' && $this->key() == 'kvstore')) {
if (defined('CUSTOM_CORE_DIR') && file_exists(CUSTOM_CORE_DIR . '/' . $this->target_app->app_id . '/dbschema/' . $this->key . '.php')) {
$define_lastmodified = $check_lastmodified ? filemtime(CUSTOM_CORE_DIR . '/' . $this->target_app->app_id . '/dbschema/' . $this->key . '.php') : null;
} else {
$define_lastmodified = $check_lastmodified ? filemtime($this->target_app->app_dir . '/dbschema/' . $this->key . '.php') : null;
}
$define_flag = base_kvstore::instance('tbdefine')->fetch($this->target_app->app_id . $this->key, $define, $define_lastmodified);
} else {
$define_flag = false;
}
if ($define_flag === false) {
if (defined('CUSTOM_CORE_DIR') && file_exists(CUSTOM_CORE_DIR . '/' . $this->target_app->app_id . '/dbschema/' . $this->key . '.php')) {
require CUSTOM_CORE_DIR . '/' . $this->target_app->app_id . '/dbschema/' . $this->key . '.php';
} else {
require $this->target_app->app_dir . '/dbschema/' . $this->key . '.php';
}
$define =& $db[$this->key()];
$this->_define[$real_table_name] =& $define;
foreach ($define['columns'] as $k => $v) {
if ($v['pkey']) {
$define['idColumn'][$k] = $k;
}
if ($v['is_title']) {
$define['textColumn'][$k] = $k;
}
if ($v['in_list']) {
$define['in_list'][] = $k;
if ($v['default_in_list']) {
$define['default_in_list'][] = $k;
}
}
$define['columns'][$k] = $this->_prepare_column($k, $v);
if (isset($v['pkey']) && $v['pkey']) {
$define['pkeys'][$k] = $k;
}
}
if (!$define['idColumn']) {
$define['idColumn'] = key($define['columns']);
} elseif (count($define['idColumn']) == 1) {
$define['idColumn'] = current($define['idColumn']);
}
if (!$define['textColumn']) {
$keys = array_keys($define['columns']);
$define['textColumn'] = $keys[1];
} elseif (count($define['idColumn']) == 1) {
$define['textColumn'] = current($define['textColumn']);
}
if (kernel::is_online() && !($this->target_app->app_id == 'base' && $this->key() == 'kvstore')) {
base_kvstore::instance('tbdefine')->store($this->target_app->app_id . $this->key, $define);
}
}
return $define;
}
示例8: status
function status()
{
if (kernel::is_online()) {
if ($this->app_id == 'base') {
if (!kernel::database()->select('SHOW TABLES LIKE "' . kernel::database()->prefix . 'base_apps"')) {
return 'uninstalled';
}
}
$row = @kernel::database()->selectrow('select status from sdb_base_apps where app_id="' . $this->app_id . '"');
return $row ? $row['status'] : 'uninstalled';
} else {
return 'uninstalled';
}
}
示例9: store
public function store($key, $value, $ttl = 0)
{
self::$__store_count++;
if (!(defined('WITHOUT_KVSTORE_PERSISTENT') && constant('WITHOUT_KVSTORE_PERSISTENT')) && self::$__persistent && get_class($this->get_controller()) != 'base_kvstore_mysql' && kernel::is_online()) {
$this->persistent($key, $value, $ttl);
}
logger::debug('kvstore:' . self::$__fetch_count . '.' . ' instance:' . $this->get_prefix() . ' store key:' . $key);
return $this->get_controller()->store($key, $value, $ttl);
}
示例10: filemtime
public function &load($check_lastmodified = true)
{
$real_table_name = $this->real_table_name();
if (!static::$_define[$real_table_name]) {
if (defined('CUSTOM_CORE_DIR')) {
$customSchemaPath = CUSTOM_CORE_DIR . '/' . $this->target_app->app_id . '/dbschema/' . $this->key . '.php';
if (file_exists($customSchemaPath)) {
$path = $customSchemaPath;
}
}
if (!$path) {
$path = $this->target_app->app_dir . '/dbschema/' . $this->key . '.php';
}
$lastModified = $check_lastmodified ? filemtime($path) : null;
// 当未安装时 或者 涉及到base kvstore 或者取不到数据
if (!kernel::is_online() || $this->target_app->app_id == 'base' && $this->key() == 'kvstore') {
$define = $this->loadDefine($path);
} else {
if (!base_kvstore::instance('tbdefine')->fetch($this->target_app->app_id . $this->key, $define, $lastModified)) {
$define = $this->loadDefine($path);
base_kvstore::instance('tbdefine')->store($this->target_app->app_id . $this->key, $define);
}
}
static::$_define[$real_table_name] = $define;
}
return static::$_define[$real_table_name];
}
示例11: store
public function store($key, $value, $ttl = 0)
{
self::$__store_count++;
$persistent = config::get('kvstore.persistent', true);
if ($persistent && self::$__persistent && get_class($this->get_controller()) != 'base_kvstore_mysql' && kernel::is_online()) {
$this->persistent($key, $value, $ttl);
}
logger::debug('kvstore:' . self::$__fetch_count . '.' . ' instance:' . $this->get_prefix() . ' store key:' . $key);
return $this->get_controller()->store($key, $value, $ttl);
}
示例12: store
public function store($key, $value, $ttl = 0)
{
self::$__store_count++;
if (!(defined('WITHOUT_KVSTORE_PERSISTENT') && constant('WITHOUT_KVSTORE_PERSISTENT')) && self::$__persistent && get_class($this->get_controller()) != 'base_kvstore_mysql' && kernel::is_online()) {
$this->persistent($key, $value, $ttl);
}
return $this->get_controller()->store($key, $value, $ttl);
}
示例13: status
function status()
{
if (kernel::is_online()) {
try {
$row = app::get('base')->database()->executeQuery('select status from base_apps where app_id = ?', [$this->app_id])->fetch();
return $row['status'] ? $row['status'] : 'uninstalled';
} catch (Exception $e) {
return 'uninstalled';
}
} else {
return 'uninstalled';
}
}
示例14: has_conflict_apps
public function has_conflict_apps($apps, &$conflict_apps)
{
if (!kernel::is_online()) {
return false;
}
if (is_string($apps)) {
$apps = array($apps);
}
$queue = array();
$installed_queue = array();
$install_apps = array();
$installed_apps = array();
foreach ($apps as $app_id) {
$install_apps[$app_id] = array();
$this->check_conflicts_install($app_id, $queue);
}
try {
$rows = app::get('base')->database()->executeQuery('select app_id from base_apps where status <> "uninstalled"')->fetchAll();
} catch (Exception $e) {
$rows = array();
}
foreach ($rows as $row) {
$installed_apps[$row['app_id']] = array();
$this->check_conflicts_install($row['app_id'], $installed_queue);
}
$conflict_one = array_intersect_key($queue, $installed_apps);
$conflict_two = array_intersect_key($installed_queue, $install_apps);
$conflict_apps = array_merge($conflict_one, $conflict_two);
return count($conflict_apps) ? true : false;
}
示例15: persistent
public function persistent($key, $value, $ttl = 0)
{
if (get_class($this->get_controller()) != 'base_kvstore_mysql' && kernel::is_online()) {
kernel::single('base_kvstore_mysql', $this->get_prefix())->store($key, $value, $ttl);
//todo: 持久化
}
}