From 2e3da29789c691db834395261d8c2355ebd58bd9 Mon Sep 17 00:00:00 2001 From: skodak Date: Fri, 3 Jul 2009 13:35:36 +0000 Subject: [PATCH] MDL-16089 entry in modules table created before calling install.php because it might be used there already, also if something fails in install.php the db will be in a more consistent state --- lib/upgradelib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/upgradelib.php b/lib/upgradelib.php index 18ea138b0a..420977ad72 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -431,6 +431,9 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) { /// Execute install.xml (XMLDB) - must be present in all modules $DB->get_manager()->install_from_xmldb_file($fullmod.'/db/install.xml'); + /// Add record into modules table - may be needed in install.php already + $module->id = $DB->insert_record('modules', $module); + /// Post installation hook - optional if (file_exists("$fullmod/db/install.php")) { require_once("$fullmod/db/install.php"); @@ -438,9 +441,6 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) { $post_install_function(); } - /// Continue with the installation, roles and other stuff - $module->id = $DB->insert_record('modules', $module); - /// Install various components update_capabilities($component); events_update_definition($component); -- 2.39.5