本文整理汇总了PHP中DB_Helper::getMaxAllowedPacket方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_Helper::getMaxAllowedPacket方法的具体用法?PHP DB_Helper::getMaxAllowedPacket怎么用?PHP DB_Helper::getMaxAllowedPacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_Helper
的用法示例。
在下文中一共展示了DB_Helper::getMaxAllowedPacket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _notify
/**
* Notifies site administrators of the error condition
*
* @param string $notify_msg The formatted error message
* @param string $notify_from Sender of the email
* @param string $notify_list Email addresses to whom send the error report.
*/
private static function _notify(&$notify_msg, $notify_from, $notify_list)
{
$backtrace = debug_backtrace();
array_splice($backtrace, 0, 2);
foreach ($backtrace as $frame) {
// avoid recursion?
if (isset($frame['class']) && $frame['class'] == __CLASS__) {
return;
}
}
$time = time();
$date = date('Y-m-d H:i:s', $time);
$msg = "Hello,\n\n";
$msg .= $notify_msg;
// this checks that we're not running from commandline (cron for example)
if (isset($_SERVER['REMOTE_ADDR'])) {
$proto = 'http';
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] == 1)) {
$proto .= 's';
}
$url = "{$proto}://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}";
if (isset($_SERVER['QUERY_STRING'])) {
$url .= "?{$_SERVER['QUERY_STRING']}";
}
$msg .= "URL: {$url}\n";
$msg .= "IP: {$_SERVER['REMOTE_ADDR']}\n";
$login = Auth::getUserLogin();
if ($login) {
$msg .= "User: {$login}\n";
}
if (!empty($_SERVER['HTTP_REFERER'])) {
$msg .= "Referer: {$_SERVER['HTTP_REFERER']}\n";
}
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$msg .= "User-Agent: {$_SERVER['HTTP_USER_AGENT']}\n";
}
$msg .= "\n";
}
$msg .= "-- \nSincerely yours,\nAutomated Error_Handler Class";
$max_allowed_packet = DB_Helper::getMaxAllowedPacket();
// skip error details of an email notification about a query that
// was bigger than max_allowed_packet + 1024
if (strlen($msg) > $max_allowed_packet + 1024) {
return;
}
$notify_list = str_replace(';', ',', $notify_list);
$notify_list = explode(',', $notify_list);
$subject = APP_SITE_NAME . ' - Error found! - ' . $date;
foreach ($notify_list as $notify_email) {
$mail = new Mail_Helper();
$mail->setTextBody($msg);
$mail->send($notify_from, $notify_email, $subject, 0, false, 'error');
}
}