Less deprecated calls to OCP\Util::writeLog
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
8748e636f6
commit
dd34cb7540
|
@ -156,7 +156,7 @@ class File extends Node implements IFile {
|
|||
try {
|
||||
$target = $partStorage->fopen($internalPartPath, 'wb');
|
||||
if ($target === false) {
|
||||
\OCP\Util::writeLog('webdav', '\OC\Files\Filesystem::fopen() failed', \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('\OC\Files\Filesystem::fopen() failed', ['app' => 'webdav']);
|
||||
// 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');
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ class File extends Node implements IFile {
|
|||
$fileExists = $storage->file_exists($internalPath);
|
||||
}
|
||||
if (!$run || $renameOkay === false || $fileExists === false) {
|
||||
\OCP\Util::writeLog('webdav', 'renaming part file to final file failed ($run: ' . ( $run ? 'true' : 'false' ) . ', $renameOkay: ' . ( $renameOkay ? 'true' : 'false' ) . ', $fileExists: ' . ( $fileExists ? 'true' : 'false' ) . ')', \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('renaming part file to final file failed ($run: ' . ( $run ? 'true' : 'false' ) . ', $renameOkay: ' . ( $renameOkay ? 'true' : 'false' ) . ', $fileExists: ' . ( $fileExists ? 'true' : 'false' ) . ')', ['app' => 'webdav']);
|
||||
throw new Exception('Could not rename part file to final file');
|
||||
}
|
||||
} catch (ForbiddenException $ex) {
|
||||
|
@ -474,7 +474,7 @@ class File extends Node implements IFile {
|
|||
$renameOkay = $targetStorage->moveFromStorage($partStorage, $partInternalPath, $targetInternalPath);
|
||||
$fileExists = $targetStorage->file_exists($targetInternalPath);
|
||||
if ($renameOkay === false || $fileExists === false) {
|
||||
\OCP\Util::writeLog('webdav', '\OC\Files\Filesystem::rename() failed', \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('\OC\Files\Filesystem::rename() failed', ['app' => 'webdav']);
|
||||
// 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
|
||||
|
|
|
@ -140,13 +140,14 @@ class RequestHandlerController extends OCSController {
|
|||
}
|
||||
|
||||
// FIXME this should be a method in the user management instead
|
||||
\OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG);
|
||||
$logger = \OC::$server->getLogger();
|
||||
$logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']);
|
||||
\OCP\Util::emitHook(
|
||||
'\OCA\Files_Sharing\API\Server2Server',
|
||||
'preLoginNameUsedAsUserName',
|
||||
array('uid' => &$shareWith)
|
||||
);
|
||||
\OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG);
|
||||
$logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']);
|
||||
|
||||
if (!\OC::$server->getUserManager()->userExists($shareWith)) {
|
||||
throw new OCSException('User does not exists', 400);
|
||||
|
|
|
@ -140,11 +140,7 @@ abstract class LegacyStoragesService {
|
|||
$parts = explode('/', ltrim($rootMountPath, '/'), 3);
|
||||
if (count($parts) < 3) {
|
||||
// something went wrong, skip
|
||||
\OCP\Util::writeLog(
|
||||
'files_external',
|
||||
'Could not parse mount point "' . $rootMountPath . '"',
|
||||
\OCP\Util::ERROR
|
||||
);
|
||||
\OC::$server->getLogger()->error('Could not parse mount point "' . $rootMountPath . '"', ['app' => 'files_external']);
|
||||
continue;
|
||||
}
|
||||
$relativeMountPath = rtrim($parts[2], '/');
|
||||
|
|
|
@ -229,7 +229,7 @@ class File implements \OCP\Share_Backend_File_Dependent {
|
|||
if (isset($fileOwner)) {
|
||||
$source['fileOwner'] = $fileOwner;
|
||||
} else {
|
||||
\OCP\Util::writeLog('files_sharing', "No owner found for reshare", \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('No owner found for reshare', ['app' => 'files_sharing']);
|
||||
}
|
||||
|
||||
return $source;
|
||||
|
|
|
@ -167,9 +167,7 @@ class SharedMount extends MountPoint implements MoveableMount {
|
|||
|
||||
// it is not a file relative to data/user/files
|
||||
if (count($split) < 3 || $split[1] !== 'files') {
|
||||
\OCP\Util::writeLog('file sharing',
|
||||
'Can not strip userid and "files/" from path: ' . $path,
|
||||
\OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('Can not strip userid and "files/" from path: ' . $path, ['app' => 'files_sharing']);
|
||||
throw new \OCA\Files_Sharing\Exceptions\BrokenPath('Path does not start with /user/files', 10);
|
||||
}
|
||||
|
||||
|
@ -198,9 +196,7 @@ class SharedMount extends MountPoint implements MoveableMount {
|
|||
$this->setMountPoint($target);
|
||||
$this->storage->setMountPoint($relTargetPath);
|
||||
} catch (\Exception $e) {
|
||||
\OCP\Util::writeLog('file sharing',
|
||||
'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"',
|
||||
\OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->logException($e, ['app' => 'files_sharing', 'message' => 'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"']);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
|
|
@ -195,7 +195,7 @@ class Trashbin {
|
|||
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
|
||||
$result = $query->execute(array($targetFilename, $timestamp, $targetLocation, $user));
|
||||
if (!$result) {
|
||||
\OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated for the files owner', \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('trash bin database couldn\'t be updated for the files owner', ['app' => 'files_trashbin']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,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', \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']);
|
||||
}
|
||||
|
||||
if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort
|
||||
|
@ -275,7 +275,7 @@ class Trashbin {
|
|||
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
|
||||
$result = $query->execute(array($filename, $timestamp, $location, $owner));
|
||||
if (!$result) {
|
||||
\OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated', \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
|
||||
}
|
||||
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => Filesystem::normalizePath($file_path),
|
||||
'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)));
|
||||
|
@ -391,7 +391,7 @@ class Trashbin {
|
|||
if ($timestamp) {
|
||||
$location = self::getLocation($user, $filename, $timestamp);
|
||||
if ($location === false) {
|
||||
\OCP\Util::writeLog('files_trashbin', 'trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']);
|
||||
} else {
|
||||
// if location no longer exists, restore file in the root directory
|
||||
if ($location !== '/' &&
|
||||
|
@ -763,7 +763,7 @@ class Trashbin {
|
|||
foreach ($files as $file) {
|
||||
if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) {
|
||||
$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)', \OCP\Util::INFO);
|
||||
\OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
|
||||
$availableSpace += $tmp;
|
||||
$size += $tmp;
|
||||
} else {
|
||||
|
|
|
@ -658,7 +658,7 @@ class Storage {
|
|||
//distance between two version too small, mark to delete
|
||||
$toDelete[$key] = $version['path'] . '.v' . $version['version'];
|
||||
$size += $version['size'];
|
||||
\OCP\Util::writeLog('files_versions', 'Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, \OCP\Util::INFO);
|
||||
\OC::$server->getLogger()->info('Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, ['app' => 'files_versions']);
|
||||
} else {
|
||||
$nextVersion = $version['version'] - $step;
|
||||
$prevTimestamp = $version['version'];
|
||||
|
@ -713,7 +713,7 @@ class Storage {
|
|||
// get available disk space for user
|
||||
$user = \OC::$server->getUserManager()->get($uid);
|
||||
if (is_null($user)) {
|
||||
\OCP\Util::writeLog('files_versions', 'Backends provided no user object for ' . $uid, \OCP\Util::ERROR);
|
||||
\OC::$server->getLogger()->error('Backends provided no user object for ' . $uid, ['app' => 'files_versions']);
|
||||
throw new \OC\User\NoUserException('Backends provided no user object for ' . $uid);
|
||||
}
|
||||
|
||||
|
@ -782,12 +782,13 @@ class Storage {
|
|||
$versionsSize = $versionsSize - $sizeOfDeletedVersions;
|
||||
}
|
||||
|
||||
$logger = \OC::$server->getLogger();
|
||||
foreach($toDelete as $key => $path) {
|
||||
\OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED));
|
||||
self::deleteVersion($versionsFileview, $path);
|
||||
\OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED));
|
||||
unset($allVersions[$key]); // update array with the versions we keep
|
||||
\OCP\Util::writeLog('files_versions', "Expire: " . $path, \OCP\Util::INFO);
|
||||
$logger->info('Expire: ' . $path, ['app' => 'files_versions']);
|
||||
}
|
||||
|
||||
// Check if enough space is available after versions are rearranged.
|
||||
|
@ -803,7 +804,7 @@ class Storage {
|
|||
\OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED));
|
||||
self::deleteVersion($versionsFileview, $version['path'] . '.v' . $version['version']);
|
||||
\OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED));
|
||||
\OCP\Util::writeLog('files_versions', 'running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'] , \OCP\Util::INFO);
|
||||
\OC::$server->getLogger()->info('running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'], ['app' => 'files_versions']);
|
||||
$versionsSize -= $version['size'];
|
||||
$availableSpace += $version['size'];
|
||||
next($allVersions);
|
||||
|
|
4
cron.php
4
cron.php
|
@ -41,11 +41,11 @@ try {
|
|||
require_once __DIR__ . '/lib/base.php';
|
||||
|
||||
if (\OCP\Util::needUpgrade()) {
|
||||
\OCP\Util::writeLog('cron', 'Update required, skipping cron', \OCP\Util::DEBUG);
|
||||
\OC::$server->getLogger()->debug('Update required, skipping cron', ['app' => 'cron']);
|
||||
exit;
|
||||
}
|
||||
if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) {
|
||||
\OCP\Util::writeLog('cron', 'We are in maintenance mode, skipping cron', \OCP\Util::DEBUG);
|
||||
\OC::$server->getLogger()->debug('We are in maintenance mode, skipping cron', ['app' => 'cron']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue