Revert "Added content ID to export handlers"

This reverts commit 7fca1d100d.

Holding off on the exports for now
JI-92-path-fix
Frode Petterson 2016-09-08 14:48:08 +02:00
parent 7fca1d100d
commit 2896c9fdab
3 changed files with 8 additions and 10 deletions

View File

@ -144,7 +144,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
* @param string $filename * @param string $filename
* Name of export file. * Name of export file.
*/ */
public function saveExport($source, $filename, $contentId) { public function saveExport($source, $filename) {
$this->deleteExport($filename); $this->deleteExport($filename);
self::dirReady("{$this->path}/exports"); self::dirReady("{$this->path}/exports");
copy($source, "{$this->path}/exports/{$filename}"); copy($source, "{$this->path}/exports/{$filename}");
@ -155,7 +155,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
* *
* @param string $filename * @param string $filename
*/ */
public function deleteExport($filename, $contentId) { public function deleteExport($filename) {
$target = "{$this->path}/exports/{$filename}"; $target = "{$this->path}/exports/{$filename}";
if (file_exists($target)) { if (file_exists($target)) {
unlink($target); unlink($target);

View File

@ -80,17 +80,15 @@ interface H5PFileStorage {
* Path on file system to temporary export file. * Path on file system to temporary export file.
* @param string $filename * @param string $filename
* Name of export file. * Name of export file.
* @param int $contentId
*/ */
public function saveExport($source, $filename, $contentId); public function saveExport($source, $filename);
/** /**
* Removes given export file * Removes given export file
* *
* @param string $filename * @param string $filename
* @param int $contentId
*/ */
public function deleteExport($filename, $contentId); public function deleteExport($filename);
/** /**
* Will concatenate all JavaScrips and Stylesheets into two files in order * Will concatenate all JavaScrips and Stylesheets into two files in order

View File

@ -1434,7 +1434,7 @@ class H5PStorage {
*/ */
public function deletePackage($content) { public function deletePackage($content) {
$this->h5pC->fs->deleteContent($content['id']); $this->h5pC->fs->deleteContent($content['id']);
$this->h5pC->fs->deleteExport(($content['slug'] ? $content['slug'] . '-' : '') . $content['id'] . '.h5p', $content['id']); $this->h5pC->fs->deleteExport(($content['slug'] ? $content['slug'] . '-' : '') . $content['id'] . '.h5p');
$this->h5pF->deleteContentData($content['id']); $this->h5pF->deleteContentData($content['id']);
} }
@ -1587,7 +1587,7 @@ Class H5PExport {
try { try {
// Save export // Save export
$this->h5pC->fs->saveExport($tmpFile, $content['slug'] . '-' . $content['id'] . '.h5p', $content['id']); $this->h5pC->fs->saveExport($tmpFile, $content['slug'] . '-' . $content['id'] . '.h5p');
} }
catch (Exception $e) { catch (Exception $e) {
$this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage())); $this->h5pF->setErrorMessage($this->h5pF->t($e->getMessage()));
@ -1633,7 +1633,7 @@ Class H5PExport {
* @param array $content object * @param array $content object
*/ */
public function deleteExport($content) { public function deleteExport($content) {
$this->h5pC->fs->deleteExport(($content['slug'] ? $content['slug'] . '-' : '') . $content['id'] . '.h5p', $content['id']); $this->h5pC->fs->deleteExport(($content['slug'] ? $content['slug'] . '-' : '') . $content['id'] . '.h5p');
} }
/** /**
@ -1837,7 +1837,7 @@ class H5PCore {
$content['slug'] = $this->generateContentSlug($content); $content['slug'] = $this->generateContentSlug($content);
// Remove old export file // Remove old export file
$this->fs->deleteExport($content['id'] . '.h5p', $content['id']); $this->fs->deleteExport($content['id'] . '.h5p');
} }
if ($this->exportEnabled) { if ($this->exportEnabled) {