summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-29 15:25:08 +0100
committerGitHub <noreply@github.com>2018-01-29 15:25:08 +0100
commit01482b32a171bb8529bc8baacbe764107e52e14c (patch)
treec129fb9971d57a0685b84bd97d4235f84231eb19 /lib/private
parent6d86dcb2654739bac62948c94a076c101b1e637d (diff)
parenteb51f06a3b9e42686f462b9f7a56411d3fe6cb27 (diff)
downloadnextcloud-server-01482b32a171bb8529bc8baacbe764107e52e14c.tar.gz
nextcloud-server-01482b32a171bb8529bc8baacbe764107e52e14c.zip
Merge pull request #8062 from nextcloud/use-class
Use ::class statement instead of string
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Accounts/AccountManager.php3
-rw-r--r--lib/private/AppFramework/App.php8
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php8
-rw-r--r--lib/private/Authentication/Token/DefaultTokenCleanupJob.php2
-rw-r--r--lib/private/Command/CronBus.php6
-rw-r--r--lib/private/DB/ConnectionFactory.php16
-rw-r--r--lib/private/Files/Cache/Scanner.php2
-rw-r--r--lib/private/Files/Stream/Encryption.php2
-rw-r--r--lib/private/Files/Utils/Scanner.php5
-rw-r--r--lib/private/Log/Rotate.php2
-rw-r--r--lib/private/Memcache/Factory.php2
-rw-r--r--lib/private/PreviewManager.php62
-rw-r--r--lib/private/Server.php31
-rw-r--r--lib/private/Share/Share.php10
-rw-r--r--lib/private/Share20/LegacyHooks.php11
-rw-r--r--lib/private/Share20/Manager.php7
-rw-r--r--lib/private/Tagging/TagMapper.php2
17 files changed, 95 insertions, 84 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 8c79de7f9e1..524d378f940 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -31,6 +31,7 @@ use OCP\IDBConnection;
use OCP\IUser;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
+use OC\Settings\BackgroundJobs\VerifyUserData;
/**
* Class AccountManager
@@ -167,7 +168,7 @@ class AccountManager {
*/
protected function checkEmailVerification($oldData, $newData, IUser $user) {
if ($oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value']) {
- $this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData',
+ $this->jobList->add(VerifyUserData::class,
[
'verificationCode' => '',
'data' => $newData[self::PROPERTY_EMAIL]['value'],
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php
index 653000ab726..6e8c3736fdb 100644
--- a/lib/private/AppFramework/App.php
+++ b/lib/private/AppFramework/App.php
@@ -33,6 +33,8 @@ use OC\AppFramework\DependencyInjection\DIContainer;
use OCP\AppFramework\Http;
use OCP\AppFramework\QueryException;
use OCP\AppFramework\Http\ICallbackResponse;
+use OCP\AppFramework\Http\IOutput;
+use OCP\IRequest;
/**
* Entry point for every request in your app. You can consider this as your
@@ -81,9 +83,9 @@ class App {
*/
public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) {
if (!is_null($urlParams)) {
- $container['OCP\\IRequest']->setUrlParameters($urlParams);
+ $container[IRequest::class]->setUrlParameters($urlParams);
} else if (isset($container['urlParams']) && !is_null($container['urlParams'])) {
- $container['OCP\\IRequest']->setUrlParameters($container['urlParams']);
+ $container[IRequest::class]->setUrlParameters($container['urlParams']);
}
$appName = $container['AppName'];
@@ -114,7 +116,7 @@ class App {
$response
) = $dispatcher->dispatch($controller, $methodName);
- $io = $container['OCP\\AppFramework\\Http\\IOutput'];
+ $io = $container[IOutput::class];
if(!is_null($httpHeaders)) {
$io->setHeader($httpHeaders);
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index d9e82819d14..5fe925c2998 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -62,6 +62,8 @@ use OCP\IServerContainer;
use OCP\IUserSession;
use OCP\RichObjectStrings\IValidator;
use OCP\Util;
+use OCP\Encryption\IManager;
+use OCA\WorkflowEngine\Manager;
class DIContainer extends SimpleContainer implements IAppContainer {
@@ -134,7 +136,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
$this->registerAlias('ServerContainer', IServerContainer::class);
$this->registerService(\OCP\WorkflowEngine\IManager::class, function ($c) {
- return $c->query('OCA\WorkflowEngine\Manager');
+ return $c->query(Manager::class);
});
$this->registerService(\OCP\AppFramework\IAppContainer::class, function ($c) {
@@ -143,7 +145,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
// commonly used attributes
$this->registerService('UserId', function ($c) {
- return $c->query('OCP\\IUserSession')->getSession()->get('user_id');
+ return $c->query(IUserSession::class)->getSession()->get('user_id');
});
$this->registerService('WebRoot', function ($c) {
@@ -158,7 +160,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
return $c->getServer()->getThemingDefaults();
});
- $this->registerService('OCP\Encryption\IManager', function ($c) {
+ $this->registerService(IManager::class, function ($c) {
return $this->getServer()->getEncryptionManager();
});
diff --git a/lib/private/Authentication/Token/DefaultTokenCleanupJob.php b/lib/private/Authentication/Token/DefaultTokenCleanupJob.php
index 389a25a9bba..60bb0adbf7b 100644
--- a/lib/private/Authentication/Token/DefaultTokenCleanupJob.php
+++ b/lib/private/Authentication/Token/DefaultTokenCleanupJob.php
@@ -29,7 +29,7 @@ class DefaultTokenCleanupJob extends Job {
protected function run($argument) {
/* @var $provider IProvider */
- $provider = OC::$server->query('OC\Authentication\Token\IProvider');
+ $provider = OC::$server->query(IProvider::class);
$provider->invalidateOldTokens();
}
diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php
index 87244fcaa45..b3ee1ae6313 100644
--- a/lib/private/Command/CronBus.php
+++ b/lib/private/Command/CronBus.php
@@ -51,11 +51,11 @@ class CronBus extends AsyncBus {
*/
private function getJobClass($command) {
if ($command instanceof \Closure) {
- return 'OC\Command\ClosureJob';
+ return ClosureJob::class;
} else if (is_callable($command)) {
- return 'OC\Command\CallableJob';
+ return CallableJob::class;
} else if ($command instanceof ICommand) {
- return 'OC\Command\CommandJob';
+ return CommandJob::class;
} else {
throw new \InvalidArgumentException('Invalid command');
}
diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php
index fcb0117a0db..c841a36bb5a 100644
--- a/lib/private/DB/ConnectionFactory.php
+++ b/lib/private/DB/ConnectionFactory.php
@@ -46,26 +46,26 @@ class ConnectionFactory {
*/
protected $defaultConnectionParams = [
'mysql' => [
- 'adapter' => '\OC\DB\AdapterMySQL',
+ 'adapter' => AdapterMySQL::class,
'charset' => 'UTF8',
'driver' => 'pdo_mysql',
- 'wrapperClass' => 'OC\DB\Connection',
+ 'wrapperClass' => Connection::class,
],
'oci' => [
- 'adapter' => '\OC\DB\AdapterOCI8',
+ 'adapter' => AdapterOCI8::class,
'charset' => 'AL32UTF8',
'driver' => 'oci8',
- 'wrapperClass' => 'OC\DB\OracleConnection',
+ 'wrapperClass' => OracleConnection::class,
],
'pgsql' => [
- 'adapter' => '\OC\DB\AdapterPgSql',
+ 'adapter' => AdapterPgSql::class,
'driver' => 'pdo_pgsql',
- 'wrapperClass' => 'OC\DB\Connection',
+ 'wrapperClass' => Connection::class,
],
'sqlite3' => [
- 'adapter' => '\OC\DB\AdapterSqlite',
+ 'adapter' => AdapterSqlite::class,
'driver' => 'pdo_sqlite',
- 'wrapperClass' => 'OC\DB\Connection',
+ 'wrapperClass' => Connection::class,
],
];
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index 22d82a36c4d..8f5f09319dd 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -110,7 +110,7 @@ class Scanner extends BasicEmitter implements IScanner {
protected function getData($path) {
$data = $this->storage->getMetaData($path);
if (is_null($data)) {
- \OCP\Util::writeLog('OC\Files\Cache\Scanner', "!!! Path '$path' is not accessible or present !!!", \OCP\Util::DEBUG);
+ \OCP\Util::writeLog(Scanner::class, "!!! Path '$path' is not accessible or present !!!", \OCP\Util::DEBUG);
}
return $data;
}
diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php
index 05107652c91..05be5a5b286 100644
--- a/lib/private/Files/Stream/Encryption.php
+++ b/lib/private/Files/Stream/Encryption.php
@@ -157,7 +157,7 @@ class Encryption extends Wrapper {
$unencryptedSize,
$headerSize,
$signed,
- $wrapper = 'OC\Files\Stream\Encryption') {
+ $wrapper = Encryption::class) {
$context = stream_context_create(array(
'ocencryption' => array(
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php
index 162e5759121..dd20e11fb63 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -38,6 +38,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\ILogger;
+use OC\Files\Storage\FailedStorage;
/**
* Class Scanner
@@ -146,7 +147,7 @@ class Scanner extends PublicEmitter {
}
// don't bother scanning failed storages (shortcut for same result)
- if ($storage->instanceOfStorage('OC\Files\Storage\FailedStorage')) {
+ if ($storage->instanceOfStorage(FailedStorage::class)) {
continue;
}
@@ -196,7 +197,7 @@ class Scanner extends PublicEmitter {
}
// don't bother scanning failed storages (shortcut for same result)
- if ($storage->instanceOfStorage('OC\Files\Storage\FailedStorage')) {
+ if ($storage->instanceOfStorage(FailedStorage::class)) {
continue;
}
diff --git a/lib/private/Log/Rotate.php b/lib/private/Log/Rotate.php
index 1788cbfa6e1..d7c554374fd 100644
--- a/lib/private/Log/Rotate.php
+++ b/lib/private/Log/Rotate.php
@@ -49,6 +49,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('OC\Log\Rotate', $msg, \OCP\Util::WARN);
+ \OCP\Util::writeLog(Rotate::class, $msg, \OCP\Util::WARN);
}
}
diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php
index b79f17ba8ea..cb2cd8aabe2 100644
--- a/lib/private/Memcache/Factory.php
+++ b/lib/private/Memcache/Factory.php
@@ -37,7 +37,7 @@ use OCP\ILogger;
use OCP\IMemcache;
class Factory implements ICacheFactory {
- const NULL_CACHE = '\\OC\\Memcache\\NullCache';
+ const NULL_CACHE = NullCache::class;
/**
* @var string $globalPrefix
diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php
index f9c96aa6e7a..979208d0aed 100644
--- a/lib/private/PreviewManager.php
+++ b/lib/private/PreviewManager.php
@@ -306,20 +306,20 @@ class PreviewManager implements IPreview {
}
$imageProviders = [
- 'OC\Preview\PNG',
- 'OC\Preview\JPEG',
- 'OC\Preview\GIF',
- 'OC\Preview\BMP',
- 'OC\Preview\XBitmap'
+ Preview\PNG::class,
+ Preview\JPEG::class,
+ Preview\GIF::class,
+ Preview\BMP::class,
+ Preview\XBitmap::class
];
$this->defaultProviders = $this->config->getSystemValue('enabledPreviewProviders', array_merge([
- 'OC\Preview\MarkDown',
- 'OC\Preview\MP3',
- 'OC\Preview\TXT',
+ Preview\MarkDown::class,
+ Preview\MP3::class,
+ Preview\TXT::class,
], $imageProviders));
- if (in_array('OC\Preview\Image', $this->defaultProviders)) {
+ if (in_array(Preview\Image::class, $this->defaultProviders)) {
$this->defaultProviders = array_merge($this->defaultProviders, $imageProviders);
}
$this->defaultProviders = array_unique($this->defaultProviders);
@@ -349,27 +349,27 @@ class PreviewManager implements IPreview {
}
$this->registeredCoreProviders = true;
- $this->registerCoreProvider('OC\Preview\TXT', '/text\/plain/');
- $this->registerCoreProvider('OC\Preview\MarkDown', '/text\/(x-)?markdown/');
- $this->registerCoreProvider('OC\Preview\PNG', '/image\/png/');
- $this->registerCoreProvider('OC\Preview\JPEG', '/image\/jpeg/');
- $this->registerCoreProvider('OC\Preview\GIF', '/image\/gif/');
- $this->registerCoreProvider('OC\Preview\BMP', '/image\/bmp/');
- $this->registerCoreProvider('OC\Preview\XBitmap', '/image\/x-xbitmap/');
- $this->registerCoreProvider('OC\Preview\MP3', '/audio\/mpeg/');
+ $this->registerCoreProvider(Preview\TXT::class, '/text\/plain/');
+ $this->registerCoreProvider(Preview\MarkDown::class, '/text\/(x-)?markdown/');
+ $this->registerCoreProvider(Preview\PNG::class, '/image\/png/');
+ $this->registerCoreProvider(Preview\JPEG::class, '/image\/jpeg/');
+ $this->registerCoreProvider(Preview\GIF::class, '/image\/gif/');
+ $this->registerCoreProvider(Preview\BMP::class, '/image\/bmp/');
+ $this->registerCoreProvider(Preview\XBitmap::class, '/image\/x-xbitmap/');
+ $this->registerCoreProvider(Preview\MP3::class, '/audio\/mpeg/');
// SVG, Office and Bitmap require imagick
if (extension_loaded('imagick')) {
$checkImagick = new \Imagick();
$imagickProviders = [
- 'SVG' => ['mimetype' => '/image\/svg\+xml/', 'class' => '\OC\Preview\SVG'],
- 'TIFF' => ['mimetype' => '/image\/tiff/', 'class' => '\OC\Preview\TIFF'],
- 'PDF' => ['mimetype' => '/application\/pdf/', 'class' => '\OC\Preview\PDF'],
- 'AI' => ['mimetype' => '/application\/illustrator/', 'class' => '\OC\Preview\Illustrator'],
- 'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => '\OC\Preview\Photoshop'],
- 'EPS' => ['mimetype' => '/application\/postscript/', 'class' => '\OC\Preview\Postscript'],
- 'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => '\OC\Preview\Font'],
+ 'SVG' => ['mimetype' => '/image\/svg\+xml/', 'class' => Preview\SVG::class],
+ 'TIFF' => ['mimetype' => '/image\/tiff/', 'class' => Preview\TIFF::class],
+ 'PDF' => ['mimetype' => '/application\/pdf/', 'class' => Preview\PDF::class],
+ 'AI' => ['mimetype' => '/application\/illustrator/', 'class' => Preview\Illustrator::class],
+ 'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => Preview\Photoshop::class],
+ 'EPS' => ['mimetype' => '/application\/postscript/', 'class' => Preview\Postscript::class],
+ 'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => Preview\Font::class],
];
foreach ($imagickProviders as $queryFormat => $provider) {
@@ -398,18 +398,18 @@ class PreviewManager implements IPreview {
}
if ($officeFound) {
- $this->registerCoreProvider('\OC\Preview\MSOfficeDoc', '/application\/msword/');
- $this->registerCoreProvider('\OC\Preview\MSOffice2003', '/application\/vnd.ms-.*/');
- $this->registerCoreProvider('\OC\Preview\MSOffice2007', '/application\/vnd.openxmlformats-officedocument.*/');
- $this->registerCoreProvider('\OC\Preview\OpenDocument', '/application\/vnd.oasis.opendocument.*/');
- $this->registerCoreProvider('\OC\Preview\StarOffice', '/application\/vnd.sun.xml.*/');
+ $this->registerCoreProvider(Preview\MSOfficeDoc::class, '/application\/msword/');
+ $this->registerCoreProvider(Preview\MSOffice2003::class, '/application\/vnd.ms-.*/');
+ $this->registerCoreProvider(Preview\MSOffice2007::class, '/application\/vnd.openxmlformats-officedocument.*/');
+ $this->registerCoreProvider(Preview\OpenDocument::class, '/application\/vnd.oasis.opendocument.*/');
+ $this->registerCoreProvider(Preview\StarOffice::class, '/application\/vnd.sun.xml.*/');
}
}
}
}
// Video requires avconv or ffmpeg
- if (in_array('OC\Preview\Movie', $this->getEnabledDefaultProvider())) {
+ if (in_array(Preview\Movie::class, $this->getEnabledDefaultProvider())) {
$avconvBinary = \OC_Helper::findBinaryPath('avconv');
$ffmpegBinary = $avconvBinary ? null : \OC_Helper::findBinaryPath('ffmpeg');
@@ -418,7 +418,7 @@ class PreviewManager implements IPreview {
\OC\Preview\Movie::$avconvBinary = $avconvBinary;
\OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary;
- $this->registerCoreProvider('\OC\Preview\Movie', '/video\/.*/');
+ $this->registerCoreProvider(Preview\Movie::class, '/video\/.*/');
}
}
}
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 1f572280c7c..8799223345e 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -57,11 +57,13 @@ use OC\AppFramework\Http\Request;
use OC\AppFramework\Utility\SimpleContainer;
use OC\AppFramework\Utility\TimeFactory;
use OC\Authentication\LoginCredentials\Store;
+use OC\Authentication\Token\IProvider;
use OC\Collaboration\Collaborators\GroupPlugin;
use OC\Collaboration\Collaborators\MailPlugin;
use OC\Collaboration\Collaborators\RemotePlugin;
use OC\Collaboration\Collaborators\UserPlugin;
use OC\Command\CronBus;
+use OC\Comments\ManagerFactory as CommentsManagerFactory;
use OC\Contacts\ContactsMenu\ActionFactory;
use OC\Contacts\ContactsMenu\ContactsStore;
use OC\Diagnostics\EventLogger;
@@ -106,7 +108,9 @@ use OC\Security\CredentialsManager;
use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper;
use OC\Session\CryptoWrapper;
+use OC\Share20\ProviderFactory;
use OC\Share20\ShareHelper;
+use OC\SystemTag\ManagerFactory as SystemTagManagerFactory;
use OC\Tagging\TagMapper;
use OC\Template\SCSSCacher;
use OCA\Theming\ThemingDefaults;
@@ -132,7 +136,6 @@ use OCP\Remote\Api\IApiFactory;
use OCP\Remote\IInstanceFactory;
use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager;
-use OCP\Share;
use OCP\Share\IShareHelper;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -242,7 +245,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('SystemTagManagerFactory', function (Server $c) {
$config = $c->getConfig();
- $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory');
+ $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class);
return new $factoryClass($this);
});
$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
@@ -317,7 +320,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(Store::class, function (Server $c) {
$session = $c->getSession();
if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
- $tokenProvider = $c->query('OC\Authentication\Token\IProvider');
+ $tokenProvider = $c->query(IProvider::class);
} else {
$tokenProvider = null;
}
@@ -325,19 +328,19 @@ class Server extends ServerContainer implements IServerContainer {
return new Store($session, $logger, $tokenProvider);
});
$this->registerAlias(IStore::class, Store::class);
- $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) {
+ $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) {
$dbConnection = $c->getDatabaseConnection();
return new Authentication\Token\DefaultTokenMapper($dbConnection);
});
- $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) {
- $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper');
+ $this->registerService(Authentication\Token\DefaultTokenProvider::class, function (Server $c) {
+ $mapper = $c->query(Authentication\Token\DefaultTokenMapper::class);
$crypto = $c->getCrypto();
$config = $c->getConfig();
$logger = $c->getLogger();
$timeFactory = new TimeFactory();
return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory);
});
- $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider');
+ $this->registerAlias(IProvider::class, Authentication\Token\DefaultTokenProvider::class);
$this->registerService(\OCP\IUserSession::class, function (Server $c) {
$manager = $c->getUserManager();
@@ -346,7 +349,7 @@ class Server extends ServerContainer implements IServerContainer {
// Token providers might require a working database. This code
// might however be called when ownCloud is not yet setup.
if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
- $defaultTokenProvider = $c->query('OC\Authentication\Token\IProvider');
+ $defaultTokenProvider = $c->query(IProvider::class);
} else {
$defaultTokenProvider = null;
}
@@ -417,7 +420,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->getConfig(),
$c->getActivityManager(),
$c->getLogger(),
- $c->query(\OC\Authentication\Token\IProvider::class),
+ $c->query(IProvider::class),
$c->query(ITimeFactory::class),
$c->query(EventDispatcherInterface::class)
);
@@ -480,9 +483,9 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(Factory::class, function (Server $c) {
$arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(),
- '\\OC\\Memcache\\ArrayCache',
- '\\OC\\Memcache\\ArrayCache',
- '\\OC\\Memcache\\ArrayCache'
+ ArrayCache::class,
+ ArrayCache::class,
+ ArrayCache::class
);
$config = $c->getConfig();
$request = $c->getRequest();
@@ -903,7 +906,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) {
$config = $c->getConfig();
- $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory');
+ $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class);
/** @var \OCP\Comments\ICommentsManagerFactory $factory */
$factory = new $factoryClass($this);
$manager = $factory->getManager();
@@ -1020,7 +1023,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(\OCP\Share\IManager::class, function (Server $c) {
$config = $c->getConfig();
- $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory');
+ $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
/** @var \OCP\Share\IProviderFactory $factory */
$factory = new $factoryClass($this);
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index 465446c52b7..9507eaf5c1f 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -849,11 +849,11 @@ class Share extends Constants {
$hookParams['fileTarget'] = $item['file_target'];
}
- \OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams);
+ \OC_Hook::emit(\OCP\Share::class, 'pre_unshare', $hookParams);
$deletedShares = Helper::delete($item['id'], false, null, $newParent);
$deletedShares[] = $hookParams;
$hookParams['deletedShares'] = $deletedShares;
- \OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams);
+ \OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams);
if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
list(, $remote) = Helper::splitUserRemote($item['share_with']);
self::sendRemoteUnshare($remote, $item['id'], $item['token']);
@@ -1549,7 +1549,7 @@ class Share extends Constants {
$preHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget;
$preHookData['shareWith'] = $isGroupShare ? $shareWith['group'] : $shareWith;
- \OC_Hook::emit('OCP\Share', 'pre_shared', $preHookData);
+ \OC_Hook::emit(\OCP\Share::class, 'pre_shared', $preHookData);
if ($run === false) {
throw new \Exception($error);
@@ -1663,7 +1663,7 @@ class Share extends Constants {
$postHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget;
$postHookData['fileTarget'] = $isGroupShare ? $groupFileTarget : $fileTarget;
- \OC_Hook::emit('OCP\Share', 'post_shared', $postHookData);
+ \OC_Hook::emit(\OCP\Share::class, 'post_shared', $postHookData);
return $id ? $id : false;
@@ -2037,7 +2037,7 @@ class Share extends Constants {
$status = json_decode($result['result'], true);
if ($result['success'] && ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200)) {
- \OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $remote]);
+ \OC_Hook::emit(\OCP\Share::class, 'federated_share_added', ['server' => $remote]);
return true;
}
diff --git a/lib/private/Share20/LegacyHooks.php b/lib/private/Share20/LegacyHooks.php
index 77db4c5d0e0..c3a4e9d999d 100644
--- a/lib/private/Share20/LegacyHooks.php
+++ b/lib/private/Share20/LegacyHooks.php
@@ -27,6 +27,7 @@ use OCP\Files\File;
use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
+use OCP\Share;
class LegacyHooks {
/** @var EventDispatcher */
@@ -55,7 +56,7 @@ class LegacyHooks {
$share = $e->getSubject();
$formatted = $this->formatHookParams($share);
- \OC_Hook::emit('OCP\Share', 'pre_unshare', $formatted);
+ \OC_Hook::emit(Share::class, 'pre_unshare', $formatted);
}
/**
@@ -76,7 +77,7 @@ class LegacyHooks {
$formatted['deletedShares'] = $formattedDeletedShares;
- \OC_Hook::emit('OCP\Share', 'post_unshare', $formatted);
+ \OC_Hook::emit(Share::class, 'post_unshare', $formatted);
}
/**
@@ -90,7 +91,7 @@ class LegacyHooks {
$formatted['itemTarget'] = $formatted['fileTarget'];
$formatted['unsharedItems'] = [$formatted];
- \OC_Hook::emit('OCP\Share', 'post_unshareFromSelf', $formatted);
+ \OC_Hook::emit(Share::class, 'post_unshareFromSelf', $formatted);
}
private function formatHookParams(IShare $share) {
@@ -138,7 +139,7 @@ class LegacyHooks {
'run' => &$run,
'error' => &$error,
];
- \OC_Hook::emit('OCP\Share', 'pre_shared', $preHookData);
+ \OC_Hook::emit(Share::class, 'pre_shared', $preHookData);
if ($run === false) {
$e->setArgument('error', $error);
@@ -167,7 +168,7 @@ class LegacyHooks {
'fileTarget' => $share->getTarget(),
];
- \OC_Hook::emit('OCP\Share', 'post_shared', $postHookData);
+ \OC_Hook::emit(Share::class, 'post_shared', $postHookData);
}
}
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 48c70606835..0ae96f29ded 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -64,6 +64,7 @@ use OCP\Share\IProviderFactory;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\Share\IShareProvider;
+use OCP\Share;
/**
* This class is the communication hub for all sharing related operations.
@@ -838,7 +839,7 @@ class Manager implements IManager {
}
if ($expirationDateUpdated === true) {
- \OC_Hook::emit('OCP\Share', 'post_set_expiration_date', [
+ \OC_Hook::emit(Share::class, 'post_set_expiration_date', [
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
'date' => $share->getExpirationDate(),
@@ -847,7 +848,7 @@ class Manager implements IManager {
}
if ($share->getPassword() !== $originalShare->getPassword()) {
- \OC_Hook::emit('OCP\Share', 'post_update_password', [
+ \OC_Hook::emit(Share::class, 'post_update_password', [
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
'uidOwner' => $share->getSharedBy(),
@@ -862,7 +863,7 @@ class Manager implements IManager {
} else {
$userFolder = $this->rootFolder->getUserFolder($share->getSharedBy());
}
- \OC_Hook::emit('OCP\Share', 'post_update_permissions', array(
+ \OC_Hook::emit(Share::class, 'post_update_permissions', array(
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
'shareType' => $share->getShareType(),
diff --git a/lib/private/Tagging/TagMapper.php b/lib/private/Tagging/TagMapper.php
index d52a3f3eb83..e5ca41f69e3 100644
--- a/lib/private/Tagging/TagMapper.php
+++ b/lib/private/Tagging/TagMapper.php
@@ -39,7 +39,7 @@ class TagMapper extends Mapper {
* @param IDBConnection $db Instance of the Db abstraction layer.
*/
public function __construct(IDBConnection $db) {
- parent::__construct($db, 'vcategory', 'OC\Tagging\Tag');
+ parent::__construct($db, 'vcategory', Tag::class);
}
/**