Remove OC_Log

This commit is contained in:
Thomas Müller 2015-07-03 14:06:40 +02:00
parent 68fd74963e
commit d3ac73c0c9
45 changed files with 142 additions and 209 deletions

View File

@ -66,7 +66,7 @@ $path = $view->getPath($pathId);
if($path === null) {
\OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
\OC_Log::write('core-preview', 'Could not resolve file for shared item', OC_Log::WARN);
\OCP\Util::writeLog('core-preview', 'Could not resolve file for shared item', \OCP\Util::WARN);
exit;
}

View File

@ -160,7 +160,7 @@ class Trashbin {
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
$result = $query->execute(array($ownerFilename, $timestamp, $ownerLocation, $owner));
if (!$result) {
\OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated for the files owner', \OC_log::ERROR);
\OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated for the files owner', \OCP\Util::ERROR);
}
}
}
@ -216,7 +216,7 @@ class Trashbin {
if ($trashStorage->file_exists($trashInternalPath)) {
$trashStorage->unlink($trashInternalPath);
}
\OCP\Util::writeLog('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OC_log::ERROR);
\OCP\Util::writeLog('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OCP\Util::ERROR);
}
if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort
@ -231,7 +231,7 @@ class Trashbin {
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
$result = $query->execute(array($filename, $timestamp, $location, $user));
if (!$result) {
\OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR);
\OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated', \OCP\Util::ERROR);
}
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => \OC\Files\Filesystem::normalizePath($file_path),
'trashPath' => \OC\Files\Filesystem::normalizePath($filename . '.d' . $timestamp)));
@ -675,7 +675,7 @@ class Trashbin {
foreach ($files as $file) {
if ($availableSpace < 0) {
$tmp = self::delete($file['name'], $user, $file['mtime']);
\OCP\Util::writeLog('files_trashbin', 'remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', \OC_log::INFO);
\OCP\Util::writeLog('files_trashbin', 'remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', \OCP\Util::INFO);
$availableSpace += $tmp;
$size += $tmp;
} else {

View File

@ -35,14 +35,14 @@ $always = array_key_exists('forceIcon', $_GET) ? (bool)$_GET['forceIcon'] : true
if ($file === '') {
//400 Bad Request
\OC_Response::setStatus(400);
\OC_Log::write('core-preview', 'No file parameter was passed', \OC_Log::DEBUG);
\OCP\Util::writeLog('core-preview', 'No file parameter was passed', \OCP\Util::DEBUG);
exit;
}
if ($maxX === 0 || $maxY === 0) {
//400 Bad Request
\OC_Response::setStatus(400);
\OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG);
\OCP\Util::writeLog('core-preview', 'x and/or y set to 0', \OCP\Util::DEBUG);
exit;
}

View File

@ -37,10 +37,11 @@ if (OC::checkUpgrade(false)) {
$l = new \OC_L10N('core');
$eventSource = \OC::$server->createEventSource();
$logger = \OC::$server->getLogger();
$updater = new \OC\Updater(
\OC::$server->getHTTPHelper(),
\OC::$server->getConfig(),
\OC_Log::$object
$logger
);
$incompatibleApps = [];
$disabledThirdPartyApps = [];

View File

@ -105,7 +105,7 @@ class Controller {
public function loadAutoConfig($post) {
if( file_exists($this->autoConfigFile)) {
\OC_Log::write('core', 'Autoconfig file found, setting up ownCloud…', \OC_Log::INFO);
\OCP\Util::writeLog('core', 'Autoconfig file found, setting up ownCloud…', \OCP\Util::INFO);
$AUTOCONFIG = array();
include $this->autoConfigFile;
$post = array_merge ($post, $AUTOCONFIG);

View File

@ -54,7 +54,7 @@ try {
// initialize a dummy memory session
\OC::$server->setSession(new \OC\Session\Memory(''));
$logger = \OC_Log::$object;
$logger = \OC::$server->getLogger();
// Don't do anything if ownCloud has not been installed
if (!OC_Config::getValue('installed', false)) {

View File

@ -73,7 +73,7 @@ class Autoloader {
* Remove "apps/" from inclusion path for smooth migration to mutli app dir
*/
if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
\OC_Log::write('core', 'include path for class "' . $class . '" starts with "apps/"', \OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG);
$paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]);
}
} elseif (strpos($class, 'OC_') === 0) {

View File

@ -572,7 +572,8 @@ class OC {
OC_Util::isSetLocaleWorking();
if (!defined('PHPUNIT_RUN')) {
OC\Log\ErrorHandler::setLogger(OC_Log::$object);
$logger = \OC::$server->getLogger();
OC\Log\ErrorHandler::setLogger($logger);
if (defined('DEBUG') and DEBUG) {
OC\Log\ErrorHandler::register(true);
set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
@ -1029,7 +1030,7 @@ class OC {
}
if (defined("DEBUG") && DEBUG) {
OC_Log::write('core', 'Trying to login from cookie', OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'Trying to login from cookie', \OCP\Util::DEBUG);
}
if(OC_User::userExists($_COOKIE['oc_username'])) {
@ -1041,8 +1042,8 @@ class OC {
OC_Util::redirectToDefaultPage();
// doesn't return
}
OC_Log::write('core', 'Authentication cookie rejected for user ' .
$_COOKIE['oc_username'], OC_Log::WARN);
\OCP\Util::writeLog('core', 'Authentication cookie rejected for user ' .
$_COOKIE['oc_username'], \OCP\Util::WARN);
// if you reach this point you have changed your password
// or you are an attacker
// we can not delete tokens here because users may reach

View File

@ -511,7 +511,7 @@ class OC_App {
}
}
OC_Log::write('core', 'No application directories are marked as writable.', OC_Log::ERROR);
\OCP\Util::writeLog('core', 'No application directories are marked as writable.', \OCP\Util::ERROR);
return null;
}
@ -771,7 +771,7 @@ class OC_App {
foreach (OC::$APPSROOTS as $apps_dir) {
if (!is_readable($apps_dir['path'])) {
OC_Log::write('core', 'unable to read app folder : ' . $apps_dir['path'], OC_Log::WARN);
\OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], \OCP\Util::WARN);
continue;
}
$dh = opendir($apps_dir['path']);
@ -817,7 +817,7 @@ class OC_App {
$info = OC_App::getAppInfo($app);
if (!isset($info['name'])) {
OC_Log::write('core', 'App id "' . $app . '" has no name in appinfo', OC_Log::ERROR);
\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', \OCP\Util::ERROR);
continue;
}
@ -1205,11 +1205,11 @@ class OC_App {
}
return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
} else {
OC_Log::write('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', OC_Log::ERROR);
\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', \OCP\Util::ERROR);
return false;
}
} else {
OC_Log::write('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', OC_Log::ERROR);
\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', \OCP\Util::ERROR);
return false;
}
}

View File

@ -54,7 +54,7 @@ class File implements ICache {
$this->storage = new View('/' . $user->getUID() . '/cache');
return $this->storage;
} else {
\OC_Log::write('core', 'Can\'t get cache storage, user not logged in', \OC_Log::ERROR);
\OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', \OCP\Util::ERROR);
throw new \OC\ForbiddenException('Can\t get cache storage, user not logged in');
}
}

View File

@ -128,7 +128,7 @@ class File extends Node implements IFile {
try {
$target = $partStorage->fopen($internalPartPath, 'wb');
if ($target === false) {
\OC_Log::write('webdav', '\OC\Files\Filesystem::fopen() failed', \OC_Log::ERROR);
\OCP\Util::writeLog('webdav', '\OC\Files\Filesystem::fopen() failed', \OCP\Util::ERROR);
// because we have no clue about the cause we can only throw back a 500/Internal Server Error
throw new Exception('Could not write file contents');
}
@ -192,7 +192,7 @@ class File extends Node implements IFile {
$fileExists = $storage->file_exists($internalPath);
}
if (!$run || $renameOkay === false || $fileExists === false) {
\OC_Log::write('webdav', 'renaming part file to final file failed', \OC_Log::ERROR);
\OCP\Util::writeLog('webdav', 'renaming part file to final file failed', \OCP\Util::ERROR);
throw new Exception('Could not rename part file to final file');
}
} catch (\Exception $e) {
@ -366,7 +366,7 @@ class File extends Node implements IFile {
$renameOkay = $this->fileView->rename($partFile, $targetPath);
$fileExists = $this->fileView->file_exists($targetPath);
if ($renameOkay === false || $fileExists === false) {
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
\OCP\Util::writeLog('webdav', '\OC\Files\Filesystem::rename() failed', \OCP\Util::ERROR);
// only delete if an error occurred and the target file was already created
if ($fileExists) {
// set to null to avoid double-deletion when handling exception

View File

@ -230,7 +230,7 @@ class OC_DB {
try {
$result = $schemaManager->updateDbFromStructure($file);
} catch (Exception $e) {
OC_Log::write('core', 'Failed to update database structure ('.$e.')', OC_Log::FATAL);
\OCP\Util::writeLog('core', 'Failed to update database structure ('.$e.')', \OCP\Util::FATAL);
throw $e;
}
return $result;
@ -247,7 +247,7 @@ class OC_DB {
try {
$result = $schemaManager->simulateUpdateDbFromStructure($file);
} catch (Exception $e) {
OC_Log::write('core', 'Simulated database structure update failed ('.$e.')', OC_Log::FATAL);
\OCP\Util::writeLog('core', 'Simulated database structure update failed ('.$e.')', \OCP\Util::FATAL);
throw $e;
}
return $result;

View File

@ -103,7 +103,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
$statement = $this->adapter->fixupStatement($statement);
if(\OC_Config::getValue( 'log_query', false)) {
\OC_Log::write('core', 'DB prepare : '.$statement, \OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'DB prepare : '.$statement, \OCP\Util::DEBUG);
}
return parent::prepare($statement);
}

View File

@ -66,7 +66,7 @@ class OC_DB_StatementWrapper {
public function execute($input=array()) {
if(OC_Config::getValue( "log_query", false)) {
$params_str = str_replace("\n", " ", var_export($input, true));
OC_Log::write('core', 'DB execute with arguments : '.$params_str, OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'DB execute with arguments : '.$params_str, \OCP\Util::DEBUG);
}
$this->lastArguments = $input;
if (count($input) > 0) {

View File

@ -317,9 +317,9 @@ class OC_Files {
file_put_contents(OC::$SERVERROOT . '/.htaccess', $htaccess);
return OC_Helper::computerFileSize($size);
} else {
OC_Log::write('files',
\OCP\Util::writeLog('files',
'Can\'t write upload limit to ' . OC::$SERVERROOT . '/.htaccess. Please check the file permissions',
OC_Log::WARN);
\OCP\Util::WARN);
}
return false;
}

View File

@ -120,7 +120,7 @@ class Cache {
]);
$this->loadMimetypes();
} catch (\Doctrine\DBAL\DBALException $e) {
\OC_Log::write('core', 'Exception during mimetype insertion: ' . $e->getmessage(), \OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'Exception during mimetype insertion: ' . $e->getmessage(), \OCP\Util::DEBUG);
return -1;
}
}

View File

@ -355,7 +355,7 @@ class Scanner extends BasicEmitter {
// might happen if inserting duplicate while a scanning
// process is running in parallel
// log and ignore
\OC_Log::write('core', 'Exception while scanning file "' . $child . '": ' . $ex->getMessage(), \OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'Exception while scanning file "' . $child . '": ' . $ex->getMessage(), \OCP\Util::DEBUG);
$exceptionOccurred = true;
} catch (\OCP\Lock\LockedException $e) {
if ($this->useTransactions) {

View File

@ -140,12 +140,12 @@ class MountPoint implements IMountPoint {
// the root storage could not be initialized, show the user!
throw new \Exception('The root storage could not be initialized. Please contact your local administrator.', $exception->getCode(), $exception);
} else {
\OC_Log::write('core', $exception->getMessage(), \OC_Log::ERROR);
\OCP\Util::writeLog('core', $exception->getMessage(), \OCP\Util::ERROR);
}
return null;
}
} else {
\OC_Log::write('core', 'storage backend ' . $this->class . ' not found', \OC_Log::ERROR);
\OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', \OCP\Util::ERROR);
$this->invalidStorage = true;
return null;
}

View File

@ -203,17 +203,17 @@ class Local extends \OC\Files\Storage\Common {
$dstParent = dirname($path2);
if (!$this->isUpdatable($srcParent)) {
\OC_Log::write('core', 'unable to rename, source directory is not writable : ' . $srcParent, \OC_Log::ERROR);
\OCP\Util::writeLog('core', 'unable to rename, source directory is not writable : ' . $srcParent, \OCP\Util::ERROR);
return false;
}
if (!$this->isUpdatable($dstParent)) {
\OC_Log::write('core', 'unable to rename, destination directory is not writable : ' . $dstParent, \OC_Log::ERROR);
\OCP\Util::writeLog('core', 'unable to rename, destination directory is not writable : ' . $dstParent, \OCP\Util::ERROR);
return false;
}
if (!$this->file_exists($path1)) {
\OC_Log::write('core', 'unable to rename, file does not exists : ' . $path1, \OC_Log::ERROR);
\OCP\Util::writeLog('core', 'unable to rename, file does not exists : ' . $path1, \OCP\Util::ERROR);
return false;
}

View File

@ -848,7 +848,7 @@ class View {
$hooks[] = 'write';
break;
default:
\OC_Log::write('core', 'invalid mode (' . $mode . ') for ' . $path, \OC_Log::ERROR);
\OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, \OCP\Util::ERROR);
}
return $this->basicOperation('fopen', $path, $hooks, $mode);

View File

@ -111,9 +111,9 @@ class OC_Hook{
if (empty($message)) {
$message = get_class($e);
}
OC_Log::write('hook',
\OCP\Util::writeLog('hook',
'error while running hook (' . $class . '::' . $i["name"] . '): ' . $message,
OC_Log::ERROR);
\OCP\Util::ERROR);
if($e instanceof \OC\ServerNotAvailableException) {
throw $e;
}

View File

@ -480,7 +480,7 @@ class OC_Installer{
return true;
}else{
OC_Log::write('core', 'can\'t remove app '.$name.'. It is not installed.', OC_Log::ERROR);
\OCP\Util::writeLog('core', 'can\'t remove app '.$name.'. It is not installed.', \OCP\Util::ERROR);
return false;
}

View File

@ -1,69 +0,0 @@
<?php
/**
* @author Bart Visscher <bartv@thisnet.nl>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
/**
* logging utilities
*
* Log is saved by default at data/owncloud.log using OC_Log_Owncloud.
* Selecting other backend is done with a config option 'log_type'.
*/
OC_Log::$object = new \OC\Log();
/**
* @deprecated use \OC::$server->getLogger() to get an \OCP\ILogger instance
*/
class OC_Log {
public static $object;
const DEBUG=0;
const INFO=1;
const WARN=2;
const ERROR=3;
const FATAL=4;
static private $level_funcs = array(
self::DEBUG => 'debug',
self::INFO => 'info',
self::WARN => 'warning',
self::ERROR => 'error',
self::FATAL => 'emergency',
);
static public $enabled = true;
static protected $class = null;
/**
* write a message in the log
* @param string $app
* @param string $message
* @param int $level
*/
public static function write($app, $message, $level) {
if (self::$enabled) {
$context = array('app' => $app);
$func = array(self::$object, self::$level_funcs[$level]);
call_user_func($func, $message, $context);
}
}
}

View File

@ -79,7 +79,7 @@ class Log implements ILogger {
* @param array $context
*/
public function emergency($message, array $context = array()) {
$this->log(\OC_Log::FATAL, $message, $context);
$this->log(\OCP\Util::FATAL, $message, $context);
}
/**
@ -92,7 +92,7 @@ class Log implements ILogger {
* @param array $context
*/
public function alert($message, array $context = array()) {
$this->log(\OC_Log::ERROR, $message, $context);
$this->log(\OCP\Util::ERROR, $message, $context);
}
/**
@ -104,7 +104,7 @@ class Log implements ILogger {
* @param array $context
*/
public function critical($message, array $context = array()) {
$this->log(\OC_Log::ERROR, $message, $context);
$this->log(\OCP\Util::ERROR, $message, $context);
}
/**
@ -115,7 +115,7 @@ class Log implements ILogger {
* @param array $context
*/
public function error($message, array $context = array()) {
$this->log(\OC_Log::ERROR, $message, $context);
$this->log(\OCP\Util::ERROR, $message, $context);
}
/**
@ -128,7 +128,7 @@ class Log implements ILogger {
* @param array $context
*/
public function warning($message, array $context = array()) {
$this->log(\OC_Log::WARN, $message, $context);
$this->log(\OCP\Util::WARN, $message, $context);
}
/**
@ -138,7 +138,7 @@ class Log implements ILogger {
* @param array $context
*/
public function notice($message, array $context = array()) {
$this->log(\OC_Log::INFO, $message, $context);
$this->log(\OCP\Util::INFO, $message, $context);
}
/**
@ -150,7 +150,7 @@ class Log implements ILogger {
* @param array $context
*/
public function info($message, array $context = array()) {
$this->log(\OC_Log::INFO, $message, $context);
$this->log(\OCP\Util::INFO, $message, $context);
}
/**
@ -160,7 +160,7 @@ class Log implements ILogger {
* @param array $context
*/
public function debug($message, array $context = array()) {
$this->log(\OC_Log::DEBUG, $message, $context);
$this->log(\OCP\Util::DEBUG, $message, $context);
}
@ -172,7 +172,7 @@ class Log implements ILogger {
* @param array $context
*/
public function log($level, $message, array $context = array()) {
$minLevel = min($this->config->getValue('loglevel', \OC_Log::WARN), \OC_Log::ERROR);
$minLevel = min($this->config->getValue('loglevel', \OCP\Util::WARN), \OCP\Util::ERROR);
$logCondition = $this->config->getValue('log.condition', []);
if (isset($context['app'])) {
@ -185,7 +185,7 @@ class Log implements ILogger {
if(!empty($logCondition)
&& isset($logCondition['apps'])
&& in_array($app, $logCondition['apps'], true)) {
$minLevel = \OC_Log::DEBUG;
$minLevel = \OCP\Util::DEBUG;
}
} else {
@ -233,7 +233,7 @@ class Log implements ILogger {
// if log condition is satisfied change the required log level to DEBUG
if($this->logConditionSatisfied) {
$minLevel = \OC_Log::DEBUG;
$minLevel = \OCP\Util::DEBUG;
}
if ($level >= $minLevel) {

View File

@ -78,8 +78,8 @@ class OC_Log_Owncloud {
$remoteAddr = $request->getRemoteAddress();
// remove username/passwords from URLs before writing the to the log file
$time = $time->format($format);
$minLevel=min($config->getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR);
if($minLevel == OC_Log::DEBUG) {
$minLevel=min($config->getValue( "loglevel", \OCP\Util::WARN ), \OCP\Util::ERROR);
if($minLevel == \OCP\Util::DEBUG) {
$url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '--';
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '--';
$entry = compact('reqId', 'remoteAddr', 'app', 'message', 'level', 'time', 'method', 'url');
@ -107,7 +107,7 @@ class OC_Log_Owncloud {
*/
public static function getEntries($limit=50, $offset=0) {
self::init();
$minLevel=OC_Config::getValue( "loglevel", OC_Log::WARN );
$minLevel=OC_Config::getValue( "loglevel", \OCP\Util::WARN );
$entries = array();
$handle = @fopen(self::$logFile, 'rb');
if ($handle) {

View File

@ -44,6 +44,6 @@ class Rotate extends \OC\BackgroundJob\Job {
$rotatedLogfile = $logfile.'.1';
rename($logfile, $rotatedLogfile);
$msg = 'Log file "'.$logfile.'" was over '.$this->max_log_size.' bytes, moved to "'.$rotatedLogfile.'"';
\OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN);
\OCP\Util::writeLog('OC\Log\Rotate', $msg, \OCP\Util::WARN);
}
}

View File

@ -23,11 +23,11 @@
class OC_Log_Syslog {
static protected $levels = array(
OC_Log::DEBUG => LOG_DEBUG,
OC_Log::INFO => LOG_INFO,
OC_Log::WARN => LOG_WARNING,
OC_Log::ERROR => LOG_ERR,
OC_Log::FATAL => LOG_CRIT,
\OCP\Util::DEBUG => LOG_DEBUG,
\OCP\Util::INFO => LOG_INFO,
\OCP\Util::WARN => LOG_WARNING,
\OCP\Util::ERROR => LOG_ERR,
\OCP\Util::FATAL => LOG_CRIT,
);
/**

View File

@ -39,7 +39,7 @@ class NaturalSort {
// or inject an instance of \OC\NaturalSort_DefaultCollator to force using Owncloud's default collator
if (isset($injectedCollator)) {
$this->collator = $injectedCollator;
\OC_Log::write('core', 'forced use of '.get_class($injectedCollator), \OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'forced use of '.get_class($injectedCollator), \OCP\Util::DEBUG);
}
}

View File

@ -272,7 +272,7 @@ class OCSClient {
$tmp = $data->data->content;
if (is_null($tmp)) {
\OC_Log::write('core', 'No update found at the ownCloud appstore for app ' . $id, \OC_Log::INFO);
\OCP\Util::writeLog('core', 'No update found at the ownCloud appstore for app ' . $id, \OCP\Util::INFO);
return null;
}

View File

@ -135,7 +135,7 @@ class Preview {
&& \OC::$server->getConfig()
->getSystemValue('enable_previews', true)
) {
\OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR);
\OCP\Util::writeLog('core', 'No preview providers exist', \OCP\Util::ERROR);
throw new \Exception('No preview providers');
}
}

View File

@ -46,7 +46,7 @@ abstract class Bitmap extends Provider {
try {
$bp = $this->getResizedPreview($tmpPath, $maxX, $maxY);
} catch (\Exception $e) {
\OC_Log::write('core', 'ImageMagick says: ' . $e->getmessage(), \OC_Log::ERROR);
\OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getmessage(), \OCP\Util::ERROR);
return false;
}

View File

@ -56,7 +56,7 @@ abstract class Office extends Provider {
} catch (\Exception $e) {
unlink($absPath);
unlink($pdfPreview);
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
return false;
}

View File

@ -52,7 +52,7 @@ class SVG extends Provider {
$svg->readImageBlob($content);
$svg->setImageFormat('png32');
} catch (\Exception $e) {
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
return false;
}

View File

@ -66,7 +66,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
$row = sqlsrv_fetch_array($result);
@ -77,7 +77,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
if ($row == null) {
$query = "CREATE LOGIN [".$this->dbuser."] WITH PASSWORD = '".$this->dbpassword."';";
@ -89,7 +89,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
}
}
@ -106,7 +106,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
$row = sqlsrv_fetch_array($result);
@ -117,7 +117,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
if ($row == null) {
$query = "USE [".$this->dbname."]; CREATE USER [".$this->dbuser."] FOR LOGIN [".$this->dbuser."];";
@ -129,7 +129,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
}
@ -142,7 +142,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
}
}
@ -158,7 +158,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
}
@ -179,7 +179,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
$row = sqlsrv_fetch_array($result);
@ -190,7 +190,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
if ($row == null) {
\OC_DB::createDbFromStructure($this->dbDefinitionFile);

View File

@ -103,7 +103,7 @@ class MySQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(mysql_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
$query="GRANT ALL PRIVILEGES ON `$name` . * TO '$user'";

View File

@ -66,7 +66,7 @@ class OCI extends AbstractDatabase {
} else {
$easy_connect_string = '//'.$e_host.'/'.$e_dbname;
}
\OC_Log::write('setup oracle', 'connect string: ' . $easy_connect_string, \OC_Log::DEBUG);
\OCP\Util::writeLog('setup oracle', 'connect string: ' . $easy_connect_string, \OCP\Util::DEBUG);
$connection = @oci_connect($this->dbuser, $this->dbpassword, $easy_connect_string);
if(!$connection) {
$errorMessage = $this->getLastError();
@ -93,7 +93,7 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
$result = oci_execute($stmt);
if($result) {
@ -155,7 +155,7 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
$result = oci_execute($stmt);
@ -178,14 +178,14 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
oci_bind_by_name($stmt, ':un', $name);
$result = oci_execute($stmt);
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
if(! oci_fetch_row($stmt)) {
@ -196,7 +196,7 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
//oci_bind_by_name($stmt, ':un', $name);
$result = oci_execute($stmt);
@ -204,7 +204,7 @@ class OCI extends AbstractDatabase {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
array($query, $name, $password)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
} else { // change password of the existing role
$query = "ALTER USER :un IDENTIFIED BY :pw";
@ -212,7 +212,7 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
oci_bind_by_name($stmt, ':un', $name);
oci_bind_by_name($stmt, ':pw', $password);
@ -220,7 +220,7 @@ class OCI extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
}
// grant necessary roles
@ -229,14 +229,14 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
$result = oci_execute($stmt);
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
array($query, $name, $password)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
}

View File

@ -118,7 +118,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
if(! pg_fetch_row($result)) {
//The database does not exists... let's create it
@ -127,7 +127,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
else {
$query = "REVOKE ALL PRIVILEGES ON DATABASE \"$e_name\" FROM PUBLIC";
@ -144,7 +144,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
if(! pg_fetch_row($result)) {
@ -154,7 +154,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
}
else { // change password of the existing role
@ -163,7 +163,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
\OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
}
}

View File

@ -87,10 +87,10 @@ class Share extends Constants {
}
return true;
}
\OC_Log::write('OCP\Share',
\OCP\Util::writeLog('OCP\Share',
'Sharing backend '.$class.' not registered, '.self::$backendTypes[$itemType]['class']
.' is already registered for '.$itemType,
\OC_Log::WARN);
\OCP\Util::WARN);
}
return false;
}
@ -153,7 +153,7 @@ class Share extends Constants {
$result = $query->execute(array($source, self::SHARE_TYPE_USER));
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
$shares[] = $row['share_with'];
@ -175,7 +175,7 @@ class Share extends Constants {
$result = $query->execute(array($source, self::SHARE_TYPE_GROUP));
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
$usersInGroup = \OC_Group::usersInGroup($row['share_with']);
@ -256,7 +256,7 @@ class Share extends Constants {
$result = $query->execute();
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
@ -464,7 +464,7 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1);
$result = $query->execute(array($token));
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OCP\Util::ERROR);
}
$row = $result->fetchRow();
if ($row === false) {
@ -581,7 +581,7 @@ class Share extends Constants {
if ($backend->isShareTypeAllowed($shareType) === false) {
$message = 'Sharing %s failed, because the backend does not allow shares from type %i';
$message_t = $l->t('Sharing %s failed, because the backend does not allow shares from type %i', array($itemSourceName, $shareType));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareType), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@ -599,14 +599,14 @@ class Share extends Constants {
if (!$path) {
$message = 'Sharing %s failed, because the file does not exist';
$message_t = $l->t('Sharing %s failed, because the file does not exist', array($itemSourceName));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
// verify that the user has share permission
if (!\OC\Files\Filesystem::isSharable($path)) {
$message = 'You are not allowed to share %s';
$message_t = $l->t('You are not allowed to share %s', array($itemSourceName));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@ -619,7 +619,7 @@ class Share extends Constants {
foreach ($mounts as $mount) {
if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
$message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!';
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::ERROR);
throw new \Exception($message);
}
@ -636,13 +636,13 @@ class Share extends Constants {
if ($shareWith == $uidOwner) {
$message = 'Sharing %s failed, because the user %s is the item owner';
$message_t = $l->t('Sharing %s failed, because the user %s is the item owner', array($itemSourceName, $shareWith));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if (!\OC_User::userExists($shareWith)) {
$message = 'Sharing %s failed, because the user %s does not exist';
$message_t = $l->t('Sharing %s failed, because the user %s does not exist', array($itemSourceName, $shareWith));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($shareWithinGroupOnly) {
@ -651,7 +651,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the user '
.'%s is not a member of any groups that %s is a member of';
$message_t = $l->t('Sharing %s failed, because the user %s is not a member of any groups that %s is a member of', array($itemSourceName, $shareWith, $uidOwner));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith, $uidOwner), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith, $uidOwner), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@ -664,7 +664,7 @@ class Share extends Constants {
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
$message = 'Sharing %s failed, because this item is already shared with %s';
$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@ -672,14 +672,14 @@ class Share extends Constants {
if (!\OC_Group::groupExists($shareWith)) {
$message = 'Sharing %s failed, because the group %s does not exist';
$message_t = $l->t('Sharing %s failed, because the group %s does not exist', array($itemSourceName, $shareWith));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($shareWithinGroupOnly && !\OC_Group::inGroup($uidOwner, $shareWith)) {
$message = 'Sharing %s failed, because '
.'%s is not a member of the group %s';
$message_t = $l->t('Sharing %s failed, because %s is not a member of the group %s', array($itemSourceName, $uidOwner, $shareWith));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
// Check if the item source is already shared with the group, either from the same owner or a different user
@ -692,7 +692,7 @@ class Share extends Constants {
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
$message = 'Sharing %s failed, because this item is already shared with %s';
$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@ -731,7 +731,7 @@ class Share extends Constants {
if (\OCP\Util::isPublicLinkPasswordRequired() && empty($shareWith)) {
$message = 'You need to provide a password to create a public link, only protected links are allowed';
$message_t = $l->t('You need to provide a password to create a public link, only protected links are allowed');
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@ -760,7 +760,7 @@ class Share extends Constants {
}
$message = 'Sharing %s failed, because sharing with links is not allowed';
$message_t = $l->t('Sharing %s failed, because sharing with links is not allowed', array($itemSourceName));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
} else if ($shareType === self::SHARE_TYPE_REMOTE) {
$token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER .
@ -787,7 +787,7 @@ class Share extends Constants {
// Future share types need to include their own conditions
$message = 'Share type %s is not valid for %s';
$message_t = $l->t('Share type %s is not valid for %s', array($shareType, $itemSource));
\OC_Log::write('OCP\Share', sprintf($message, $shareType, $itemSource), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $shareType, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@ -988,7 +988,7 @@ class Share extends Constants {
$result = $query->execute(array($status, $itemType, $itemSource, $shareType, $recipient));
if($result === false) {
\OC_Log::write('OCP\Share', 'Couldn\'t set send mail status', \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', \OCP\Util::ERROR);
}
}
@ -1015,7 +1015,7 @@ class Share extends Constants {
$message = 'Setting permissions for %s failed,'
.' because the permissions exceed permissions granted to %s';
$message_t = $l->t('Setting permissions for %s failed, because the permissions exceed permissions granted to %s', array($itemSource, \OC_User::getUser()));
\OC_Log::write('OCP\Share', sprintf($message, $itemSource, \OC_User::getUser()), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, \OC_User::getUser()), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@ -1078,7 +1078,7 @@ class Share extends Constants {
$message = 'Setting permissions for %s failed, because the item was not found';
$message_t = $l->t('Setting permissions for %s failed, because the item was not found', array($itemSource));
\OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@ -1340,20 +1340,20 @@ class Share extends Constants {
if (!(self::$backends[$itemType] instanceof \OCP\Share_Backend)) {
$message = 'Sharing backend %s must implement the interface OCP\Share_Backend';
$message_t = $l->t('Sharing backend %s must implement the interface OCP\Share_Backend', array($class));
\OC_Log::write('OCP\Share', sprintf($message, $class), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
return self::$backends[$itemType];
} else {
$message = 'Sharing backend %s not found';
$message_t = $l->t('Sharing backend %s not found', array($class));
\OC_Log::write('OCP\Share', sprintf($message, $class), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
$message = 'Sharing backend for %s not found';
$message_t = $l->t('Sharing backend for %s not found', array($itemType));
\OC_Log::write('OCP\Share', sprintf($message, $itemType), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@ -1617,9 +1617,9 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, $queryLimit);
$result = $query->execute($queryArgs);
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share',
\OCP\Util::writeLog('OCP\Share',
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
\OC_Log::ERROR);
\OCP\Util::ERROR);
}
$items = array();
$targets = array();
@ -1681,9 +1681,9 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
$parentResult = $query->execute(array($row['parent']));
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share', 'Can\'t select parent: ' .
\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' .
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where,
\OC_Log::ERROR);
\OCP\Util::ERROR);
} else {
$parentRow = $parentResult->fetchRow();
$tmpPath = $parentRow['file_target'];
@ -2124,7 +2124,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the user %s is the original sharer';
$message_t = $l->t('Sharing %s failed, because the user %s is the original sharer', array($itemSourceName, $shareWith));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@ -2136,7 +2136,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
$message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OCP\Util::ERROR);
throw new \Exception($message_t);
} else {
// TODO Don't check if inside folder
@ -2162,7 +2162,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because resharing is not allowed';
$message_t = $l->t('Sharing %s failed, because resharing is not allowed', array($itemSourceName));
\OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
} else {
@ -2175,7 +2175,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the sharing backend for '
.'%s could not find its source';
$message_t = $l->t('Sharing %s failed, because the sharing backend for %s could not find its source', array($itemSource, $itemType));
\OC_Log::write('OCP\Share', sprintf($message, $itemSource, $itemType), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, $itemType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($backend instanceof \OCP\Share_Backend_File_Dependent) {
@ -2190,7 +2190,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the file could not be found in the file cache';
$message_t = $l->t('Sharing %s failed, because the file could not be found in the file cache', array($itemSource));
\OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
} else {

View File

@ -142,12 +142,12 @@ class OC_User {
case 'database':
case 'mysql':
case 'sqlite':
OC_Log::write('core', 'Adding user backend ' . $backend . '.', OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'Adding user backend ' . $backend . '.', \OCP\Util::DEBUG);
self::$_usedBackends[$backend] = new OC_User_Database();
self::getManager()->registerBackend(self::$_usedBackends[$backend]);
break;
default:
OC_Log::write('core', 'Adding default user backend ' . $backend . '.', OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'Adding default user backend ' . $backend . '.', \OCP\Util::DEBUG);
$className = 'OC_USER_' . strToUpper($backend);
self::$_usedBackends[$backend] = new $className();
self::getManager()->registerBackend(self::$_usedBackends[$backend]);
@ -184,10 +184,10 @@ class OC_User {
self::useBackend($backend);
self::$_setupedBackends[] = $i;
} else {
OC_Log::write('core', 'User backend ' . $class . ' already initialized.', OC_Log::DEBUG);
\OCP\Util::writeLog('core', 'User backend ' . $class . ' already initialized.', \OCP\Util::DEBUG);
}
} else {
OC_Log::write('core', 'User backend ' . $class . ' not found.', OC_Log::ERROR);
\OCP\Util::writeLog('core', 'User backend ' . $class . ' not found.', \OCP\Util::ERROR);
}
}
}

View File

@ -211,7 +211,7 @@ class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend {
$result = $query->execute(array($uid));
if (OC_DB::isError($result)) {
OC_Log::write('core', OC_DB::getErrorMessage(), OC_Log::ERROR);
\OCP\Util::writeLog('core', OC_DB::getErrorMessage(), \OCP\Util::ERROR);
return false;
}
@ -288,7 +288,7 @@ class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend {
$query = OC_DB::prepare('SELECT COUNT(*) FROM `*PREFIX*users`');
$result = $query->execute();
if (OC_DB::isError($result)) {
OC_Log::write('core', OC_DB::getErrorMessage(), OC_Log::ERROR);
\OCP\Util::writeLog('core', OC_DB::getErrorMessage(), \OCP\Util::ERROR);
return false;
}
return $result->fetchOne();

View File

@ -1345,7 +1345,7 @@ class OC_Util {
// XCache
if (function_exists('xcache_clear_cache')) {
if (ini_get('xcache.admin.enable_auth')) {
OC_Log::write('core', 'XCache opcode cache will not be cleared because "xcache.admin.enable_auth" is enabled.', \OC_Log::WARN);
\OCP\Util::writeLog('core', 'XCache opcode cache will not be cleared because "xcache.admin.enable_auth" is enabled.', \OCP\Util::WARN);
} else {
@xcache_clear_cache(XC_TYPE_PHP, 0);
}

View File

@ -149,7 +149,7 @@ class Util {
*/
public static function writeLog( $app, $message, $level ) {
// call the internal log class
\OC_LOG::write( $app, $message, $level );
\OCP\Util::writeLog( $app, $message, $level );
}
/**

View File

@ -31,6 +31,6 @@ try {
OC_App::enable(OC_App::cleanAppId((string)$_POST['appid']), $groups);
OC_JSON::success();
} catch (Exception $e) {
OC_Log::write('core', $e->getMessage(), OC_Log::ERROR);
\OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
OC_JSON::error(array("data" => array("message" => $e->getMessage()) ));
}

View File

@ -17,4 +17,4 @@ if (!class_exists('PHPUnit_Framework_TestCase')) {
}
OC_Hook::clear();
OC_Log::$enabled = false;
\OCP\Util::$enabled = false;

View File

@ -40,7 +40,7 @@ class Logger extends TestCase {
$this->config->expects($this->any())
->method('getValue')
->will(($this->returnValueMap([
['loglevel', \OC_Log::WARN, \OC_Log::WARN],
['loglevel', \OCP\Util::WARN, \OCP\Util::WARN],
['log.condition', [], ['apps' => ['files']]]
])));
$logger = $this->logger;