aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-03 20:45:02 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-07-03 20:45:02 +0200
commit7959605e4e389ee26705094656f636f23b9cfb8d (patch)
treef16ec80ebaf382629cdadef773c1dcb8d8e6d9e2 /lib
parent3df27a01bea923237cfa9db0c2238e0fb022c06b (diff)
parent43ebf0d1272de80007d016aacd8dcdefc318b78d (diff)
downloadnextcloud-server-7959605e4e389ee26705094656f636f23b9cfb8d.tar.gz
nextcloud-server-7959605e4e389ee26705094656f636f23b9cfb8d.zip
Merge pull request #17378 from owncloud/kill-more-legacy-classes
Kill more legacy classes
Diffstat (limited to 'lib')
-rw-r--r--lib/autoloader.php2
-rw-r--r--lib/base.php9
-rw-r--r--lib/private/app.php24
-rw-r--r--lib/private/cache/file.php2
-rw-r--r--lib/private/connector/sabre/file.php6
-rw-r--r--lib/private/db.php4
-rw-r--r--lib/private/db/connection.php2
-rw-r--r--lib/private/db/statementwrapper.php2
-rw-r--r--lib/private/files.php4
-rw-r--r--lib/private/files/cache/cache.php2
-rw-r--r--lib/private/files/cache/scanner.php2
-rw-r--r--lib/private/files/mount/mountpoint.php4
-rw-r--r--lib/private/files/storage/local.php6
-rw-r--r--lib/private/files/view.php2
-rw-r--r--lib/private/hook.php4
-rw-r--r--lib/private/installer.php20
-rw-r--r--lib/private/legacy/appconfig.php131
-rw-r--r--lib/private/legacy/log.php69
-rw-r--r--lib/private/legacy/search.php70
-rw-r--r--lib/private/legacy/search/provider.php31
-rw-r--r--lib/private/legacy/search/provider/file.php29
-rw-r--r--lib/private/legacy/search/result.php41
-rw-r--r--lib/private/log.php22
-rw-r--r--lib/private/log/owncloud.php6
-rw-r--r--lib/private/log/rotate.php2
-rw-r--r--lib/private/log/syslog.php10
-rw-r--r--lib/private/naturalsort.php2
-rw-r--r--lib/private/ocsclient.php2
-rw-r--r--lib/private/preview.php2
-rw-r--r--lib/private/preview/bitmap.php2
-rw-r--r--lib/private/preview/office.php2
-rw-r--r--lib/private/preview/svg.php2
-rw-r--r--lib/private/setup/mssql.php20
-rw-r--r--lib/private/setup/mysql.php2
-rw-r--r--lib/private/setup/oci.php22
-rw-r--r--lib/private/setup/postgresql.php10
-rw-r--r--lib/private/share/share.php80
-rw-r--r--lib/private/user.php8
-rw-r--r--lib/private/user/database.php4
-rw-r--r--lib/private/util.php8
-rw-r--r--lib/public/util.php6
41 files changed, 154 insertions, 524 deletions
diff --git a/lib/autoloader.php b/lib/autoloader.php
index 7031962fc49..23285f61e73 100644
--- a/lib/autoloader.php
+++ b/lib/autoloader.php
@@ -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) {
diff --git a/lib/base.php b/lib/base.php
index 8812d5698f1..1766fc38f89 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -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
diff --git a/lib/private/app.php b/lib/private/app.php
index e45d9ac07ba..1e49fdc6010 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -168,7 +168,7 @@ class OC_App {
private static function getAppTypes($app) {
//load the cache
if (count(self::$appTypes) == 0) {
- self::$appTypes = OC_Appconfig::getValues(false, 'types');
+ self::$appTypes = \OC::$server->getAppConfig()->getValues(false, 'types');
}
if (isset(self::$appTypes[$app])) {
@@ -190,7 +190,7 @@ class OC_App {
$appTypes = '';
}
- OC_Appconfig::setValue($app, 'types', $appTypes);
+ \OC::$server->getAppConfig()->setValue($app, 'types', $appTypes);
}
/**
@@ -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,11 +817,11 @@ 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;
}
- $enabled = OC_Appconfig::getValue($app, 'enabled', 'no');
+ $enabled = \OC::$server->getAppConfig()->getValue($app, 'enabled', 'no');
$info['groups'] = null;
if ($enabled === 'yes') {
$active = true;
@@ -1173,9 +1173,9 @@ class OC_App {
//set remote/public handlers
$appData = self::getAppInfo($appId);
if (array_key_exists('ocsid', $appData)) {
- OC_Appconfig::setValue($appId, 'ocsid', $appData['ocsid']);
- } elseif(OC_Appconfig::getValue($appId, 'ocsid', null) !== null) {
- OC_Appconfig::deleteKey($appId, 'ocsid');
+ \OC::$server->getAppConfig()->setValue($appId, 'ocsid', $appData['ocsid']);
+ } elseif(\OC::$server->getAppConfig()->getValue($appId, 'ocsid', null) !== null) {
+ \OC::$server->getAppConfig()->deleteKey($appId, 'ocsid');
}
foreach ($appData['remote'] as $name => $path) {
OCP\CONFIG::setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
@@ -1187,7 +1187,7 @@ class OC_App {
self::setAppTypes($appId);
$version = \OC_App::getAppVersion($appId);
- \OC_Appconfig::setValue($appId, 'installed_version', $version);
+ \OC::$server->getAppConfig()->setValue($appId, 'installed_version', $version);
return true;
}
@@ -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;
}
}
diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php
index 69008c7fab5..a433b84d7bf 100644
--- a/lib/private/cache/file.php
+++ b/lib/private/cache/file.php
@@ -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');
}
}
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index e4f53a219d2..18bd3b8d91d 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -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
diff --git a/lib/private/db.php b/lib/private/db.php
index 98df1c73714..1e93eb1892e 100644
--- a/lib/private/db.php
+++ b/lib/private/db.php
@@ -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;
diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php
index 2d8ab550a70..a36bd2649df 100644
--- a/lib/private/db/connection.php
+++ b/lib/private/db/connection.php
@@ -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);
}
diff --git a/lib/private/db/statementwrapper.php b/lib/private/db/statementwrapper.php
index a8fd168d157..4bdaf01f071 100644
--- a/lib/private/db/statementwrapper.php
+++ b/lib/private/db/statementwrapper.php
@@ -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) {
diff --git a/lib/private/files.php b/lib/private/files.php
index 17e2e5a398f..b61d09d8a0c 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -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;
}
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 680398e383f..8cf097421d4 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -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;
}
}
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php
index 50609e1e20e..7c65c721352 100644
--- a/lib/private/files/cache/scanner.php
+++ b/lib/private/files/cache/scanner.php
@@ -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) {
diff --git a/lib/private/files/mount/mountpoint.php b/lib/private/files/mount/mountpoint.php
index f1e492c8603..2871bbd9083 100644
--- a/lib/private/files/mount/mountpoint.php
+++ b/lib/private/files/mount/mountpoint.php
@@ -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;
}
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index 839fb81d5a0..b7272b7d1f0 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -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;
}
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 1706818f03e..cb3c05d2bca 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -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);
diff --git a/lib/private/hook.php b/lib/private/hook.php
index 188c3d65acb..faf5495b646 100644
--- a/lib/private/hook.php
+++ b/lib/private/hook.php
@@ -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;
}
diff --git a/lib/private/installer.php b/lib/private/installer.php
index bd214be5667..37af8d0edcb 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -114,7 +114,7 @@ class OC_Installer{
//install the database
if(is_file($basedir.'/appinfo/database.xml')) {
- if (OC_Appconfig::getValue($info['id'], 'installed_version') === null) {
+ if (\OC::$server->getAppConfig()->getValue($info['id'], 'installed_version') === null) {
OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml');
} else {
OC_DB::updateDbFromStructure($basedir.'/appinfo/database.xml');
@@ -127,8 +127,8 @@ class OC_Installer{
}
//set the installed version
- OC_Appconfig::setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
- OC_Appconfig::setValue($info['id'], 'enabled', 'no');
+ \OC::$server->getAppConfig()->setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
+ \OC::$server->getAppConfig()->setValue($info['id'], 'enabled', 'no');
//set remote/public handelers
foreach($info['remote'] as $name=>$path) {
@@ -151,7 +151,7 @@ class OC_Installer{
* Checks whether or not an app is installed, i.e. registered in apps table.
*/
public static function isInstalled( $app ) {
- return (OC_Appconfig::getValue($app, "installed_version") !== null);
+ return (\OC::$server->getAppConfig()->getValue($app, "installed_version") !== null);
}
/**
@@ -184,7 +184,7 @@ class OC_Installer{
* -# setting the installed version
*
* upgrade.php can determine the current installed version of the app using
- * "OC_Appconfig::getValue($appid, 'installed_version')"
+ * "\OC::$server->getAppConfig()->getValue($appid, 'installed_version')"
*/
public static function updateApp( $info=array(), $isShipped=false) {
list($extractDir, $path) = self::downloadApp($info);
@@ -387,7 +387,7 @@ class OC_Installer{
return false;
}
- $ocsid=OC_Appconfig::getValue( $app, 'ocsid', '');
+ $ocsid=\OC::$server->getAppConfig()->getValue( $app, 'ocsid', '');
if($ocsid<>'') {
$ocsClient = new OCSClient(
@@ -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;
}
@@ -503,7 +503,7 @@ class OC_Installer{
$enabled = isset($info['default_enable']);
if( $enabled ) {
OC_Installer::installShippedApp($filename);
- OC_Appconfig::setValue($filename, 'enabled', 'yes');
+ \OC::$server->getAppConfig()->setValue($filename, 'enabled', 'yes');
}
}
}
@@ -533,9 +533,9 @@ class OC_Installer{
if (is_null($info)) {
return false;
}
- OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
+ \OC::$server->getAppConfig()->setValue($app, 'installed_version', OC_App::getAppVersion($app));
if (array_key_exists('ocsid', $info)) {
- OC_Appconfig::setValue($app, 'ocsid', $info['ocsid']);
+ \OC::$server->getAppConfig()->setValue($app, 'ocsid', $info['ocsid']);
}
//set remote/public handlers
diff --git a/lib/private/legacy/appconfig.php b/lib/private/legacy/appconfig.php
deleted file mode 100644
index 54e568d9ff6..00000000000
--- a/lib/private/legacy/appconfig.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
- * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
- * @author Vincent Petry <pvince81@owncloud.com>
- *
- * @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/>
- *
- */
-
-/**
- * This class provides an easy way for apps to store config values in the
- * database.
- *
- * @deprecated use \OC::$server->getAppConfig() to get an \OCP\IAppConfig instance
- */
-class OC_Appconfig {
- /**
- * @return \OCP\IAppConfig
- */
- private static function getAppConfig() {
- return \OC::$server->getAppConfig();
- }
-
- /**
- * Get all apps using the config
- * @return array an array of app ids
- *
- * This function returns a list of all apps that have at least one
- * entry in the appconfig table.
- */
- public static function getApps() {
- return self::getAppConfig()->getApps();
- }
-
- /**
- * Get the available keys for an app
- * @param string $app the app we are looking for
- * @return array an array of key names
- *
- * This function gets all keys of an app. Please note that the values are
- * not returned.
- */
- public static function getKeys($app) {
- return self::getAppConfig()->getKeys($app);
- }
-
- /**
- * Gets the config value
- * @param string $app app
- * @param string $key key
- * @param string $default = null, default value if the key does not exist
- * @return string the value or $default
- *
- * This function gets a value from the appconfig table. If the key does
- * not exist the default value will be returned
- */
- public static function getValue($app, $key, $default = null) {
- return self::getAppConfig()->getValue($app, $key, $default);
- }
-
- /**
- * check if a key is set in the appconfig
- * @param string $app
- * @param string $key
- * @return bool
- */
- public static function hasKey($app, $key) {
- return self::getAppConfig()->hasKey($app, $key);
- }
-
- /**
- * sets a value in the appconfig
- * @param string $app app
- * @param string $key key
- * @param string $value value
- *
- * Sets a value. If the key did not exist before it will be created.
- */
- public static function setValue($app, $key, $value) {
- self::getAppConfig()->setValue($app, $key, $value);
- }
-
- /**
- * Deletes a key
- * @param string $app app
- * @param string $key key
- *
- * Deletes a key.
- */
- public static function deleteKey($app, $key) {
- self::getAppConfig()->deleteKey($app, $key);
- }
-
- /**
- * Remove app from appconfig
- * @param string $app app
- *
- * Removes all keys in appconfig belonging to the app.
- */
- public static function deleteApp($app) {
- self::getAppConfig()->deleteApp($app);
- }
-
- /**
- * get multiply values, either the app or key can be used as wildcard by setting it to false
- *
- * @param string|false $app
- * @param string|false $key
- * @return array
- */
- public static function getValues($app, $key) {
- return self::getAppConfig()->getValues($app, $key);
- }
-}
diff --git a/lib/private/legacy/log.php b/lib/private/legacy/log.php
deleted file mode 100644
index f9a2044da77..00000000000
--- a/lib/private/legacy/log.php
+++ /dev/null
@@ -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);
- }
- }
-}
diff --git a/lib/private/legacy/search.php b/lib/private/legacy/search.php
deleted file mode 100644
index d113412dc4a..00000000000
--- a/lib/private/legacy/search.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * @author Andrew Brown <andrew@casabrown.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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/>
- *
- */
-
-/**
- * provides an interface to all search providers
- *
- * @deprecated use \OCP\ISearch / \OC\Search instead
- */
-class OC_Search {
- /**
- * @return \OCP\ISearch
- */
- private static function getSearch() {
- return \OC::$server->getSearch();
- }
-
- /**
- * Search all providers for $query
- * @param string $query
- * @return array An array of OCP\Search\Result's
- */
- public static function search($query) {
- return self::getSearch()->search($query);
- }
-
- /**
- * Register a new search provider to search with
- * @param string $class class name of a OCP\Search\Provider
- * @param array $options optional
- */
- public static function registerProvider($class, $options = array()) {
- return self::getSearch()->registerProvider($class, $options);
- }
-
- /**
- * Remove one existing search provider
- * @param string $provider class name of a OCP\Search\Provider
- */
- public static function removeProvider($provider) {
- return self::getSearch()->removeProvider($provider);
- }
-
- /**
- * Remove all registered search providers
- */
- public static function clearProviders() {
- return self::getSearch()->clearProviders();
- }
-
-}
diff --git a/lib/private/legacy/search/provider.php b/lib/private/legacy/search/provider.php
deleted file mode 100644
index e411673fe0e..00000000000
--- a/lib/private/legacy/search/provider.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * @author Andrew Brown <andrew@casabrown.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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/>
- *
- */
-
-/**
- * Class OC_Search_Provider
- *
- * @deprecated use \OCP\Search\Provider instead
- */
-abstract class OC_Search_Provider extends \OCP\Search\Provider {
-
-}
diff --git a/lib/private/legacy/search/provider/file.php b/lib/private/legacy/search/provider/file.php
deleted file mode 100644
index f895ce8e07e..00000000000
--- a/lib/private/legacy/search/provider/file.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * @author Andrew Brown <andrew@casabrown.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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/>
- *
- */
-
-/**
- * @deprecated use \OC\Search\Provider\File instead
- */
-class OC_Search_Provider_File extends \OC\Search\Provider\File {
-
-}
diff --git a/lib/private/legacy/search/result.php b/lib/private/legacy/search/result.php
deleted file mode 100644
index 73ee91f089d..00000000000
--- a/lib/private/legacy/search/result.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * @author Andrew Brown <andrew@casabrown.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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/>
- *
- */
-
-/**
- * @deprecated use \OCP\Search\Result instead
- */
-class OC_Search_Result extends \OCP\Search\Result {
- /**
- * Create a new search result
- * @param string $id unique identifier from application: '[app_name]/[item_identifier_in_app]'
- * @param string $name displayed text of result
- * @param string $link URL to the result within its app
- * @param string $type @deprecated because it is now set in \OC\Search\Result descendants
- */
- public function __construct($id = null, $name = null, $link = null, $type = null) {
- $this->id = $id;
- $this->name = $name;
- $this->link = $link;
- $this->type = $type;
- }
-}
diff --git a/lib/private/log.php b/lib/private/log.php
index dd5cb6efbb9..3c0e7b45d1b 100644
--- a/lib/private/log.php
+++ b/lib/private/log.php
@@ -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) {
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php
index 01112ef7f9d..c98f21208bb 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -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) {
diff --git a/lib/private/log/rotate.php b/lib/private/log/rotate.php
index a8882e0e2f1..4572a9904d2 100644
--- a/lib/private/log/rotate.php
+++ b/lib/private/log/rotate.php
@@ -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);
}
}
diff --git a/lib/private/log/syslog.php b/lib/private/log/syslog.php
index 863d1d6c201..cb42c1dc011 100644
--- a/lib/private/log/syslog.php
+++ b/lib/private/log/syslog.php
@@ -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,
);
/**
diff --git a/lib/private/naturalsort.php b/lib/private/naturalsort.php
index 310a029b6de..26b9cec6cf1 100644
--- a/lib/private/naturalsort.php
+++ b/lib/private/naturalsort.php
@@ -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);
}
}
diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php
index 18ba4cea003..d6593e5089a 100644
--- a/lib/private/ocsclient.php
+++ b/lib/private/ocsclient.php
@@ -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;
}
diff --git a/lib/private/preview.php b/lib/private/preview.php
index cc954bc3653..5dcab476a4f 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -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');
}
}
diff --git a/lib/private/preview/bitmap.php b/lib/private/preview/bitmap.php
index 12ad4f020eb..065425c9a1d 100644
--- a/lib/private/preview/bitmap.php
+++ b/lib/private/preview/bitmap.php
@@ -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;
}
diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php
index f72c5def35f..30398147aa6 100644
--- a/lib/private/preview/office.php
+++ b/lib/private/preview/office.php
@@ -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;
}
diff --git a/lib/private/preview/svg.php b/lib/private/preview/svg.php
index 4e3cba576fb..f8318e9a69a 100644
--- a/lib/private/preview/svg.php
+++ b/lib/private/preview/svg.php
@@ -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;
}
diff --git a/lib/private/setup/mssql.php b/lib/private/setup/mssql.php
index f8815259af4..0ae02d6cbcc 100644
--- a/lib/private/setup/mssql.php
+++ b/lib/private/setup/mssql.php
@@ -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);
diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php
index b9246a915a6..c01ff724b80 100644
--- a/lib/private/setup/mysql.php
+++ b/lib/private/setup/mysql.php
@@ -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'";
diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php
index 791dc7232f5..d46d5529da0 100644
--- a/lib/private/setup/oci.php
+++ b/lib/private/setup/oci.php
@@ -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);
}
}
diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php
index 597e38f43a6..c8fd3b98fe4 100644
--- a/lib/private/setup/postgresql.php
+++ b/lib/private/setup/postgresql.php
@@ -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);
}
}
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index af7f78b9ff5..14909c6f8ce 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -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;
}
@@ -102,7 +102,7 @@ class Share extends Constants {
* The Share API is enabled by default if not configured
*/
public static function isEnabled() {
- if (\OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes') == 'yes') {
return true;
}
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);
}
}
@@ -703,7 +703,7 @@ class Share extends Constants {
$shareWith['users'] = array_diff(\OC_Group::usersInGroup($group), array($uidOwner));
} else if ($shareType === self::SHARE_TYPE_LINK) {
$updateExistingShare = false;
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes') == 'yes') {
// when updating a link share
// FIXME Don't delete link if we update it
@@ -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);
}
@@ -1365,7 +1365,7 @@ class Share extends Constants {
*/
public static function isResharingAllowed() {
if (!isset(self::$isResharingAllowed)) {
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes') == 'yes') {
self::$isResharingAllowed = true;
} else {
self::$isResharingAllowed = false;
@@ -1509,7 +1509,7 @@ class Share extends Constants {
$queryArgs = array($itemType);
}
}
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
$where .= ' AND `share_type` != ?';
$queryArgs[] = self::SHARE_TYPE_LINK;
}
@@ -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 {
@@ -2504,7 +2504,7 @@ class Share extends Constants {
* @return bool
*/
public static function shareWithGroupMembersOnly() {
- $value = \OC_Appconfig::getValue('core', 'shareapi_only_share_with_group_members', 'no');
+ $value = \OC::$server->getAppConfig()->getValue('core', 'shareapi_only_share_with_group_members', 'no');
return ($value === 'yes') ? true : false;
}
diff --git a/lib/private/user.php b/lib/private/user.php
index 7c3cb528a9a..1d8b89e273f 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -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);
}
}
}
diff --git a/lib/private/user/database.php b/lib/private/user/database.php
index 3cf73f939e5..081066398c0 100644
--- a/lib/private/user/database.php
+++ b/lib/private/user/database.php
@@ -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();
diff --git a/lib/private/util.php b/lib/private/util.php
index 1558a06f7fc..51815a0ae3d 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -212,9 +212,9 @@ class OC_Util {
* @return boolean
*/
public static function isSharingDisabledForUser() {
- if (\OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
$user = \OCP\User::getUser();
- $groupsList = \OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', '');
+ $groupsList = \OC::$server->getAppConfig()->getValue('core', 'shareapi_exclude_groups_list', '');
$excludedGroups = explode(',', $groupsList);
$usersGroups = \OC_Group::getUserGroups($user);
if (!empty($usersGroups)) {
@@ -999,7 +999,7 @@ class OC_Util {
if (isset($_REQUEST['redirect_url']) && strpos($_REQUEST['redirect_url'], '@') === false) {
$location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url']));
} else {
- $defaultPage = OC_Appconfig::getValue('core', 'defaultpage');
+ $defaultPage = \OC::$server->getAppConfig()->getValue('core', 'defaultpage');
if ($defaultPage) {
$location = $urlGenerator->getAbsoluteURL($defaultPage);
} else {
@@ -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);
}
diff --git a/lib/public/util.php b/lib/public/util.php
index 087bb639618..06ad5de60ca 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -78,7 +78,7 @@ class Util {
public static function setChannel($channel) {
//Flush timestamp to reload version.php
\OC::$server->getSession()->set('OC_Version_Timestamp', 0);
- return \OC::$server->getAppConfig()->setValue('core', 'OC_Channel', $channel);
+ \OC::$server->getAppConfig()->setValue('core', 'OC_Channel', $channel);
}
/**
@@ -148,8 +148,8 @@ class Util {
* @since 4.0.0
*/
public static function writeLog( $app, $message, $level ) {
- // call the internal log class
- \OC_LOG::write( $app, $message, $level );
+ $context = ['app' => $app];
+ \OC::$server->getLogger()->log($level, $message, $context);
}
/**