本文整理汇总了PHP中logError函数的典型用法代码示例。如果您正苦于以下问题:PHP logError函数的具体用法?PHP logError怎么用?PHP logError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeLocalPlaylist
/** Saves the local playlist */
function makeLocalPlaylist()
{
global $config, $user;
if (count($this->audioFiles) == 0) {
raiseError("playlist_empty");
}
// clear old playlists
$userid = $user->id;
if (!$userid) {
$userid = 'guest';
}
$dir = dir($config['tmpDir']);
while ($entry = $dir->read()) {
if (preg_match("/^pl_{$userid}/", $entry)) {
if (!unlink($config['tmpDir'] . "/" . $entry)) {
logError("Could not delete playlist: {$entry}");
}
}
}
// write new playlist
$tmpfile = $config['tmpDir'] . '/pl_' . $this->getTmpId() . '.m3u';
$fp = fopen($tmpfile, 'wb');
if (!$fp) {
raiseError("Could not write to playlist file: {$tmpfile}");
}
reset($this->audioFiles);
while (list(, $audioFile) = each($this->audioFiles)) {
fwrite($fp, $audioFile['path'] . "\n");
}
fclose($fp);
$this->localPlaylist = $tmpfile;
return $tmpfile;
}
示例2: handleUpload
function handleUpload($FILE, $params)
{
global $auth, $locale, $dataDir, $db, $defaults, $passHasher;
// fix file size overflow (when possible) in php 5.4-5.5
if ($FILE['size'] < 0) {
$FILE['size'] = filesize($FILE["tmp_name"]);
if ($FILE['size'] < 0) {
logError($FILE["tmp_name"] . ": uncorrectable PHP file size overflow");
return false;
}
}
// generate new unique id/file name
list($id, $tmpFile) = genTicketId();
$tmpFile = preg_replace('/(\\/.*\\/)/', "\\1{$FILE['name']}_", $tmpFile);
if (!move_uploaded_file($FILE["tmp_name"], $tmpFile)) {
logError("cannot move file " . $FILE["tmp_name"] . " into {$tmpFile}");
return handleUploadFailure($tmpFile);
}
// check DB connection after upload
reconnectDB();
// prepare data
$sql = "INSERT INTO ticket (id, user_id, name, path, size, cmt, pass_ph" . ", time, expire, last_time, expire_dln, notify_email, sent_email, locale) VALUES (";
$sql .= $db->quote($id);
$sql .= ", " . $auth['id'];
$sql .= ", " . $db->quote(mb_sane_base($FILE["name"]));
$sql .= ", " . $db->quote($tmpFile);
$sql .= ", " . $FILE["size"];
$sql .= ", " . (empty($params["comment"]) ? 'NULL' : $db->quote($params["comment"]));
$sql .= ", " . (empty($params["pass"]) ? 'NULL' : $db->quote($passHasher->HashPassword($params["pass"])));
$sql .= ", " . time();
if (@$params["permanent"]) {
$sql .= ", NULL";
$sql .= ", NULL";
$sql .= ", NULL";
} else {
if (!isset($params["ticket_total"]) && !isset($params["ticket_lastdl"]) && !isset($params["ticket_maxdl"])) {
$params["ticket_total"] = $defaults['ticket']['total'];
$params["ticket_lastdl"] = $defaults['ticket']['lastdl'];
$params["ticket_maxdl"] = $defaults['ticket']['maxdl'];
}
$sql .= ", " . (empty($params["ticket_total"]) ? 'NULL' : time() + $params["ticket_total"]);
$sql .= ", " . (empty($params["ticket_lastdl"]) ? 'NULL' : $params["ticket_lastdl"]);
$sql .= ", " . (empty($params["ticket_maxdl"]) ? 'NULL' : (int) $params["ticket_maxdl"]);
}
$sql .= ", " . (empty($params["notify"]) ? 'NULL' : $db->quote(fixEMailAddrs($params["notify"])));
$sql .= ", " . (empty($params["send_to"]) ? 'NULL' : $db->quote(fixEMailAddrs($params["send_to"])));
$sql .= ", " . $db->quote($locale);
$sql .= ")";
if ($db->exec($sql) != 1) {
logDBError($db, "cannot commit new ticket to database");
return handleUploadFailure($tmpFile);
}
// fetch defaults
$sql = "SELECT * FROM ticket WHERE id = " . $db->quote($id);
$DATA = $db->query($sql)->fetch();
$DATA['pass'] = empty($params["pass"]) ? NULL : $params["pass"];
// trigger creation hooks
onTicketCreate($DATA);
return $DATA;
}
示例3: analytics
/**
* Functions registered with the worker
*
* @param object $job
* @return void
*/
function analytics($job)
{
//Get the info of the job
list($domain, $id, $data) = unserialize($job->workload());
//Ensure the minimum info
if (empty($id) || empty($data) || empty($domain)) {
echo sprintf("%s: To register an event we need the data and the id\n", date('r'));
$job->sendFail();
return FALSE;
}
echo sprintf("%s: Received a task to store an analytics event\n", date('r'));
echo sprintf("%s: Sending the event #%s to %s domain\n", date('r'), $id, $domain);
$document = new Zend_Cloud_DocumentService_Document($data, $id);
try {
$amazonSDB = getAmazonSDB();
try {
$amazonSDB->insertDocument($domain, $document);
} catch (Zend_Cloud_DocumentService_Exception $e) {
echo sprintf("%s: Connectivity issues, sleeping 0.5s\n", date('r'));
usleep(500000);
$amazonSDB->insertDocument($domain, $document);
}
echo sprintf("%s: Event #%s stored\n\n", date('r'), $id);
$job->sendComplete(TRUE);
return TRUE;
} catch (Zend_Cloud_DocumentService_Exception $e) {
logError(sprintf("%s: Error while storing the event #%s - %s\n\n", date('r'), $id, $e->getMessage()));
$job->sendFail();
return FALSE;
}
}
示例4: __construct
function __construct($orientation, $metric, $size, $startdate, $enddate, $userid)
{
$dynamicY = 0;
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$and = "";
if ($startdate != "") {
$and .= " AND A.metacreateddate >= '{$startdate}' ";
}
if ($enddate != "") {
$and .= " AND A.metacreateddate <= '{$enddate}' ";
}
if ($userid != "0") {
$and .= " AND A.takenbyid = {$userid} ";
}
$sql = "SELECT A.*, \n\t\t\t\t\t B.name AS customername, B.accountnumber, \n\t\t\t\t\t C.fullname,\n\t\t\t\t\t\tDATE_FORMAT(A.metacreateddate, '%d/%m/%Y %H:%I') AS metacreateddate\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}quotation A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}customer B \n\t\t\t\t\t\tON B.id = A.customerid \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}members C \n\t\t\t\t\t\tON C.member_id = A.takenbyid \n\t\t\t\t\t\tWHERE 1 = 1 {$and} \n\t\t\t\t\t\tORDER BY B.name, A.metacreateddate";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$line = array("Customer" => $member['customername'], "Customer Code" => $member['accountnumber'], "Quotation Number" => getSiteConfigData()->bookingprefix . "-" . sprintf("%06d", $member['id']), "User" => $member['fullname'], "Quotation Date" => $member['metacreateddate'], "Value" => number_format($member['total'], 2));
$this->addLine($this->GetY(), $line);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例5: newticket
function newticket($msg, $params = null)
{
global $ticketRestParams;
// handle the upload itself
$DATA = $validated = false;
if (isset($_FILES["file"]) && is_uploaded_file($_FILES["file"]["tmp_name"]) && $_FILES["file"]["error"] == UPLOAD_ERR_OK && ($validated = validateParams($ticketRestParams, $msg))) {
$DATA = handleUpload($_FILES["file"], $msg);
}
if ($DATA === false) {
// ticket creation unsucessfull
if ($validated && !empty($_FILES["file"]) && !empty($_FILES["file"]["name"])) {
$err = uploadErrorStr($_FILES["file"]);
logError("ticket upload failure: {$err}");
return array('httpInternalError', $err);
} elseif (!$validated) {
logError('invalid ticket parameters');
return array('httpBadRequest', 'bad parameters');
} else {
// errors already generated in handleUpload
return array('httpInternalError', 'internal error');
}
}
// return ticket instance
return array(false, array("id" => $DATA['id'], "url" => ticketUrl($DATA)));
}
示例6: __construct
function __construct($orientation, $metric, $size, $startdate, $enddate, $userid)
{
$dynamicY = 0;
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$and = "";
if ($startdate != "") {
$and .= " AND A.matchdate >= '{$startdate}' ";
}
if ($enddate != "") {
$and .= " AND A.matchdate <= '{$enddate}' ";
}
if ($userid != "0") {
$and .= " AND A.refereeid = {$userid} ";
}
$sql = "SELECT COUNT(*) AS matches, SUM(refereescore) AS score, \n\t\t\t\t\t B.name AS refereeename\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}matchdetails A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}referee B \n\t\t\t\t\t\tON B.id = A.refereeid \n\t\t\t\t\t\tWHERE refereescore >= 0 {$and}\n\t\t\t\t\t\tGROUP BY B.name \n\t\t\t\t\t\tORDER BY B.name";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$line = array("Referee" => $member['refereeename'], "Games" => $member['matches'], "Average Score" => number_format($member['score'] / $member['matches'], 1));
if ($this->GetY() > 265) {
$this->AddPage();
}
$this->addLine($this->GetY(), $line);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例7: internal_upload
/**
* Functions registered with the worker
*
* @param object $job
* @return void
*/
function internal_upload($job)
{
//Get the info of the job
list($localFilename, $remoteFilename, $removeFile) = unserialize($job->workload());
//Default value if empty
if (is_null($removeFile)) {
$removeFile = FALSE;
}
//Do some checks
if (empty($localFilename) || empty($remoteFilename)) {
logError(sprintf("%s: The workload do not contain the required info to do the upload\n\n", date('r')));
$job->sendFail();
return FALSE;
}
echo sprintf("%s: Received job to internal upload %s\n", date('r'), $localFilename);
//Do the upload
$uploaded = upload($localFilename, $remoteFilename);
if ($uploaded !== TRUE) {
logError(sprintf("%s: Error while uploading the file to Amazon S3 - %s\n\n", date('r'), $uploaded->getMessage()));
$job->sendFail();
return FALSE;
}
//Check if we have to remove the file
if ($removeFile) {
//Remove the original file
if (!unlink(ROOT_PATH . '/public/frontend/tmp/' . $localFilename)) {
logError(sprintf("%s: Error removing the file\n\n", date('r')));
$job->sendFail();
return FALSE;
}
}
$job->sendComplete(TRUE);
echo sprintf("%s: Job finished successfully\n\n", date('r'));
return TRUE;
}
示例8: __construct
function __construct($orientation, $metric, $size, $datefrom)
{
$dynamicY = 0;
$this->dateFrom = $datefrom;
start_db();
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$startdate = convertStringToDate($this->dateFrom);
$sql = "SELECT A.name, C.amount,\n\t\t\t\t\t (\n\t\t\t\t\t \t\tSELECT SUM(B.amount) * D.retailprice\n\t\t\t\t\t \t\tFROM {$_SESSION['DB_PREFIX']}eventtransaction B \n\t\t\t\t\t \t\tINNER JOIN {$_SESSION['DB_PREFIX']}product D\n\t\t\t\t\t \t\tON D.id = B.productid \n\t\t\t\t\t \t\tWHERE B.eventid = A.id \n\t\t\t\t\t \t\tAND B.eventdate = '{$startdate}' \n\t\t\t\t\t \t\tAND B.type = 'S'\n\t\t\t\t\t ) AS sold\n\t\t\t\t\t FROM {$_SESSION['DB_PREFIX']}event A \n\t\t\t\t\t LEFT OUTER JOIN {$_SESSION['DB_PREFIX']}eventforecast C\n\t\t\t\t\t ON C.eventid = A.id\n\t\t\t\t\t AND C.forecastdate = '{$startdate}' \n\t\t\t\t\t\tORDER BY A.name";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$sold = $member['sold'] != "" ? $member['sold'] : 0;
$line = array("Event" => $member['name'], "Takings" => "£ " . number_format($sold, 2), "Expected" => "£ " . number_format($member['amount'], 2));
$this->addLine($this->GetY(), $line, 6.2);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例9: __construct
function __construct($orientation, $metric, $size, $startdate, $enddate, $userid)
{
$dynamicY = 0;
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$sql = "SELECT A.*, \n\t\t\t\t\t B.name AS customername, B.accountnumber, \n\t\t\t\t\t\tDATE_FORMAT(A.metacreateddate, '%d/%m/%Y %H:%I') AS metacreateddate, \n\t\t\t\t\t\tDATE_FORMAT(A.converteddatetime, '%d/%m/%Y %H:%I') AS converteddatetime,\n\t\t\t\t\t\tTIMEDIFF(A.converteddatetime, A.metacreateddate) as diff\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}quotation A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}customer B \n\t\t\t\t\t\tON B.id = A.customerid \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}members C \n\t\t\t\t\t\tON C.member_id = A.takenbyid \n\t\t\t\t\t\tWHERE A.takenbyid = {$userid} \n\t\t\t\t\t\tAND A.metacreateddate >= '{$startdate}' \n\t\t\t\t\t\tAND A.metacreateddate <= '{$enddate}' \n\t\t\t\t\t\tORDER BY A.metacreateddate DESC";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$diff = $member['diff'];
$conversiondate = $member['converteddatetime'];
if (substr($diff, 0, 1) == "-") {
$diff = " ";
}
if (substr($conversiondate, 0, 2) == "00") {
$conversiondate = " ";
}
$line = array("Customer" => $member['customername'], "Customer Code" => $member['accountnumber'], "Quotation Number" => getSiteConfigData()->bookingprefix . "-" . sprintf("%06d", $member['id']), "Quotation Date" => $member['metacreateddate'], "Conversion Date" => $conversiondate, "Time Taken" => $diff, "Total" => number_format($member['total'], 2));
$this->addLine($this->GetY(), $line);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例10: __construct
function __construct($orientation, $metric, $size, $year, $month)
{
$dynamicY = 0;
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$sql = "SELECT SUM(TIMESTAMPDIFF(MINUTE, starttime, endtime)) AS hours, B.name AS customername\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}diary A \n\t\t\t\t\t\tINNER JOIN {$_SESSION['DB_PREFIX']}client B \n\t\t\t\t\t\tON B.id = A.clientid \n\t\t\t\t\t\tWHERE A.status IN ('I', 'C')\n\t\t\t\t\t\tAND YEAR(A.starttime) = {$year}\n\t\t\t\t\t\tAND MONTH(A.starttime) = {$month}\n\t\t\t\t\t\tAND A.deleted != 'Y'\n\t\t\t\t\t\tGROUP BY B.name\n\t\t\t\t\t\tORDER BY B.name";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$line = array("Customer" => $member['customername'], "Hours Worked" => number_format($member['hours'] / 60, 2));
if ($this->GetY() > 260) {
$this->AddPage();
}
$this->addLine($this->GetY(), $line, 5.5);
$this->Line(10, $this->GetY() - 0.5, 200, $this->GetY() - 0.5);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例11: __construct
function __construct($orientation, $metric, $size, $startdate, $enddate)
{
$dynamicY = 0;
parent::__construct($orientation, $metric, $size);
$this->SetAutoPageBreak(true, 30);
$this->AddPage();
try {
$and = "";
if ($startdate != "") {
$and .= " AND A.matchdate >= '{$startdate}' ";
}
if ($enddate != "") {
$and .= " AND A.matchdate <= '{$enddate}' ";
}
$sql = "SELECT A.*, DATE_FORMAT(A.matchdate, '%d/%m/%Y') AS matchdate,\n\t\t\t\t\t B.name AS refereeename,\n\t\t\t\t\t C.age, C.name AS teamname\n\t\t\t\t\t\tFROM {$_SESSION['DB_PREFIX']}matchdetails A \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}referee B \n\t\t\t\t\t\tON B.id = A.refereeid \n\t\t\t\t\t\tLEFT OUTER JOIN {$_SESSION['DB_PREFIX']}teamagegroup C \n\t\t\t\t\t\tON C.id = A.teamid \n\t\t\t\t\t\tWHERE (A.ratereferee = 'P' OR A.rateplayers = 'P' OR A.ratemanagement = 'P' OR A.ratespectators = 'P' OR A.ratepitchsize = 'P' OR A.ratepitchcondition = 'P' OR A.rategoalsize = 'P' OR A.ratechangingrooms = 'P') {$and}\n\t\t\t\t\t\tORDER BY A.matchdate";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$line = array("Date of Match" => $member['matchdate'], "Age Group" => "Under " . $member['age'], "Division" => $member['division'], "Reported By" => $member['teamname'], "Match ID" => $member['id'], "Comments" => $member['remarks']);
if ($this->GetY() > 175) {
$this->AddPage();
}
$this->addLine($this->GetY(), $line);
}
} else {
logError($sql . " - " . mysql_error());
}
} catch (Exception $e) {
logError($e->getMessage());
}
}
示例12: shutdown
function shutdown()
{
$error=error_get_last();
if(is_array($error))
{
if($error['type']==E_ERROR || $error['type']==E_CORE_ERROR || $error['type']==E_COMPILE_ERROR) // Håndterer fatal errors
{
$feilmelding=now();
foreach($error as $value)
{
$feilmelding.=" - $value";
}
logFatal($feilmelding);
header("Location: error.php");
}
if($error['type']==E_WARNING || $error['type']==E_PARSE) // Håndterer warning og parse
{
$feilmelding=now();
foreach($error as $value)
{
$feilmelding.=" - $value";
}
logError($feilmelding);
}
}
}
示例13: resultHandle
/**
* @param $result
* @param array $cache array( //二维数组
* array($key,$prefix,$time), //需要缓存微信返回的键 , 系统标识前缀 ,缓存时间(可为空)
* array($key2,$prefix2,$time2)
* )
* @return bool
*/
public function resultHandle($result, $cache = array())
{
$body = $result->body;
if (is_object($body)) {
if (!property_exists($body, 'errcode') || 0 == $body->errcode) {
foreach ($body as $key => $val) {
$this->{$key} = $val;
foreach ($cache as $v) {
if ($v[0] == $key) {
if (isset($v[2]) && is_numeric($v[2])) {
$this->setCacheToWechat($v[1], $v[0], $val, $v[2]);
} elseif (isset($v[2]) && property_exists($body, $v[2]) && is_numeric($body->{$v}[2])) {
$this->setCacheToWechat($v[1], $v[0], $val, $body->{$v}[2]);
} else {
$this->setCacheToWechat($v[1], $v[0], $val);
}
}
}
}
return true;
} else {
logError('[errcode:' . $body->errcode . '][errmsg:' . $body->errmsg . ']');
return false;
}
}
logError('[Result Body not Object On Time' . date('Y-m-d H:i:s') . ']');
return false;
}
示例14: errorAction
public function errorAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->viewRenderer->setViewSuffix('phtml');
$errors = $this->_getParam('error_handler');
if ($errors) {
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
//case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER:
// 404 error -- controller or action not found
$this->_helper->viewRenderer('404');
$this->getResponse()->setHttpResponseCode(404);
$this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
echo $this->view->message = 'Page not found';
//$this->view->errorMessage = $this->_defaultMessages['ERROR_404'];
break;
default:
// application error; display error page, but don't change
// status code
// Log the exception:
$exception = $errors->exception;
logError('ERROR HANDLER', $exception->getMessage() . "\n" . $exception->getTraceAsString());
break;
}
} else {
$this->_helper->viewRenderer('404');
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
}
}
示例15: reject
function reject()
{
global $message;
$id = $_POST['pk1'];
$messageid = $_POST['pk2'];
$sql = "SELECT A.weeknumber, A.memberid, A.swapmemberid " . "FROM {$_SESSION['DB_PREFIX']}oncallswap A " . "WHERE A.id = {$id}";
$result = mysql_query($sql);
if ($result) {
/* Show children. */
while ($member = mysql_fetch_assoc($result)) {
$qry = "UPDATE {$_SESSION['DB_PREFIX']}oncallswap " . "SET agreed = 'X', metamodifieddate = NOW(), metamodifieduserid = " . getLoggedOnMemberID() . " " . "WHERE id = {$id}";
$itemresult = mysql_query($qry);
if (!$itemresult) {
logError($qry . " = " . mysql_error());
}
$qry = "UPDATE {$_SESSION['DB_PREFIX']}messages " . "SET status = 'R', metamodifieddate = NOW(), metamodifieduserid = " . getLoggedOnMemberID() . " " . "WHERE id = {$messageid}";
$itemresult = mysql_query($qry);
if (!$itemresult) {
logError($qry . " = " . mysql_error());
}
sendInternalUserMessage($member['memberid'], "On Call Swap Request", "Your request for on call cover for week " . $member['weeknumber'] . " has been rejected by " . GetUserName($member['swapmemberid']));
$message = "Request has been rejected";
}
}
}