diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-22 15:42:17 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-24 10:58:11 +0100 |
commit | 90910290d17390889b5f8ffe97de9105f23d094b (patch) | |
tree | 7449537d6b0dab6589129a40234bb1e85b937655 /lib/private/Template/JSCombiner.php | |
parent | 242f8964cf8e98726a4d6e51cfd5200b17211e3e (diff) | |
download | nextcloud-server-90910290d17390889b5f8ffe97de9105f23d094b.tar.gz nextcloud-server-90910290d17390889b5f8ffe97de9105f23d094b.zip |
Add debug mode
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Template/JSCombiner.php')
-rw-r--r-- | lib/private/Template/JSCombiner.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php index f470ee330c7..a7bbf129e01 100644 --- a/lib/private/Template/JSCombiner.php +++ b/lib/private/Template/JSCombiner.php @@ -22,6 +22,7 @@ */ namespace OC\Template; +use OC\SystemConfig; use OCP\ICache; use OCP\Files\IAppData; use OCP\Files\NotFoundException; @@ -40,6 +41,9 @@ class JSCombiner { /** @var ICache */ protected $depsCache; + /** @var SystemConfig */ + protected $config; + /** * JSCombiner constructor. * @@ -49,10 +53,12 @@ class JSCombiner { */ public function __construct(IAppData $appData, IURLGenerator $urlGenerator, - ICache $depsCache) { + ICache $depsCache, + SystemConfig $config) { $this->appData = $appData; $this->urlGenerator = $urlGenerator; $this->depsCache = $depsCache; + $this->config = $config; } /** @@ -62,6 +68,10 @@ class JSCombiner { * @return bool */ public function process($root, $file, $app) { + if ($this->config->getValue('debug')) { + return false; + } + $path = explode('/', $root . '/' . $file); $fileName = array_pop($path); @@ -166,4 +176,24 @@ class JSCombiner { return substr($this->urlGenerator->linkToRoute('core.Js.getJs', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1); } + + /** + * @param string $root + * @param string $file + * @return string[] + */ + public function getContent($root, $file) { + $data = json_decode(file_get_contents($root . '/' . $file)); + + $path = explode('/', $file); + array_pop($path); + $path = implode('/', $path); + + $result = []; + foreach ($data as $f) { + $result[] = $path . '/' . $f; + } + + return $result; + } } |