Do not create Application instances directly
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
f6a79338d4
commit
543190f8b3
|
@ -29,7 +29,8 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
|
||||
\OC_App::loadApps(['dav']);
|
||||
|
||||
$app = new Application();
|
||||
/** @var Application $app */
|
||||
$app = \OC::$server->query(Application::class);
|
||||
$app->registerHooks();
|
||||
|
||||
\OC::$server->registerService('CardDAVSyncService', function() use ($app) {
|
||||
|
|
|
@ -28,7 +28,8 @@ namespace OCA\Encryption\AppInfo;
|
|||
|
||||
$encryptionSystemReady = \OC::$server->getEncryptionManager()->isReady();
|
||||
|
||||
$app = new Application();
|
||||
/** @var Application $app */
|
||||
$app = \OC::$server->query(Application::class);
|
||||
if ($encryptionSystemReady) {
|
||||
$app->registerEncryptionModule();
|
||||
$app->registerHooks();
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
|
||||
namespace OCA\Encryption\AppInfo;
|
||||
|
||||
(new Application())->registerRoutes($this, array('routes' => array(
|
||||
/** @var Application $app */
|
||||
$app = \OC::$server->query(Application::class);
|
||||
$app->registerRoutes($this, array('routes' => array(
|
||||
|
||||
[
|
||||
'name' => 'Recovery#adminRecovery',
|
||||
|
|
|
@ -22,5 +22,6 @@
|
|||
|
||||
namespace OCA\Federation\AppInfo;
|
||||
|
||||
$app = new Application();
|
||||
/** @var Application $app */
|
||||
$app = \OC::$server->query(Application::class);
|
||||
$app->registerHooks();
|
||||
|
|
|
@ -29,7 +29,8 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OCA\Files\AppInfo;
|
||||
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$application->registerRoutes(
|
||||
$this,
|
||||
[
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
namespace OCA\Files_Trashbin\AppInfo;
|
||||
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$application->registerRoutes($this, [
|
||||
'routes' => [
|
||||
[
|
||||
|
|
|
@ -62,7 +62,8 @@ class ExpireTrash extends \OC\BackgroundJob\TimedJob {
|
|||
}
|
||||
|
||||
protected function fixDIForJobs() {
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$this->userManager = \OC::$server->getUserManager();
|
||||
$this->expiration = $application->getContainer()->query('Expiration');
|
||||
}
|
||||
|
|
|
@ -747,7 +747,8 @@ class Trashbin {
|
|||
*/
|
||||
private static function scheduleExpire($user) {
|
||||
// let the admin disable auto expire
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$expiration = $application->getContainer()->query('Expiration');
|
||||
if ($expiration->isEnabled()) {
|
||||
\OC::$server->getCommandBus()->push(new Expire($user));
|
||||
|
@ -764,7 +765,8 @@ class Trashbin {
|
|||
* @return int size of deleted files
|
||||
*/
|
||||
protected static function deleteFiles($files, $user, $availableSpace) {
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$expiration = $application->getContainer()->query('Expiration');
|
||||
$size = 0;
|
||||
|
||||
|
@ -791,7 +793,8 @@ class Trashbin {
|
|||
* @return integer[] size of deleted files and number of deleted files
|
||||
*/
|
||||
public static function deleteExpiredFiles($files, $user) {
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$expiration = $application->getContainer()->query('Expiration');
|
||||
$size = 0;
|
||||
$count = 0;
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
namespace OCA\Files_Versions\AppInfo;
|
||||
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$application->registerRoutes($this, [
|
||||
'routes' => [
|
||||
[
|
||||
|
|
|
@ -850,8 +850,8 @@ class Storage {
|
|||
* @return Expiration
|
||||
*/
|
||||
protected static function getExpiration(){
|
||||
if (is_null(self::$application)) {
|
||||
self::$application = new Application();
|
||||
if (self::$application === null) {
|
||||
self::$application = \OC::$server->query(Application::class);
|
||||
}
|
||||
return self::$application->getContainer()->query(Expiration::class);
|
||||
}
|
||||
|
|
|
@ -25,9 +25,19 @@ declare(strict_types=1);
|
|||
namespace OCA\Provisioning_API;
|
||||
|
||||
use OCA\FederatedFileSharing\AppInfo\Application;
|
||||
use OCP\IServerContainer;
|
||||
|
||||
class FederatedFileSharingFactory {
|
||||
public function get(): Application {
|
||||
return new Application();
|
||||
|
||||
/** @var IServerContainer */
|
||||
private $serverContainer;
|
||||
|
||||
public function __construct(IServerContainer $serverContainer) {
|
||||
$this->serverContainer = $serverContainer;
|
||||
}
|
||||
|
||||
public function get(): Application {
|
||||
return $this->serverContainer->query(Application::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ namespace OCA\Settings;
|
|||
|
||||
use OCA\Settings\AppInfo\Application;
|
||||
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$this->useCollection('root');
|
||||
$application->registerRoutes($this, [
|
||||
'resources' => [
|
||||
|
|
|
@ -90,7 +90,7 @@ class PersonalInfo implements ISettings {
|
|||
$federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
|
||||
$lookupServerUploadEnabled = false;
|
||||
if($federatedFileSharingEnabled) {
|
||||
$federatedFileSharing = new Application();
|
||||
$federatedFileSharing = \OC::$server->query(Application::class);
|
||||
$shareProvider = $federatedFileSharing->getFederatedShareProvider();
|
||||
$lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
|
||||
use OC\Core\Application;
|
||||
|
||||
$application = new Application();
|
||||
/** @var Application $application */
|
||||
$application = \OC::$server->query(Application::class);
|
||||
$application->registerRoutes($this, [
|
||||
'routes' => [
|
||||
['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
|
||||
|
|
Loading…
Reference in New Issue