function init() { /* Load the config */ try { $config = new Core_Config(); } catch (Exception $e) { throw $e; } Zend_Registry::set('config', $config); $config->init(); Core_Common::raiseMemoryLimitIfNecessary(); /* Load the database */ try { $db = Core_Db::getInstance(); } catch (Exception $e) { throw $e; } Zend_Registry::set('db', $db); /* Load the plugins */ $moduleManager = Core_ModuleManager::getInstance(); $moduleManager->loadModules(); Core_Common::createAccessObject(); /* Load the events */ Core_PostEvent('FrontController.initAuthenticationObject'); try { $authAdapter = Zend_Registry::get('auth'); } catch (Exception $e) { throw new Exception("Authentication object cannot be found in the Registry. Maybe the Login plugin is not activated?\n <br />You can activate the plugin by adding:<br />\n <code>Plugins[] = Login</code><br />\n under the <code>[Plugins]</code> section in your config/config.inc.php"); } Zend_Registry::get('access')->reloadAccess($authAdapter); $moduleManager->postLoadModules(); }
/** */ public static function getInstance() { if (self::$instance == null) { $c = __CLASS__; self::$instance = $c::factory(); } return self::$instance; }
public static function setNotFound(array $hashes) { // clear previous data $data = array('not_found_date' => 'DEFAULT'); Core_Db::update(self::$table, $data)->execute(); // set the new not found $data = array('not_found_date' => array('NOW()')); Core_Db::update(self::$table, $data)->where('tag_hash NOT IN (' . implode(',', $hashes) . ')')->execute(); }
/** * @param array $input_parameters * @return array */ public function get(array $input_parameters = array()) { // Calculate total results $stm_count = $this->db->prepare('SELECT COUNT(*) AS "cnt" FROM (' . $this->query . ') AS "rs"'); if ($this->dump_mode) { $stm_count->setDumpMode(); } $stm_count->execute($input_parameters); $count_rs = $stm_count->fetch(); // Prepare statement $input_parameters['paging_limit'] = $this->per_page; $input_parameters['paging_offset'] = ($this->current_page - 1) * $this->per_page; $query_execute = 'SELECT * FROM (' . $this->query . ') AS "rs" LIMIT :paging_limit OFFSET :paging_offset'; $this->statement = $this->db->prepare($query_execute); if ($this->dump_mode) { $this->statement->setDumpMode(); } $this->statement->execute($input_parameters); return array('results' => $this->statement->fetchAll(), 'count' => $count_rs['cnt']); }
*/ require_once LIB_DIR . 'config.php'; require_once LIB_DIR . 'helper.php'; require_once LIB_DIR . 'pdo.class.php'; require_once QBOX_SDK_DIR . 'rs.php'; require_once QBOX_SDK_DIR . 'fileop.php'; require_once QBOX_SDK_DIR . 'client/rs.php'; require_once QBOX_SDK_DIR . 'authtoken.php'; /** * 设置错误报告级别 */ error_reporting($config['error']['reporting']); /** * 初始化数据库连接句柄 */ $db = Core_Db::getInstance($config["db"]); /** * 配置七牛云存储密钥信息 */ $QBOX_ACCESS_KEY = $config["qbox"]["access_key"]; $QBOX_SECRET_KEY = $config["qbox"]["secret_key"]; /** * 初始化 OAuth Client Transport */ $client = QBox_OAuth2_NewClient(); /** * 初始化 Qbox Reource Service Transport */ $bucket = $config["qbox"]["bucket"]; $rs = QBox_RS_NewService($client, $bucket); $upToken = QBox_MakeAuthToken(array('expiresIn' => 3600));
/** * __destruct * * @desc 释放数据库连接句柄 * @access public * @return void */ public function __destruct() { self::$_dbh = null; }
/** * */ protected function initDb() { Core_Db::init(cfg()->db_data); }
/** * */ public function rollback() { $queries = $this->down(); if (empty($queries)) { return; } foreach ($queries as $query) { Core_Db::query($query); $this->insertRollback(); } }