本文整理汇总了PHP中AWS_APP::debug_log方法的典型用法代码示例。如果您正苦于以下问题:PHP AWS_APP::debug_log方法的具体用法?PHP AWS_APP::debug_log怎么用?PHP AWS_APP::debug_log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AWS_APP
的用法示例。
在下文中一共展示了AWS_APP::debug_log方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (load_class('core_config')->get('system')->debug) {
$start_time = microtime(TRUE);
}
if (load_class('core_config')->get('database')->charset) {
load_class('core_config')->get('database')->master['charset'] = load_class('core_config')->get('database')->charset;
if (load_class('core_config')->get('database')->slave) {
load_class('core_config')->get('database')->slave['charset'] = load_class('core_config')->get('database')->charset;
}
}
$this->db['master'] = Zend_Db::factory(load_class('core_config')->get('database')->driver, load_class('core_config')->get('database')->master);
try {
$this->db['master']->query("SET sql_mode = ''");
} catch (Exception $e) {
throw new Zend_Exception('Can\'t connect master database: ' . $e->getMessage());
}
if (load_class('core_config')->get('system')->debug and class_exists('AWS_APP', false)) {
AWS_APP::debug_log('database', microtime(TRUE) - $start_time, 'Connect Master DB');
}
if (load_class('core_config')->get('database')->slave) {
if (load_class('core_config')->get('system')->debug) {
$start_time = microtime(TRUE);
}
$this->db['slave'] = Zend_Db::factory(load_class('core_config')->get('database')->driver, load_class('core_config')->get('database')->slave);
try {
$this->db['slave']->query("SET sql_mode = ''");
} catch (Exception $e) {
throw new Zend_Exception('Can\'t connect slave database: ' . $e->getMessage());
}
if (load_class('core_config')->get('system')->debug and class_exists('AWS_APP', false)) {
AWS_APP::debug_log('database', microtime(TRUE) - $start_time, 'Connect Slave DB');
}
} else {
$this->db['slave'] =& $this->db['master'];
}
if (!defined('MYSQL_VERSION')) {
define('MYSQL_VERSION', $this->db['master']->getServerVersion());
}
//Zend_Db_Table_Abstract::setDefaultAdapter($this->db['master']);
$this->setObject();
}
示例2: init
/**
* 系统初始化
*/
private static function init()
{
set_exception_handler(array('AWS_APP', 'exception_handle'));
self::$config = load_class('core_config');
self::$db = load_class('core_db');
self::$plugins = load_class('core_plugins');
self::$settings = self::model('setting')->get_settings();
if ((!defined('G_SESSION_SAVE') or G_SESSION_SAVE == 'db') and get_setting('db_version') > 20121123) {
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable(array('name' => get_table('sessions'), 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime')));
self::$session_type = 'db';
}
Zend_Session::setOptions(array('name' => G_COOKIE_PREFIX . '_Session', 'cookie_domain' => G_COOKIE_DOMAIN));
if (G_SESSION_SAVE == 'file' and G_SESSION_SAVE_PATH) {
Zend_Session::setOptions(array('save_path' => G_SESSION_SAVE_PATH));
}
Zend_Session::start();
self::$session = new Zend_Session_Namespace(G_COOKIE_PREFIX . '_Anwsion');
if ($default_timezone = get_setting('default_timezone')) {
date_default_timezone_set($default_timezone);
}
if ($img_url = get_setting('img_url')) {
define('G_STATIC_URL', $img_url);
} else {
define('G_STATIC_URL', base_url() . '/static');
}
if (self::config()->get('system')->debug) {
if ($cornd_timer = self::cache()->getGroup('crond')) {
foreach ($cornd_timer as $cornd_tag) {
if ($cornd_runtime = self::cache()->get($cornd_tag)) {
AWS_APP::debug_log('crond', 0, 'Tag: ' . str_replace('crond_timer_', '', $cornd_tag) . ', Last run time: ' . date('Y-m-d H:i:s', $cornd_runtime));
}
}
}
}
}
示例3: get
/**
* GET
* @param $key
*/
public function get($key)
{
if (AWS_APP::config()->get('system')->debug) {
list($usec, $sec) = explode(' ', microtime());
$start_time = (double) $usec + (double) $sec;
}
if (!$key) {
return false;
}
$result = $this->cache_factory->load($this->cachePrefix . $key);
if (AWS_APP::config()->get('system')->debug) {
list($usec, $sec) = explode(' ', microtime());
$end_time = (double) $usec + (double) $sec;
$stime = sprintf("%06f", $end_time - $start_time);
AWS_APP::debug_log('cache', $stime, 'Get Cache: ' . str_replace($this->groupPrefix, '', $key) . ', result type: ' . gettype($result));
}
return $result;
}
示例4: sum
/**
* 计算字段总和, SELECT SUM() 方法
*
* 面向对象数据库操作, 表名无需加表前缀, 数据也无需使用 $this->quote 进行过滤 ($where 条件除外)
*
* @param string
* @param string
* @param string
* @return int
*/
public function sum($table, $column, $where = '')
{
$this->slave();
$select = $this->select();
$select->from($this->get_table($table), 'SUM(' . $column . ') AS n');
if ($where) {
$select->where($where);
}
$sql = $select->__toString();
if (AWS_APP::config()->get('system')->debug) {
$start_time = microtime(TRUE);
}
try {
$result = $this->db()->fetchRow($select);
} catch (Exception $e) {
show_error("Database error\n------\n\nSQL: {$sql}\n\nError Message: " . $e->getMessage(), $e->getMessage());
}
if (AWS_APP::config()->get('system')->debug) {
AWS_APP::debug_log('database', microtime(TRUE) - $start_time, $sql);
}
return intval($result['n']);
}