本文整理汇总了PHP中OCP\ILogger::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP ILogger::debug方法的具体用法?PHP ILogger::debug怎么用?PHP ILogger::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\ILogger
的用法示例。
在下文中一共展示了ILogger::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanUserTags
/**
* Deleting orphaned user tag mappings
*
* @return int Number of deleted entries
*/
protected function cleanUserTags()
{
$subQuery = $this->connection->getQueryBuilder();
$subQuery->select($subQuery->expr()->literal('1'))->from('filecache', 'f')->where($subQuery->expr()->eq('objid', 'f.fileid'));
$query = $this->connection->getQueryBuilder();
$deletedEntries = $query->delete('vcategory_to_object')->where($query->expr()->eq('type', $query->expr()->literal('files')))->andWhere($query->expr()->isNull($query->createFunction('(' . $subQuery->getSql() . ')')))->execute();
$this->logger->debug("{$deletedEntries} orphaned user tag relations deleted", ['app' => 'DeleteOrphanedTagsJob']);
return $deletedEntries;
}
示例2: cleanCommentMarkers
/**
* Deleting orphaned comment read markers
*
* @return int Number of deleted entries
*/
protected function cleanCommentMarkers()
{
$qb = $this->connection->getQueryBuilder();
$deletedEntries = $this->cleanUp('comments_read_markers', $qb->expr()->castColumn('object_id', IQueryBuilder::PARAM_INT), 'object_type');
$this->logger->debug("{$deletedEntries} orphaned comment read marks deleted", ['app' => 'DeleteOrphanedItems']);
return $deletedEntries;
}
示例3: create
/**
* @NoAdminRequired
*
* @param string $accountName
* @param string $emailAddress
* @param string $password
* @param string $imapHost
* @param int $imapPort
* @param string $imapSslMode
* @param string $imapUser
* @param string $imapPassword
* @param string $smtpHost
* @param int $smtpPort
* @param string $smtpSslMode
* @param string $smtpUser
* @param string $smtpPassword
* @param bool $autoDetect
* @return JSONResponse
*/
public function create($accountName, $emailAddress, $password, $imapHost, $imapPort, $imapSslMode, $imapUser, $imapPassword, $smtpHost, $smtpPort, $smtpSslMode, $smtpUser, $smtpPassword, $autoDetect)
{
try {
if ($autoDetect) {
$this->logger->info('setting up auto detected account');
$newAccount = $this->autoConfig->createAutoDetected($emailAddress, $password, $accountName);
} else {
$this->logger->info('Setting up manually configured account');
$newAccount = new MailAccount(['accountName' => $accountName, 'emailAddress' => $emailAddress, 'imapHost' => $imapHost, 'imapPort' => $imapPort, 'imapSslMode' => $imapSslMode, 'imapUser' => $imapUser, 'imapPassword' => $imapPassword, 'smtpHost' => $smtpHost, 'smtpPort' => $smtpPort, 'smtpSslMode' => $smtpSslMode, 'smtpUser' => $smtpUser, 'smtpPassword' => $smtpPassword]);
$newAccount->setUserId($this->currentUserId);
$newAccount->setInboundPassword($this->crypto->encrypt($newAccount->getInboundPassword()));
$newAccount->setOutboundPassword($this->crypto->encrypt($newAccount->getOutboundPassword()));
$a = new Account($newAccount);
$this->logger->debug('Connecting to account {account}', ['account' => $newAccount->getEmail()]);
$a->testConnectivity();
}
if ($newAccount) {
$this->accountService->save($newAccount);
$this->logger->debug("account created " . $newAccount->getId());
return new JSONResponse(['data' => ['id' => $newAccount->getId()]], Http::STATUS_CREATED);
}
} catch (\Exception $ex) {
$this->logger->error('Creating account failed: ' . $ex->getMessage());
return new JSONResponse(array('message' => $this->l10n->t('Creating account failed: ') . $ex->getMessage()), HTTP::STATUS_BAD_REQUEST);
}
$this->logger->info('Auto detect failed');
return new JSONResponse(array('message' => $this->l10n->t('Auto detect failed. Please use manual mode.')), HTTP::STATUS_BAD_REQUEST);
}
示例4: runStep
/**
* Send an email to {$limit} users
*
* @param int $limit Number of users we want to send an email to
* @return int Number of users we sent an email to
*/
protected function runStep($limit)
{
// We don't use time() but "time() - 1" here, so we don't run into
// runtime issues later and delete emails, which were created in the
// same second, but were not collected for the emails.
$sendTime = time() - 1;
// Get all users which should receive an email
$affectedUsers = $this->mqHandler->getAffectedUsers($limit, $sendTime);
if (empty($affectedUsers)) {
// No users found to notify, mission abort
return 0;
}
$userLanguages = $this->config->getUserValueForUsers('core', 'lang', $affectedUsers);
$userTimezones = $this->config->getUserValueForUsers('core', 'timezone', $affectedUsers);
$userEmails = $this->config->getUserValueForUsers('settings', 'email', $affectedUsers);
// Get all items for these users
$mailData = $this->mqHandler->getItemsForUsers($affectedUsers, $sendTime);
// Send Email
$default_lang = $this->config->getSystemValue('default_language', 'en');
$defaultTimeZone = date_default_timezone_get();
foreach ($mailData as $user => $data) {
if (empty($userEmails[$user])) {
// The user did not setup an email address
// So we will not send an email :(
$this->logger->debug("Couldn't send notification email to user '" . $user . "' (email address isn't set for that user)", ['app' => 'activity']);
continue;
}
$language = !empty($userLanguages[$user]) ? $userLanguages[$user] : $default_lang;
$timezone = !empty($userTimezones[$user]) ? $userTimezones[$user] : $defaultTimeZone;
$this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $timezone, $data);
}
// Delete all entries we dealt with
$this->mqHandler->deleteSentItems($affectedUsers, $sendTime);
return sizeof($affectedUsers);
}
示例5: update
/**
* update encrypted file, e.g. give additional users access to the file
*
* @param string $path path to the file which should be updated
* @param string $uid of the user who performs the operation
* @param array $accessList who has access to the file contains the key 'users' and 'public'
* @return boolean
*/
public function update($path, $uid, array $accessList)
{
if (empty($accessList)) {
if (isset(self::$rememberVersion[$path])) {
$this->keyManager->setVersion($path, self::$rememberVersion[$path], new View());
unset(self::$rememberVersion[$path]);
}
return;
}
$fileKey = $this->keyManager->getFileKey($path, $uid);
if (!empty($fileKey)) {
$publicKeys = array();
if ($this->useMasterPassword === true) {
$publicKeys[$this->keyManager->getMasterKeyId()] = $this->keyManager->getPublicMasterKey();
} else {
foreach ($accessList['users'] as $user) {
try {
$publicKeys[$user] = $this->keyManager->getPublicKey($user);
} catch (PublicKeyMissingException $e) {
$this->logger->warning('Could not encrypt file for ' . $user . ': ' . $e->getMessage());
}
}
}
$publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $uid);
$encryptedFileKey = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys);
$this->keyManager->deleteAllFileKeys($path);
$this->keyManager->setAllFileKeys($path, $encryptedFileKey);
} else {
$this->logger->debug('no file key found, we assume that the file "{file}" is not encrypted', array('file' => $path, 'app' => 'encryption'));
return false;
}
return true;
}
示例6: formatItems
/**
* {@inheritDoc}
*/
public function formatItems($items, $format, $parameters = null)
{
$entities = [];
if ($format === Types::ENTITY) {
foreach ($items as $item) {
try {
$calendar = $this->calendars->find($item['item_source'], $item['uid_owner']);
} catch (BusinessLayer\Exception $ex) {
$this->logger->debug($ex->getMessage());
continue;
}
$calendar->setId(null);
$calendar->setBackend($this->sharingBackend);
$calendar->setCruds($item['permissions']);
$calendar->setPrivateUri('calendar::' . $item['item_source']);
$calendar->setUserId($item['share_with']);
$entities[] = $calendar;
}
return $this->factory->createCollectionFromEntities($entities);
} elseif ($format === Types::ENTITYLIST) {
foreach ($items as $item) {
$entities[] = $item['item_source'];
}
return $entities;
} else {
return null;
}
}
示例7: upgrade
/**
* runs the update actions in maintenance mode, does not upgrade the source files
* except the main .htaccess file
*
* @return bool true if the operation succeeded, false otherwise
*/
public function upgrade() {
$wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
if(!$wasMaintenanceModeEnabled) {
$this->config->setSystemValue('maintenance', true);
$this->emit('\OC\Updater', 'maintenanceEnabled');
}
$installedVersion = $this->config->getSystemValue('version', '0.0.0');
$currentVersion = implode('.', \OC_Util::getVersion());
if ($this->log) {
$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
}
$success = true;
try {
$this->doUpgrade($currentVersion, $installedVersion);
} catch (\Exception $exception) {
\OCP\Util::logException('update', $exception);
$this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));
$success = false;
}
$this->emit('\OC\Updater', 'updateEnd', array($success));
if(!$wasMaintenanceModeEnabled && $success) {
$this->config->setSystemValue('maintenance', false);
$this->emit('\OC\Updater', 'maintenanceDisabled');
} else {
$this->emit('\OC\Updater', 'maintenanceActive');
}
return $success;
}
示例8: runStep
/**
* Send an email to {$limit} users
*
* @param int $limit Number of users we want to send an email to
* @param int $sendTime The latest send time
* @return int Number of users we sent an email to
*/
protected function runStep($limit, $sendTime)
{
// Get all users which should receive an email
$affectedUsers = $this->mqHandler->getAffectedUsers($limit, $sendTime);
if (empty($affectedUsers)) {
// No users found to notify, mission abort
return 0;
}
$userLanguages = $this->config->getUserValueForUsers('core', 'lang', $affectedUsers);
$userTimezones = $this->config->getUserValueForUsers('core', 'timezone', $affectedUsers);
$userEmails = $this->config->getUserValueForUsers('settings', 'email', $affectedUsers);
// Send Email
$default_lang = $this->config->getSystemValue('default_language', 'en');
$defaultTimeZone = date_default_timezone_get();
foreach ($affectedUsers as $user) {
if (empty($userEmails[$user])) {
// The user did not setup an email address
// So we will not send an email :(
$this->logger->debug("Couldn't send notification email to user '" . $user . "' (email address isn't set for that user)", ['app' => 'activity']);
continue;
}
$language = !empty($userLanguages[$user]) ? $userLanguages[$user] : $default_lang;
$timezone = !empty($userTimezones[$user]) ? $userTimezones[$user] : $defaultTimeZone;
$this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $timezone, $sendTime);
}
// Delete all entries we dealt with
$this->mqHandler->deleteSentItems($affectedUsers, $sendTime);
return sizeof($affectedUsers);
}
示例9: upgrade
/**
* runs the update actions in maintenance mode, does not upgrade the source files
* except the main .htaccess file
*
* @return bool true if the operation succeeded, false otherwise
*/
public function upgrade()
{
$this->emitRepairEvents();
$logLevel = $this->config->getSystemValue('loglevel', \OCP\Util::WARN);
$this->emit('\\OC\\Updater', 'setDebugLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]);
$this->config->setSystemValue('loglevel', \OCP\Util::DEBUG);
$wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
if (!$wasMaintenanceModeEnabled) {
$this->config->setSystemValue('maintenance', true);
$this->emit('\\OC\\Updater', 'maintenanceEnabled');
}
$installedVersion = $this->config->getSystemValue('version', '0.0.0');
$currentVersion = implode('.', \OCP\Util::getVersion());
$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
$success = true;
try {
$this->doUpgrade($currentVersion, $installedVersion);
} catch (\Exception $exception) {
$this->log->logException($exception, ['app' => 'core']);
$this->emit('\\OC\\Updater', 'failure', array(get_class($exception) . ': ' . $exception->getMessage()));
$success = false;
}
$this->emit('\\OC\\Updater', 'updateEnd', array($success));
if (!$wasMaintenanceModeEnabled && $success) {
$this->config->setSystemValue('maintenance', false);
$this->emit('\\OC\\Updater', 'maintenanceDisabled');
} else {
$this->emit('\\OC\\Updater', 'maintenanceActive');
}
$this->emit('\\OC\\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]);
$this->config->setSystemValue('loglevel', $logLevel);
return $success;
}
示例10: __destruct
public function __destruct()
{
// Only releaseAll if we have locks to release
if (!empty($this->handle) || !empty($this->lockFile)) {
$this->log->debug(sprintf('INFO: Destroying locks on %s', $this->path), ['app' => 'files_locking']);
$this->releaseAll();
}
}
示例11: draft
/**
* @NoAdminRequired
*
* @param int $accountId
* @param string $subject
* @param string $body
* @param string $to
* @param string $cc
* @param string $bcc
* @param int $uid
* @param string $messageId
* @return JSONResponse
*/
public function draft($accountId, $subject, $body, $to, $cc, $bcc, $uid, $messageId)
{
if (is_null($uid)) {
$this->logger->info("Saving a new draft in account <{$accountId}>");
} else {
$this->logger->info("Updating draft <{$uid}> in account <{$accountId}>");
}
$account = $this->accountService->find($this->currentUserId, $accountId);
if ($account instanceof UnifiedAccount) {
list($account) = $account->resolve($messageId);
}
if (!$account instanceof Account) {
return new JSONResponse(array('message' => 'Invalid account'), Http::STATUS_BAD_REQUEST);
}
// get sender data
$headers = [];
$from = new Horde_Mail_Rfc822_Address($account->getEMailAddress());
$from->personal = $account->getName();
$headers['From'] = $from;
$headers['Subject'] = $subject;
if (trim($cc) !== '') {
$headers['Cc'] = trim($cc);
}
if (trim($bcc) !== '') {
$headers['Bcc'] = trim($bcc);
}
$headers['To'] = $to;
$headers['Date'] = Horde_Mime_Headers_Date::create();
// build mime body
$mail = new Horde_Mime_Mail();
$mail->addHeaders($headers);
$bodyPart = new Horde_Mime_Part();
$bodyPart->appendContents($body, ['encoding' => \Horde_Mime_Part::ENCODE_8BIT]);
$mail->setBasePart($bodyPart);
// create transport and save message
try {
// save the message in the drafts folder
$draftsFolder = $account->getDraftsFolder();
/** @var resource $raw */
$raw = $mail->getRaw();
$raw = stream_get_contents($raw);
$newUid = $draftsFolder->saveDraft($raw);
// delete old version if one exists
if (!is_null($uid)) {
$folderId = $draftsFolder->getFolderId();
$this->logger->debug("deleting outdated draft <{$uid}> in folder <{$folderId}>");
$draftsFolder->setMessageFlag($uid, \Horde_Imap_Client::FLAG_DELETED, true);
$account->deleteDraft($uid);
$this->logger->debug("draft <{$uid}> deleted");
}
} catch (\Horde_Exception $ex) {
$this->logger->error('Saving draft failed: ' . $ex->getMessage());
return new JSONResponse(['message' => $ex->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
}
return new JSONResponse(['uid' => $newUid]);
}
示例12: deleteFile
/**
* removes a file from the lucene index
*
* @param int $fileId file id to remove from the index
*
* @return int count of deleted documents in the index
*/
public function deleteFile($fileId)
{
$hits = $this->index->find('fileId:' . $fileId);
$this->logger->debug('found ' . count($hits) . ' hits for file id ' . $fileId);
foreach ($hits as $hit) {
$this->logger->debug('removing ' . $hit->id . ':' . $hit->path . ' from index');
$this->index->delete($hit);
}
return count($hits);
}
示例13: validateToken
/**
* @param string $token
* @throws InvalidTokenException
* @return DefaultToken user UID
*/
public function validateToken($token)
{
try {
$dbToken = $this->mapper->getToken($this->hashToken($token));
$this->logger->debug('valid default token for ' . $dbToken->getUID());
return $dbToken;
} catch (DoesNotExistException $ex) {
throw new InvalidTokenException();
}
}
示例14: indexFiles
/**
* @param array $fileIds
* @param \OC_EventSource $eventSource
*/
public function indexFiles(array $fileIds, \OC_EventSource $eventSource = null)
{
foreach ($fileIds as $id) {
$fileStatus = $this->mapper->getOrCreateFromFileId($id);
try {
// before we start mark the file as error so we know there
// was a problem in case the php execution dies and we don't try
// the file again
$this->mapper->markError($fileStatus);
$nodes = $this->server->getUserFolder()->getById($id);
// getById can return more than one id because the containing storage might be mounted more than once
// Since we only want to index the file once, we only use the first entry
if (isset($nodes[0])) {
/** @var File $node */
$node = $nodes[0];
} else {
throw new VanishedException($id);
}
if (!$node instanceof File) {
throw new NotIndexedException();
}
$path = $node->getPath();
foreach ($this->skippedDirs as $skippedDir) {
if (strpos($path, '/' . $skippedDir . '/') !== false || strrpos($path, '/' . $skippedDir) === strlen($path) - (strlen($skippedDir) + 1)) {
throw new SkippedException('skipping file ' . $id . ':' . $path);
}
}
if ($eventSource) {
$eventSource->send('indexing', $path);
}
if ($this->indexFile($node, false)) {
$this->mapper->markIndexed($fileStatus);
}
} catch (VanishedException $e) {
$this->mapper->markVanished($fileStatus);
} catch (NotIndexedException $e) {
$this->mapper->markUnIndexed($fileStatus);
} catch (SkippedException $e) {
$this->mapper->markSkipped($fileStatus);
$this->logger->debug($e->getMessage());
} catch (\Exception $e) {
//sqlite might report database locked errors when stock filescan is in progress
//this also catches db locked exception that might come up when using sqlite
$this->logger->error($e->getMessage() . ' Trace:\\n' . $e->getTraceAsString());
$this->mapper->markError($fileStatus);
// TODO Add UI to trigger rescan of files with status 'E'rror?
if ($eventSource) {
$eventSource->send('error', $e->getMessage());
}
}
}
$this->index->commit();
}
示例15: send
/**
* Send the specified message. Also sets the from address to the value defined in config.php
* if no-one has been passed.
*
* @param Message $message Message to send
* @return string[] Array with failed recipients. Be aware that this depends on the used mail backend and
* therefore should be considered
* @throws \Exception In case it was not possible to send the message. (for example if an invalid mail address
* has been supplied.)
*/
public function send(Message $message)
{
$debugMode = $this->config->getSystemValue('mail_smtpdebug', false);
if (sizeof($message->getFrom()) === 0) {
$message->setFrom([\OCP\Util::getDefaultEmailAddress($this->defaults->getName())]);
}
$failedRecipients = [];
$mailer = $this->getInstance();
// Enable logger if debug mode is enabled
if ($debugMode) {
$mailLogger = new \Swift_Plugins_Loggers_ArrayLogger();
$mailer->registerPlugin(new \Swift_Plugins_LoggerPlugin($mailLogger));
}
$mailer->send($message->getSwiftMessage(), $failedRecipients);
// Debugging logging
$logMessage = sprintf('Sent mail to "%s" with subject "%s"', print_r($message->getTo(), true), $message->getSubject());
$this->logger->debug($logMessage, ['app' => 'core']);
if ($debugMode && isset($mailLogger)) {
$this->logger->debug($mailLogger->dump(), ['app' => 'core']);
}
return $failedRecipients;
}