function opigno_lms_update_7111 in Opigno LMS 7
Add the new menu entry
File
- ./
opigno_lms.install, line 809 - Install, update and uninstall functions for the Opigno LMS installation profile.
Code
function opigno_lms_update_7111(&$sandbox) {
// Installs latest H5P Libraries
if (module_exists("h5p")) {
$path = file_get_contents(drupal_get_path("profile", "opigno_lms") . "/h5plib/libraries.h5p");
$temporary_file_path = 'public://' . variable_get('h5p_default_path', 'h5p') . '/temp/' . uniqid('h5p-');
$prepare = file_prepare_directory($temporary_file_path, FILE_CREATE_DIRECTORY);
$temporary_file_name = $temporary_file_path . "/libraries.h5p";
$file = file_save_data($path, $temporary_file_name, FILE_EXISTS_REPLACE);
$_SESSION['h5p_upload'] = drupal_realpath($file->uri);
$_SESSION['h5p_upload_folder'] = drupal_realpath($temporary_file_path);
$validator = _h5p_get_instance('validator');
$isvalid = $validator
->isValidPackage(TRUE, FALSE);
$h5p_core = _h5p_get_instance('storage');
$save_package = $h5p_core
->savePackage(NULL, NULL, TRUE);
unset($_SESSION['h5p_upload'], $_SESSION['h5p_upload_folder']);
}
/////////////////////////////////////////////////////////////////////
module_enable(array(
'opigno_statistics_app',
), TRUE);
module_enable(array(
'opigno_moxtra_app',
), TRUE);
$menu = menu_load_links("main-menu");
foreach ($menu as $menu_link) {
if ($menu_link['link_path'] == "admin/opigno-statistics") {
$menu_link['hidden'] = 0;
menu_link_save($menu_link);
}
}
opigno_lms_refresh_strings_and_import(array(
'field',
));
drupal_flush_all_caches();
}