Skip to content
Permalink
Browse files

Regenerate export if missing on view

Thanks to paravibe on Drupal.org for contributing.
  • Loading branch information...
icc committed Sep 23, 2016
1 parent 263a987 commit 1c5b9707e583fff170d9985c2c351d4f442dfc15
Showing with 23 additions and 1 deletion.
  1. +11 −0 h5p-default-storage.class.php
  2. +8 −0 h5p-file-storage.interface.php
  3. +4 −1 h5p.classes.php
@@ -151,6 +151,17 @@ public function deleteExport($filename) {
}
}
/**
* Check if the given export file exists
*
* @param string $filename
* @return boolean
*/
public function hasExport($filename) {
$target = "{$this->path}/exports/{$filename}";
return file_exists($target);
}
/**
* Will concatenate all JavaScrips and Stylesheets into two files in order
* to improve page performance.
@@ -90,6 +90,14 @@ public function saveExport($source, $filename);
*/
public function deleteExport($filename);
/**
* Check if the given export file exists
*
* @param string $filename
* @return boolean
*/
public function hasExport($filename);
/**
* Will concatenate all JavaScrips and Stylesheets into two files in order
* to improve page performance.
@@ -1812,7 +1812,10 @@ public function loadContent($id) {
* @return Object NULL on failure.
*/
public function filterParameters(&$content) {
if (isset($content['filtered']) && $content['filtered'] !== '') {
if (!empty($content['filtered']) &&
(!$this->exportEnabled ||
($content['slug'] &&
$this->fs->hasExport($content['slug'] . '-' . $content['id'] . '.h5p')))) {
return $content['filtered'];
}

0 comments on commit 1c5b970

Please sign in to comment.
You can’t perform that action at this time.