From c37bc4fdf934a20b95334874b807b8f25f74d9f0 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 8 May 2018 13:32:37 +0200 Subject: [PATCH] Expose isCLI to DI This allows apps/backgroundjobs to find out if they are run from the CLI or not. Some apps/backgroundjobs might do more if they are not at risk of timing out. Signed-off-by: Roeland Jago Douma --- lib/private/Server.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/Server.php b/lib/private/Server.php index a879c65bb9..f230ce5b88 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -164,6 +164,9 @@ class Server extends ServerContainer implements IServerContainer { parent::__construct(); $this->webRoot = $webRoot; + // To find out if we are running from CLI or not + $this->registerParameter('isCLI', \OC::$CLI); + $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { return $c; });