move log constants to ILogger
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
12c5db9032
commit
38a90130ce
74 changed files with 412 additions and 298 deletions
|
@ -108,14 +108,14 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
*/
|
||||
public function logException(\Exception $ex) {
|
||||
$exceptionClass = get_class($ex);
|
||||
$level = \OCP\Util::FATAL;
|
||||
$level = ILogger::FATAL;
|
||||
if (isset($this->nonFatalExceptions[$exceptionClass]) ||
|
||||
(
|
||||
$exceptionClass === ServiceUnavailable::class &&
|
||||
$ex->getMessage() === 'System in maintenance mode.'
|
||||
)
|
||||
) {
|
||||
$level = \OCP\Util::DEBUG;
|
||||
$level = ILogger::DEBUG;
|
||||
}
|
||||
|
||||
$this->logger->logException($ex, [
|
||||
|
|
|
@ -374,7 +374,7 @@ class KeyManager {
|
|||
} catch (\Exception $e) {
|
||||
$this->log->logException($e, [
|
||||
'message' => 'Could not decrypt the private key from user "' . $uid . '"" during login. Assume password change on the user back-end.',
|
||||
'level' => \OCP\Util::WARN,
|
||||
'level' => ILogger::WARN,
|
||||
'app' => 'encryption',
|
||||
]);
|
||||
return false;
|
||||
|
|
|
@ -42,6 +42,7 @@ use OCP\Federation\ICloudIdManager;
|
|||
use OCP\Files\StorageInvalidException;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use OCP\ISession;
|
||||
use OCP\IUserSession;
|
||||
|
@ -165,7 +166,7 @@ class MountPublicLinkController extends Controller {
|
|||
$this->federatedShareProvider->create($share);
|
||||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::WARN,
|
||||
'level' => ILogger::WARN,
|
||||
'app' => 'federatedfilesharing',
|
||||
]);
|
||||
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
|
||||
|
|
|
@ -217,7 +217,7 @@ class RequestHandlerController extends OCSController {
|
|||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Server can not add remote share.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_sharing'
|
||||
]);
|
||||
throw new OCSException('internal server error, was not able to add share from ' . $remote, 500);
|
||||
|
|
|
@ -266,7 +266,7 @@ class FederatedShareProvider implements IShareProvider {
|
|||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Failed to notify remote server of federated share, removing share.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'federatedfilesharing',
|
||||
]);
|
||||
$failure = true;
|
||||
|
|
|
@ -194,14 +194,14 @@ class GetSharedSecret extends Job {
|
|||
$status = -1; // There is no status code if we could not connect
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Could not connect to ' . $target,
|
||||
'level' => \OCP\Util::INFO,
|
||||
'level' => ILogger::INFO,
|
||||
'app' => 'federation',
|
||||
]);
|
||||
} catch (RingException $e) {
|
||||
$status = -1; // There is no status code if we could not connect
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Could not connect to ' . $target,
|
||||
'level' => \OCP\Util::INFO,
|
||||
'level' => ILogger::INFO,
|
||||
'app' => 'federation',
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
@ -72,7 +72,7 @@ class AddServerMiddleware extends Middleware {
|
|||
throw $exception;
|
||||
}
|
||||
$this->logger->logException($exception, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => $this->appName,
|
||||
]);
|
||||
if ($exception instanceof HintException) {
|
||||
|
|
|
@ -50,7 +50,7 @@ class SyncJob extends TimedJob {
|
|||
if ($ex instanceof \Exception) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => "Error while syncing $url.",
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'fed-sync',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ class TrustedServers {
|
|||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'No Nextcloud server.',
|
||||
'level' => \OCP\Util::DEBUG,
|
||||
'level' => ILogger::DEBUG,
|
||||
'app' => 'federation',
|
||||
]);
|
||||
return false;
|
||||
|
|
|
@ -52,6 +52,7 @@ use OCP\Files\Notify\IChange;
|
|||
use OCP\Files\Notify\IRenameChange;
|
||||
use OCP\Files\Storage\INotifyStorage;
|
||||
use OCP\Files\StorageNotAvailableException;
|
||||
use OCP\ILogger;
|
||||
use OCP\Util;
|
||||
|
||||
class SMB extends Common implements INotifyStorage {
|
||||
|
@ -202,7 +203,7 @@ class SMB extends Common implements INotifyStorage {
|
|||
$this->remove($target);
|
||||
$result = $this->share->rename($absoluteSource, $absoluteTarget);
|
||||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, ['level' => Util::WARN]);
|
||||
\OC::$server->getLogger()->logException($e, ['level' => ILogger::WARN]);
|
||||
return false;
|
||||
}
|
||||
unset($this->statCache[$absoluteSource], $this->statCache[$absoluteTarget]);
|
||||
|
|
|
@ -45,6 +45,7 @@ use Icewind\Streams\CallbackWrapper;
|
|||
use Icewind\Streams\IteratorDirectory;
|
||||
use OC\Files\ObjectStore\SwiftFactory;
|
||||
use OCP\Files\StorageBadConfigException;
|
||||
use OCP\ILogger;
|
||||
use OpenStack\Common\Error\BadResponseError;
|
||||
use OpenStack\ObjectStore\v1\Models\StorageObject;
|
||||
|
||||
|
@ -132,7 +133,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
// Expected response is "404 Not Found", so only log if it isn't
|
||||
if ($e->getResponse()->getStatusCode() !== 404) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
}
|
||||
|
@ -225,7 +226,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->objectCache->remove($path);
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
@ -269,7 +270,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->objectCache->remove($path . '/');
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
@ -307,7 +308,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
return IteratorDirectory::wrap($files);
|
||||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
@ -331,7 +332,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
}
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
@ -385,7 +386,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
} catch (BadResponseError $e) {
|
||||
if ($e->getResponse()->getStatusCode() !== 404) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
throw $e;
|
||||
|
@ -409,7 +410,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
return $this->objectStore->readObject($path);
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
@ -496,7 +497,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->objectCache->remove($path2 . '/');
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
@ -513,7 +514,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->objectCache->remove($path2 . '/');
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
namespace OCA\Files_External\Service;
|
||||
|
||||
use OCA\Files_External\Lib\StorageConfig;
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* Read mount config from legacy mount.json
|
||||
|
@ -190,7 +191,7 @@ abstract class LegacyStoragesService {
|
|||
// don't die if a storage backend doesn't exist
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'Could not load storage.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ use \OCA\Files_External\Lib\Backend\Backend;
|
|||
use \OCA\Files_External\Lib\Auth\AuthMechanism;
|
||||
use OCP\Files\Config\IUserMountCache;
|
||||
use \OCP\Files\StorageNotAvailableException;
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* Service class to manage external storages
|
||||
|
@ -104,14 +105,14 @@ abstract class StoragesService {
|
|||
// don't die if a storage backend doesn't exist
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'Could not load storage.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return null;
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'Could not load storage.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return null;
|
||||
|
@ -479,7 +480,7 @@ abstract class StoragesService {
|
|||
// be instantiated or whenever $user vars where used, in which case
|
||||
// the storage id could not be computed
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
\OC_JSON::checkLoggedIn();
|
||||
\OC_JSON::callCheck();
|
||||
\OC::$server->getSession()->close();
|
||||
|
@ -66,7 +69,7 @@ foreach ($list as $file) {
|
|||
OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp);
|
||||
if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
|
||||
$error[] = $filename;
|
||||
\OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', ILogger::ERROR);
|
||||
}
|
||||
// only list deleted files if not deleting everything
|
||||
else if (!$deleteAll) {
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
\OC_JSON::checkLoggedIn();
|
||||
\OC_JSON::callCheck();
|
||||
\OC::$server->getSession()->close();
|
||||
|
@ -72,7 +75,7 @@ foreach ($list as $file) {
|
|||
|
||||
if ( !OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp) ) {
|
||||
$error[] = $filename;
|
||||
\OCP\Util::writeLog('trashbin', 'can\'t restore ' . $filename, \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('trashbin', 'can\'t restore ' . $filename, ILogger::ERROR);
|
||||
} else {
|
||||
$success[$i]['filename'] = $file;
|
||||
$success[$i]['timestamp'] = $timestamp;
|
||||
|
|
|
@ -132,7 +132,7 @@ class Storage extends Wrapper {
|
|||
// do nothing, in this case we just disable the trashbin and continue
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'Trashbin storage could not check if a file was moved out of a shared folder.',
|
||||
'level' => \OCP\Util::DEBUG,
|
||||
'level' => ILogger::DEBUG,
|
||||
'app' => 'files_trashbin',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ class UsersController extends AUserData {
|
|||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Can't send new user mail to $email",
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'ocs_api',
|
||||
]);
|
||||
throw new OCSException('Unable to send the invitation mail', 109);
|
||||
|
@ -306,14 +306,14 @@ class UsersController extends AUserData {
|
|||
} catch (HintException $e ) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Failed addUser attempt with hint exception.',
|
||||
'level' => \OCP\Util::WARN,
|
||||
'level' => ILogger::WARN,
|
||||
'app' => 'ocs_api',
|
||||
]);
|
||||
throw new OCSException($e->getHint(), 107);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Failed addUser attempt with exception.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'ocs_api',
|
||||
]);
|
||||
throw new OCSException('Bad request', 101);
|
||||
|
@ -885,7 +885,7 @@ class UsersController extends AUserData {
|
|||
} catch(\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => "Can't send new user mail to $email",
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'settings',
|
||||
]);
|
||||
throw new OCSException('Sending email failed', 102);
|
||||
|
|
|
@ -442,7 +442,7 @@ class UsersControllerTest extends TestCase {
|
|||
->method('logException')
|
||||
->with($exception, [
|
||||
'message' => 'Failed addUser attempt with exception.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'ocs_api',
|
||||
]);
|
||||
$loggedInUser = $this->getMockBuilder(IUser::class)
|
||||
|
|
|
@ -353,7 +353,7 @@ class ShareByMailProvider implements IShareProvider {
|
|||
} catch (HintException $hintException) {
|
||||
$this->logger->logException($hintException, [
|
||||
'message' => 'Failed to send share by mail.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'sharebymail',
|
||||
]);
|
||||
$this->removeShareFromTable($shareId);
|
||||
|
@ -361,7 +361,7 @@ class ShareByMailProvider implements IShareProvider {
|
|||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Failed to send share by mail.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'sharebymail',
|
||||
]);
|
||||
$this->removeShareFromTable($shareId);
|
||||
|
|
|
@ -52,6 +52,7 @@ use OCA\User_LDAP\User\OfflineUser;
|
|||
use OCA\User_LDAP\Mapping\AbstractMapping;
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Util;
|
||||
|
||||
|
@ -186,13 +187,13 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
if(!$this->checkConnection()) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'No LDAP Connector assigned, access impossible for readAttribute.',
|
||||
\OCP\Util::WARN);
|
||||
ILogger::WARN);
|
||||
return false;
|
||||
}
|
||||
$cr = $this->connection->getConnectionResource();
|
||||
if(!$this->ldap->isResource($cr)) {
|
||||
//LDAP not available
|
||||
\OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
//Cancel possibly running Paged Results operation, otherwise we run in
|
||||
|
@ -247,7 +248,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
}
|
||||
} while($isRangeRequest);
|
||||
|
||||
\OCP\Util::writeLog('user_ldap', 'Requested attribute '.$attr.' not found for '.$dn, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Requested attribute '.$attr.' not found for '.$dn, ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -271,13 +272,13 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
if (!$this->ldap->isResource($rr)) {
|
||||
if ($attribute !== '') {
|
||||
//do not throw this message on userExists check, irritates
|
||||
\OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN ' . $dn, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN ' . $dn, ILogger::DEBUG);
|
||||
}
|
||||
//in case an error occurs , e.g. object does not exist
|
||||
return false;
|
||||
}
|
||||
if ($attribute === '' && ($filter === 'objectclass=*' || $this->invokeLDAPMethod('countEntries', $cr, $rr) === 1)) {
|
||||
\OCP\Util::writeLog('user_ldap', 'readAttribute: ' . $dn . ' found', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'readAttribute: ' . $dn . ' found', ILogger::DEBUG);
|
||||
return true;
|
||||
}
|
||||
$er = $this->invokeLDAPMethod('firstEntry', $cr, $rr);
|
||||
|
@ -363,7 +364,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
$cr = $this->connection->getConnectionResource();
|
||||
if(!$this->ldap->isResource($cr)) {
|
||||
//LDAP not available
|
||||
\OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
|
@ -566,14 +567,14 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
}
|
||||
} else {
|
||||
//If the UUID can't be detected something is foul.
|
||||
\OCP\Util::writeLog('user_ldap', 'Cannot determine UUID for '.$fdn.'. Skipping.', \OCP\Util::INFO);
|
||||
\OCP\Util::writeLog('user_ldap', 'Cannot determine UUID for '.$fdn.'. Skipping.', ILogger::INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(is_null($ldapName)) {
|
||||
$ldapName = $this->readAttribute($fdn, $nameAttribute, $filter);
|
||||
if(!isset($ldapName[0]) && empty($ldapName[0])) {
|
||||
\OCP\Util::writeLog('user_ldap', 'No or empty name for '.$fdn.' with filter '.$filter.'.', \OCP\Util::INFO);
|
||||
\OCP\Util::writeLog('user_ldap', 'No or empty name for '.$fdn.' with filter '.$filter.'.', ILogger::INFO);
|
||||
return false;
|
||||
}
|
||||
$ldapName = $ldapName[0];
|
||||
|
@ -592,7 +593,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
} catch (\InvalidArgumentException $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'app' => 'user_ldap',
|
||||
'level' => Util::WARN,
|
||||
'level' => ILogger::WARN,
|
||||
]);
|
||||
// we don't attempt to set a username here. We can go for
|
||||
// for an alternative 4 digit random number as we would append
|
||||
|
@ -633,7 +634,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
}
|
||||
|
||||
//if everything else did not help..
|
||||
\OCP\Util::writeLog('user_ldap', 'Could not create unique name for '.$fdn.'.', \OCP\Util::INFO);
|
||||
\OCP\Util::writeLog('user_ldap', 'Could not create unique name for '.$fdn.'.', ILogger::INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1031,13 +1032,13 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
* Maybe implement exponential backoff?
|
||||
* This was enough to get solr indexer working which has large delays between LDAP fetches.
|
||||
*/
|
||||
\OCP\Util::writeLog('user_ldap', "Connection lost on $command, attempting to reestablish.", \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', "Connection lost on $command, attempting to reestablish.", ILogger::DEBUG);
|
||||
$this->connection->resetConnectionResource();
|
||||
$cr = $this->connection->getConnectionResource();
|
||||
|
||||
if(!$this->ldap->isResource($cr)) {
|
||||
// Seems like we didn't find any resource.
|
||||
\OCP\Util::writeLog('user_ldap', "Could not $command, because resource is missing.", \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', "Could not $command, because resource is missing.", ILogger::DEBUG);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
@ -1069,7 +1070,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
if(!$this->ldap->isResource($cr)) {
|
||||
// Seems like we didn't find any resource.
|
||||
// Return an empty array just like before.
|
||||
\OCP\Util::writeLog('user_ldap', 'Could not search, because resource is missing.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Could not search, because resource is missing.', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1082,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
// cannot use $cr anymore, might have changed in the previous call!
|
||||
$error = $this->ldap->errno($this->connection->getConnectionResource());
|
||||
if(!is_array($sr) || $error !== 0) {
|
||||
\OCP\Util::writeLog('user_ldap', 'Attempt for Paging? '.print_r($pagedSearchOK, true), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('user_ldap', 'Attempt for Paging? '.print_r($pagedSearchOK, true), ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1152,7 +1153,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
* @throws ServerNotAvailableException
|
||||
*/
|
||||
private function count($filter, $base, $attr = null, $limit = null, $offset = null, $skipHandling = false) {
|
||||
\OCP\Util::writeLog('user_ldap', 'Count filter: '.print_r($filter, true), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Count filter: '.print_r($filter, true), ILogger::DEBUG);
|
||||
|
||||
$limitPerPage = (int)$this->connection->ldapPagingSize;
|
||||
if(!is_null($limit) && $limit < $limitPerPage && $limit > 0) {
|
||||
|
@ -1468,7 +1469,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
'Creating advanced filter for search failed, falling back to simple method.',
|
||||
\OCP\Util::INFO
|
||||
ILogger::INFO
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1629,16 +1630,20 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
|
||||
$value = $this->readAttribute($dn, $attribute);
|
||||
if(is_array($value) && isset($value[0]) && !empty($value[0])) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'Setting '.$attribute.' as '.$uuidAttr,
|
||||
\OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
'Setting '.$attribute.' as '.$uuidAttr,
|
||||
ILogger::DEBUG
|
||||
);
|
||||
$this->connection->$uuidAttr = $attribute;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'Could not autodetect the UUID attribute',
|
||||
\OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
'Could not autodetect the UUID attribute',
|
||||
ILogger::ERROR
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1941,7 +1946,7 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
\OCP\Util::writeLog('user_ldap',
|
||||
'initializing paged search for Filter '.$filter.' base '.print_r($bases, true)
|
||||
.' attr '.print_r($attr, true). ' limit ' .$limit.' offset '.$offset,
|
||||
\OCP\Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
//get the cookie from the search for the previous search, required by LDAP
|
||||
foreach($bases as $base) {
|
||||
|
||||
|
@ -1969,10 +1974,10 @@ class Access extends LDAPUtility implements IUserTools {
|
|||
if(!$pagedSearchOK) {
|
||||
return false;
|
||||
}
|
||||
\OCP\Util::writeLog('user_ldap', 'Ready for a paged search', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Ready for a paged search', ILogger::DEBUG);
|
||||
} else {
|
||||
$e = new \Exception('No paged search possible, Limit '.$limit.' Offset '.$offset);
|
||||
\OC::$server->getLogger()->logException($e, ['level' => Util::DEBUG]);
|
||||
\OC::$server->getLogger()->logException($e, ['level' => ILogger::DEBUG]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
namespace OCA\User_LDAP;
|
||||
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* magic properties (incomplete)
|
||||
|
@ -192,7 +193,7 @@ class Connection extends LDAPUtility {
|
|||
$this->establishConnection();
|
||||
}
|
||||
if(is_null($this->ldapConnectionRes)) {
|
||||
\OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server ' . $this->configuration->ldapHost, \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server ' . $this->configuration->ldapHost, ILogger::ERROR);
|
||||
throw new ServerNotAvailableException('Connection to LDAP server could not be established');
|
||||
}
|
||||
return $this->ldapConnectionRes;
|
||||
|
@ -366,7 +367,7 @@ class Connection extends LDAPUtility {
|
|||
\OCP\Util::writeLog('user_ldap',
|
||||
'Illegal value for the '.
|
||||
$effectiveSetting.', '.'reset to '.
|
||||
'autodetect.', \OCP\Util::INFO);
|
||||
'autodetect.', ILogger::INFO);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -390,10 +391,11 @@ class Connection extends LDAPUtility {
|
|||
if((stripos($this->configuration->ldapHost, 'ldaps://') === 0)
|
||||
&& $this->configuration->ldapTLS) {
|
||||
$this->configuration->ldapTLS = false;
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'LDAPS (already using secure connection) and '.
|
||||
'TLS do not work together. Switched off TLS.',
|
||||
\OCP\Util::INFO);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
'LDAPS (already using secure connection) and TLS do not work together. Switched off TLS.',
|
||||
ILogger::INFO
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,9 +434,11 @@ class Connection extends LDAPUtility {
|
|||
break;
|
||||
}
|
||||
$configurationOK = false;
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
$errorStr.'No '.$subj.' given!',
|
||||
\OCP\Util::WARN);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
$errorStr.'No '.$subj.' given!',
|
||||
ILogger::WARN
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,11 +449,11 @@ class Connection extends LDAPUtility {
|
|||
($agent === '' && $pwd !== '')
|
||||
|| ($agent !== '' && $pwd === '')
|
||||
) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
$errorStr.'either no password is given for the '.
|
||||
'user agent or a password is given, but not an '.
|
||||
'LDAP agent.',
|
||||
\OCP\Util::WARN);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
$errorStr.'either no password is given for the user ' .
|
||||
'agent or a password is given, but not an LDAP agent.',
|
||||
ILogger::WARN);
|
||||
$configurationOK = false;
|
||||
}
|
||||
|
||||
|
@ -458,18 +462,21 @@ class Connection extends LDAPUtility {
|
|||
$baseGroups = $this->configuration->ldapBaseGroups;
|
||||
|
||||
if(empty($base) && empty($baseUsers) && empty($baseGroups)) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
$errorStr.'Not a single Base DN given.',
|
||||
\OCP\Util::WARN);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
$errorStr.'Not a single Base DN given.',
|
||||
ILogger::WARN
|
||||
);
|
||||
$configurationOK = false;
|
||||
}
|
||||
|
||||
if(mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8')
|
||||
=== false) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
$errorStr.'login filter does not contain %uid '.
|
||||
'place holder.',
|
||||
\OCP\Util::WARN);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
$errorStr.'login filter does not contain %uid place holder.',
|
||||
ILogger::WARN
|
||||
);
|
||||
$configurationOK = false;
|
||||
}
|
||||
|
||||
|
@ -511,18 +518,21 @@ class Connection extends LDAPUtility {
|
|||
return false;
|
||||
}
|
||||
if(!$this->ignoreValidation && !$this->configured) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'Configuration is invalid, cannot connect',
|
||||
\OCP\Util::WARN);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
'Configuration is invalid, cannot connect',
|
||||
ILogger::WARN
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if(!$this->ldapConnectionRes) {
|
||||
if(!$this->ldap->areLDAPFunctionsAvailable()) {
|
||||
$phpLDAPinstalled = false;
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'function ldap_connect is not available. Make '.
|
||||
'sure that the PHP ldap module is installed.',
|
||||
\OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
'function ldap_connect is not available. Make sure that the PHP ldap module is installed.',
|
||||
ILogger::ERROR
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -530,11 +540,13 @@ class Connection extends LDAPUtility {
|
|||
if(putenv('LDAPTLS_REQCERT=never')) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'Turned off SSL certificate validation successfully.',
|
||||
\OCP\Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
} else {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'Could not turn off SSL certificate validation.',
|
||||
\OCP\Util::WARN);
|
||||
\OCP\Util::writeLog(
|
||||
'user_ldap',
|
||||
'Could not turn off SSL certificate validation.',
|
||||
ILogger::WARN
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -651,7 +663,7 @@ class Connection extends LDAPUtility {
|
|||
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'Bind failed: ' . $errno . ': ' . $this->ldap->error($cr),
|
||||
\OCP\Util::WARN);
|
||||
ILogger::WARN);
|
||||
|
||||
// Set to failure mode, if LDAP error code is not LDAP_SUCCESS or LDAP_INVALID_CREDENTIALS
|
||||
if($errno !== 0x00 && $errno !== 0x31) {
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace OCA\User_LDAP;
|
|||
|
||||
use OC\Cache\CappedMemoryCache;
|
||||
use OCP\GroupInterface;
|
||||
use OCP\ILogger;
|
||||
|
||||
class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLDAP {
|
||||
protected $enabled = false;
|
||||
|
@ -197,7 +198,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
}
|
||||
} else {
|
||||
\OCP\Util::writeLog('user_ldap', 'No search filter found on member url '.
|
||||
'of group ' . $dnGroup, \OCP\Util::DEBUG);
|
||||
'of group ' . $dnGroup, ILogger::DEBUG);
|
||||
}
|
||||
}
|
||||
return $dynamicMembers;
|
||||
|
@ -656,7 +657,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
}
|
||||
} else {
|
||||
\OCP\Util::writeLog('user_ldap', 'No search filter found on member url '.
|
||||
'of group ' . print_r($dynamicGroup, true), \OCP\Util::DEBUG);
|
||||
'of group ' . print_r($dynamicGroup, true), ILogger::DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -699,7 +700,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
$result = $this->access->readAttribute($userDN, 'uid');
|
||||
if ($result === false) {
|
||||
\OCP\Util::writeLog('user_ldap', 'No uid attribute found for DN ' . $userDN . ' on '.
|
||||
$this->access->connection->ldapHost, \OCP\Util::DEBUG);
|
||||
$this->access->connection->ldapHost, ILogger::DEBUG);
|
||||
}
|
||||
$uid = $result[0];
|
||||
} else {
|
||||
|
@ -961,7 +962,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
$cacheKey = 'getGroups-'.$search.'-'.$limit.'-'.$offset;
|
||||
|
||||
//Check cache before driving unnecessary searches
|
||||
\OCP\Util::writeLog('user_ldap', 'getGroups '.$cacheKey, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'getGroups '.$cacheKey, ILogger::DEBUG);
|
||||
$ldap_groups = $this->access->connection->getFromCache($cacheKey);
|
||||
if(!is_null($ldap_groups)) {
|
||||
return $ldap_groups;
|
||||
|
@ -976,7 +977,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
$this->access->connection->ldapGroupFilter,
|
||||
$this->access->getFilterPartForGroupSearch($search)
|
||||
));
|
||||
\OCP\Util::writeLog('user_ldap', 'getGroups Filter '.$filter, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'getGroups Filter '.$filter, ILogger::DEBUG);
|
||||
$ldap_groups = $this->access->fetchListOfGroups($filter,
|
||||
array($this->access->connection->ldapGroupDisplayName, 'dn'),
|
||||
$limit,
|
||||
|
@ -1021,7 +1022,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
$chunkLimit = min($pagingSize, $overallLimit - $chunkOffset);
|
||||
$ldapGroups = $this->getGroupsChunk($search, $chunkLimit, $chunkOffset);
|
||||
$nread = count($ldapGroups);
|
||||
\OCP\Util::writeLog('user_ldap', 'getGroups('.$search.'): read '.$nread.' at offset '.$chunkOffset.' (limit: '.$chunkLimit.')', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'getGroups('.$search.'): read '.$nread.' at offset '.$chunkOffset.' (limit: '.$chunkLimit.')', ILogger::DEBUG);
|
||||
if ($nread) {
|
||||
$allGroups = array_merge($allGroups, $ldapGroups);
|
||||
$chunkOffset += $nread;
|
||||
|
|
|
@ -43,6 +43,7 @@ use OCA\User_LDAP\LogWrapper;
|
|||
use OCA\User_LDAP\Mapping\GroupMapping;
|
||||
use OCA\User_LDAP\Mapping\UserMapping;
|
||||
use OCA\User_LDAP\User\Manager;
|
||||
use OCP\ILogger;
|
||||
|
||||
class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
||||
static private $groupsFromDB;
|
||||
|
@ -61,7 +62,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
|||
}
|
||||
|
||||
static public function updateGroups() {
|
||||
\OCP\Util::writeLog('user_ldap', 'Run background job "updateGroups"', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Run background job "updateGroups"', ILogger::DEBUG);
|
||||
|
||||
$knownGroups = array_keys(self::getKnownGroups());
|
||||
$actualGroups = self::getGroupBE()->getGroups();
|
||||
|
@ -69,7 +70,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
|||
if(empty($actualGroups) && empty($knownGroups)) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'bgJ "updateGroups" – groups do not seem to be configured properly, aborting.',
|
||||
\OCP\Util::INFO);
|
||||
ILogger::INFO);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -77,7 +78,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
|||
self::handleCreatedGroups(array_diff($actualGroups, $knownGroups));
|
||||
self::handleRemovedGroups(array_diff($knownGroups, $actualGroups));
|
||||
|
||||
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Finished.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Finished.', ILogger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +93,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
|||
* @param string[] $groups
|
||||
*/
|
||||
static private function handleKnownGroups($groups) {
|
||||
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Dealing with known Groups.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Dealing with known Groups.', ILogger::DEBUG);
|
||||
$query = \OC_DB::prepare('
|
||||
UPDATE `*PREFIX*ldap_group_members`
|
||||
SET `owncloudusers` = ?
|
||||
|
@ -107,14 +108,14 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
|||
\OCP\Util::emitHook('OC_User', 'post_removeFromGroup', array('uid' => $removedUser, 'gid' => $group));
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'bgJ "updateGroups" – "'.$removedUser.'" removed from "'.$group.'".',
|
||||
\OCP\Util::INFO);
|
||||
ILogger::INFO);
|
||||
$hasChanged = true;
|
||||
}
|
||||
foreach(array_diff($actualUsers, $knownUsers) as $addedUser) {
|
||||
\OCP\Util::emitHook('OC_User', 'post_addToGroup', array('uid' => $addedUser, 'gid' => $group));
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'bgJ "updateGroups" – "'.$addedUser.'" added to "'.$group.'".',
|
||||
\OCP\Util::INFO);
|
||||
ILogger::INFO);
|
||||
$hasChanged = true;
|
||||
}
|
||||
if($hasChanged) {
|
||||
|
@ -123,14 +124,14 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
|||
}
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'bgJ "updateGroups" – FINISHED dealing with known Groups.',
|
||||
\OCP\Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $createdGroups
|
||||
*/
|
||||
static private function handleCreatedGroups($createdGroups) {
|
||||
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – dealing with created Groups.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – dealing with created Groups.', ILogger::DEBUG);
|
||||
$query = \OC_DB::prepare('
|
||||
INSERT
|
||||
INTO `*PREFIX*ldap_group_members` (`owncloudname`, `owncloudusers`)
|
||||
|
@ -139,20 +140,20 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
|||
foreach($createdGroups as $createdGroup) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'bgJ "updateGroups" – new group "'.$createdGroup.'" found.',
|
||||
\OCP\Util::INFO);
|
||||
ILogger::INFO);
|
||||
$users = serialize(self::getGroupBE()->usersInGroup($createdGroup));
|
||||
$query->execute(array($createdGroup, $users));
|
||||
}
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'bgJ "updateGroups" – FINISHED dealing with created Groups.',
|
||||
\OCP\Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $removedGroups
|
||||
*/
|
||||
static private function handleRemovedGroups($removedGroups) {
|
||||
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – dealing with removed groups.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – dealing with removed groups.', ILogger::DEBUG);
|
||||
$query = \OC_DB::prepare('
|
||||
DELETE
|
||||
FROM `*PREFIX*ldap_group_members`
|
||||
|
@ -161,12 +162,12 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
|
|||
foreach($removedGroups as $removedGroup) {
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'bgJ "updateGroups" – group "'.$removedGroup.'" was removed.',
|
||||
\OCP\Util::INFO);
|
||||
ILogger::INFO);
|
||||
$query->execute(array($removedGroup));
|
||||
}
|
||||
\OCP\Util::writeLog('user_ldap',
|
||||
'bgJ "updateGroups" – FINISHED dealing with removed groups.',
|
||||
\OCP\Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,6 +35,7 @@ use OCA\User_LDAP\FilesystemHelper;
|
|||
use OCA\User_LDAP\LogWrapper;
|
||||
use OCP\IAvatarManager;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\Image;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Util;
|
||||
|
@ -125,10 +126,10 @@ class User {
|
|||
INotificationManager $notificationManager) {
|
||||
|
||||
if ($username === null) {
|
||||
$log->log("uid for '$dn' must not be null!", Util::ERROR);
|
||||
$log->log("uid for '$dn' must not be null!", ILogger::ERROR);
|
||||
throw new \InvalidArgumentException('uid must not be null!');
|
||||
} else if ($username === '') {
|
||||
$log->log("uid for '$dn' must not be an empty string", Util::ERROR);
|
||||
$log->log("uid for '$dn' must not be an empty string", ILogger::ERROR);
|
||||
throw new \InvalidArgumentException('uid must not be an empty string!');
|
||||
}
|
||||
|
||||
|
@ -507,7 +508,7 @@ class User {
|
|||
if ($this->verifyQuotaValue($aQuota[0])) {
|
||||
$quota = $aQuota[0];
|
||||
} else {
|
||||
$this->log->log('not suitable LDAP quota found for user ' . $this->uid . ': [' . $aQuota[0] . ']', \OCP\Util::WARN);
|
||||
$this->log->log('not suitable LDAP quota found for user ' . $this->uid . ': [' . $aQuota[0] . ']', ILogger::WARN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +516,7 @@ class User {
|
|||
if ($this->verifyQuotaValue($valueFromLDAP)) {
|
||||
$quota = $valueFromLDAP;
|
||||
} else {
|
||||
$this->log->log('not suitable LDAP quota found for user ' . $this->uid . ': [' . $valueFromLDAP . ']', \OCP\Util::WARN);
|
||||
$this->log->log('not suitable LDAP quota found for user ' . $this->uid . ': [' . $valueFromLDAP . ']', ILogger::WARN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -532,10 +533,10 @@ class User {
|
|||
if($quota !== false) {
|
||||
$targetUser->setQuota($quota);
|
||||
} else {
|
||||
$this->log->log('not suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', \OCP\Util::WARN);
|
||||
$this->log->log('not suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', ILogger::WARN);
|
||||
}
|
||||
} else {
|
||||
$this->log->log('trying to set a quota for user ' . $this->uid . ' but the user is missing', \OCP\Util::ERROR);
|
||||
$this->log->log('trying to set a quota for user ' . $this->uid . ' but the user is missing', ILogger::ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -577,13 +578,13 @@ class User {
|
|||
*/
|
||||
private function setOwnCloudAvatar() {
|
||||
if(!$this->image->valid()) {
|
||||
$this->log->log('jpegPhoto data invalid for '.$this->dn, \OCP\Util::ERROR);
|
||||
$this->log->log('jpegPhoto data invalid for '.$this->dn, ILogger::ERROR);
|
||||
return;
|
||||
}
|
||||
//make sure it is a square and not bigger than 128x128
|
||||
$size = min(array($this->image->width(), $this->image->height(), 128));
|
||||
if(!$this->image->centerCrop($size)) {
|
||||
$this->log->log('croping image for avatar failed for '.$this->dn, \OCP\Util::ERROR);
|
||||
$this->log->log('croping image for avatar failed for '.$this->dn, ILogger::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -597,7 +598,7 @@ class User {
|
|||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'Could not set avatar for ' . $this->dn,
|
||||
'level' => \OCP\Util::INFO,
|
||||
'level' => ILogger::INFO,
|
||||
'app' => 'user_ldap',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ use OCA\User_LDAP\Exceptions\NotOnLDAP;
|
|||
use OCA\User_LDAP\User\OfflineUser;
|
||||
use OCA\User_LDAP\User\User;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Notification\IManager as INotificationManager;
|
||||
|
@ -181,7 +182,7 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
|
|||
try {
|
||||
$ldapRecord = $this->getLDAPUserByLoginName($uid);
|
||||
} catch(NotOnLDAP $e) {
|
||||
if($this->ocConfig->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) {
|
||||
if($this->ocConfig->getSystemValue('loglevel', ILogger::WARN) === ILogger::DEBUG) {
|
||||
\OC::$server->getLogger()->logException($e, ['app' => 'user_ldap']);
|
||||
}
|
||||
return false;
|
||||
|
@ -193,7 +194,7 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
|
|||
Util::writeLog('user_ldap',
|
||||
'LDAP Login: Could not get user object for DN ' . $dn .
|
||||
'. Maybe the LDAP entry has no set display name attribute?',
|
||||
Util::WARN);
|
||||
ILogger::WARN);
|
||||
return false;
|
||||
}
|
||||
if($user->getUsername() !== false) {
|
||||
|
@ -278,14 +279,14 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
|
|||
|
||||
Util::writeLog('user_ldap',
|
||||
'getUsers: Options: search '.$search.' limit '.$limit.' offset '.$offset.' Filter: '.$filter,
|
||||
Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
//do the search and translate results to Nextcloud names
|
||||
$ldap_users = $this->access->fetchListOfUsers(
|
||||
$filter,
|
||||
$this->access->userManager->getAttributes(true),
|
||||
$limit, $offset);
|
||||
$ldap_users = $this->access->nextcloudUserNames($ldap_users);
|
||||
Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users). ' Users found', Util::DEBUG);
|
||||
Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users). ' Users found', ILogger::DEBUG);
|
||||
|
||||
$this->access->connection->writeToCache($cachekey, $ldap_users);
|
||||
return $ldap_users;
|
||||
|
@ -358,7 +359,7 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
|
|||
|
||||
if(is_null($user)) {
|
||||
Util::writeLog('user_ldap', 'No DN found for '.$uid.' on '.
|
||||
$this->access->connection->ldapHost, Util::DEBUG);
|
||||
$this->access->connection->ldapHost, ILogger::DEBUG);
|
||||
$this->access->connection->writeToCache('userExists'.$uid, false);
|
||||
return false;
|
||||
} else if($user instanceof OfflineUser) {
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
namespace OCA\User_LDAP;
|
||||
|
||||
use OC\ServerNotAvailableException;
|
||||
use OCP\ILogger;
|
||||
|
||||
class Wizard extends LDAPUtility {
|
||||
/** @var \OCP\IL10N */
|
||||
|
@ -301,7 +302,7 @@ class Wizard extends LDAPUtility {
|
|||
if($writeLog) {
|
||||
\OCP\Util::writeLog('user_ldap', 'The mail attribute has ' .
|
||||
'automatically been reset, because the original value ' .
|
||||
'did not return any results.', \OCP\Util::INFO);
|
||||
'did not return any results.', ILogger::INFO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -679,7 +680,7 @@ class Wizard extends LDAPUtility {
|
|||
foreach($portSettings as $setting) {
|
||||
$p = $setting['port'];
|
||||
$t = $setting['tls'];
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: trying port '. $p . ', TLS '. $t, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: trying port '. $p . ', TLS '. $t, ILogger::DEBUG);
|
||||
//connectAndBind may throw Exception, it needs to be catched by the
|
||||
//callee of this method
|
||||
|
||||
|
@ -702,7 +703,7 @@ class Wizard extends LDAPUtility {
|
|||
'ldapTLS' => (int)$t
|
||||
);
|
||||
$this->configuration->setConfiguration($config);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: detected Port ' . $p, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: detected Port ' . $p, ILogger::DEBUG);
|
||||
$this->result->addChange('ldap_port', $p);
|
||||
return $this->result;
|
||||
}
|
||||
|
@ -848,7 +849,7 @@ class Wizard extends LDAPUtility {
|
|||
$errorNo = $this->ldap->errno($cr);
|
||||
$errorMsg = $this->ldap->error($cr);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Could not search base '.$base.
|
||||
' Error '.$errorNo.': '.$errorMsg, \OCP\Util::INFO);
|
||||
' Error '.$errorNo.': '.$errorMsg, ILogger::INFO);
|
||||
return false;
|
||||
}
|
||||
$entries = $this->ldap->countEntries($cr, $rr);
|
||||
|
@ -1024,7 +1025,7 @@ class Wizard extends LDAPUtility {
|
|||
break;
|
||||
}
|
||||
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Final filter '.$filter, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Final filter '.$filter, ILogger::DEBUG);
|
||||
|
||||
return $filter;
|
||||
}
|
||||
|
@ -1044,7 +1045,7 @@ class Wizard extends LDAPUtility {
|
|||
if(!$hostInfo) {
|
||||
throw new \Exception(self::$l->t('Invalid Host'));
|
||||
}
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Attempting to connect ', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Attempting to connect ', ILogger::DEBUG);
|
||||
$cr = $this->ldap->connect($host, $port);
|
||||
if(!is_resource($cr)) {
|
||||
throw new \Exception(self::$l->t('Invalid Host'));
|
||||
|
@ -1063,7 +1064,7 @@ class Wizard extends LDAPUtility {
|
|||
}
|
||||
}
|
||||
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Attemping to Bind ', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Attemping to Bind ', ILogger::DEBUG);
|
||||
//interesting part: do the bind!
|
||||
$login = $this->ldap->bind($cr,
|
||||
$this->configuration->ldapAgentName,
|
||||
|
@ -1078,7 +1079,7 @@ class Wizard extends LDAPUtility {
|
|||
|
||||
if($login === true) {
|
||||
$this->ldap->unbind($cr);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Bind successful to Port '. $port . ' TLS ' . (int)$tls, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('user_ldap', 'Wiz: Bind successful to Port '. $port . ' TLS ' . (int)$tls, ILogger::DEBUG);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
namespace OC\Core\Controller;
|
||||
|
||||
use OC\Setup;
|
||||
use OCP\ILogger;
|
||||
|
||||
class SetupController {
|
||||
/** @var Setup */
|
||||
|
@ -107,7 +108,7 @@ class SetupController {
|
|||
|
||||
public function loadAutoConfig($post) {
|
||||
if( file_exists($this->autoConfigFile)) {
|
||||
\OCP\Util::writeLog('core', 'Autoconfig file found, setting up ownCloud…', \OCP\Util::INFO);
|
||||
\OCP\Util::writeLog('core', 'Autoconfig file found, setting up ownCloud…', ILogger::INFO);
|
||||
$AUTOCONFIG = array();
|
||||
include $this->autoConfigFile;
|
||||
$post = array_merge ($post, $AUTOCONFIG);
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
use OCP\ILogger;
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||
|
@ -208,7 +210,7 @@ if (\OCP\Util::needUpgrade()) {
|
|||
$updater->upgrade();
|
||||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'update',
|
||||
]);
|
||||
$eventSource->send('failure', get_class($e) . ': ' . $e->getMessage());
|
||||
|
|
|
@ -34,6 +34,7 @@ declare(strict_types=1);
|
|||
namespace OC;
|
||||
|
||||
use \OCP\AutoloadNotAllowedException;
|
||||
use OCP\ILogger;
|
||||
|
||||
class Autoloader {
|
||||
/** @var bool */
|
||||
|
@ -100,7 +101,7 @@ class Autoloader {
|
|||
* Remove "apps/" from inclusion path for smooth migration to multi app dir
|
||||
*/
|
||||
if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
|
||||
\OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', ILogger::DEBUG);
|
||||
$paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]);
|
||||
}
|
||||
} elseif (strpos($class, 'OC_') === 0) {
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use OCP\ILogger;
|
||||
use OCP\Share;
|
||||
use OC\Encryption\HookManager;
|
||||
use OC\Files\Filesystem;
|
||||
|
@ -828,7 +829,7 @@ class OC {
|
|||
// so log the exception
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'Exception when running cache gc.',
|
||||
'level' => \OCP\Util::WARN,
|
||||
'level' => ILogger::WARN,
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class AppFetcher extends Fetcher {
|
|||
$releases[] = $release;
|
||||
}
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => Util::WARN]);
|
||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::WARN]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,10 +171,10 @@ abstract class Fetcher {
|
|||
$file->putContent(json_encode($responseJson));
|
||||
return json_decode($file->getContent(), true)['data'];
|
||||
} catch (ConnectException $e) {
|
||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => Util::INFO, 'message' => 'Could not connect to appstore']);
|
||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::INFO, 'message' => 'Could not connect to appstore']);
|
||||
return [];
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => Util::INFO]);
|
||||
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::INFO]);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ use OCP\Files\Folder;
|
|||
use OCP\Files\IAppData;
|
||||
use OCP\GlobalScale\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use OCP\IServerContainer;
|
||||
use OCP\IUserSession;
|
||||
|
@ -375,19 +376,19 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
public function log($message, $level) {
|
||||
switch($level){
|
||||
case 'debug':
|
||||
$level = \OCP\Util::DEBUG;
|
||||
$level = ILogger::DEBUG;
|
||||
break;
|
||||
case 'info':
|
||||
$level = \OCP\Util::INFO;
|
||||
$level = ILogger::INFO;
|
||||
break;
|
||||
case 'warn':
|
||||
$level = \OCP\Util::WARN;
|
||||
$level = ILogger::WARN;
|
||||
break;
|
||||
case 'fatal':
|
||||
$level = \OCP\Util::FATAL;
|
||||
$level = ILogger::FATAL;
|
||||
break;
|
||||
default:
|
||||
$level = \OCP\Util::ERROR;
|
||||
$level = ILogger::ERROR;
|
||||
break;
|
||||
}
|
||||
\OCP\Util::writeLog($this->getAppName(), $message, $level);
|
||||
|
|
|
@ -255,7 +255,7 @@ class SecurityMiddleware extends Middleware {
|
|||
}
|
||||
|
||||
$this->logger->logException($exception, [
|
||||
'level' => \OCP\Util::DEBUG,
|
||||
'level' => ILogger::DEBUG,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return $response;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
namespace OC\Archive;
|
||||
|
||||
use Icewind\Streams\CallbackWrapper;
|
||||
use OCP\ILogger;
|
||||
|
||||
class ZIP extends Archive{
|
||||
/**
|
||||
|
@ -47,7 +48,7 @@ class ZIP extends Archive{
|
|||
$this->zip=new \ZipArchive();
|
||||
if($this->zip->open($source, \ZipArchive::CREATE)) {
|
||||
}else{
|
||||
\OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, \OCP\Util::WARN);
|
||||
\OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, ILogger::WARN);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace OC\Cache;
|
|||
use OC\Files\Filesystem;
|
||||
use OC\Files\View;
|
||||
use OCP\ICache;
|
||||
use OCP\ILogger;
|
||||
use OCP\Security\ISecureRandom;
|
||||
|
||||
class File implements ICache {
|
||||
|
@ -58,7 +59,7 @@ class File implements ICache {
|
|||
$this->storage = new View('/' . $user->getUID() . '/cache');
|
||||
return $this->storage;
|
||||
} else {
|
||||
\OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', ILogger::ERROR);
|
||||
throw new \OC\ForbiddenException('Can\t get cache storage, user not logged in');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class CapabilitiesManager {
|
|||
} catch (QueryException $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'CapabilitiesManager',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
continue;
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace OC;
|
|||
|
||||
use OCP\IConfig;
|
||||
use OCP\IDateTimeZone;
|
||||
use OCP\ILogger;
|
||||
use OCP\ISession;
|
||||
|
||||
class DateTimeZone implements IDateTimeZone {
|
||||
|
@ -64,7 +65,7 @@ class DateTimeZone implements IDateTimeZone {
|
|||
try {
|
||||
return new \DateTimeZone($timeZone);
|
||||
} catch (\Exception $e) {
|
||||
\OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "' . $timeZone . "'", \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "' . $timeZone . "'", ILogger::DEBUG);
|
||||
return new \DateTimeZone($this->getDefaultTimeZone());
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +110,7 @@ class DateTimeZone implements IDateTimeZone {
|
|||
}
|
||||
|
||||
// No timezone found, fallback to UTC
|
||||
\OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "' . $offset . "'", \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "' . $offset . "'", ILogger::DEBUG);
|
||||
return new \DateTimeZone($this->getDefaultTimeZone());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ use OC\Files\Filesystem;
|
|||
use OC\Hooks\BasicEmitter;
|
||||
use OCP\Files\Cache\IScanner;
|
||||
use OCP\Files\ForbiddenException;
|
||||
use OCP\ILogger;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
|
||||
/**
|
||||
|
@ -110,7 +111,7 @@ class Scanner extends BasicEmitter implements IScanner {
|
|||
protected function getData($path) {
|
||||
$data = $this->storage->getMetaData($path);
|
||||
if (is_null($data)) {
|
||||
\OCP\Util::writeLog(Scanner::class, "!!! Path '$path' is not accessible or present !!!", \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog(Scanner::class, "!!! Path '$path' is not accessible or present !!!", ILogger::DEBUG);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
@ -454,7 +455,7 @@ class Scanner extends BasicEmitter implements IScanner {
|
|||
}
|
||||
\OC::$server->getLogger()->logException($ex, [
|
||||
'message' => 'Exception while scanning file "' . $child . '"',
|
||||
'level' => \OCP\Util::DEBUG,
|
||||
'level' => ILogger::DEBUG,
|
||||
'app' => 'core',
|
||||
]);
|
||||
$exceptionOccurred = true;
|
||||
|
|
|
@ -65,6 +65,7 @@ use OC\Files\Storage\StorageFactory;
|
|||
use OC\Lockdown\Filesystem\NullStorage;
|
||||
use OCP\Files\Config\IMountProvider;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUserManager;
|
||||
|
||||
class Filesystem {
|
||||
|
@ -408,7 +409,7 @@ class Filesystem {
|
|||
$userObject = $userManager->get($user);
|
||||
|
||||
if (is_null($userObject)) {
|
||||
\OCP\Util::writeLog('files', ' Backends provided no user object for ' . $user, \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('files', ' Backends provided no user object for ' . $user, ILogger::ERROR);
|
||||
// reset flag, this will make it possible to rethrow the exception if called again
|
||||
unset(self::$usersSetup[$user]);
|
||||
throw new \OC\User\NoUserException('Backends provided no user object for ' . $user);
|
||||
|
@ -418,7 +419,7 @@ class Filesystem {
|
|||
// workaround in case of different casings
|
||||
if ($user !== $realUid) {
|
||||
$stack = json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 50));
|
||||
\OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $realUid . '" got "' . $user . '". Stack: ' . $stack, \OCP\Util::WARN);
|
||||
\OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $realUid . '" got "' . $user . '". Stack: ' . $stack, ILogger::WARN);
|
||||
$user = $realUid;
|
||||
|
||||
// again with the correct casing
|
||||
|
|
|
@ -33,6 +33,7 @@ use \OC\Files\Filesystem;
|
|||
use OC\Files\Storage\StorageFactory;
|
||||
use OC\Files\Storage\Storage;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\ILogger;
|
||||
|
||||
class MountPoint implements IMountPoint {
|
||||
/**
|
||||
|
@ -152,12 +153,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::$server->getLogger()->logException($exception, ['level' => \OCP\Util::ERROR]);
|
||||
\OC::$server->getLogger()->logException($exception, ['level' => ILogger::ERROR]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
\OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', ILogger::ERROR);
|
||||
$this->invalidStorage = true;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace OC\Files\Mount;
|
|||
use OCP\Files\Config\IHomeMountProvider;
|
||||
use OCP\Files\Storage\IStorageFactory;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
|
||||
/**
|
||||
|
@ -79,7 +80,7 @@ class ObjectHomeMountProvider implements IHomeMountProvider {
|
|||
|
||||
// sanity checks
|
||||
if (empty($config['class'])) {
|
||||
\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR);
|
||||
}
|
||||
if (!isset($config['arguments'])) {
|
||||
$config['arguments'] = [];
|
||||
|
@ -104,7 +105,7 @@ class ObjectHomeMountProvider implements IHomeMountProvider {
|
|||
|
||||
// sanity checks
|
||||
if (empty($config['class'])) {
|
||||
\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR);
|
||||
}
|
||||
if (!isset($config['arguments'])) {
|
||||
$config['arguments'] = [];
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace OC\Files\ObjectStore;
|
|||
use Aws\ClientResolver;
|
||||
use Aws\S3\Exception\S3Exception;
|
||||
use Aws\S3\S3Client;
|
||||
use OCP\ILogger;
|
||||
|
||||
trait S3ConnectionTrait {
|
||||
/** @var array */
|
||||
|
@ -113,7 +114,7 @@ trait S3ConnectionTrait {
|
|||
} catch (S3Exception $e) {
|
||||
$logger->logException($e, [
|
||||
'message' => 'Invalid remote storage.',
|
||||
'level' => \OCP\Util::DEBUG,
|
||||
'level' => ILogger::DEBUG,
|
||||
'app' => 'objectstore',
|
||||
]);
|
||||
throw new \Exception('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage());
|
||||
|
|
|
@ -54,6 +54,7 @@ use OCP\Files\InvalidPathException;
|
|||
use OCP\Files\ReservedWordException;
|
||||
use OCP\Files\Storage\ILockingStorage;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
use OCP\ILogger;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
use OCP\Lock\LockedException;
|
||||
|
||||
|
@ -453,7 +454,7 @@ abstract class Common implements Storage, ILockingStorage {
|
|||
return false;
|
||||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->info("External storage not available: " . $e->getMessage());
|
||||
\OC::$server->getLogger()->logException($e, ['level' => \OCP\Util::DEBUG]);
|
||||
\OC::$server->getLogger()->logException($e, ['level' => ILogger::DEBUG]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace OC\Files\Storage;
|
|||
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use OCP\ILogger;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Icewind\Streams\CallbackWrapper;
|
||||
use OC\Files\Filesystem;
|
||||
|
@ -357,7 +358,7 @@ class DAV extends Common {
|
|||
if ($response->getStatusCode() === Http::STATUS_LOCKED) {
|
||||
throw new \OCP\Lock\LockedException($path);
|
||||
} else {
|
||||
Util::writeLog("webdav client", 'Guzzle get returned status code ' . $response->getStatusCode(), Util::ERROR);
|
||||
Util::writeLog("webdav client", 'Guzzle get returned status code ' . $response->getStatusCode(), ILogger::ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace OC\Files\Storage;
|
|||
use OC\Files\Storage\Wrapper\Jail;
|
||||
use OCP\Files\ForbiddenException;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* for local filestore, we only have to map the paths
|
||||
|
@ -235,17 +236,17 @@ class Local extends \OC\Files\Storage\Common {
|
|||
$dstParent = dirname($path2);
|
||||
|
||||
if (!$this->isUpdatable($srcParent)) {
|
||||
\OCP\Util::writeLog('core', 'unable to rename, source directory is not writable : ' . $srcParent, \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'unable to rename, source directory is not writable : ' . $srcParent, ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->isUpdatable($dstParent)) {
|
||||
\OCP\Util::writeLog('core', 'unable to rename, destination directory is not writable : ' . $dstParent, \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'unable to rename, destination directory is not writable : ' . $dstParent, ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->file_exists($path1)) {
|
||||
\OCP\Util::writeLog('core', 'unable to rename, file does not exists : ' . $path1, \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'unable to rename, file does not exists : ' . $path1, ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -382,7 +383,7 @@ class Local extends \OC\Files\Storage\Common {
|
|||
return $fullPath;
|
||||
}
|
||||
|
||||
\OCP\Util::writeLog('core', "Following symlinks is not allowed ('$fullPath' -> '$realPath' not inside '{$this->realDataDir}')", \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', "Following symlinks is not allowed ('$fullPath' -> '$realPath' not inside '{$this->realDataDir}')", ILogger::ERROR);
|
||||
throw new ForbiddenException('Following symlinks is not allowed', false);
|
||||
}
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ class Encryption extends Wrapper {
|
|||
} catch (ModuleDoesNotExistsException $e) {
|
||||
$this->logger->logException($e, [
|
||||
'message' => 'Encryption module "' . $encryptionModuleId . '" not found, file will be stored unencrypted',
|
||||
'level' => \OCP\Util::WARN,
|
||||
'level' => ILogger::WARN,
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ use OCP\Files\InvalidPathException;
|
|||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\ReservedWordException;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
use OCP\Lock\LockedException;
|
||||
|
@ -975,7 +976,7 @@ class View {
|
|||
$hooks[] = 'write';
|
||||
break;
|
||||
default:
|
||||
\OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR);
|
||||
}
|
||||
|
||||
if ($mode !== 'r' && $mode !== 'w') {
|
||||
|
@ -1463,7 +1464,7 @@ class View {
|
|||
// sometimes when the storage is not available it can be any exception
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'lib',
|
||||
]);
|
||||
continue;
|
||||
|
@ -1752,7 +1753,7 @@ class View {
|
|||
if (!$targetStorage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
|
||||
\OCP\Util::writeLog('files',
|
||||
'It is not allowed to move one mount point into another one',
|
||||
\OCP\Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1775,7 +1776,7 @@ class View {
|
|||
if (count($shares) > 0) {
|
||||
\OCP\Util::writeLog('files',
|
||||
'It is not allowed to move one mount point into a shared folder',
|
||||
\OCP\Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ class Installer {
|
|||
$this->downloadApp($appId);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
@ -460,7 +460,7 @@ class Installer {
|
|||
OC_Helper::rmdirr($appDir);
|
||||
return true;
|
||||
}else{
|
||||
\OCP\Util::writeLog('core', 'can\'t remove app '.$appId.'. It is not installed.', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'can\'t remove app '.$appId.'. It is not installed.', ILogger::ERROR);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class Log implements ILogger {
|
|||
* @return void
|
||||
*/
|
||||
public function emergency(string $message, array $context = []) {
|
||||
$this->log(Util::FATAL, $message, $context);
|
||||
$this->log(ILogger::FATAL, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ class Log implements ILogger {
|
|||
* @return void
|
||||
*/
|
||||
public function alert(string $message, array $context = []) {
|
||||
$this->log(Util::ERROR, $message, $context);
|
||||
$this->log(ILogger::ERROR, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +134,7 @@ class Log implements ILogger {
|
|||
* @return void
|
||||
*/
|
||||
public function critical(string $message, array $context = []) {
|
||||
$this->log(Util::ERROR, $message, $context);
|
||||
$this->log(ILogger::ERROR, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,7 +146,7 @@ class Log implements ILogger {
|
|||
* @return void
|
||||
*/
|
||||
public function error(string $message, array $context = []) {
|
||||
$this->log(Util::ERROR, $message, $context);
|
||||
$this->log(ILogger::ERROR, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ class Log implements ILogger {
|
|||
* @return void
|
||||
*/
|
||||
public function warning(string $message, array $context = []) {
|
||||
$this->log(Util::WARN, $message, $context);
|
||||
$this->log(ILogger::WARN, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,7 +171,7 @@ class Log implements ILogger {
|
|||
* @return void
|
||||
*/
|
||||
public function notice(string $message, array $context = []) {
|
||||
$this->log(Util::INFO, $message, $context);
|
||||
$this->log(ILogger::INFO, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,7 +184,7 @@ class Log implements ILogger {
|
|||
* @return void
|
||||
*/
|
||||
public function info(string $message, array $context = []) {
|
||||
$this->log(Util::INFO, $message, $context);
|
||||
$this->log(ILogger::INFO, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -195,7 +195,7 @@ class Log implements ILogger {
|
|||
* @return void
|
||||
*/
|
||||
public function debug(string $message, array $context = []) {
|
||||
$this->log(Util::DEBUG, $message, $context);
|
||||
$this->log(ILogger::DEBUG, $message, $context);
|
||||
}
|
||||
|
||||
|
||||
|
@ -260,7 +260,7 @@ class Log implements ILogger {
|
|||
|
||||
// if log condition is satisfied change the required log level to DEBUG
|
||||
if ($this->logConditionSatisfied) {
|
||||
return Util::DEBUG;
|
||||
return ILogger::DEBUG;
|
||||
}
|
||||
|
||||
if (isset($context['app'])) {
|
||||
|
@ -274,11 +274,11 @@ class Log implements ILogger {
|
|||
if (!empty($logCondition)
|
||||
&& isset($logCondition['apps'])
|
||||
&& in_array($app, $logCondition['apps'], true)) {
|
||||
return Util::DEBUG;
|
||||
return ILogger::DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
return min($this->config->getValue('loglevel', Util::WARN), Util::FATAL);
|
||||
return min($this->config->getValue('loglevel', ILogger::WARN), ILogger::FATAL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -291,7 +291,7 @@ class Log implements ILogger {
|
|||
*/
|
||||
public function logException(\Throwable $exception, array $context = []) {
|
||||
$app = $context['app'] ?? 'no app in context';
|
||||
$level = $context['level'] ?? Util::ERROR;
|
||||
$level = $context['level'] ?? ILogger::ERROR;
|
||||
|
||||
$serializer = new ExceptionSerializer();
|
||||
$data = $serializer->serializeException($exception);
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
namespace OC\Log;
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* logging utilities
|
||||
*
|
||||
|
@ -159,7 +161,7 @@ class File {
|
|||
*/
|
||||
public static function getEntries($limit=50, $offset=0) {
|
||||
self::init();
|
||||
$minLevel = \OC::$server->getSystemConfig()->getValue("loglevel", \OCP\Util::WARN);
|
||||
$minLevel = \OC::$server->getSystemConfig()->getValue("loglevel", ILogger::WARN);
|
||||
$entries = array();
|
||||
$handle = @fopen(self::$logFile, 'rb');
|
||||
if ($handle) {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
namespace OC\Log;
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* This rotates the current logfile to a new name, this way the total log usage
|
||||
|
@ -49,6 +50,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.'"';
|
||||
\OCP\Util::writeLog(Rotate::class, $msg, \OCP\Util::WARN);
|
||||
\OCP\Util::writeLog(Rotate::class, $msg, ILogger::WARN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,13 +25,15 @@
|
|||
|
||||
namespace OC\Log;
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
class Syslog {
|
||||
static protected $levels = array(
|
||||
\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,
|
||||
ILogger::DEBUG => LOG_DEBUG,
|
||||
ILogger::INFO => LOG_INFO,
|
||||
ILogger::WARN => LOG_WARNING,
|
||||
ILogger::ERROR => LOG_ERR,
|
||||
ILogger::FATAL => LOG_CRIT,
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
namespace OC;
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
class NaturalSort {
|
||||
private static $instance;
|
||||
private $collator;
|
||||
|
@ -41,7 +43,7 @@ class NaturalSort {
|
|||
// or inject an instance of \OC\NaturalSort_DefaultCollator to force using Owncloud's default collator
|
||||
if (isset($injectedCollator)) {
|
||||
$this->collator = $injectedCollator;
|
||||
\OCP\Util::writeLog('core', 'forced use of '.get_class($injectedCollator), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', 'forced use of '.get_class($injectedCollator), ILogger::DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
namespace OC\Preview;
|
||||
|
||||
use Imagick;
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* Creates a PNG preview using ImageMagick via the PECL extension
|
||||
|
@ -50,7 +51,7 @@ abstract class Bitmap extends Provider {
|
|||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => 'Imagick says:',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
*/
|
||||
namespace OC\Preview;
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
abstract class Office extends Provider {
|
||||
private $cmd;
|
||||
|
||||
|
@ -60,7 +62,7 @@ abstract class Office extends Provider {
|
|||
unlink($absPath);
|
||||
unlink($pdfPreview);
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
*/
|
||||
namespace OC\Preview;
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
class SVG extends Provider {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -54,7 +56,7 @@ class SVG extends Provider {
|
|||
$svg->setImageFormat('png32');
|
||||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
|
|
@ -150,12 +150,12 @@ class Manager implements IManager {
|
|||
/** @var ISection $section */
|
||||
$section = \OC::$server->query($class);
|
||||
} catch (QueryException $e) {
|
||||
$this->log->logException($e, ['level' => Util::INFO]);
|
||||
$this->log->logException($e, ['level' => ILogger::INFO]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$section instanceof ISection) {
|
||||
$this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => Util::INFO]);
|
||||
$this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -200,12 +200,12 @@ class Manager implements IManager {
|
|||
/** @var ISettings $setting */
|
||||
$setting = \OC::$server->query($class);
|
||||
} catch (QueryException $e) {
|
||||
$this->log->logException($e, ['level' => Util::INFO]);
|
||||
$this->log->logException($e, ['level' => ILogger::INFO]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$setting instanceof ISettings) {
|
||||
$this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => Util::INFO]);
|
||||
$this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => ILogger::INFO]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace OC\Setup;
|
|||
|
||||
use OC\DB\MySqlTools;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\ILogger;
|
||||
|
||||
class MySQL extends AbstractDatabase {
|
||||
public $dbprettyname = 'MySQL/MariaDB';
|
||||
|
@ -70,7 +71,7 @@ class MySQL extends AbstractDatabase {
|
|||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => 'Database creation failed.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'mysql.setup',
|
||||
]);
|
||||
return;
|
||||
|
@ -83,7 +84,7 @@ class MySQL extends AbstractDatabase {
|
|||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => 'Could not automatically grant privileges, this can be ignored if database user already had privileges.',
|
||||
'level' => \OCP\Util::DEBUG,
|
||||
'level' => ILogger::DEBUG,
|
||||
'app' => 'mysql.setup',
|
||||
]);
|
||||
}
|
||||
|
@ -107,7 +108,7 @@ class MySQL extends AbstractDatabase {
|
|||
catch (\Exception $ex){
|
||||
$this->logger->logException($ex, [
|
||||
'message' => 'Database user creation failed.',
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'mysql.setup',
|
||||
]);
|
||||
}
|
||||
|
@ -162,7 +163,7 @@ class MySQL extends AbstractDatabase {
|
|||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => 'Can not create a new MySQL user, will continue with the provided user.',
|
||||
'level' => \OCP\Util::INFO,
|
||||
'level' => ILogger::INFO,
|
||||
'app' => 'mysql.setup',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace OC\Share;
|
|||
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\Util;
|
||||
|
||||
/**
|
||||
|
@ -92,7 +93,7 @@ class Share extends Constants {
|
|||
\OCP\Util::writeLog('OCP\Share',
|
||||
'Sharing backend '.$class.' not registered, '.self::$backendTypes[$itemType]['class']
|
||||
.' is already registered for '.$itemType,
|
||||
\OCP\Util::WARN);
|
||||
ILogger::WARN);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -264,7 +265,7 @@ class Share extends Constants {
|
|||
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1);
|
||||
$result = $query->execute(array($token));
|
||||
if ($result === false) {
|
||||
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, ILogger::ERROR);
|
||||
}
|
||||
$row = $result->fetchRow();
|
||||
if ($row === false) {
|
||||
|
@ -335,7 +336,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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareType), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareType), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
|
||||
|
@ -356,14 +357,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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
// verify that the user has share permission
|
||||
if (!\OC\Files\Filesystem::isSharable($path) || \OCP\Util::isSharingDisabledForUser()) {
|
||||
$message = 'You are not allowed to share %s';
|
||||
$message_t = $l->t('You are not allowed to share %s', [$path]);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $path), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $path), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
}
|
||||
|
@ -376,7 +377,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!';
|
||||
\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', $message, ILogger::DEBUG);
|
||||
throw new \Exception($message);
|
||||
}
|
||||
|
||||
|
@ -408,13 +409,13 @@ class Share extends Constants {
|
|||
if ($shareWith == $uidOwner) {
|
||||
$message = 'Sharing %s failed, because you can not share with yourself';
|
||||
$message_t = $l->t('Sharing %s failed, because you can not share with yourself', [$itemName]);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
if (!\OC::$server->getUserManager()->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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
if ($shareWithinGroupOnly) {
|
||||
|
@ -435,7 +436,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($itemName, $shareWith, $uidOwner));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemName, $shareWith, $uidOwner), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemName, $shareWith, $uidOwner), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
}
|
||||
|
@ -448,7 +449,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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
}
|
||||
|
@ -460,7 +461,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 user %s';
|
||||
$message_t = $l->t('Sharing %s failed, because this item is already shared with user %s', array($itemSourceName, $shareWith));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::ERROR);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
}
|
||||
|
@ -468,7 +469,7 @@ class Share extends Constants {
|
|||
if (!\OC::$server->getGroupManager()->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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
if ($shareWithinGroupOnly) {
|
||||
|
@ -478,7 +479,7 @@ class Share extends Constants {
|
|||
$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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
}
|
||||
|
@ -490,7 +491,7 @@ class Share extends Constants {
|
|||
if ($checkExists['share_with'] === $shareWith && $checkExists['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
|
||||
$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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
}
|
||||
|
@ -557,7 +558,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');
|
||||
\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', $message, ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
|
||||
|
@ -585,7 +586,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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
} else if ($shareType === self::SHARE_TYPE_REMOTE) {
|
||||
|
||||
|
@ -596,7 +597,7 @@ class Share extends Constants {
|
|||
$shareWith, $uidOwner, self::FORMAT_NONE, null, 1, true, true)) {
|
||||
$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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
|
||||
|
@ -607,7 +608,7 @@ class Share extends Constants {
|
|||
if (Helper::isSameUserOnSameServer($user, $remote, $currentUser, $currentServer)) {
|
||||
$message = 'Not allowed to create a federated share with the same user.';
|
||||
$message_t = $l->t('Not allowed to create a federated share with the same user');
|
||||
\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', $message, ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
|
||||
|
@ -634,7 +635,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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $shareType, $itemSource), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $shareType, $itemSource), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
|
||||
|
@ -703,7 +704,7 @@ class Share extends Constants {
|
|||
$result = $query->execute(array($status, $itemType, $itemSource, $shareType, $recipient));
|
||||
|
||||
if($result === false) {
|
||||
\OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', ILogger::ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -740,7 +741,7 @@ class Share extends Constants {
|
|||
if ($date > $maxDate) {
|
||||
$warning = 'Cannot set expiration date. Shares cannot expire later than ' . $maxDays . ' after they have been shared';
|
||||
$warning_t = $l->t('Cannot set expiration date. Shares cannot expire later than %s after they have been shared', array($maxDays));
|
||||
\OCP\Util::writeLog('OCP\Share', $warning, \OCP\Util::WARN);
|
||||
\OCP\Util::writeLog('OCP\Share', $warning, ILogger::WARN);
|
||||
throw new \Exception($warning_t);
|
||||
}
|
||||
}
|
||||
|
@ -748,7 +749,7 @@ class Share extends Constants {
|
|||
if ($date < $today) {
|
||||
$message = 'Cannot set expiration date. Expiration date is in the past';
|
||||
$message_t = $l->t('Cannot set expiration date. Expiration date is in the past');
|
||||
\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::WARN);
|
||||
\OCP\Util::writeLog('OCP\Share', $message, ILogger::WARN);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
|
||||
|
@ -849,20 +850,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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), ILogger::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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $class), ILogger::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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemType), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemType), ILogger::ERROR);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
|
||||
|
@ -1133,7 +1134,7 @@ class Share extends Constants {
|
|||
if ($result === false) {
|
||||
\OCP\Util::writeLog('OCP\Share',
|
||||
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
|
||||
\OCP\Util::ERROR);
|
||||
ILogger::ERROR);
|
||||
}
|
||||
$items = array();
|
||||
$targets = array();
|
||||
|
@ -1197,7 +1198,7 @@ class Share extends Constants {
|
|||
if ($result === false) {
|
||||
\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' .
|
||||
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where,
|
||||
\OCP\Util::ERROR);
|
||||
ILogger::ERROR);
|
||||
} else {
|
||||
$parentRow = $parentResult->fetchRow();
|
||||
$tmpPath = $parentRow['file_target'];
|
||||
|
@ -1668,7 +1669,7 @@ class Share extends Constants {
|
|||
$message = 'Sharing %s failed, because the user %s is the original sharer';
|
||||
$message_t = $l->t('Sharing failed, because the user %s is the original sharer', [$shareWith]);
|
||||
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
}
|
||||
|
@ -1680,7 +1681,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));
|
||||
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
} else {
|
||||
// TODO Don't check if inside folder
|
||||
|
@ -1712,7 +1713,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));
|
||||
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
} else {
|
||||
|
@ -1725,7 +1726,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));
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, $itemType), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, $itemType), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
if ($backend instanceof \OCP\Share_Backend_File_Dependent) {
|
||||
|
@ -1740,7 +1741,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));
|
||||
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), ILogger::DEBUG);
|
||||
throw new \Exception($message_t);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace OC;
|
|||
use OC\Tagging\Tag;
|
||||
use OC\Tagging\TagMapper;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\ILogger;
|
||||
|
||||
class Tags implements \OCP\ITags {
|
||||
|
||||
|
@ -237,14 +238,14 @@ class Tags implements \OCP\ITags {
|
|||
$entries[$objId][] = $row['category'];
|
||||
}
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
@ -270,7 +271,7 @@ class Tags implements \OCP\ITags {
|
|||
} elseif(is_string($tag)) {
|
||||
$tag = trim($tag);
|
||||
if($tag === '') {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
$tagId = $this->getTagId($tag);
|
||||
|
@ -291,13 +292,13 @@ class Tags implements \OCP\ITags {
|
|||
$stmt = \OC_DB::prepare($sql);
|
||||
$result = $stmt->execute(array($tagId));
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
@ -360,11 +361,11 @@ class Tags implements \OCP\ITags {
|
|||
$name = trim($name);
|
||||
|
||||
if($name === '') {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
if($this->userHasTag($name, $this->user)) {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', name: ' . $name. ' exists already', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', name: ' . $name. ' exists already', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
|
@ -374,12 +375,12 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
\OCP\Util::writeLog('core', __METHOD__.', id: ' . $tag->getId(), \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', id: ' . $tag->getId(), ILogger::DEBUG);
|
||||
return $tag->getId();
|
||||
}
|
||||
|
||||
|
@ -395,7 +396,7 @@ class Tags implements \OCP\ITags {
|
|||
$to = trim($to);
|
||||
|
||||
if($to === '' || $from === '') {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -405,13 +406,13 @@ class Tags implements \OCP\ITags {
|
|||
$key = $this->getTagByName($from);
|
||||
}
|
||||
if($key === false) {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', tag: ' . $from. ' does not exist', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', tag: ' . $from. ' does not exist', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
$tag = $this->tags[$key];
|
||||
|
||||
if($this->userHasTag($to, $tag->getOwner())) {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', A tag named ' . $to. ' already exists for user ' . $tag->getOwner() . '.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', A tag named ' . $to. ' already exists for user ' . $tag->getOwner() . '.', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -421,7 +422,7 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
@ -476,7 +477,7 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
|
@ -485,7 +486,7 @@ class Tags implements \OCP\ITags {
|
|||
// reload tags to get the proper ids.
|
||||
$this->tags = $this->mapper->loadTags($this->owners, $this->type);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', tags: ' . print_r($this->tags, true),
|
||||
\OCP\Util::DEBUG);
|
||||
ILogger::DEBUG);
|
||||
// Loop through temporarily cached objectid/tagname pairs
|
||||
// and save relations.
|
||||
$tags = $this->tags;
|
||||
|
@ -494,7 +495,7 @@ class Tags implements \OCP\ITags {
|
|||
$dbConnection = \OC::$server->getDatabaseConnection();
|
||||
foreach(self::$relations as $relation) {
|
||||
$tagId = $this->getTagId($relation['tag']);
|
||||
\OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, ILogger::DEBUG);
|
||||
if($tagId) {
|
||||
try {
|
||||
$dbConnection->insertIfNotExist(self::RELATION_TABLE,
|
||||
|
@ -506,7 +507,7 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
|
@ -515,7 +516,7 @@ class Tags implements \OCP\ITags {
|
|||
self::$relations = array(); // reset
|
||||
} else {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', $this->tags is not an array! '
|
||||
. print_r($this->tags, true), \OCP\Util::ERROR);
|
||||
. print_r($this->tags, true), ILogger::ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -534,12 +535,12 @@ class Tags implements \OCP\ITags {
|
|||
. 'WHERE `uid` = ?');
|
||||
$result = $stmt->execute(array($arguments['uid']));
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
|
@ -554,7 +555,7 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
|
@ -562,7 +563,7 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
|
@ -572,12 +573,12 @@ class Tags implements \OCP\ITags {
|
|||
. 'WHERE `uid` = ?');
|
||||
$result = $stmt->execute(array($arguments['uid']));
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
|
@ -603,13 +604,13 @@ class Tags implements \OCP\ITags {
|
|||
$stmt = \OC_DB::prepare($query);
|
||||
$result = $stmt->execute($updates);
|
||||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
@ -628,7 +629,7 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return array();
|
||||
|
@ -669,7 +670,7 @@ class Tags implements \OCP\ITags {
|
|||
if(is_string($tag) && !is_numeric($tag)) {
|
||||
$tag = trim($tag);
|
||||
if($tag === '') {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
if(!$this->hasTag($tag)) {
|
||||
|
@ -689,7 +690,7 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
@ -708,7 +709,7 @@ class Tags implements \OCP\ITags {
|
|||
if(is_string($tag) && !is_numeric($tag)) {
|
||||
$tag = trim($tag);
|
||||
if($tag === '') {
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', ILogger::DEBUG);
|
||||
return false;
|
||||
}
|
||||
$tagId = $this->getTagId($tag);
|
||||
|
@ -724,7 +725,7 @@ class Tags implements \OCP\ITags {
|
|||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
@ -747,7 +748,7 @@ class Tags implements \OCP\ITags {
|
|||
array_filter($names);
|
||||
|
||||
\OCP\Util::writeLog('core', __METHOD__ . ', before: '
|
||||
. print_r($this->tags, true), \OCP\Util::DEBUG);
|
||||
. print_r($this->tags, true), ILogger::DEBUG);
|
||||
foreach($names as $name) {
|
||||
$id = null;
|
||||
|
||||
|
@ -763,7 +764,7 @@ class Tags implements \OCP\ITags {
|
|||
$this->mapper->delete($tag);
|
||||
} else {
|
||||
\OCP\Util::writeLog('core', __METHOD__ . 'Cannot delete tag ' . $name
|
||||
. ': not found.', \OCP\Util::ERROR);
|
||||
. ': not found.', ILogger::ERROR);
|
||||
}
|
||||
if(!is_null($id) && $id !== false) {
|
||||
try {
|
||||
|
@ -774,13 +775,13 @@ class Tags implements \OCP\ITags {
|
|||
if ($result === null) {
|
||||
\OCP\Util::writeLog('core',
|
||||
__METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(),
|
||||
\OCP\Util::ERROR);
|
||||
ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'core',
|
||||
]);
|
||||
return false;
|
||||
|
|
|
@ -100,9 +100,9 @@ class Updater extends BasicEmitter {
|
|||
$this->emitRepairEvents();
|
||||
$this->logAllEvents();
|
||||
|
||||
$logLevel = $this->config->getSystemValue('loglevel', Util::WARN);
|
||||
$logLevel = $this->config->getSystemValue('loglevel', ILogger::WARN);
|
||||
$this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
|
||||
$this->config->setSystemValue('loglevel', Util::DEBUG);
|
||||
$this->config->setSystemValue('loglevel', ILogger::DEBUG);
|
||||
|
||||
$wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace OC\User;
|
|||
|
||||
use OC\Cache\CappedMemoryCache;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\ILogger;
|
||||
use OCP\User\Backend\ABackend;
|
||||
use OCP\User\Backend\ICheckPasswordBackend;
|
||||
use OCP\User\Backend\ICountUsersBackend;
|
||||
|
@ -408,7 +409,7 @@ class Database extends ABackend
|
|||
$query = \OC_DB::prepare('SELECT COUNT(*) FROM `*PREFIX*users`');
|
||||
$result = $query->execute();
|
||||
if ($result === false) {
|
||||
Util::writeLog('core', \OC_DB::getErrorMessage(), Util::ERROR);
|
||||
Util::writeLog('core', \OC_DB::getErrorMessage(), ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
return $result->fetchOne();
|
||||
|
|
|
@ -56,6 +56,7 @@ use OC\DB\MigrationService;
|
|||
use OC\Installer;
|
||||
use OC\Repair;
|
||||
use OCP\App\ManagerEvent;
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* This class manages the apps. It allows them to register and integrate in the
|
||||
|
@ -425,7 +426,7 @@ class OC_App {
|
|||
}
|
||||
}
|
||||
|
||||
\OCP\Util::writeLog('core', 'No application directories are marked as writable.', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'No application directories are marked as writable.', ILogger::ERROR);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -666,7 +667,7 @@ class OC_App {
|
|||
|
||||
foreach (OC::$APPSROOTS as $apps_dir) {
|
||||
if (!is_readable($apps_dir['path'])) {
|
||||
\OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], \OCP\Util::WARN);
|
||||
\OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN);
|
||||
continue;
|
||||
}
|
||||
$dh = opendir($apps_dir['path']);
|
||||
|
@ -707,12 +708,12 @@ class OC_App {
|
|||
|
||||
$info = OC_App::getAppInfo($app, false, $langCode);
|
||||
if (!is_array($info)) {
|
||||
\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($info['name'])) {
|
||||
\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -994,11 +995,11 @@ class OC_App {
|
|||
}
|
||||
return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
|
||||
} else {
|
||||
\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* This class manages the access to the database. It basically is a wrapper for
|
||||
* Doctrine with some adaptions.
|
||||
|
@ -185,7 +187,7 @@ class OC_DB {
|
|||
try {
|
||||
$result = $schemaManager->updateDbFromStructure($file);
|
||||
} catch (Exception $e) {
|
||||
\OCP\Util::writeLog('core', 'Failed to update database structure ('.$e.')', \OCP\Util::FATAL);
|
||||
\OCP\Util::writeLog('core', 'Failed to update database structure ('.$e.')', ILogger::FATAL);
|
||||
throw $e;
|
||||
}
|
||||
return $result;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
use OC\Files\View;
|
||||
use OC\Streamer;
|
||||
use OCP\ILogger;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
|
||||
/**
|
||||
|
@ -422,7 +423,7 @@ class OC_Files {
|
|||
if (!$handle) {
|
||||
\OCP\Util::writeLog('files',
|
||||
'Can\'t write upload limit to ' . $filename . '. Please check the file permissions',
|
||||
\OCP\Util::WARN);
|
||||
ILogger::WARN);
|
||||
$success = false;
|
||||
continue; // try to update as many files as possible
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
/**
|
||||
* This class provides wrapper methods for user management. Multiple backends are
|
||||
* supported. User management operations are delegated to the configured backend for
|
||||
|
@ -89,7 +91,7 @@ class OC_User {
|
|||
case 'database':
|
||||
case 'mysql':
|
||||
case 'sqlite':
|
||||
\OCP\Util::writeLog('core', 'Adding user backend ' . $backend . '.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', 'Adding user backend ' . $backend . '.', ILogger::DEBUG);
|
||||
self::$_usedBackends[$backend] = new \OC\User\Database();
|
||||
\OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
|
||||
break;
|
||||
|
@ -98,7 +100,7 @@ class OC_User {
|
|||
\OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
|
||||
break;
|
||||
default:
|
||||
\OCP\Util::writeLog('core', 'Adding default user backend ' . $backend . '.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', 'Adding default user backend ' . $backend . '.', ILogger::DEBUG);
|
||||
$className = 'OC_USER_' . strtoupper($backend);
|
||||
self::$_usedBackends[$backend] = new $className();
|
||||
\OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]);
|
||||
|
@ -143,10 +145,10 @@ class OC_User {
|
|||
self::useBackend($backend);
|
||||
self::$_setupedBackends[] = $i;
|
||||
} else {
|
||||
\OCP\Util::writeLog('core', 'User backend ' . $class . ' already initialized.', \OCP\Util::DEBUG);
|
||||
\OCP\Util::writeLog('core', 'User backend ' . $class . ' already initialized.', ILogger::DEBUG);
|
||||
}
|
||||
} else {
|
||||
\OCP\Util::writeLog('core', 'User backend ' . $class . ' not found.', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', 'User backend ' . $class . ' not found.', ILogger::ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
use OCP\IConfig;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUser;
|
||||
|
||||
class OC_Util {
|
||||
|
@ -100,7 +101,7 @@ class OC_Util {
|
|||
private static function initObjectStoreRootFS($config) {
|
||||
// check misconfiguration
|
||||
if (empty($config['class'])) {
|
||||
\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR);
|
||||
}
|
||||
if (!isset($config['arguments'])) {
|
||||
$config['arguments'] = array();
|
||||
|
@ -134,7 +135,7 @@ class OC_Util {
|
|||
private static function initObjectStoreMultibucketRootFS($config) {
|
||||
// check misconfiguration
|
||||
if (empty($config['class'])) {
|
||||
\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR);
|
||||
}
|
||||
if (!isset($config['arguments'])) {
|
||||
$config['arguments'] = array();
|
||||
|
@ -409,7 +410,7 @@ class OC_Util {
|
|||
\OCP\Util::writeLog(
|
||||
'files_skeleton',
|
||||
'copying skeleton for '.$userId.' from '.$skeletonDirectory.' to '.$userDirectory->getFullPath('/'),
|
||||
\OCP\Util::DEBUG
|
||||
ILogger::DEBUG
|
||||
);
|
||||
self::copyr($skeletonDirectory, $userDirectory);
|
||||
// update the file cache
|
||||
|
@ -1378,7 +1379,7 @@ class OC_Util {
|
|||
// XCache
|
||||
if (function_exists('xcache_clear_cache')) {
|
||||
if (\OC::$server->getIniWrapper()->getBool('xcache.admin.enable_auth')) {
|
||||
\OCP\Util::writeLog('core', 'XCache opcode cache will not be cleared because "xcache.admin.enable_auth" is enabled.', \OCP\Util::WARN);
|
||||
\OCP\Util::writeLog('core', 'XCache opcode cache will not be cleared because "xcache.admin.enable_auth" is enabled.', ILogger::WARN);
|
||||
} else {
|
||||
@xcache_clear_cache(XC_TYPE_PHP, 0);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,27 @@ namespace OCP;
|
|||
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface
|
||||
*/
|
||||
interface ILogger {
|
||||
/**
|
||||
* @since 14.0.0
|
||||
*/
|
||||
const DEBUG=0;
|
||||
/**
|
||||
* @since 14.0.0
|
||||
*/
|
||||
const INFO=1;
|
||||
/**
|
||||
* @since 14.0.0
|
||||
*/
|
||||
const WARN=2;
|
||||
/**
|
||||
* @since 14.0.0
|
||||
*/
|
||||
const ERROR=3;
|
||||
/**
|
||||
* @since 14.0.0
|
||||
*/
|
||||
const FATAL=4;
|
||||
|
||||
/**
|
||||
* System is unusable.
|
||||
*
|
||||
|
|
|
@ -57,11 +57,25 @@ namespace OCP;
|
|||
* @since 4.0.0
|
||||
*/
|
||||
class Util {
|
||||
// consts for Logging
|
||||
/**
|
||||
* @deprecated 14.0.0 use \OCP\ILogger::DEBUG
|
||||
*/
|
||||
const DEBUG=0;
|
||||
/**
|
||||
* @deprecated 14.0.0 use \OCP\ILogger::INFO
|
||||
*/
|
||||
const INFO=1;
|
||||
/**
|
||||
* @deprecated 14.0.0 use \OCP\ILogger::WARN
|
||||
*/
|
||||
const WARN=2;
|
||||
/**
|
||||
* @deprecated 14.0.0 use \OCP\ILogger::ERROR
|
||||
*/
|
||||
const ERROR=3;
|
||||
/**
|
||||
* @deprecated 14.0.0 use \OCP\ILogger::FATAL
|
||||
*/
|
||||
const FATAL=4;
|
||||
|
||||
/** \OCP\Share\IManager */
|
||||
|
@ -115,7 +129,7 @@ class Util {
|
|||
* @since ....0.0 - parameter $level was added in 7.0.0
|
||||
* @deprecated 8.2.0 use logException of \OCP\ILogger
|
||||
*/
|
||||
public static function logException( $app, \Exception $ex, $level = \OCP\Util::FATAL ) {
|
||||
public static function logException( $app, \Exception $ex, $level = ILogger::FATAL) {
|
||||
\OC::$server->getLogger()->logException($ex, ['app' => $app]);
|
||||
}
|
||||
|
||||
|
|
|
@ -455,7 +455,7 @@ class UsersController extends Controller {
|
|||
} catch (\Exception $e) {
|
||||
$this->log->logException($e, [
|
||||
'message' => "Can't send new user mail to $email",
|
||||
'level' => \OCP\Util::ERROR,
|
||||
'level' => ILogger::ERROR,
|
||||
'app' => 'settings',
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
use OCP\ILogger;
|
||||
|
||||
OC_JSON::checkAdminUser();
|
||||
\OC_JSON::callCheck();
|
||||
|
||||
|
@ -51,7 +54,7 @@ try {
|
|||
OC_JSON::success(['data' => ['update_required' => $updateRequired]]);
|
||||
} catch (Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => \OCP\Util::DEBUG,
|
||||
'level' => ILogger::DEBUG,
|
||||
'app' => 'core',
|
||||
]);
|
||||
OC_JSON::error(array("data" => array("message" => $e->getMessage()) ));
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
namespace Test\Log;
|
||||
|
||||
use OC\Log\File;
|
||||
use OCP\ILogger;
|
||||
use Test\TestCase;
|
||||
|
||||
/**
|
||||
|
@ -62,8 +63,8 @@ class FileTest extends TestCase
|
|||
|
||||
# set format & write log line
|
||||
$config->setSystemValue('logdateformat', 'u');
|
||||
File::write('test', 'message', \OCP\Util::ERROR);
|
||||
|
||||
File::write('test', 'message', ILogger::ERROR);
|
||||
|
||||
# read log line
|
||||
$handle = @fopen($config->getSystemValue('logfile'), 'r');
|
||||
$line = fread($handle, 1000);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
namespace Test;
|
||||
|
||||
use OC\Log;
|
||||
use OCP\ILogger;
|
||||
|
||||
class LoggerTest extends TestCase {
|
||||
|
||||
|
@ -45,7 +46,7 @@ class LoggerTest extends TestCase {
|
|||
$this->config->expects($this->any())
|
||||
->method('getValue')
|
||||
->will(($this->returnValueMap([
|
||||
['loglevel', \OCP\Util::WARN, \OCP\Util::WARN],
|
||||
['loglevel', ILogger::WARN, ILogger::WARN],
|
||||
['log.condition', [], ['apps' => ['files']]]
|
||||
])));
|
||||
$logger = $this->logger;
|
||||
|
|
Loading…
Reference in a new issue