diff --git a/core/js/dist/main.js b/core/js/dist/main.js
index 51d1d10a490891bdd4f0a7925d1cc5019d7ce8b9..e665ae5666b1166ac1ae6742b02dfe65b7b22337 100644
Binary files a/core/js/dist/main.js and b/core/js/dist/main.js differ
diff --git a/core/js/dist/main.js.map b/core/js/dist/main.js.map
index ea01e00e325b8fbc0c64d055b3932e415ed65e00..69f584b4e2c08483bc6304d36d5a6c2dff8f6f07 100644
Binary files a/core/js/dist/main.js.map and b/core/js/dist/main.js.map differ
diff --git a/core/js/js.js b/core/js/js.js
index e9e66fd63fc483b25c7fd5955091019c2104f76f..311bcc7a77094a45235ab89d8520299b2525cc6a 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1,6 +1,4 @@
-var oc_debug;
 var oc_webroot;
-
 var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user');
 var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken');
 
diff --git a/core/src/OC/debug.js b/core/src/OC/debug.js
new file mode 100644
index 0000000000000000000000000000000000000000..15a66c44aed831145cf9e9e3735f0e7794d8276f
--- /dev/null
+++ b/core/src/OC/debug.js
@@ -0,0 +1,24 @@
+/*
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+const base = window._oc_debug
+
+export const debug = base
diff --git a/core/src/OC/index.js b/core/src/OC/index.js
index dd618e7a1a05437dfb091e410972e7b76fecdbd3..ff7b3c2503d6468a3790360d69f7c1b396d13d06 100644
--- a/core/src/OC/index.js
+++ b/core/src/OC/index.js
@@ -42,6 +42,7 @@ import PasswordConfirmation from './password-confirmation'
 import Plugins from './plugins'
 import search from './search'
 import Util from './util'
+import {debug} from './debug'
 import {redirect, reload} from './navigation'
 
 /** @namespace OC */
@@ -61,6 +62,7 @@ export default {
 	Plugins,
 	search,
 	Util,
+	debug,
 	generateUrl,
 	filePath,
 	redirect,
diff --git a/core/src/globals.js b/core/src/globals.js
index 9fcf03ba9ee6524e841c87c6f7ee17ed6f1d591d..01a7f3452ef01799f11b33a258f372ac9e8f170e 100644
--- a/core/src/globals.js
+++ b/core/src/globals.js
@@ -109,6 +109,7 @@ window['moment'] = moment
 window['OC'] = OC
 setDeprecatedProp('oc_config', OC.config, 'use OC.config instead')
 setDeprecatedProp('oc_isadmin', OC.isUserAdmin(), 'use OC.isUserAdmin() instead')
+setDeprecatedProp('oc_debug', OC.debug, 'use OC.debug instead')
 setDeprecatedProp('OCDialogs', OC.dialogs, 'use OC.dialogs instead')
 window['OCP'] = OCP
 window['OCA'] = OCA
diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php
index a190371d6d9e1b7049a8e8a48d5a7beaadfcd0b9..7400650eade133379424f84e35eba7708ddb2c74 100644
--- a/lib/private/Template/JSConfigHelper.php
+++ b/lib/private/Template/JSConfigHelper.php
@@ -166,7 +166,7 @@ class JSConfigHelper {
 		$capabilities = $this->capabilitiesManager->getCapabilities();
 
 		$array = [
-			"oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false',
+			"_oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false',
 			"_oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false',
 			"backendAllowsPasswordConfirmation" => $userBackendAllowsPasswordConfirmation ? 'true' : 'false',
 			"oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false',