Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/maven/fixes/8.0' into maven/rele…
Browse files Browse the repository at this point in the history
…ase/8.0
  • Loading branch information
metaventis-build committed Jan 24, 2024
2 parents 6fd72fa + caf8075 commit fff8281
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ services:
ONLYOFFICE_DOCUMENT_SERVER: "${SERVICES_EDU_CONNECTOR_ONLYOFFICE_DOCUMENT_SERVER:-}"
ONLYOFFICE_PLUGIN_URL: "${SERVICES_EDU_CONNECTOR_ONLYOFFICE_PLUGIN_URL:-}"
ONLYOFFICE_JWT_SECRET: "${SERVICES_EDU_CONNECTOR_ONLYOFFICE_JWT_SECRET:-}"
H5P_SUPPRESS_CLEANUP: "{$SERVICES_EDU_CONNECTOR_H5P_SUPPRESS_CLEANUP:false}"
UPLOAD_FILE_SIZE: "${SERVICES_EDU_CONNECTOR_UPLOAD_FILE_SIZE:-512M}"
POST_MAX_SIZE: "${SERVICES_EDU_CONNECTOR_POST_MAX_SIZE:-513M}"
MEMORY_LIMIT: "${SERVICES_EDU_CONNECTOR_MEMORY_LIMIT:-1024M}"
Expand Down
2 changes: 2 additions & 0 deletions service/src/main/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ sed -i "s|define('ONLYOFFICE_JWT_SECRET', '.*')|define('ONLYOFFICE_JWT_SECRET',
sed -i "s|define('MOODLE_BASE_DIR', '.*')|define('MOODLE_BASE_DIR', '${moodle_base_dir}')|g" "${conf}"
sed -i "s|define('MOODLE_TOKEN', '.*')|define('MOODLE_TOKEN', '${moodle_token}')|g" "${conf}"

sed -i "s|define('H5P_SUPPRESS_CLEANUP', false)|define('H5P_SUPPRESS_CLEANUP', ${H5P_SUPPRESS_CLEANUP})|g" "${conf}"

echo "Installing..."
php install/install.php

Expand Down
28 changes: 19 additions & 9 deletions service/src/main/php/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,29 @@
$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>';
echo '<script>setInterval(function(){if(window.opener){window.opener.postMessage({event:"REFRESH"},"*"); window.opener.postMessage({event:"CLOSE"},"*");}},100);</script>';
echo '<script>setInterval(
() => {
if(window.opener){
setTimeout(() => {
window.opener.postMessage({event:"REFRESH"},"*");
window.opener.postMessage({event:"CLOSE"},"*");
}, 3000)
}
},100);</script>';
exit(0);
}
}
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 fff8281

Please sign in to comment.