当前位置: 首页>>代码示例>>PHP>>正文


PHP base_kvstore::config_persistent方法代码示例

本文整理汇总了PHP中base_kvstore::config_persistent方法的典型用法代码示例。如果您正苦于以下问题:PHP base_kvstore::config_persistent方法的具体用法?PHP base_kvstore::config_persistent怎么用?PHP base_kvstore::config_persistent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在base_kvstore的用法示例。


在下文中一共展示了base_kvstore::config_persistent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: command_kvrecovery

 function command_kvrecovery($instance = null)
 {
     if (!is_null($instance) && !defined('FORCE_KVSTORE_STORAGE')) {
         $instance = trim($instance);
         if (!(strpos($instance, '_') === 0)) {
             $instance = 'base_kvstore_' . $instance;
         }
         define('FORCE_KVSTORE_STORAGE', $instance);
     }
     base_kvstore::config_persistent(false);
     $testObj = base_kvstore::instance('test');
     if (get_class($testObj->get_controller()) === 'base_kvstore_mysql') {
         kernel::log('The \'base_kvstore_mysql\' is default persistent, Not necessary recovery');
         exit;
     }
     kernel::log('KVstore Recovery...');
     $db = kernel::database();
     $count = $db->count('SELECT count(*) AS count FROM sdb_base_kvstore', true);
     if (empty($count)) {
         kernel::log('No data recovery');
         exit;
     }
     $pagesize = 100;
     $page = ceil($count / 100);
     for ($i = 0; $i < $page; $i++) {
         $rows = $db->selectlimit('SELECT * FROM sdb_base_kvstore', $pagesize, $i * $pagesize);
         foreach ($rows as $row) {
             //kernel::log($row['key']);continue;
             $row['value'] = unserialize($row['value']);
             //todo:合法数据
             if (base_kvstore::instance($row['prefix'])->recovery($row)) {
                 kernel::log($row['prefix'] . '=>' . $row['key'] . ' ... Recovery Success');
             } else {
                 kernel::log($row['prefix'] . '=>' . $row['key'] . ' ... Recovery Failure');
             }
         }
     }
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:38,代码来源:buildin.php

示例2: command_kvrecovery

 public function command_kvrecovery($instance = null)
 {
     if (app::get('base')->status() == 'uninstalled') {
         logger::info('系统未安装!请先运行install');
         return;
     }
     base_kvstore::config_persistent(false);
     //临时禁用KV持久化 TODO 比较危险
     $testObj = base_kvstore::instance('test');
     if (get_class($testObj->get_controller()) === 'base_kvstore_mysql') {
         logger::info('The \'base_kvstore_mysql\' is default persistent, Not necessary recovery');
         exit;
     }
     logger::info('KVrecovery BEGIN...');
     $db = vmc::database();
     $count = $db->count('SELECT count(*) AS count FROM vmc_base_kvstore', true);
     if (empty($count)) {
         logger::info('No data recovery');
         exit;
     }
     $pagesize = 100;
     $page = ceil($count / 100);
     for ($i = 0; $i < $page; $i++) {
         $rows = $db->selectlimit('SELECT * FROM vmc_base_kvstore', $pagesize, $i * $pagesize);
         foreach ($rows as $row) {
             $arr_value = unserialize($row['value']);
             if (!$arr_value || !is_array($arr_value)) {
                 logger::error($row['prefix'] . '=>' . $row['key'] . ' ... KVrecovery ERROR');
             }
             $row['value'] = $arr_value;
             if (base_kvstore::instance($row['prefix'])->recovery($row)) {
                 logger::info($row['prefix'] . '=>' . $row['key'] . ' ... KVrecovery Success');
             } else {
                 logger::warning($row['prefix'] . '=>' . $row['key'] . ' ... KVrcovery Failure');
             }
         }
     }
     logger::info('KVrecovery END...');
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:39,代码来源:buildin.php

示例3: command_kvrecovery

 function command_kvrecovery($instance = null)
 {
     if (!is_null($instance)) {
         $instance = trim($instance);
         if (!(strpos($instance, '_') === 0)) {
             $instance = 'base_kvstore_' . $instance;
         }
         config::set('kvstore.default', $instance);
     }
     base_kvstore::config_persistent(false);
     $testObj = base_kvstore::instance('test');
     if (get_class($testObj->get_controller()) === 'base_kvstore_mysql') {
         logger::info('The \'base_kvstore_mysql\' is default persistent, Not necessary recovery');
         exit;
     }
     logger::info('KVstore Recovery...');
     $db = app::get('base')->database();
     $count = $db->executeQuery('SELECT count(*) AS count FROM base_kvstore')->fetchColumn();
     if (!$count) {
         logger::info('No data recovery');
         exit;
     }
     $pagesize = 100;
     $page = ceil($count / 100);
     for ($i = 0; $i < $page; $i++) {
         $rows = $db->executeQuery('SELECT * FROM base_kvstore limit ? offset ?', [$pagesize, $pagesize * $i])->fetchAll();
         foreach ($rows as $row) {
             //logger::info($row['key']);continue;
             $row['value'] = unserialize($row['value']);
             //todo:合法数据
             if (base_kvstore::instance($row['prefix'])->recovery($row)) {
                 logger::info($row['prefix'] . '=>' . $row['key'] . ' ... Recovery Success');
             } else {
                 logger::info($row['prefix'] . '=>' . $row['key'] . ' ... Recovery Failure');
             }
         }
     }
 }
开发者ID:453111208,项目名称:bbc,代码行数:38,代码来源:buildin.php


注:本文中的base_kvstore::config_persistent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。