Use ::class statement instead of string

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2018-01-25 23:16:13 +01:00
parent 1d8b90b8d3
commit eb51f06a3b
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
53 changed files with 270 additions and 184 deletions

View File

@ -48,6 +48,7 @@ use OCP\IPreview;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\Util; use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\Share;
class Application extends App { class Application extends App {
@ -107,12 +108,12 @@ class Application extends App {
protected function sharingHooks(ILogger $logger) { protected function sharingHooks(ILogger $logger) {
$shareActions = new Sharing($logger); $shareActions = new Sharing($logger);
Util::connectHook('OCP\Share', 'post_shared', $shareActions, 'shared'); Util::connectHook(Share::class, 'post_shared', $shareActions, 'shared');
Util::connectHook('OCP\Share', 'post_unshare', $shareActions, 'unshare'); Util::connectHook(Share::class, 'post_unshare', $shareActions, 'unshare');
Util::connectHook('OCP\Share', 'post_update_permissions', $shareActions, 'updatePermissions'); Util::connectHook(Share::class, 'post_update_permissions', $shareActions, 'updatePermissions');
Util::connectHook('OCP\Share', 'post_update_password', $shareActions, 'updatePassword'); Util::connectHook(Share::class, 'post_update_password', $shareActions, 'updatePassword');
Util::connectHook('OCP\Share', 'post_set_expiration_date', $shareActions, 'updateExpirationDate'); Util::connectHook(Share::class, 'post_set_expiration_date', $shareActions, 'updateExpirationDate');
Util::connectHook('OCP\Share', 'share_link_access', $shareActions, 'shareAccessed'); Util::connectHook(Share::class, 'share_link_access', $shareActions, 'shareAccessed');
} }
protected function authHooks(ILogger $logger) { protected function authHooks(ILogger $logger) {

View File

@ -23,6 +23,7 @@
*/ */
namespace OCA\DAV\CalDAV\Search; namespace OCA\DAV\CalDAV\Search;
use OCA\DAV\CalDAV\Search\Xml\Request\CalendarSearchReport;
use Sabre\DAV\Server; use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin; use Sabre\DAV\ServerPlugin;
use OCA\DAV\CalDAV\CalendarHome; use OCA\DAV\CalDAV\CalendarHome;
@ -78,7 +79,7 @@ class SearchPlugin extends ServerPlugin {
$server->on('report', [$this, 'report']); $server->on('report', [$this, 'report']);
$server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] = $server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] =
'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport'; CalendarSearchReport::class;
} }
/** /**

View File

@ -27,6 +27,7 @@ use Sabre\CalDAV\Principal\User;
use Sabre\DAV\Exception\NotFound; use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\INode; use Sabre\DAV\INode;
use \Sabre\DAV\PropFind; use \Sabre\DAV\PropFind;
use OCA\DAV\CardDAV\AddressBook;
/** /**
* Class DavAclPlugin is a wrapper around \Sabre\DAVACL\Plugin that returns 404 * Class DavAclPlugin is a wrapper around \Sabre\DAVACL\Plugin that returns 404
@ -49,7 +50,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin {
$node = $this->server->tree->getNodeForPath($uri); $node = $this->server->tree->getNodeForPath($uri);
switch(get_class($node)) { switch(get_class($node)) {
case 'OCA\DAV\CardDAV\AddressBook': case AddressBook::class:
$type = 'Addressbook'; $type = 'Addressbook';
break; break;
default: default:

View File

@ -102,7 +102,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
*/ */
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$server->xml->namespacesMap[self::NS_OWNCLOUD] = 'oc'; $server->xml->namespacesMap[self::NS_OWNCLOUD] = 'oc';
$server->xml->elementMap[self::SHARETYPES_PROPERTYNAME] = 'OCA\\DAV\\Connector\\Sabre\\ShareTypeList'; $server->xml->elementMap[self::SHARETYPES_PROPERTYNAME] = ShareTypeList::class;
$server->protectedProperties[] = self::SHARETYPES_PROPERTYNAME; $server->protectedProperties[] = self::SHARETYPES_PROPERTYNAME;
$this->server = $server; $this->server = $server;

View File

@ -112,7 +112,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
$server->xml->elementMap[self::TAGS_PROPERTYNAME] = 'OCA\\DAV\\Connector\\Sabre\\TagList'; $server->xml->elementMap[self::TAGS_PROPERTYNAME] = TagList::class;
$this->server = $server; $this->server = $server;
$this->server->on('propFind', array($this, 'handleGetProperties')); $this->server->on('propFind', array($this, 'handleGetProperties'));

View File

@ -25,6 +25,7 @@ namespace OCA\DAV\DAV\Sharing;
use OCA\DAV\Connector\Sabre\Auth; use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\DAV\Sharing\Xml\Invite; use OCA\DAV\DAV\Sharing\Xml\Invite;
use OCA\DAV\DAV\Sharing\Xml\ShareRequest;
use OCP\IRequest; use OCP\IRequest;
use Sabre\DAV\Exception\NotFound; use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\INode; use Sabre\DAV\INode;
@ -100,8 +101,8 @@ class Plugin extends ServerPlugin {
*/ */
function initialize(Server $server) { function initialize(Server $server) {
$this->server = $server; $this->server = $server;
$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest'; $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class;
$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite'; $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class;
$this->server->on('method:POST', [$this, 'httpPost']); $this->server->on('method:POST', [$this, 'httpPost']);
$this->server->on('propFind', [$this, 'propFind']); $this->server->on('propFind', [$this, 'propFind']);

View File

@ -120,7 +120,7 @@ class RetryJob extends Job {
* @param array $argument * @param array $argument
*/ */
protected function reAddJob(IJobList $jobList, array $argument) { protected function reAddJob(IJobList $jobList, array $argument) {
$jobList->add('OCA\FederatedFileSharing\BackgroundJob\RetryJob', $jobList->add(RetryJob::class,
[ [
'remote' => $argument['remote'], 'remote' => $argument['remote'],
'remoteId' => $argument['remoteId'], 'remoteId' => $argument['remoteId'],

View File

@ -32,6 +32,7 @@ use OCP\SabrePluginEvent;
use OCP\Util; use OCP\Util;
use Sabre\DAV\Auth\Plugin; use Sabre\DAV\Auth\Plugin;
use Sabre\DAV\Server; use Sabre\DAV\Server;
use OCP\Share;
class Application extends App { class Application extends App {
@ -59,7 +60,7 @@ class Application extends App {
$hooksManager = $container->query(Hooks::class); $hooksManager = $container->query(Hooks::class);
Util::connectHook( Util::connectHook(
'OCP\Share', Share::class,
'federated_share_added', 'federated_share_added',
$hooksManager, $hooksManager,
'addServerHook' 'addServerHook'

View File

@ -28,6 +28,7 @@
namespace OCA\Federation; namespace OCA\Federation;
use OC\HintException; use OC\HintException;
use OCA\Federation\BackgroundJob\RequestSharedSecret;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory; use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\IJobList;
@ -116,7 +117,7 @@ class TrustedServers {
$token = $this->secureRandom->generate(16); $token = $this->secureRandom->generate(16);
$this->dbHandler->addToken($url, $token); $this->dbHandler->addToken($url, $token);
$this->jobList->add( $this->jobList->add(
'OCA\Federation\BackgroundJob\RequestSharedSecret', RequestSharedSecret::class,
[ [
'url' => $url, 'url' => $url,
'token' => $token, 'token' => $token,

View File

@ -23,6 +23,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* *
*/ */
use OCP\Files\StorageNotAvailableException;
use OCP\Files\StorageInvalidException;
OCP\JSON::checkLoggedIn(); OCP\JSON::checkLoggedIn();
\OC::$server->getSession()->close(); \OC::$server->getSession()->close();
$l = \OC::$server->getL10N('files'); $l = \OC::$server->getL10N('files');
@ -80,7 +84,7 @@ try {
\OCP\Util::logException('files', $e); \OCP\Util::logException('files', $e);
OCP\JSON::error([ OCP\JSON::error([
'data' => [ 'data' => [
'exception' => '\OCP\Files\StorageNotAvailableException', 'exception' => StorageNotAvailableException::class,
'message' => $l->t('Storage is temporarily not available') 'message' => $l->t('Storage is temporarily not available')
] ]
]); ]);
@ -88,7 +92,7 @@ try {
\OCP\Util::logException('files', $e); \OCP\Util::logException('files', $e);
OCP\JSON::error(array( OCP\JSON::error(array(
'data' => array( 'data' => array(
'exception' => '\OCP\Files\StorageInvalidException', 'exception' => StorageInvalidException::class,
'message' => $l->t('Storage invalid') 'message' => $l->t('Storage invalid')
) )
)); ));
@ -96,7 +100,7 @@ try {
\OCP\Util::logException('files', $e); \OCP\Util::logException('files', $e);
OCP\JSON::error(array( OCP\JSON::error(array(
'data' => array( 'data' => array(
'exception' => '\Exception', 'exception' => \Exception::class,
'message' => $l->t('Unknown error') 'message' => $l->t('Unknown error')
) )
)); ));

View File

@ -24,11 +24,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* *
*/ */
use OC\Search\Provider\File;
// required for translation purpose // required for translation purpose
// t('Files') // t('Files')
$l = \OC::$server->getL10N('files'); $l = \OC::$server->getL10N('files');
\OC::$server->getSearch()->registerProvider('OC\Search\Provider\File', array('apps' => array('files'))); \OC::$server->getSearch()->registerProvider(File::class, array('apps' => array('files')));
$templateManager = \OC_Helper::getFileTemplateManager(); $templateManager = \OC_Helper::getFileTemplateManager();
$templateManager->registerTemplate('text/html', 'core/templates/filetemplates/template.html'); $templateManager->registerTemplate('text/html', 'core/templates/filetemplates/template.html');

View File

@ -31,6 +31,7 @@ use OCP\AppFramework\App;
use \OCA\Files\Service\TagService; use \OCA\Files\Service\TagService;
use \OCP\IContainer; use \OCP\IContainer;
use OCA\Files\Controller\ViewController; use OCA\Files\Controller\ViewController;
use OCA\Files\Capabilities;
class Application extends App { class Application extends App {
public function __construct(array $urlParams=array()) { public function __construct(array $urlParams=array()) {
@ -95,6 +96,6 @@ class Application extends App {
/* /*
* Register capabilities * Register capabilities
*/ */
$container->registerCapability('OCA\Files\Capabilities'); $container->registerCapability(Capabilities::class);
} }
} }

View File

@ -261,7 +261,7 @@ class Helper {
} else if ($sortAttribute === 'size') { } else if ($sortAttribute === 'size') {
$sortFunc = 'compareSize'; $sortFunc = 'compareSize';
} }
usort($files, array('\OCA\Files\Helper', $sortFunc)); usort($files, array(Helper::class, $sortFunc));
if ($sortDescending) { if ($sortDescending) {
$files = array_reverse($files); $files = array_reverse($files);
} }

View File

@ -26,6 +26,8 @@
* *
*/ */
use OCA\Files_External\Config\ConfigAdapter;
OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php'; OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';
require_once __DIR__ . '/../3rdparty/autoload.php'; require_once __DIR__ . '/../3rdparty/autoload.php';
@ -45,5 +47,5 @@ $appContainer = \OC_Mount_Config::$app->getContainer();
]; ];
}); });
$mountProvider = $appContainer->query('OCA\Files_External\Config\ConfigAdapter'); $mountProvider = $appContainer->query(ConfigAdapter::class);
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider); \OC::$server->getMountProviderCollection()->registerProvider($mountProvider);

View File

@ -35,6 +35,30 @@ use \OCP\IContainer;
use \OCA\Files_External\Service\BackendService; use \OCA\Files_External\Service\BackendService;
use \OCA\Files_External\Lib\Config\IBackendProvider; use \OCA\Files_External\Lib\Config\IBackendProvider;
use \OCA\Files_External\Lib\Config\IAuthMechanismProvider; use \OCA\Files_External\Lib\Config\IAuthMechanismProvider;
use OCA\Files_External\Lib\Auth\AmazonS3\AccessKey;
use OCA\Files_External\Lib\Auth\OpenStack\Rackspace;
use OCA\Files_External\Lib\Auth\OpenStack\OpenStack;
use OCA\Files_External\Lib\Auth\PublicKey\RSA;
use OCA\Files_External\Lib\Auth\OAuth2\OAuth2;
use OCA\Files_External\Lib\Auth\OAuth1\OAuth1;
use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
use OCA\Files_External\Lib\Auth\Password\UserProvided;
use OCA\Files_External\Lib\Auth\Password\LoginCredentials;
use OCA\Files_External\Lib\Auth\Password\SessionCredentials;
use OCA\Files_External\Lib\Auth\Password\Password;
use OCA\Files_External\Lib\Auth\Builtin;
use OCA\Files_External\Lib\Auth\NullMechanism;
use OCA\Files_External\Lib\Backend\SMB_OC;
use OCA\Files_External\Lib\Backend\SMB;
use OCA\Files_External\Lib\Backend\SFTP_Key;
use OCA\Files_External\Lib\Backend\Swift;
use OCA\Files_External\Lib\Backend\AmazonS3;
use OCA\Files_External\Lib\Backend\SFTP;
use OCA\Files_External\Lib\Backend\OwnCloud;
use OCA\Files_External\Lib\Backend\DAV;
use OCA\Files_External\Lib\Backend\FTP;
use OCA\Files_External\Lib\Backend\Local;
use OCP\Files\Config\IUserMountCache;
/** /**
* @package OCA\Files_External\AppInfo * @package OCA\Files_External\AppInfo
@ -46,11 +70,11 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
$container = $this->getContainer(); $container = $this->getContainer();
$container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) { $container->registerService(IUserMountCache::class, function (IAppContainer $c) {
return $c->getServer()->query('UserMountCache'); return $c->getServer()->query('UserMountCache');
}); });
$backendService = $container->query('OCA\\Files_External\\Service\\BackendService'); $backendService = $container->query(BackendService::class);
$backendService->registerBackendProvider($this); $backendService->registerBackendProvider($this);
$backendService->registerAuthMechanismProvider($this); $backendService->registerAuthMechanismProvider($this);
@ -71,16 +95,16 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
$container = $this->getContainer(); $container = $this->getContainer();
$backends = [ $backends = [
$container->query('OCA\Files_External\Lib\Backend\Local'), $container->query(Local::class),
$container->query('OCA\Files_External\Lib\Backend\FTP'), $container->query(FTP::class),
$container->query('OCA\Files_External\Lib\Backend\DAV'), $container->query(DAV::class),
$container->query('OCA\Files_External\Lib\Backend\OwnCloud'), $container->query(OwnCloud::class),
$container->query('OCA\Files_External\Lib\Backend\SFTP'), $container->query(SFTP::class),
$container->query('OCA\Files_External\Lib\Backend\AmazonS3'), $container->query(AmazonS3::class),
$container->query('OCA\Files_External\Lib\Backend\Swift'), $container->query(Swift::class),
$container->query('OCA\Files_External\Lib\Backend\SFTP_Key'), $container->query(SFTP_Key::class),
$container->query('OCA\Files_External\Lib\Backend\SMB'), $container->query(SMB::class),
$container->query('OCA\Files_External\Lib\Backend\SMB_OC'), $container->query(SMB_OC::class),
]; ];
return $backends; return $backends;
@ -94,33 +118,33 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
return [ return [
// AuthMechanism::SCHEME_NULL mechanism // AuthMechanism::SCHEME_NULL mechanism
$container->query('OCA\Files_External\Lib\Auth\NullMechanism'), $container->query(NullMechanism::class),
// AuthMechanism::SCHEME_BUILTIN mechanism // AuthMechanism::SCHEME_BUILTIN mechanism
$container->query('OCA\Files_External\Lib\Auth\Builtin'), $container->query(Builtin::class),
// AuthMechanism::SCHEME_PASSWORD mechanisms // AuthMechanism::SCHEME_PASSWORD mechanisms
$container->query('OCA\Files_External\Lib\Auth\Password\Password'), $container->query(Password::class),
$container->query('OCA\Files_External\Lib\Auth\Password\SessionCredentials'), $container->query(SessionCredentials::class),
$container->query('OCA\Files_External\Lib\Auth\Password\LoginCredentials'), $container->query(LoginCredentials::class),
$container->query('OCA\Files_External\Lib\Auth\Password\UserProvided'), $container->query(UserProvided::class),
$container->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth'), $container->query(GlobalAuth::class),
// AuthMechanism::SCHEME_OAUTH1 mechanisms // AuthMechanism::SCHEME_OAUTH1 mechanisms
$container->query('OCA\Files_External\Lib\Auth\OAuth1\OAuth1'), $container->query(OAuth1::class),
// AuthMechanism::SCHEME_OAUTH2 mechanisms // AuthMechanism::SCHEME_OAUTH2 mechanisms
$container->query('OCA\Files_External\Lib\Auth\OAuth2\OAuth2'), $container->query(OAuth2::class),
// AuthMechanism::SCHEME_PUBLICKEY mechanisms // AuthMechanism::SCHEME_PUBLICKEY mechanisms
$container->query('OCA\Files_External\Lib\Auth\PublicKey\RSA'), $container->query(RSA::class),
// AuthMechanism::SCHEME_OPENSTACK mechanisms // AuthMechanism::SCHEME_OPENSTACK mechanisms
$container->query('OCA\Files_External\Lib\Auth\OpenStack\OpenStack'), $container->query(OpenStack::class),
$container->query('OCA\Files_External\Lib\Auth\OpenStack\Rackspace'), $container->query(Rackspace::class),
// Specialized mechanisms // Specialized mechanisms
$container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'), $container->query(AccessKey::class),
]; ];
} }

View File

@ -41,6 +41,12 @@ use \OCA\Files_External\Lib\Backend\LegacyBackend;
use \OCA\Files_External\Lib\StorageConfig; use \OCA\Files_External\Lib\StorageConfig;
use \OCA\Files_External\Lib\Backend\Backend; use \OCA\Files_External\Lib\Backend\Backend;
use \OCP\Files\StorageNotAvailableException; use \OCP\Files\StorageNotAvailableException;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Lib\Auth\Builtin;
use OCA\Files_External\Service\UserGlobalStoragesService;
use OCP\IUserManager;
use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Service\UserStoragesService;
/** /**
* Class to configure mount.json globally and for users * Class to configure mount.json globally and for users
@ -66,8 +72,8 @@ class OC_Mount_Config {
* @deprecated 8.2.0 use \OCA\Files_External\Service\BackendService::registerBackend() * @deprecated 8.2.0 use \OCA\Files_External\Service\BackendService::registerBackend()
*/ */
public static function registerBackend($class, $definition) { public static function registerBackend($class, $definition) {
$backendService = self::$app->getContainer()->query('OCA\Files_External\Service\BackendService'); $backendService = self::$app->getContainer()->query(BackendService::class);
$auth = self::$app->getContainer()->query('OCA\Files_External\Lib\Auth\Builtin'); $auth = self::$app->getContainer()->query(Builtin::class);
$backendService->registerBackend(new LegacyBackend($class, $definition, $auth)); $backendService->registerBackend(new LegacyBackend($class, $definition, $auth));
@ -86,9 +92,9 @@ class OC_Mount_Config {
public static function getAbsoluteMountPoints($uid) { public static function getAbsoluteMountPoints($uid) {
$mountPoints = array(); $mountPoints = array();
$userGlobalStoragesService = self::$app->getContainer()->query('OCA\Files_External\Service\UserGlobalStoragesService'); $userGlobalStoragesService = self::$app->getContainer()->query(UserGlobalStoragesService::class);
$userStoragesService = self::$app->getContainer()->query('OCA\Files_External\Service\UserStoragesService'); $userStoragesService = self::$app->getContainer()->query(UserStoragesService::class);
$user = self::$app->getContainer()->query('OCP\IUserManager')->get($uid); $user = self::$app->getContainer()->query(IUserManager::class)->get($uid);
$userGlobalStoragesService->setUser($user); $userGlobalStoragesService->setUser($user);
$userStoragesService->setUser($user); $userStoragesService->setUser($user);
@ -127,7 +133,7 @@ class OC_Mount_Config {
*/ */
public static function getSystemMountPoints() { public static function getSystemMountPoints() {
$mountPoints = []; $mountPoints = [];
$service = self::$app->getContainer()->query('OCA\Files_External\Service\GlobalStoragesService'); $service = self::$app->getContainer()->query(GlobalStoragesService::class);
foreach ($service->getStorages() as $storage) { foreach ($service->getStorages() as $storage) {
$mountPoints[] = self::prepareMountPointEntry($storage, false); $mountPoints[] = self::prepareMountPointEntry($storage, false);
@ -145,7 +151,7 @@ class OC_Mount_Config {
*/ */
public static function getPersonalMountPoints() { public static function getPersonalMountPoints() {
$mountPoints = []; $mountPoints = [];
$service = self::$app->getContainer()->query('OCA\Files_External\Service\UserStoragesService'); $service = self::$app->getContainer()->query(UserStoragesService::class);
foreach ($service->getStorages() as $storage) { foreach ($service->getStorages() as $storage) {
$mountPoints[] = self::prepareMountPointEntry($storage, true); $mountPoints[] = self::prepareMountPointEntry($storage, true);

View File

@ -27,10 +27,13 @@
* *
*/ */
use OCA\Files_Sharing\ShareBackend\File;
use OCA\Files_Sharing\ShareBackend\Folder;
\OCA\Files_Sharing\Helper::registerHooks(); \OCA\Files_Sharing\Helper::registerHooks();
\OC\Share\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File'); \OC\Share\Share::registerBackend('file', File::class);
\OC\Share\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file'); \OC\Share\Share::registerBackend('folder', Folder::class, 'file');
$application = new \OCA\Files_Sharing\AppInfo\Application(); $application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders(); $application->registerMountProviders();

View File

@ -41,6 +41,8 @@ use OCP\Defaults;
use OCP\Federation\ICloudIdManager; use OCP\Federation\ICloudIdManager;
use \OCP\IContainer; use \OCP\IContainer;
use OCP\IServerContainer; use OCP\IServerContainer;
use OCA\Files_Sharing\Capabilities;
use OCA\Files_Sharing\External\Manager;
class Application extends App { class Application extends App {
public function __construct(array $urlParams = array()) { public function __construct(array $urlParams = array()) {
@ -104,7 +106,7 @@ class Application extends App {
$uid $uid
); );
}); });
$container->registerAlias('OCA\Files_Sharing\External\Manager', 'ExternalManager'); $container->registerAlias(Manager::class, 'ExternalManager');
/** /**
* Middleware * Middleware
@ -163,7 +165,7 @@ class Application extends App {
/* /*
* Register capabilities * Register capabilities
*/ */
$container->registerCapability('OCA\Files_Sharing\Capabilities'); $container->registerCapability(Capabilities::class);
} }
public function registerMountProviders() { public function registerMountProviders() {

View File

@ -244,7 +244,7 @@ class ShareController extends Controller {
$exception = $e; $exception = $e;
} }
} }
\OC_Hook::emit('OCP\Share', 'share_link_access', [ \OC_Hook::emit(Share::class, 'share_link_access', [
'itemType' => $itemType, 'itemType' => $itemType,
'itemSource' => $itemSource, 'itemSource' => $itemSource,
'uidOwner' => $uidOwner, 'uidOwner' => $uidOwner,

View File

@ -39,6 +39,7 @@ use OCP\Http\Client\IClientService;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\Notification\IManager; use OCP\Notification\IManager;
use OCP\OCS\IDiscoveryService; use OCP\OCS\IDiscoveryService;
use OCP\Share;
class Manager { class Manager {
const STORAGE = '\OCA\Files_Sharing\External\Storage'; const STORAGE = '\OCA\Files_Sharing\External\Storage';
@ -217,7 +218,7 @@ class Manager {
$updated = $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid)); $updated = $acceptShare->execute(array(1, $mountPoint, $hash, $id, $this->uid));
if ($updated === true) { if ($updated === true) {
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept'); $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'accept');
\OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $share['remote']]); \OC_Hook::emit(Share::class, 'federated_share_added', ['server' => $share['remote']]);
$result = true; $result = true;
} }
} }

View File

@ -53,7 +53,7 @@ class Hooks {
$mountManager = \OC\Files\Filesystem::getMountManager(); $mountManager = \OC\Files\Filesystem::getMountManager();
$mountedShares = $mountManager->findIn($path); $mountedShares = $mountManager->findIn($path);
foreach ($mountedShares as $mount) { foreach ($mountedShares as $mount) {
if ($mount->getStorage()->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) { if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
$mountPoint = $mount->getMountPoint(); $mountPoint = $mount->getMountPoint();
$view->unlink($mountPoint); $view->unlink($mountPoint);
} }

View File

@ -121,11 +121,11 @@ class SharingCheckMiddleware extends Middleware {
* @throws \Exception * @throws \Exception
*/ */
public function afterException($controller, $methodName, \Exception $exception) { public function afterException($controller, $methodName, \Exception $exception) {
if(is_a($exception, '\OCP\Files\NotFoundException')) { if(is_a($exception, NotFoundException::class)) {
return new NotFoundResponse(); return new NotFoundResponse();
} }
if (is_a($exception, '\OCA\Files_Sharing\Exceptions\S2SException')) { if (is_a($exception, S2SException::class)) {
return new JSONResponse($exception->getMessage(), 405); return new JSONResponse($exception->getMessage(), 405);
} }

View File

@ -96,7 +96,7 @@ class Updater {
$mountManager = \OC\Files\Filesystem::getMountManager(); $mountManager = \OC\Files\Filesystem::getMountManager();
$mountedShares = $mountManager->findIn('/' . \OCP\User::getUser() . '/files/' . $oldPath); $mountedShares = $mountManager->findIn('/' . \OCP\User::getUser() . '/files/' . $oldPath);
foreach ($mountedShares as $mount) { foreach ($mountedShares as $mount) {
if ($mount->getStorage()->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) { if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
$mountPoint = $mount->getMountPoint(); $mountPoint = $mount->getMountPoint();
$target = str_replace($absOldPath, $absNewPath, $mountPoint); $target = str_replace($absOldPath, $absNewPath, $mountPoint);
$mount->moveMount($target); $mount->moveMount($target);

View File

@ -25,6 +25,8 @@ namespace OCA\Files_Trashbin\AppInfo;
use OCP\AppFramework\App; use OCP\AppFramework\App;
use OCA\Files_Trashbin\Expiration; use OCA\Files_Trashbin\Expiration;
use OCP\AppFramework\Utility\ITimeFactory;
use OCA\Files_Trashbin\Capabilities;
class Application extends App { class Application extends App {
public function __construct (array $urlParams = []) { public function __construct (array $urlParams = []) {
@ -34,7 +36,7 @@ class Application extends App {
/* /*
* Register capabilities * Register capabilities
*/ */
$container->registerCapability('OCA\Files_Trashbin\Capabilities'); $container->registerCapability(Capabilities::class);
/* /*
* Register expiration * Register expiration
@ -42,7 +44,7 @@ class Application extends App {
$container->registerService('Expiration', function($c) { $container->registerService('Expiration', function($c) {
return new Expiration( return new Expiration(
$c->query('ServerContainer')->getConfig(), $c->query('ServerContainer')->getConfig(),
$c->query('OCP\AppFramework\Utility\ITimeFactory') $c->query(ITimeFactory::class)
); );
}); });
} }

View File

@ -25,6 +25,8 @@ namespace OCA\Files_Versions\AppInfo;
use OCP\AppFramework\App; use OCP\AppFramework\App;
use OCA\Files_Versions\Expiration; use OCA\Files_Versions\Expiration;
use OCP\AppFramework\Utility\ITimeFactory;
use OCA\Files_Versions\Capabilities;
class Application extends App { class Application extends App {
public function __construct(array $urlParams = array()) { public function __construct(array $urlParams = array()) {
@ -35,7 +37,7 @@ class Application extends App {
/* /*
* Register capabilities * Register capabilities
*/ */
$container->registerCapability('OCA\Files_Versions\Capabilities'); $container->registerCapability(Capabilities::class);
/* /*
* Register expiration * Register expiration
@ -43,7 +45,7 @@ class Application extends App {
$container->registerService('Expiration', function($c) { $container->registerService('Expiration', function($c) {
return new Expiration( return new Expiration(
$c->query('ServerContainer')->getConfig(), $c->query('ServerContainer')->getConfig(),
$c->query('OCP\AppFramework\Utility\ITimeFactory') $c->query(ITimeFactory::class)
); );
}); });
} }

View File

@ -39,17 +39,17 @@ class Hooks {
public static function connectHooks() { public static function connectHooks() {
// Listen to write signals // Listen to write signals
\OCP\Util::connectHook('OC_Filesystem', 'write', 'OCA\Files_Versions\Hooks', 'write_hook'); \OCP\Util::connectHook('OC_Filesystem', 'write', Hooks::class, 'write_hook');
// Listen to delete and rename signals // Listen to delete and rename signals
\OCP\Util::connectHook('OC_Filesystem', 'post_delete', 'OCA\Files_Versions\Hooks', 'remove_hook'); \OCP\Util::connectHook('OC_Filesystem', 'post_delete', Hooks::class, 'remove_hook');
\OCP\Util::connectHook('OC_Filesystem', 'delete', 'OCA\Files_Versions\Hooks', 'pre_remove_hook'); \OCP\Util::connectHook('OC_Filesystem', 'delete', Hooks::class, 'pre_remove_hook');
\OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OCA\Files_Versions\Hooks', 'rename_hook'); \OCP\Util::connectHook('OC_Filesystem', 'post_rename', Hooks::class, 'rename_hook');
\OCP\Util::connectHook('OC_Filesystem', 'post_copy', 'OCA\Files_Versions\Hooks', 'copy_hook'); \OCP\Util::connectHook('OC_Filesystem', 'post_copy', Hooks::class, 'copy_hook');
\OCP\Util::connectHook('OC_Filesystem', 'rename', 'OCA\Files_Versions\Hooks', 'pre_renameOrCopy_hook'); \OCP\Util::connectHook('OC_Filesystem', 'rename', Hooks::class, 'pre_renameOrCopy_hook');
\OCP\Util::connectHook('OC_Filesystem', 'copy', 'OCA\Files_Versions\Hooks', 'pre_renameOrCopy_hook'); \OCP\Util::connectHook('OC_Filesystem', 'copy', Hooks::class, 'pre_renameOrCopy_hook');
$eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', ['OCA\Files_Versions\Hooks', 'onLoadFilesAppScripts']); $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', [Hooks::class, 'onLoadFilesAppScripts']);
} }
/** /**

View File

@ -26,6 +26,7 @@ namespace OCA\ShareByMail\AppInfo;
use OCA\ShareByMail\Settings; use OCA\ShareByMail\Settings;
use OCP\AppFramework\App; use OCP\AppFramework\App;
use OCP\Util; use OCP\Util;
use OCA\ShareByMail\Capabilities;
class Application extends App { class Application extends App {
@ -37,7 +38,7 @@ class Application extends App {
/** register capabilities */ /** register capabilities */
$container = $this->getContainer(); $container = $this->getContainer();
$container->registerCapability('OCA\ShareByMail\Capabilities'); $container->registerCapability(Capabilities::class);
/** register hooks */ /** register hooks */
Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareProvider'); Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareProvider');

View File

@ -26,6 +26,7 @@
use OCP\SystemTag\ManagerEvent; use OCP\SystemTag\ManagerEvent;
use OCP\SystemTag\MapperEvent; use OCP\SystemTag\MapperEvent;
use OCA\SystemTags\Activity\Listener;
$eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener( $eventDispatcher->addListener(
@ -43,7 +44,7 @@ $eventDispatcher->addListener(
$managerListener = function(ManagerEvent $event) { $managerListener = function(ManagerEvent $event) {
$application = new \OCP\AppFramework\App('systemtags'); $application = new \OCP\AppFramework\App('systemtags');
/** @var \OCA\SystemTags\Activity\Listener $listener */ /** @var \OCA\SystemTags\Activity\Listener $listener */
$listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener'); $listener = $application->getContainer()->query(Listener::class);
$listener->event($event); $listener->event($event);
}; };
@ -54,7 +55,7 @@ $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener);
$mapperListener = function(MapperEvent $event) { $mapperListener = function(MapperEvent $event) {
$application = new \OCP\AppFramework\App('systemtags'); $application = new \OCP\AppFramework\App('systemtags');
/** @var \OCA\SystemTags\Activity\Listener $listener */ /** @var \OCA\SystemTags\Activity\Listener $listener */
$listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener'); $listener = $application->getContainer()->query(Listener::class);
$listener->mapperEvent($event); $listener->mapperEvent($event);
}; };

View File

@ -26,6 +26,7 @@ namespace OCA\User_LDAP\AppInfo;
use OCA\User_LDAP\Controller\RenewPasswordController; use OCA\User_LDAP\Controller\RenewPasswordController;
use OCP\AppFramework\App; use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer; use OCP\AppFramework\IAppContainer;
use OCP\IL10N;
class Application extends App { class Application extends App {
public function __construct () { public function __construct () {
@ -44,7 +45,7 @@ class Application extends App {
$server->getRequest(), $server->getRequest(),
$c->query('UserManager'), $c->query('UserManager'),
$server->getConfig(), $server->getConfig(),
$c->query('OCP\IL10N'), $c->query(IL10N::class),
$c->query('Session'), $c->query('Session'),
$server->getURLGenerator() $server->getURLGenerator()
); );

View File

@ -221,7 +221,7 @@ class Helper {
public function setLDAPProvider() { public function setLDAPProvider() {
$current = \OC::$server->getConfig()->getSystemValue('ldapProviderFactory', null); $current = \OC::$server->getConfig()->getSystemValue('ldapProviderFactory', null);
if(is_null($current)) { if(is_null($current)) {
\OC::$server->getConfig()->setSystemValue('ldapProviderFactory', '\\OCA\\User_LDAP\\LDAPProviderFactory'); \OC::$server->getConfig()->setSystemValue('ldapProviderFactory', LDAPProviderFactory::class);
} }
} }

View File

@ -21,13 +21,17 @@
namespace OCA\WorkflowEngine\AppInfo; namespace OCA\WorkflowEngine\AppInfo;
use OCP\Template;
use OCA\WorkflowEngine\Controller\RequestTime;
use OCA\WorkflowEngine\Controller\FlowOperations;
class Application extends \OCP\AppFramework\App { class Application extends \OCP\AppFramework\App {
public function __construct() { public function __construct() {
parent::__construct('workflowengine'); parent::__construct('workflowengine');
$this->getContainer()->registerAlias('FlowOperationsController', 'OCA\WorkflowEngine\Controller\FlowOperations'); $this->getContainer()->registerAlias('FlowOperationsController', FlowOperations::class);
$this->getContainer()->registerAlias('RequestTimeController', 'OCA\WorkflowEngine\Controller\RequestTime'); $this->getContainer()->registerAlias('RequestTimeController', RequestTime::class);
} }
/** /**
@ -40,7 +44,7 @@ class Application extends \OCP\AppFramework\App {
function() { function() {
if (!function_exists('style')) { if (!function_exists('style')) {
// This is hacky, but we need to load the template class // This is hacky, but we need to load the template class
class_exists('OCP\Template', true); class_exists(Template::class, true);
} }
style('workflowengine', [ style('workflowengine', [

View File

@ -38,6 +38,9 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use OC\App\CodeChecker\StrongComparisonCheck;
use OC\App\CodeChecker\DeprecationCheck;
use OC\App\CodeChecker\PrivateCheck;
class CheckCode extends Command implements CompletionAwareInterface { class CheckCode extends Command implements CompletionAwareInterface {
@ -45,9 +48,9 @@ class CheckCode extends Command implements CompletionAwareInterface {
private $infoParser; private $infoParser;
protected $checkers = [ protected $checkers = [
'private' => '\OC\App\CodeChecker\PrivateCheck', 'private' => PrivateCheck::class,
'deprecation' => '\OC\App\CodeChecker\DeprecationCheck', 'deprecation' => DeprecationCheck::class,
'strong-comparison' => '\OC\App\CodeChecker\StrongComparisonCheck', 'strong-comparison' => StrongComparisonCheck::class,
]; ];
public function __construct(InfoParser $infoParser) { public function __construct(InfoParser $infoParser) {

View File

@ -54,6 +54,12 @@
* *
*/ */
use OC\Settings\RemoveOrphaned;
use OCP\Share;
use OC\Encryption\HookManager;
use OC\Files\Filesystem;
use OC\Share20\Hooks;
require_once 'public/Constants.php'; require_once 'public/Constants.php';
/** /**
@ -836,7 +842,7 @@ class OC {
$dispatcher->addListener(OCP\App\ManagerEvent::EVENT_APP_UPDATE, function($event) { $dispatcher->addListener(OCP\App\ManagerEvent::EVENT_APP_UPDATE, function($event) {
/** @var \OCP\App\ManagerEvent $event */ /** @var \OCP\App\ManagerEvent $event */
$jobList = \OC::$server->getJobList(); $jobList = \OC::$server->getJobList();
$job = 'OC\\Settings\\RemoveOrphaned'; $job = RemoveOrphaned::class;
if(!$jobList->has($job, null)) { if(!$jobList->has($job, null)) {
$jobList->add($job); $jobList->add($job);
} }
@ -851,10 +857,10 @@ class OC {
private static function registerEncryptionHooks() { private static function registerEncryptionHooks() {
$enabled = self::$server->getEncryptionManager()->isEnabled(); $enabled = self::$server->getEncryptionManager()->isEnabled();
if ($enabled) { if ($enabled) {
\OCP\Util::connectHook('OCP\Share', 'post_shared', 'OC\Encryption\HookManager', 'postShared'); \OCP\Util::connectHook(Share::class, 'post_shared', HookManager::class, 'postShared');
\OCP\Util::connectHook('OCP\Share', 'post_unshare', 'OC\Encryption\HookManager', 'postUnshared'); \OCP\Util::connectHook(Share::class, 'post_unshare', HookManager::class, 'postUnshared');
\OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OC\Encryption\HookManager', 'postRename'); \OCP\Util::connectHook('OC_Filesystem', 'post_rename', HookManager::class, 'postRename');
\OCP\Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', 'OC\Encryption\HookManager', 'postRestore'); \OCP\Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', HookManager::class, 'postRestore');
} }
} }
@ -868,8 +874,8 @@ class OC {
*/ */
public static function registerFilesystemHooks() { public static function registerFilesystemHooks() {
// Check for blacklisted files // Check for blacklisted files
OC_Hook::connect('OC_Filesystem', 'write', 'OC\Files\Filesystem', 'isBlacklisted'); OC_Hook::connect('OC_Filesystem', 'write', Filesystem::class, 'isBlacklisted');
OC_Hook::connect('OC_Filesystem', 'rename', 'OC\Files\Filesystem', 'isBlacklisted'); OC_Hook::connect('OC_Filesystem', 'rename', Filesystem::class, 'isBlacklisted');
} }
/** /**
@ -877,9 +883,9 @@ class OC {
*/ */
public static function registerShareHooks() { public static function registerShareHooks() {
if (\OC::$server->getSystemConfig()->getValue('installed')) { if (\OC::$server->getSystemConfig()->getValue('installed')) {
OC_Hook::connect('OC_User', 'post_deleteUser', 'OC\Share20\Hooks', 'post_deleteUser'); OC_Hook::connect('OC_User', 'post_deleteUser', Hooks::class, 'post_deleteUser');
OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OC\Share20\Hooks', 'post_removeFromGroup'); OC_Hook::connect('OC_User', 'post_removeFromGroup', Hooks::class, 'post_removeFromGroup');
OC_Hook::connect('OC_User', 'post_deleteGroup', 'OC\Share20\Hooks', 'post_deleteGroup'); OC_Hook::connect('OC_User', 'post_deleteGroup', Hooks::class, 'post_deleteGroup');
} }
} }

View File

@ -31,6 +31,7 @@ use OCP\IDBConnection;
use OCP\IUser; use OCP\IUser;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\EventDispatcher\GenericEvent;
use OC\Settings\BackgroundJobs\VerifyUserData;
/** /**
* Class AccountManager * Class AccountManager
@ -167,7 +168,7 @@ class AccountManager {
*/ */
protected function checkEmailVerification($oldData, $newData, IUser $user) { protected function checkEmailVerification($oldData, $newData, IUser $user) {
if ($oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value']) { if ($oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value']) {
$this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', $this->jobList->add(VerifyUserData::class,
[ [
'verificationCode' => '', 'verificationCode' => '',
'data' => $newData[self::PROPERTY_EMAIL]['value'], 'data' => $newData[self::PROPERTY_EMAIL]['value'],

View File

@ -33,6 +33,8 @@ use OC\AppFramework\DependencyInjection\DIContainer;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\QueryException; use OCP\AppFramework\QueryException;
use OCP\AppFramework\Http\ICallbackResponse; 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 * 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) { public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) {
if (!is_null($urlParams)) { if (!is_null($urlParams)) {
$container['OCP\\IRequest']->setUrlParameters($urlParams); $container[IRequest::class]->setUrlParameters($urlParams);
} else if (isset($container['urlParams']) && !is_null($container['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']; $appName = $container['AppName'];
@ -114,7 +116,7 @@ class App {
$response $response
) = $dispatcher->dispatch($controller, $methodName); ) = $dispatcher->dispatch($controller, $methodName);
$io = $container['OCP\\AppFramework\\Http\\IOutput']; $io = $container[IOutput::class];
if(!is_null($httpHeaders)) { if(!is_null($httpHeaders)) {
$io->setHeader($httpHeaders); $io->setHeader($httpHeaders);

View File

@ -62,6 +62,8 @@ use OCP\IServerContainer;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\RichObjectStrings\IValidator; use OCP\RichObjectStrings\IValidator;
use OCP\Util; use OCP\Util;
use OCP\Encryption\IManager;
use OCA\WorkflowEngine\Manager;
class DIContainer extends SimpleContainer implements IAppContainer { class DIContainer extends SimpleContainer implements IAppContainer {
@ -134,7 +136,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
$this->registerAlias('ServerContainer', IServerContainer::class); $this->registerAlias('ServerContainer', IServerContainer::class);
$this->registerService(\OCP\WorkflowEngine\IManager::class, function ($c) { $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) { $this->registerService(\OCP\AppFramework\IAppContainer::class, function ($c) {
@ -143,7 +145,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
// commonly used attributes // commonly used attributes
$this->registerService('UserId', function ($c) { $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) { $this->registerService('WebRoot', function ($c) {
@ -158,7 +160,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
return $c->getServer()->getThemingDefaults(); return $c->getServer()->getThemingDefaults();
}); });
$this->registerService('OCP\Encryption\IManager', function ($c) { $this->registerService(IManager::class, function ($c) {
return $this->getServer()->getEncryptionManager(); return $this->getServer()->getEncryptionManager();
}); });

View File

@ -29,7 +29,7 @@ class DefaultTokenCleanupJob extends Job {
protected function run($argument) { protected function run($argument) {
/* @var $provider IProvider */ /* @var $provider IProvider */
$provider = OC::$server->query('OC\Authentication\Token\IProvider'); $provider = OC::$server->query(IProvider::class);
$provider->invalidateOldTokens(); $provider->invalidateOldTokens();
} }

View File

@ -51,11 +51,11 @@ class CronBus extends AsyncBus {
*/ */
private function getJobClass($command) { private function getJobClass($command) {
if ($command instanceof \Closure) { if ($command instanceof \Closure) {
return 'OC\Command\ClosureJob'; return ClosureJob::class;
} else if (is_callable($command)) { } else if (is_callable($command)) {
return 'OC\Command\CallableJob'; return CallableJob::class;
} else if ($command instanceof ICommand) { } else if ($command instanceof ICommand) {
return 'OC\Command\CommandJob'; return CommandJob::class;
} else { } else {
throw new \InvalidArgumentException('Invalid command'); throw new \InvalidArgumentException('Invalid command');
} }

View File

@ -46,26 +46,26 @@ class ConnectionFactory {
*/ */
protected $defaultConnectionParams = [ protected $defaultConnectionParams = [
'mysql' => [ 'mysql' => [
'adapter' => '\OC\DB\AdapterMySQL', 'adapter' => AdapterMySQL::class,
'charset' => 'UTF8', 'charset' => 'UTF8',
'driver' => 'pdo_mysql', 'driver' => 'pdo_mysql',
'wrapperClass' => 'OC\DB\Connection', 'wrapperClass' => Connection::class,
], ],
'oci' => [ 'oci' => [
'adapter' => '\OC\DB\AdapterOCI8', 'adapter' => AdapterOCI8::class,
'charset' => 'AL32UTF8', 'charset' => 'AL32UTF8',
'driver' => 'oci8', 'driver' => 'oci8',
'wrapperClass' => 'OC\DB\OracleConnection', 'wrapperClass' => OracleConnection::class,
], ],
'pgsql' => [ 'pgsql' => [
'adapter' => '\OC\DB\AdapterPgSql', 'adapter' => AdapterPgSql::class,
'driver' => 'pdo_pgsql', 'driver' => 'pdo_pgsql',
'wrapperClass' => 'OC\DB\Connection', 'wrapperClass' => Connection::class,
], ],
'sqlite3' => [ 'sqlite3' => [
'adapter' => '\OC\DB\AdapterSqlite', 'adapter' => AdapterSqlite::class,
'driver' => 'pdo_sqlite', 'driver' => 'pdo_sqlite',
'wrapperClass' => 'OC\DB\Connection', 'wrapperClass' => Connection::class,
], ],
]; ];

View File

@ -110,7 +110,7 @@ class Scanner extends BasicEmitter implements IScanner {
protected function getData($path) { protected function getData($path) {
$data = $this->storage->getMetaData($path); $data = $this->storage->getMetaData($path);
if (is_null($data)) { 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; return $data;
} }

View File

@ -157,7 +157,7 @@ class Encryption extends Wrapper {
$unencryptedSize, $unencryptedSize,
$headerSize, $headerSize,
$signed, $signed,
$wrapper = 'OC\Files\Stream\Encryption') { $wrapper = Encryption::class) {
$context = stream_context_create(array( $context = stream_context_create(array(
'ocencryption' => array( 'ocencryption' => array(

View File

@ -38,6 +38,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage; use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException; use OCP\Files\StorageNotAvailableException;
use OCP\ILogger; use OCP\ILogger;
use OC\Files\Storage\FailedStorage;
/** /**
* Class Scanner * Class Scanner
@ -146,7 +147,7 @@ class Scanner extends PublicEmitter {
} }
// don't bother scanning failed storages (shortcut for same result) // don't bother scanning failed storages (shortcut for same result)
if ($storage->instanceOfStorage('OC\Files\Storage\FailedStorage')) { if ($storage->instanceOfStorage(FailedStorage::class)) {
continue; continue;
} }
@ -196,7 +197,7 @@ class Scanner extends PublicEmitter {
} }
// don't bother scanning failed storages (shortcut for same result) // don't bother scanning failed storages (shortcut for same result)
if ($storage->instanceOfStorage('OC\Files\Storage\FailedStorage')) { if ($storage->instanceOfStorage(FailedStorage::class)) {
continue; continue;
} }

View File

@ -49,6 +49,6 @@ class Rotate extends \OC\BackgroundJob\Job {
$rotatedLogfile = $logfile.'.1'; $rotatedLogfile = $logfile.'.1';
rename($logfile, $rotatedLogfile); rename($logfile, $rotatedLogfile);
$msg = 'Log file "'.$logfile.'" was over '.$this->max_log_size.' bytes, moved to "'.$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);
} }
} }

View File

@ -37,7 +37,7 @@ use OCP\ILogger;
use OCP\IMemcache; use OCP\IMemcache;
class Factory implements ICacheFactory { class Factory implements ICacheFactory {
const NULL_CACHE = '\\OC\\Memcache\\NullCache'; const NULL_CACHE = NullCache::class;
/** /**
* @var string $globalPrefix * @var string $globalPrefix

View File

@ -306,20 +306,20 @@ class PreviewManager implements IPreview {
} }
$imageProviders = [ $imageProviders = [
'OC\Preview\PNG', Preview\PNG::class,
'OC\Preview\JPEG', Preview\JPEG::class,
'OC\Preview\GIF', Preview\GIF::class,
'OC\Preview\BMP', Preview\BMP::class,
'OC\Preview\XBitmap' Preview\XBitmap::class
]; ];
$this->defaultProviders = $this->config->getSystemValue('enabledPreviewProviders', array_merge([ $this->defaultProviders = $this->config->getSystemValue('enabledPreviewProviders', array_merge([
'OC\Preview\MarkDown', Preview\MarkDown::class,
'OC\Preview\MP3', Preview\MP3::class,
'OC\Preview\TXT', Preview\TXT::class,
], $imageProviders)); ], $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_merge($this->defaultProviders, $imageProviders);
} }
$this->defaultProviders = array_unique($this->defaultProviders); $this->defaultProviders = array_unique($this->defaultProviders);
@ -349,27 +349,27 @@ class PreviewManager implements IPreview {
} }
$this->registeredCoreProviders = true; $this->registeredCoreProviders = true;
$this->registerCoreProvider('OC\Preview\TXT', '/text\/plain/'); $this->registerCoreProvider(Preview\TXT::class, '/text\/plain/');
$this->registerCoreProvider('OC\Preview\MarkDown', '/text\/(x-)?markdown/'); $this->registerCoreProvider(Preview\MarkDown::class, '/text\/(x-)?markdown/');
$this->registerCoreProvider('OC\Preview\PNG', '/image\/png/'); $this->registerCoreProvider(Preview\PNG::class, '/image\/png/');
$this->registerCoreProvider('OC\Preview\JPEG', '/image\/jpeg/'); $this->registerCoreProvider(Preview\JPEG::class, '/image\/jpeg/');
$this->registerCoreProvider('OC\Preview\GIF', '/image\/gif/'); $this->registerCoreProvider(Preview\GIF::class, '/image\/gif/');
$this->registerCoreProvider('OC\Preview\BMP', '/image\/bmp/'); $this->registerCoreProvider(Preview\BMP::class, '/image\/bmp/');
$this->registerCoreProvider('OC\Preview\XBitmap', '/image\/x-xbitmap/'); $this->registerCoreProvider(Preview\XBitmap::class, '/image\/x-xbitmap/');
$this->registerCoreProvider('OC\Preview\MP3', '/audio\/mpeg/'); $this->registerCoreProvider(Preview\MP3::class, '/audio\/mpeg/');
// SVG, Office and Bitmap require imagick // SVG, Office and Bitmap require imagick
if (extension_loaded('imagick')) { if (extension_loaded('imagick')) {
$checkImagick = new \Imagick(); $checkImagick = new \Imagick();
$imagickProviders = [ $imagickProviders = [
'SVG' => ['mimetype' => '/image\/svg\+xml/', 'class' => '\OC\Preview\SVG'], 'SVG' => ['mimetype' => '/image\/svg\+xml/', 'class' => Preview\SVG::class],
'TIFF' => ['mimetype' => '/image\/tiff/', 'class' => '\OC\Preview\TIFF'], 'TIFF' => ['mimetype' => '/image\/tiff/', 'class' => Preview\TIFF::class],
'PDF' => ['mimetype' => '/application\/pdf/', 'class' => '\OC\Preview\PDF'], 'PDF' => ['mimetype' => '/application\/pdf/', 'class' => Preview\PDF::class],
'AI' => ['mimetype' => '/application\/illustrator/', 'class' => '\OC\Preview\Illustrator'], 'AI' => ['mimetype' => '/application\/illustrator/', 'class' => Preview\Illustrator::class],
'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => '\OC\Preview\Photoshop'], 'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => Preview\Photoshop::class],
'EPS' => ['mimetype' => '/application\/postscript/', 'class' => '\OC\Preview\Postscript'], 'EPS' => ['mimetype' => '/application\/postscript/', 'class' => Preview\Postscript::class],
'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => '\OC\Preview\Font'], 'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => Preview\Font::class],
]; ];
foreach ($imagickProviders as $queryFormat => $provider) { foreach ($imagickProviders as $queryFormat => $provider) {
@ -398,18 +398,18 @@ class PreviewManager implements IPreview {
} }
if ($officeFound) { if ($officeFound) {
$this->registerCoreProvider('\OC\Preview\MSOfficeDoc', '/application\/msword/'); $this->registerCoreProvider(Preview\MSOfficeDoc::class, '/application\/msword/');
$this->registerCoreProvider('\OC\Preview\MSOffice2003', '/application\/vnd.ms-.*/'); $this->registerCoreProvider(Preview\MSOffice2003::class, '/application\/vnd.ms-.*/');
$this->registerCoreProvider('\OC\Preview\MSOffice2007', '/application\/vnd.openxmlformats-officedocument.*/'); $this->registerCoreProvider(Preview\MSOffice2007::class, '/application\/vnd.openxmlformats-officedocument.*/');
$this->registerCoreProvider('\OC\Preview\OpenDocument', '/application\/vnd.oasis.opendocument.*/'); $this->registerCoreProvider(Preview\OpenDocument::class, '/application\/vnd.oasis.opendocument.*/');
$this->registerCoreProvider('\OC\Preview\StarOffice', '/application\/vnd.sun.xml.*/'); $this->registerCoreProvider(Preview\StarOffice::class, '/application\/vnd.sun.xml.*/');
} }
} }
} }
} }
// Video requires avconv or ffmpeg // 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'); $avconvBinary = \OC_Helper::findBinaryPath('avconv');
$ffmpegBinary = $avconvBinary ? null : \OC_Helper::findBinaryPath('ffmpeg'); $ffmpegBinary = $avconvBinary ? null : \OC_Helper::findBinaryPath('ffmpeg');
@ -418,7 +418,7 @@ class PreviewManager implements IPreview {
\OC\Preview\Movie::$avconvBinary = $avconvBinary; \OC\Preview\Movie::$avconvBinary = $avconvBinary;
\OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary; \OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary;
$this->registerCoreProvider('\OC\Preview\Movie', '/video\/.*/'); $this->registerCoreProvider(Preview\Movie::class, '/video\/.*/');
} }
} }
} }

View File

@ -57,11 +57,13 @@ use OC\AppFramework\Http\Request;
use OC\AppFramework\Utility\SimpleContainer; use OC\AppFramework\Utility\SimpleContainer;
use OC\AppFramework\Utility\TimeFactory; use OC\AppFramework\Utility\TimeFactory;
use OC\Authentication\LoginCredentials\Store; use OC\Authentication\LoginCredentials\Store;
use OC\Authentication\Token\IProvider;
use OC\Collaboration\Collaborators\GroupPlugin; use OC\Collaboration\Collaborators\GroupPlugin;
use OC\Collaboration\Collaborators\MailPlugin; use OC\Collaboration\Collaborators\MailPlugin;
use OC\Collaboration\Collaborators\RemotePlugin; use OC\Collaboration\Collaborators\RemotePlugin;
use OC\Collaboration\Collaborators\UserPlugin; use OC\Collaboration\Collaborators\UserPlugin;
use OC\Command\CronBus; use OC\Command\CronBus;
use OC\Comments\ManagerFactory as CommentsManagerFactory;
use OC\Contacts\ContactsMenu\ActionFactory; use OC\Contacts\ContactsMenu\ActionFactory;
use OC\Contacts\ContactsMenu\ContactsStore; use OC\Contacts\ContactsMenu\ContactsStore;
use OC\Diagnostics\EventLogger; use OC\Diagnostics\EventLogger;
@ -106,7 +108,9 @@ use OC\Security\CredentialsManager;
use OC\Security\SecureRandom; use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper; use OC\Security\TrustedDomainHelper;
use OC\Session\CryptoWrapper; use OC\Session\CryptoWrapper;
use OC\Share20\ProviderFactory;
use OC\Share20\ShareHelper; use OC\Share20\ShareHelper;
use OC\SystemTag\ManagerFactory as SystemTagManagerFactory;
use OC\Tagging\TagMapper; use OC\Tagging\TagMapper;
use OC\Template\SCSSCacher; use OC\Template\SCSSCacher;
use OCA\Theming\ThemingDefaults; use OCA\Theming\ThemingDefaults;
@ -132,7 +136,6 @@ use OCP\Remote\Api\IApiFactory;
use OCP\Remote\IInstanceFactory; use OCP\Remote\IInstanceFactory;
use OCP\RichObjectStrings\IValidator; use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager; use OCP\Security\IContentSecurityPolicyManager;
use OCP\Share;
use OCP\Share\IShareHelper; use OCP\Share\IShareHelper;
use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@ -242,7 +245,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('SystemTagManagerFactory', function (Server $c) { $this->registerService('SystemTagManagerFactory', function (Server $c) {
$config = $c->getConfig(); $config = $c->getConfig();
$factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class);
return new $factoryClass($this); return new $factoryClass($this);
}); });
$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { $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) { $this->registerService(Store::class, function (Server $c) {
$session = $c->getSession(); $session = $c->getSession();
if (\OC::$server->getSystemConfig()->getValue('installed', false)) { if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
$tokenProvider = $c->query('OC\Authentication\Token\IProvider'); $tokenProvider = $c->query(IProvider::class);
} else { } else {
$tokenProvider = null; $tokenProvider = null;
} }
@ -325,19 +328,19 @@ class Server extends ServerContainer implements IServerContainer {
return new Store($session, $logger, $tokenProvider); return new Store($session, $logger, $tokenProvider);
}); });
$this->registerAlias(IStore::class, Store::class); $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(); $dbConnection = $c->getDatabaseConnection();
return new Authentication\Token\DefaultTokenMapper($dbConnection); return new Authentication\Token\DefaultTokenMapper($dbConnection);
}); });
$this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { $this->registerService(Authentication\Token\DefaultTokenProvider::class, function (Server $c) {
$mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); $mapper = $c->query(Authentication\Token\DefaultTokenMapper::class);
$crypto = $c->getCrypto(); $crypto = $c->getCrypto();
$config = $c->getConfig(); $config = $c->getConfig();
$logger = $c->getLogger(); $logger = $c->getLogger();
$timeFactory = new TimeFactory(); $timeFactory = new TimeFactory();
return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $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) { $this->registerService(\OCP\IUserSession::class, function (Server $c) {
$manager = $c->getUserManager(); $manager = $c->getUserManager();
@ -346,7 +349,7 @@ class Server extends ServerContainer implements IServerContainer {
// Token providers might require a working database. This code // Token providers might require a working database. This code
// might however be called when ownCloud is not yet setup. // might however be called when ownCloud is not yet setup.
if (\OC::$server->getSystemConfig()->getValue('installed', false)) { if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
$defaultTokenProvider = $c->query('OC\Authentication\Token\IProvider'); $defaultTokenProvider = $c->query(IProvider::class);
} else { } else {
$defaultTokenProvider = null; $defaultTokenProvider = null;
} }
@ -417,7 +420,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->getConfig(), $c->getConfig(),
$c->getActivityManager(), $c->getActivityManager(),
$c->getLogger(), $c->getLogger(),
$c->query(\OC\Authentication\Token\IProvider::class), $c->query(IProvider::class),
$c->query(ITimeFactory::class), $c->query(ITimeFactory::class),
$c->query(EventDispatcherInterface::class) $c->query(EventDispatcherInterface::class)
); );
@ -480,9 +483,9 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(Factory::class, function (Server $c) { $this->registerService(Factory::class, function (Server $c) {
$arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(),
'\\OC\\Memcache\\ArrayCache', ArrayCache::class,
'\\OC\\Memcache\\ArrayCache', ArrayCache::class,
'\\OC\\Memcache\\ArrayCache' ArrayCache::class
); );
$config = $c->getConfig(); $config = $c->getConfig();
$request = $c->getRequest(); $request = $c->getRequest();
@ -903,7 +906,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) {
$config = $c->getConfig(); $config = $c->getConfig();
$factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class);
/** @var \OCP\Comments\ICommentsManagerFactory $factory */ /** @var \OCP\Comments\ICommentsManagerFactory $factory */
$factory = new $factoryClass($this); $factory = new $factoryClass($this);
$manager = $factory->getManager(); $manager = $factory->getManager();
@ -1020,7 +1023,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService(\OCP\Share\IManager::class, function (Server $c) { $this->registerService(\OCP\Share\IManager::class, function (Server $c) {
$config = $c->getConfig(); $config = $c->getConfig();
$factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory'); $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
/** @var \OCP\Share\IProviderFactory $factory */ /** @var \OCP\Share\IProviderFactory $factory */
$factory = new $factoryClass($this); $factory = new $factoryClass($this);

View File

@ -849,11 +849,11 @@ class Share extends Constants {
$hookParams['fileTarget'] = $item['file_target']; $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 = Helper::delete($item['id'], false, null, $newParent);
$deletedShares[] = $hookParams; $deletedShares[] = $hookParams;
$hookParams['deletedShares'] = $deletedShares; $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()) { if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
list(, $remote) = Helper::splitUserRemote($item['share_with']); list(, $remote) = Helper::splitUserRemote($item['share_with']);
self::sendRemoteUnshare($remote, $item['id'], $item['token']); self::sendRemoteUnshare($remote, $item['id'], $item['token']);
@ -1549,7 +1549,7 @@ class Share extends Constants {
$preHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget; $preHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget;
$preHookData['shareWith'] = $isGroupShare ? $shareWith['group'] : $shareWith; $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) { if ($run === false) {
throw new \Exception($error); throw new \Exception($error);
@ -1663,7 +1663,7 @@ class Share extends Constants {
$postHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget; $postHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget;
$postHookData['fileTarget'] = $isGroupShare ? $groupFileTarget : $fileTarget; $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; return $id ? $id : false;
@ -2037,7 +2037,7 @@ class Share extends Constants {
$status = json_decode($result['result'], true); $status = json_decode($result['result'], true);
if ($result['success'] && ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200)) { 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; return true;
} }

View File

@ -27,6 +27,7 @@ use OCP\Files\File;
use OCP\Share\IShare; use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\Share;
class LegacyHooks { class LegacyHooks {
/** @var EventDispatcher */ /** @var EventDispatcher */
@ -55,7 +56,7 @@ class LegacyHooks {
$share = $e->getSubject(); $share = $e->getSubject();
$formatted = $this->formatHookParams($share); $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; $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['itemTarget'] = $formatted['fileTarget'];
$formatted['unsharedItems'] = [$formatted]; $formatted['unsharedItems'] = [$formatted];
\OC_Hook::emit('OCP\Share', 'post_unshareFromSelf', $formatted); \OC_Hook::emit(Share::class, 'post_unshareFromSelf', $formatted);
} }
private function formatHookParams(IShare $share) { private function formatHookParams(IShare $share) {
@ -138,7 +139,7 @@ class LegacyHooks {
'run' => &$run, 'run' => &$run,
'error' => &$error, 'error' => &$error,
]; ];
\OC_Hook::emit('OCP\Share', 'pre_shared', $preHookData); \OC_Hook::emit(Share::class, 'pre_shared', $preHookData);
if ($run === false) { if ($run === false) {
$e->setArgument('error', $error); $e->setArgument('error', $error);
@ -167,7 +168,7 @@ class LegacyHooks {
'fileTarget' => $share->getTarget(), 'fileTarget' => $share->getTarget(),
]; ];
\OC_Hook::emit('OCP\Share', 'post_shared', $postHookData); \OC_Hook::emit(Share::class, 'post_shared', $postHookData);
} }
} }

View File

@ -64,6 +64,7 @@ use OCP\Share\IProviderFactory;
use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\Share\IShareProvider; use OCP\Share\IShareProvider;
use OCP\Share;
/** /**
* This class is the communication hub for all sharing related operations. * This class is the communication hub for all sharing related operations.
@ -838,7 +839,7 @@ class Manager implements IManager {
} }
if ($expirationDateUpdated === true) { 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', 'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(), 'itemSource' => $share->getNode()->getId(),
'date' => $share->getExpirationDate(), 'date' => $share->getExpirationDate(),
@ -847,7 +848,7 @@ class Manager implements IManager {
} }
if ($share->getPassword() !== $originalShare->getPassword()) { 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', 'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(), 'itemSource' => $share->getNode()->getId(),
'uidOwner' => $share->getSharedBy(), 'uidOwner' => $share->getSharedBy(),
@ -862,7 +863,7 @@ class Manager implements IManager {
} else { } else {
$userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); $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', 'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(), 'itemSource' => $share->getNode()->getId(),
'shareType' => $share->getShareType(), 'shareType' => $share->getShareType(),

View File

@ -39,7 +39,7 @@ class TagMapper extends Mapper {
* @param IDBConnection $db Instance of the Db abstraction layer. * @param IDBConnection $db Instance of the Db abstraction layer.
*/ */
public function __construct(IDBConnection $db) { public function __construct(IDBConnection $db) {
parent::__construct($db, 'vcategory', 'OC\Tagging\Tag'); parent::__construct($db, 'vcategory', Tag::class);
} }
/** /**

View File

@ -33,8 +33,10 @@
// This means that they should be used by apps instead of the internal ownCloud classes // This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP; namespace OCP;
use OC\Tags;
// FIXME: Where should I put this? Or should it be implemented as a Listener? // FIXME: Where should I put this? Or should it be implemented as a Listener?
\OC_Hook::connect('OC_User', 'post_deleteUser', 'OC\Tags', 'post_deleteUser'); \OC_Hook::connect('OC_User', 'post_deleteUser', Tags::class, 'post_deleteUser');
/** /**
* Class for easily tagging objects by their id * Class for easily tagging objects by their id

View File

@ -253,7 +253,7 @@ class VerifyUserData extends Job {
* @param array $argument * @param array $argument
*/ */
protected function reAddJob(IJobList $jobList, array $argument) { protected function reAddJob(IJobList $jobList, array $argument) {
$jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', $jobList->add(VerifyUserData::class,
[ [
'verificationCode' => $argument['verificationCode'], 'verificationCode' => $argument['verificationCode'],
'data' => $argument['data'], 'data' => $argument['data'],

View File

@ -64,6 +64,7 @@ use OCP\IAvatarManager;
use OCP\Security\ICrypto; use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom; use OCP\Security\ISecureRandom;
use OCP\Util; use OCP\Util;
use OC\Settings\BackgroundJobs\VerifyUserData;
/** /**
* @package OC\Settings\Controller * @package OC\Settings\Controller
@ -688,7 +689,7 @@ class UsersController extends Controller {
if ($onlyVerificationCode === false) { if ($onlyVerificationCode === false) {
$this->accountManager->updateUser($user, $accountData); $this->accountManager->updateUser($user, $accountData);
$this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', $this->jobList->add(VerifyUserData::class,
[ [
'verificationCode' => $code, 'verificationCode' => $code,
'data' => $data, 'data' => $data,