Browse Source

Use internally \OCP\ILogger instead of \OC\Log

* this is the preparation for some upcoming logger related changes
* also fixes an issue in the public interface where we request
  an internal class as parameter
tags/v8.1.0beta1
Morris Jobke 9 years ago
parent
commit
fbba7a61cb

+ 1
- 1
core/ajax/share.php View File

@@ -354,7 +354,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo

$sorter = new \OC\Share\SearchResultSorter((string)$_GET['search'],
'label',
new \OC\Log());
\OC::$server->getLogger());
usort($shareWith, array($sorter, 'sort'));
OC_JSON::success(array('data' => $shareWith));
}

+ 3
- 2
lib/private/backgroundjob/job.php View File

@@ -24,6 +24,7 @@
namespace OC\BackgroundJob;

use OCP\BackgroundJob\IJob;
use OCP\ILogger;

abstract class Job implements IJob {
/**
@@ -43,9 +44,9 @@ abstract class Job implements IJob {

/**
* @param JobList $jobList
* @param \OC\Log $logger
* @param ILogger $logger
*/
public function execute($jobList, $logger = null) {
public function execute($jobList, ILogger $logger = null) {
$jobList->setLastRun($this);
try {
$this->run($this->argument);

+ 3
- 2
lib/private/backgroundjob/queuedjob.php View File

@@ -21,6 +21,7 @@
*/

namespace OC\BackgroundJob;
use OCP\ILogger;

/**
* Class QueuedJob
@@ -34,9 +35,9 @@ abstract class QueuedJob extends Job {
* run the job, then remove it from the joblist
*
* @param JobList $jobList
* @param \OC\Log $logger
* @param ILogger $logger
*/
public function execute($jobList, $logger = null) {
public function execute($jobList, ILogger $logger = null) {
$jobList->remove($this, $this->argument);
parent::execute($jobList, $logger);
}

+ 3
- 2
lib/private/backgroundjob/timedjob.php View File

@@ -21,6 +21,7 @@
*/

namespace OC\BackgroundJob;
use OCP\ILogger;

/**
* Class QueuedJob
@@ -45,9 +46,9 @@ abstract class TimedJob extends Job {
* run the job if
*
* @param JobList $jobList
* @param \OC\Log $logger
* @param ILogger $logger
*/
public function execute($jobList, $logger = null) {
public function execute($jobList, ILogger $logger = null) {
if ((time() - $this->lastRun) > $this->interval) {
parent::execute($jobList, $logger);
}

+ 3
- 3
lib/private/log/errorhandler.php View File

@@ -23,10 +23,10 @@

namespace OC\Log;

use OC\Log as LoggerInterface;
use OCP\ILogger;

class ErrorHandler {
/** @var LoggerInterface */
/** @var ILogger */
private static $logger;

/**
@@ -50,7 +50,7 @@ class ErrorHandler {
set_exception_handler(array($handler, 'onException'));
}

public static function setLogger(LoggerInterface $logger) {
public static function setLogger(ILogger $logger) {
self::$logger = $logger;
}


+ 4
- 2
lib/private/share/searchresultsorter.php View File

@@ -23,6 +23,8 @@
*/
namespace OC\Share;

use OCP\ILogger;

class SearchResultSorter {
private $search;
private $encoding;
@@ -34,9 +36,9 @@ class SearchResultSorter {
* @param string $key the array key containing the value that should be compared
* against
* @param string $encoding optional, encoding to use, defaults to UTF-8
* @param \OC\Log $log optional
* @param ILogger $log optional
*/
public function __construct($search, $key, \OC\Log $log = null, $encoding = 'UTF-8') {
public function __construct($search, $key, ILogger $log = null, $encoding = 'UTF-8') {
$this->encoding = $encoding;
$this->key = $key;
$this->log = $log;

+ 4
- 3
lib/private/updater.php View File

@@ -37,6 +37,7 @@ use OC_Installer;
use OC_Util;
use OCP\IConfig;
use OC\Setup;
use OCP\ILogger;

/**
* Class that handles autoupdating of ownCloud
@@ -49,7 +50,7 @@ use OC\Setup;
*/
class Updater extends BasicEmitter {

/** @var \OC\Log $log */
/** @var ILogger $log */
private $log;
/** @var \OC\HTTPHelper $helper */
@@ -67,9 +68,9 @@ class Updater extends BasicEmitter {
/**
* @param HTTPHelper $httpHelper
* @param IConfig $config
* @param \OC\Log $log
* @param ILogger $log
*/
public function __construct(HTTPHelper $httpHelper, IConfig $config, $log = null) {
public function __construct(HTTPHelper $httpHelper, IConfig $config, ILogger $log = null) {
$this->httpHelper = $httpHelper;
$this->log = $log;
$this->config = $config;

+ 3
- 2
lib/public/backgroundjob/ijob.php View File

@@ -22,6 +22,7 @@
*/

namespace OCP\BackgroundJob;
use OCP\ILogger;

/**
* Interface IJob
@@ -34,11 +35,11 @@ interface IJob {
* Run the background job with the registered argument
*
* @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job
* @param \OC\Log $logger
* @param ILogger $logger
* @return void
* @since 7.0.0
*/
public function execute($jobList, $logger = null);
public function execute($jobList, ILogger $logger = null);

/**
* Get the id of the background job

Loading…
Cancel
Save