summaryrefslogtreecommitdiff
path: root/src/Manager/ScormDisk.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Manager/ScormDisk.php')
-rw-r--r--src/Manager/ScormDisk.php42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/Manager/ScormDisk.php b/src/Manager/ScormDisk.php
index 5f15d38..34e4cb6 100644
--- a/src/Manager/ScormDisk.php
+++ b/src/Manager/ScormDisk.php
@@ -53,20 +53,54 @@ class ScormDisk
Storage::writeStream($file, $this->getArchiveDisk()->readStream($file));
$path = Storage::path($file);
call_user_func($fn, $path);
- unlink($path); // delete temp package
- Storage::deleteDirectory(dirname($file)); // delete temp dir
+ // Clean local resources
+ $this->clean($file);
} catch (Exception $ex) {
throw new StorageNotFoundException('scorm_archive_not_found');
}
}
+ private function clean($file)
+ {
+ try {
+ Storage::delete($file);
+ Storage::deleteDirectory(dirname($file)); // delete temp dir
+ } catch (Exception $ex) {
+ }
+ }
+
+ /**
+ * @param string $directory
+ * @return bool
+ */
+ public function deleteScorm($uuid)
+ {
+ $this->deleteScormArchive($uuid); // try to delete archive if exists.
+ return $this->deleteScormContent($uuid);
+ }
+
+ /**
+ * @param string $directory
+ * @return bool
+ */
+ private function deleteScormContent($folderHashedName)
+ {
+ try {
+ return $this->getDisk()->deleteDirectory($folderHashedName);
+ } catch (Exception $ex) {
+ }
+ }
+
/**
* @param string $directory
* @return bool
*/
- public function deleteScormFolder($folderHashedName)
+ private function deleteScormArchive($uuid)
{
- return $this->getDisk()->deleteDirectory($folderHashedName);
+ try {
+ return $this->getArchiveDisk()->deleteDirectory($uuid);
+ } catch (Exception $ex) {
+ }
}
/**