}
$versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
- $useAssetPipeline = OC_Config::getValue('asset-pipeline.enabled', false);
+ $useAssetPipeline = $this->isAssetPipelineEnabled();
if ($useAssetPipeline) {
$this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
sort($files);
return hash('md5', implode('', $files));
}
+
+ /**
+ * @return bool
+ */
+ private function isAssetPipelineEnabled() {
+ // asset management enabled?
+ $useAssetPipeline = OC_Config::getValue('asset-pipeline.enabled', false);
+ if (!$useAssetPipeline) {
+ return false;
+ }
+
+ // assets folder exists?
+ $assetDir = \OC::$SERVERROOT . '/assets';
+ if (!is_dir($assetDir)) {
+ if (!mkdir($assetDir)) {
+ \OCP\Util::writeLog('assets',
+ "Folder <$assetDir> does not exist and/or could not be generated.", \OCP\Util::ERROR);
+ return false;
+ }
+ }
+
+ // assets folder can be accessed?
+ if (!touch($assetDir."/.oc")) {
+ \OCP\Util::writeLog('assets',
+ "Folder <$assetDir> could not be accessed.", \OCP\Util::ERROR);
+ return false;
+ }
+ return $useAssetPipeline;
+ }
}