/** * Page を初期化する. * * @return void */ function init() { // 開始時刻を設定する。 $this->timeStart = SC_Utils_Ex::sfMicrotimeFloat(); $this->tpl_authority = $_SESSION['authority']; // ディスプレイクラス生成 $this->objDisplay = new SC_Display_Ex(); // プラグインクラス生成 $this->objPlugin = new SC_Helper_Plugin_Ex(); $this->objPlugin->preProcess($this); $this->setTplMainpage($this->blocItems['tpl_path']); // トランザクショントークンの検証と生成 $this->setTokenTo(); }
function display($template, $no_error = false) { if (!$no_error) { global $GLOBAL_ERR; if (!defined('OUTPUT_ERR')) { // GLOBAL_ERR を割り当て $this->assign("GLOBAL_ERR", $GLOBAL_ERR); define('OUTPUT_ERR', 'ON'); } } $this->_smarty->display($template); if (ADMIN_MODE == '1') { $time_end = SC_Utils_Ex::sfMicrotimeFloat(); $time = $time_end - $this->time_start; echo '処理時間: ' . sprintf('%.3f', $time) . '秒'; } }
/** * プリペアドクエリを実行する. * * @access private * @param MDB2_Statement_Common プリペアドステートメントインスタンス * @param array $arrVal プレースホルダに挿入する配列 * @return MDB2_Result 結果セットのインスタンス */ function execute(&$sth, $arrVal = array()) { $timeStart = SC_Utils_Ex::sfMicrotimeFloat(); $affected =& $sth->execute((array) $arrVal); // 一定以上時間かかったSQLの場合、ログ出力する。 if (defined('SQL_QUERY_LOG_MODE') && SQL_QUERY_LOG_MODE == true) { $timeEnd = SC_Utils_Ex::sfMicrotimeFloat(); $timeExecTime = $timeEnd - $timeStart; if (defined('SQL_QUERY_LOG_MIN_EXEC_TIME') && $timeExecTime >= (double) SQL_QUERY_LOG_MIN_EXEC_TIME) { $logMsg = sprintf("SQL_LOG [%.2fsec]\n%s", $timeExecTime, $sth->query); error_log($logMsg, 3, LOG_REALFILE); } } if (PEAR::isError($affected)) { $sql = isset($sth->query) ? $sth->query : ''; if (!$this->force_run) { trigger_error($this->traceError($affected, $sql, $arrVal), E_USER_ERROR); } else { error_log($this->traceError($affected, $sql, $arrVal), 3, LOG_REALFILE); } } $this->conn->last_query = stripslashes($sth->query); return $affected; }
/** * デストラクタ. * * @return void */ function destroy() { // 一定時間以上かかったページの場合、ログ出力する。 // エラー画面の表示では $this->timeStart が出力されない if (defined('PAGE_DISPLAY_TIME_LOG_MODE') && PAGE_DISPLAY_TIME_LOG_MODE == true && isset($this->timeStart)) { $timeEnd = SC_Utils_Ex::sfMicrotimeFloat(); $timeExecTime = $timeEnd - $this->timeStart; if (defined('PAGE_DISPLAY_TIME_LOG_MIN_EXEC_TIME') && $timeExecTime >= (double) PAGE_DISPLAY_TIME_LOG_MIN_EXEC_TIME) { $logMsg = sprintf("PAGE_DISPLAY_TIME_LOG [%.2fsec]", $timeExecTime); GC_Utils_Ex::gfPrintLog($logMsg); } } }