From 4282898e83db24fbeb69c71c67bb7440253c1b66 Mon Sep 17 00:00:00 2001 From: Frode Petterson <frode.andre.petterson@gmail.com> Date: Mon, 3 Oct 2016 15:21:02 +0200 Subject: [PATCH] Implemented latest core changes HFP-23 --- classes/file_storage.php | 26 +++++++++++++++++++++++--- classes/framework.php | 5 +++++ library | 2 +- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/classes/file_storage.php b/classes/file_storage.php index ea9fd52..b6f2f77 100644 --- a/classes/file_storage.php +++ b/classes/file_storage.php @@ -179,23 +179,43 @@ class file_storage implements \H5PFileStorage { } /** - * Removes given export file + * Get file object for given export file. * * @param string $filename + * @return stdClass Moodle file object */ - public function deleteExport($filename) { + private function getExportFile($filename) { global $COURSE; $context = \context_course::instance($COURSE->id); // Check if file exists. $fs = get_file_storage(); - $file = $fs->get_file($context->id, 'mod_hvp', 'exports', 0, '/', $filename); + return $fs->get_file($context->id, 'mod_hvp', 'exports', 0, '/', $filename); + } + + /** + * Removes given export file + * + * @param string $filename + */ + public function deleteExport($filename) { + $file = $this->getExportFile($filename); if ($file) { // Remove old export. $file->delete(); } } + /** + * Check if the given export file exists + * + * @param string $filename + * @return boolean + */ + public function hasExport($filename) { + return !! $this->getExportFile($filename); + } + /** * Will concatenate all JavaScrips and Stylesheets into two files in order * to improve page performance. diff --git a/classes/framework.php b/classes/framework.php index f8437eb..a43597a 100644 --- a/classes/framework.php +++ b/classes/framework.php @@ -1222,4 +1222,9 @@ class framework implements \H5PFrameworkInterface { )); } + /** + * Implements afterExportCreated + */ + public function afterExportCreated() { + } } diff --git a/library b/library index 6b6d4cd..c9e5680 160000 --- a/library +++ b/library @@ -1 +1 @@ -Subproject commit 6b6d4cd109a0d187f6523fa1428a9a0440917c05 +Subproject commit c9e5680e852ddc579e78b467504cb6bec40e0e0c -- GitLab