From 5eb0e0e14c728a924d93cd420626b6126da97bc9 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 25 Jan 2016 14:44:10 +0100 Subject: [PATCH] Avoid caching dependencies without assets --- h5p.classes.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index cd7a64d..e0e0ff4 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1939,6 +1939,17 @@ class H5PCore { * @return array files. */ public function getDependenciesFiles($dependencies, $prefix = '') { + // Build files list for assets + $files = array( + 'scripts' => array(), + 'styles' => array() + ); + + // Avoid caching empty files + if (empty($dependencies)) { + return $files; + } + if ($this->aggregateAssets) { // Get aggregated files for assets $key = self::getDependenciesHash($dependencies); @@ -1949,11 +1960,6 @@ class H5PCore { } } - // Build files list for assets - $files = array( - 'scripts' => array(), - 'styles' => array() - ); // Using content dependencies foreach ($dependencies as $dependency) { if (isset($dependency['path']) === FALSE) {