本文整理汇总了PHP中Logging::logDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP Logging::logDebug方法的具体用法?PHP Logging::logDebug怎么用?PHP Logging::logDebug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logging
的用法示例。
在下文中一共展示了Logging::logDebug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
{
if ($attachments != NULL) {
throw new ServiceException("INVALID_CONFIGURATION", "Default mailer does not support sending attachments");
}
if (Logging::isDebug()) {
Logging::logDebug("Sending mail to [" . Util::array2str($to) . "]: [" . $message . "]");
}
if (!$this->enabled) {
return;
}
$isHtml = stripos($message, "<html>") !== FALSE;
$f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
$validRecipients = $this->getValidRecipients($to);
if (count($validRecipients) === 0) {
Logging::logDebug("No valid recipient email addresses, no mail sent");
return;
}
$toAddress = '';
$headers = $isHtml ? 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n" : 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n";
$headers .= 'From:' . $f;
if (count($validRecipients) == 1) {
$toAddress = $this->getRecipientString($validRecipients[0]);
} else {
$headers .= PHP_EOL . $this->getBccHeaders($validRecipients);
}
mail($toAddress, $subject, $isHtml ? $message : str_replace("\n", "\r\n", wordwrap($message)), $headers);
}
示例2: processPost
public function processPost()
{
$data = $this->request->data;
if (!isset($data['to']) or !isset($data['title']) or !isset($data['msg']) or !isset($data['items'])) {
throw $this->invalidRequestException("Data missing");
}
$to = $data['to'];
$message = $data['msg'];
$title = $data['title'];
$items = $this->items($data['items']);
if (count($items) == 0) {
throw $this->invalidRequestException("Items missing");
}
if (Logging::isDebug()) {
Logging::logDebug("SENDVIAEMAIL: Sending mail " . $to . ":" . Util::array2str($items));
}
$attachments = array();
foreach ($items as $i) {
$attachments[] = $i->internalPath();
}
//TODO stream
if ($this->env->mailer()->send(array($to), $title, $message, NULL, $attachments)) {
$this->response()->success(array());
} else {
$this->response()->error("REQUEST_FAILED", NULL);
}
}
示例3: log
function log()
{
if (!Logging::isDebug()) {
return;
}
Logging::logDebug("PLUGIN (" . get_class($this) . ")");
}
示例4: send
public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
{
if (!$this->enabled) {
return;
}
$isHtml = stripos($message, "<html>") !== FALSE;
$f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
$validRecipients = $this->getValidRecipients($to);
if (count($validRecipients) === 0) {
Logging::logDebug("No valid recipient email addresses, no mail sent");
return;
}
if (Logging::isDebug()) {
Logging::logDebug("Sending mail from [" . $f . "] to [" . Util::array2str($validRecipients) . "]: [" . $message . "]");
}
set_include_path("vendor/PHPMailer" . DIRECTORY_SEPARATOR . PATH_SEPARATOR . get_include_path());
require 'class.phpmailer.php';
$mailer = new PHPMailer();
$smtp = $this->env->settings()->setting("mail_smtp");
if ($smtp != NULL and isset($smtp["host"])) {
$mailer->isSMTP();
$mailer->Host = $smtp["host"];
if (isset($smtp["username"]) and isset($smtp["password"])) {
$mailer->SMTPAuth = true;
$mailer->Username = $smtp["username"];
$mailer->Password = $smtp["password"];
}
if (isset($smtp["secure"])) {
$mailer->SMTPSecure = $smtp["secure"];
}
}
$mailer->From = $f;
foreach ($validRecipients as $recipient) {
$mailer->addBCC($recipient["email"], $recipient["name"]);
}
if (!$isHtml) {
$mailer->WordWrap = 50;
} else {
$mailer->isHTML(true);
}
if ($attachments != NULL) {
//TODO use stream
foreach ($attachments as $attachment) {
$mailer->addAttachment($attachment);
}
}
$mailer->Subject = $subject;
$mailer->Body = $message;
try {
if (!$mailer->send()) {
Logging::logError('Message could not be sent: ' . $mailer->ErrorInfo);
return FALSE;
}
return TRUE;
} catch (Exception $e) {
Logging::logError('Message could not be sent: ' . $e);
return FALSE;
}
}
示例5: putToCache
private function putToCache($name, $subject, $value)
{
if (!array_key_exists($name, $this->permissionCaches)) {
$this->permissionCaches[$name] = array();
}
$this->permissionCaches[$name][$subject] = $value;
Logging::logDebug("Permission cache put [" . $name . "/" . $subject . "]=" . $value);
}
示例6: getShareInfo
public function getShareInfo($id, $share)
{
$ic = $this->dao()->getItemCollection($id);
if (!$ic) {
Logging::logDebug("Invalid share request, no item collection found with id " . $id);
return NULL;
}
return array("name" => $ic["name"], "type" => "prepared_download");
}
示例7: getShareItem
public function getShareItem($id)
{
$ic = $this->dao()->getItemCollection($id);
if (!$ic) {
Logging::logDebug("Invalid share request, no item collection found with id " . $id);
return NULL;
}
return array("name" => $ic["name"]);
}
示例8: globalExceptionHandler
function globalExceptionHandler($e)
{
global $responseHandler;
Logging::logException($e);
Logging::logDebug(Util::array2str(debug_backtrace()));
if ($responseHandler == NULL) {
$responseHandler = new ResponseHandler(new OutputHandler());
}
$responseHandler->unknownServerError($e->getMessage());
die;
}
示例9: retrieve
public function retrieve($url)
{
if (Logging::isDebug()) {
Logging::logDebug("Retrieving [{$url}]");
}
$h = curl_init();
if (!$h) {
throw new ServiceException("INVALID_CONFIGURATION", "Failed to initialize curl: " . curl_errno() . " " . curl_error());
}
if (!curl_setopt($h, CURLOPT_URL, $url)) {
curl_close($h);
throw new ServiceException("INVALID_CONFIGURATION", "Failed to initialize curl: " . curl_errno() . " " . curl_error());
}
$tempFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('Kloudspeaker', true);
$fh = @fopen($tempFile, "wb");
if (!$fh) {
curl_close($h);
throw new ServiceException("INVALID_CONFIGURATION", "Could not open temporary file for writing: " . $tempFile);
}
if (!curl_setopt($h, CURLOPT_FILE, $fh) or !curl_setopt($h, CURLOPT_HEADER, 0)) {
fclose($fh);
curl_close($h);
throw new ServiceException("INVALID_CONFIGURATION", "Failed to initialize curl: " . curl_errno() . " " . curl_error());
}
set_time_limit(0);
$success = curl_exec($h);
$status = FALSE;
$errorNo = 0;
$error = NULL;
if ($success) {
$status = curl_getinfo($h, CURLINFO_HTTP_CODE);
} else {
$errorNo = curl_errno($h);
$error = curl_error($h);
Logging::logDebug("Failed to retrieve url: {$errorNo} {$error}");
}
fclose($fh);
curl_close($h);
if (!$success) {
if ($errorNo === 6) {
return array("success" => false, "result" => 404);
}
throw new ServiceException("REQUEST_FAILED", $error);
}
if ($status !== 200) {
if (file_exists($tempFile)) {
unlink($tempFile);
}
return array("success" => false, "result" => $status);
}
return array("success" => true, "file" => $tempFile, "stream" => @fopen($tempFile, "rb"), "name" => $this->getName($url));
}
示例10: loadTexts
public function loadTexts($file, $curDir)
{
$file .= ".txt";
$cl = $this->getCustomizationsAbsoluteLocation($file);
if ($cl != NULL) {
Logging::logDebug("ResourceLoader: Seeking " . $cl);
if (file_exists($cl)) {
return $this->loadTextFile($cl);
}
}
Logging::logDebug("ResourceLoader: Seeking " . $curDir . DIRECTORY_SEPARATOR . $file);
return $this->loadTextFile($curDir . DIRECTORY_SEPARATOR . $file);
}
示例11: processGet
public function processGet()
{
if (count($this->path) != 1) {
throw $this->invalidRequestException();
}
$item = $this->item($this->path[0]);
$comments = $this->handler()->getComments($item);
$permission = $this->env->request()->hasParamValue("p", "1");
Logging::logDebug("PERM" . ($permission ? "1" : "0"));
if (!$permission) {
$this->response()->success($comments);
} else {
$this->response()->success(array("comments" => $comments, "permission" => $this->env->permissions()->getFilesystemPermission("comment_item", $item)));
}
}
示例12: authenticate
public function authenticate($user, $pw, $auth)
{
if ($auth["salt"] == "-" and $auth["hash"] == "-") {
$oldPw = $this->env->configuration()->getUserLegacyPw($user["id"]);
// old pw auth
if (strcmp($oldPw, md5($pw)) != 0) {
return FALSE;
}
//convert old pws into hash
Logging::logDebug("Adding new user hash for " . $user["id"]);
$this->env->configuration()->storeUserAuth($user["id"], $user["name"], $auth["type"], $pw);
return TRUE;
}
return $this->env->passwordHash()->isEqual($pw, $auth["hash"], $auth["salt"]);
}
示例13: log
function log()
{
if (!Logging::isDebug()) {
return;
}
$logged = array_merge(array(), $this->settings);
// remove db password
if (Util::isArrayKey($logged, "db") and is_array($logged["db"])) {
if (Util::isArrayKey($logged["db"], "pw")) {
$logged["db"]["pw"] = "";
}
if (Util::isArrayKey($logged["db"], "password")) {
$logged["db"]["password"] = "";
}
}
Logging::logDebug("SETTINGS: " . Util::array2str($logged));
}
示例14: updateIds
private function updateIds($tables, $ids, $db)
{
if (strcmp("mysql", $db->type()) === 0) {
mysqli_report(MYSQLI_REPORT_OFF);
}
Logging::logDebug("Converting " . count($ids) . " ids in " . Util::array2str($tables));
foreach ($ids as $old => $new) {
$db->update(sprintf("INSERT INTO " . $db->table("item_id") . " (id, path) VALUES (%s,%s)", $db->string($new, TRUE), $db->string($old, TRUE)));
}
foreach ($tables as $t) {
foreach ($ids as $old => $new) {
$db->update(sprintf("update " . $db->table($t) . " set item_id=%s where item_id=%s", $db->string($new, TRUE), $db->string($old, TRUE)));
}
}
if (strcmp("mysql", $db->type()) === 0) {
mysqli_report(MYSQLI_REPORT_ALL);
}
}
示例15: onEvent
public function onEvent($e)
{
if ($this->env->authentication()->isAuthenticated()) {
$e->setUser(array('user_id' => $this->env->session()->userId(), 'username' => $this->env->session()->username()));
} else {
$e->setUser(NULL);
}
$e->setIp($this->env->request()->ip());
if (Logging::isDebug()) {
Logging::logDebug("EVENT HANDLER: onEvent: '" . $e->type() . "'");
}
foreach ($this->listeners as $type => $listeners) {
if (strcasecmp($type, '*') == 0 or strpos($e->typeId(), $type) === 0) {
foreach ($listeners as $listener) {
$listener->onEvent($e);
}
}
}
}