Skip to content

Commit

Permalink
Fix: Add constant to suppress H5P editor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zieglermarian committed Jan 24, 2024
1 parent a7b8e3c commit 1adf314
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
18 changes: 10 additions & 8 deletions service/src/main/php/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,17 @@
$res = $apiClient->createContentNodeEnhanced($_SESSION[$id]['node']->node->ref->id, $contentPath, 'application/zip', 'EDITOR_UPLOAD,H5P');
if($res) {
//cleanup filesystem and db
$h5p->H5PFramework -> deleteContentData($cid);
$h5p->H5PFramework -> deleteLibraryUsage($cid);
unlink($contentPath);
$h5p -> rrmdir($h5p -> H5PFramework -> get_h5p_path() . '/content/' . $cid);
if(isset($_SESSION[$id]['viewContentId'])){
$h5p -> rrmdir($h5p -> H5PFramework -> get_h5p_path() . '/content/' . $_SESSION[$id]['viewContentId']);
if (! H5P_SUPPRESS_CLEANUP) {
$h5p->H5PFramework -> deleteContentData($cid);
$h5p->H5PFramework -> deleteLibraryUsage($cid);
unlink($contentPath);
$h5p -> rrmdir($h5p -> H5PFramework -> get_h5p_path() . '/content/' . $cid);
if(isset($_SESSION[$id]['viewContentId'])){
$h5p -> rrmdir($h5p -> H5PFramework -> get_h5p_path() . '/content/' . $_SESSION[$id]['viewContentId']);
}
$h5p -> rrmdir(DATA . DIRECTORY_SEPARATOR . 'h5p' . DIRECTORY_SEPARATOR . 'editor');
$h5p -> rrmdir(DATA . DIRECTORY_SEPARATOR . 'h5p' . DIRECTORY_SEPARATOR . 'temp');
}
$h5p -> rrmdir(DATA . DIRECTORY_SEPARATOR . 'h5p' . DIRECTORY_SEPARATOR . 'editor');
$h5p -> rrmdir(DATA . DIRECTORY_SEPARATOR . 'h5p' . DIRECTORY_SEPARATOR . 'temp');

//cordova
echo '<script>window.shouldClose=true;</script>';
Expand Down
3 changes: 3 additions & 0 deletions service/src/main/php/config.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@
define('ETHERPAD_SERVER', '');
define('ETHERPAD_PROTOCOL', '');
define('ETHERPAD_APIKEY', '');

/*h5p cache*/
define('H5P_SUPPRESS_CLEANUP', false);

0 comments on commit 1adf314

Please sign in to comment.