Browse Source

Merge pull request #17378 from owncloud/kill-more-legacy-classes

Kill more legacy classes
remotes/origin/handlebars-approach
Morris Jobke 10 years ago
parent
commit
7959605e4e
  1. 2
      apps/files_sharing/ajax/publicpreview.php
  2. 8
      apps/files_trashbin/lib/trashbin.php
  3. 4
      core/ajax/preview.php
  4. 3
      core/ajax/update.php
  5. 2
      core/setup/controller.php
  6. 2
      cron.php
  7. 2
      lib/autoloader.php
  8. 9
      lib/base.php
  9. 24
      lib/private/app.php
  10. 2
      lib/private/cache/file.php
  11. 6
      lib/private/connector/sabre/file.php
  12. 4
      lib/private/db.php
  13. 2
      lib/private/db/connection.php
  14. 2
      lib/private/db/statementwrapper.php
  15. 4
      lib/private/files.php
  16. 2
      lib/private/files/cache/cache.php
  17. 2
      lib/private/files/cache/scanner.php
  18. 4
      lib/private/files/mount/mountpoint.php
  19. 6
      lib/private/files/storage/local.php
  20. 2
      lib/private/files/view.php
  21. 4
      lib/private/hook.php
  22. 20
      lib/private/installer.php
  23. 131
      lib/private/legacy/appconfig.php
  24. 69
      lib/private/legacy/log.php
  25. 70
      lib/private/legacy/search.php
  26. 31
      lib/private/legacy/search/provider.php
  27. 29
      lib/private/legacy/search/provider/file.php
  28. 41
      lib/private/legacy/search/result.php
  29. 22
      lib/private/log.php
  30. 6
      lib/private/log/owncloud.php
  31. 2
      lib/private/log/rotate.php
  32. 10
      lib/private/log/syslog.php
  33. 2
      lib/private/naturalsort.php
  34. 2
      lib/private/ocsclient.php
  35. 2
      lib/private/preview.php
  36. 2
      lib/private/preview/bitmap.php
  37. 2
      lib/private/preview/office.php
  38. 2
      lib/private/preview/svg.php
  39. 20
      lib/private/setup/mssql.php
  40. 2
      lib/private/setup/mysql.php
  41. 22
      lib/private/setup/oci.php
  42. 10
      lib/private/setup/postgresql.php
  43. 80
      lib/private/share/share.php
  44. 8
      lib/private/user.php
  45. 4
      lib/private/user/database.php
  46. 8
      lib/private/util.php
  47. 6
      lib/public/util.php
  48. 2
      settings/ajax/enableapp.php
  49. 2
      settings/ajax/setquota.php
  50. 1
      tests/bootstrap.php
  51. 1
      tests/lib/appconfig.php
  52. 2
      tests/lib/logger.php
  53. 32
      tests/lib/share/share.php

2
apps/files_sharing/ajax/publicpreview.php

@ -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;
}

8
apps/files_trashbin/lib/trashbin.php

@ -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 {

4
core/ajax/preview.php

@ -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;
}

3
core/ajax/update.php

@ -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 = [];

2
core/setup/controller.php

@ -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);

2
cron.php

@ -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)) {

2
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) {

9
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

24
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;
}
}

2
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');
}
}

6
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

4
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;

2
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);
}

2
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) {

4
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;
}

2
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;
}
}

2
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) {

4
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;
}

6
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;
}

2
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);

4
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;
}

20
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

131
lib/private/legacy/appconfig.php

@ -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);
}
}

69
lib/private/legacy/log.php

@ -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);
}
}
}

70
lib/private/legacy/search.php

@ -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();
}
}

31
lib/private/legacy/search/provider.php

@ -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 {
}

29
lib/private/legacy/search/provider/file.php

@ -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 {
}

41
lib/private/legacy/search/result.php

@ -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;
}
}

22
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) {

6
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) {

2
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);
}
}

10
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,
);
/**

2
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);
}
}

2
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;
}

2
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');
}
}

2
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;
}

2
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;
}

2
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;
}

20
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);

2
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'";

22
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);
}
}

10
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);
}
}
}

80
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;
}

8
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);
}
}
}

4
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();

8
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);
}

6
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);
}
/**

2
settings/ajax/enableapp.php

@ -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()) ));
}

2
settings/ajax/setquota.php

@ -54,7 +54,7 @@ if($username) {
if($quota === 'default') {//'default' as default quota makes no sense
$quota='none';
}
OC_Appconfig::setValue('files', 'default_quota', $quota);
\OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota);
}
OC_JSON::success(array("data" => array( "username" => $username , 'quota' => $quota)));

1
tests/bootstrap.php

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

1
tests/lib/appconfig.php

@ -68,7 +68,6 @@ class Test_Appconfig extends \Test\TestCase {
public function getAppConfigs() {
return [
['\OC_Appconfig'],
[new \OC\AppConfig(\OC::$server->getDatabaseConnection())],
];
}

2
tests/lib/logger.php

@ -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;

32
tests/lib/share/share.php

@ -74,8 +74,8 @@ class Test_Share extends \Test\TestCase {
OCP\Share::registerBackend('test', 'Test_Share_Backend');
OC_Hook::clear('OCP\\Share');
OC::registerShareHooks();
$this->resharing = OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes');
OC_Appconfig::setValue('core', 'shareapi_allow_resharing', 'yes');
$this->resharing = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes');
\OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
// 20 Minutes in the past, 20 minutes in the future.
$now = time();
@ -87,7 +87,7 @@ class Test_Share extends \Test\TestCase {
protected function tearDown() {
$query = OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?');
$query->execute(array('test'));
OC_Appconfig::setValue('core', 'shareapi_allow_resharing', $this->resharing);
\OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', $this->resharing);
OC_User::deleteUser($this->user1);
OC_User::deleteUser($this->user2);
@ -486,8 +486,8 @@ class Test_Share extends \Test\TestCase {
);
// exclude group2 from sharing
\OC_Appconfig::setValue('core', 'shareapi_exclude_groups_list', $this->group2);
\OC_Appconfig::setValue('core', 'shareapi_exclude_groups', "yes");
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', $this->group2);
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', "yes");
OC_User::setUserId($this->user4);
@ -496,8 +496,8 @@ class Test_Share extends \Test\TestCase {
$this->assertSame(\OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_SHARE, $share['permissions'],
'Failed asserting that user 4 is excluded from re-sharing');
\OC_Appconfig::deleteKey('core', 'shareapi_exclude_groups_list');
\OC_Appconfig::deleteKey('core', 'shareapi_exclude_groups');
\OC::$server->getAppConfig()->deleteKey('core', 'shareapi_exclude_groups_list');
\OC::$server->getAppConfig()->deleteKey('core', 'shareapi_exclude_groups');
}
@ -569,8 +569,8 @@ class Test_Share extends \Test\TestCase {
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
$policy = OC_Appconfig::getValue('core', 'shareapi_only_share_with_group_members', 'no');
OC_Appconfig::setValue('core', 'shareapi_only_share_with_group_members', 'yes');
$policy = \OC::$server->getAppConfig()->getValue('core', 'shareapi_only_share_with_group_members', 'no');
\OC::$server->getAppConfig()->setValue('core', 'shareapi_only_share_with_group_members', 'yes');
$message = 'Sharing test.txt failed, because '.$this->user1.' is not a member of the group '.$this->group2;
try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group2, \OCP\Constants::PERMISSION_READ);
@ -578,7 +578,7 @@ class Test_Share extends \Test\TestCase {
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
OC_Appconfig::setValue('core', 'shareapi_only_share_with_group_members', $policy);
\OC::$server->getAppConfig()->setValue('core', 'shareapi_only_share_with_group_members', $policy);
// Valid share
$this->shareUserOneTestFileWithGroupOne();
@ -1224,9 +1224,9 @@ class Test_Share extends \Test\TestCase {
public function testClearExpireDateWhileEnforced() {
OC_User::setUserId($this->user1);
\OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes');
\OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2');
\OC_Appconfig::setValue('core', 'shareapi_enforce_expire_date', 'yes');
\OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'yes');
\OC::$server->getAppConfig()->setValue('core', 'shareapi_expire_after_n_days', '2');
\OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'yes');
$token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType(
@ -1247,9 +1247,9 @@ class Test_Share extends \Test\TestCase {
$this->assertTrue($setExpireDateFailed);
\OC_Appconfig::deleteKey('core', 'shareapi_default_expire_date');
\OC_Appconfig::deleteKey('core', 'shareapi_expire_after_n_days');
\OC_Appconfig::deleteKey('core', 'shareapi_enforce_expire_date');
\OC::$server->getAppConfig()->deleteKey('core', 'shareapi_default_expire_date');
\OC::$server->getAppConfig()->deleteKey('core', 'shareapi_expire_after_n_days');
\OC::$server->getAppConfig()->deleteKey('core', 'shareapi_enforce_expire_date');
}
/**

Loading…
Cancel
Save