From 7cdd8b2258ebc2a3a22af1b3cb0fe580e89977e7 Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Fri, 20 Jun 2008 09:11:08 +0000 Subject: [PATCH] MDL-14191 "Add db folder for db installation / upgrade" and MDL-14193 "Automatic processing of access.php for adding / upgrading report capabilities" New plug in capabilities for quiz reports. --- admin/index.php | 11 +++++++---- lib/adminlib.php | 33 +++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/admin/index.php b/admin/index.php index 125bebbbf6..9542aa0e66 100644 --- a/admin/index.php +++ b/admin/index.php @@ -34,14 +34,14 @@ $confirmplugincheck = optional_param('confirmplugincheck', 0, PARAM_BOOL); /// check upgrade status first - if ($ignoreupgradewarning and !empty($_SESSION['upgraderunning'])) { - $_SESSION['upgraderunning'] = 0; + if ($ignoreupgradewarning) { + $SESSION->upgraderunning = 0; } upgrade_check_running("Upgrade already running in this session, please wait!
Click on the exclamation marks to ignore this warning (!!!).", 10); /// set install/upgrade autocontinue session flag if ($autopilot) { - $_SESSION['installautopilot'] = $autopilot; + $SESSION->installautopilot = $autopilot; } /// Check some PHP server settings @@ -431,11 +431,14 @@ /// Check all admin report plugins and upgrade if necessary upgrade_plugins('report', $CFG->admin.'/report', "$CFG->wwwroot/$CFG->admin/index.php"); +/// Check all quiz report plugins and upgrade if necessary + upgrade_plugins('quiz_report', 'mod/quiz/report', "$CFG->wwwroot/$CFG->admin/index.php"); + /// just make sure upgrade logging is properly terminated upgrade_log_finish(); - unset($_SESSION['installautopilot']); + unset($SESSION->installautopilot); /// Set up the blank site - to be customized later at the end of install. if (! $site = get_site()) { diff --git a/lib/adminlib.php b/lib/adminlib.php index 29dcfd428a..f815171b41 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -186,6 +186,13 @@ function get_db_directories() { $dbdirs[] = $CFG->dirroot.'/'.$CFG->admin.'/report/'.$plugin.'/db'; } } + +/// Now quiz report plugins (mod/quiz/report/xxx/db) + if ($plugins = get_list_of_plugins('mod/quiz/report', 'db')) { + foreach ($plugins as $plugin) { + $dbdirs[] = $CFG->dirroot.'/mod/quiz/report/'.$plugin.'/db'; + } + } /// Local database changes, if the local folder exists. if (file_exists($CFG->dirroot . '/local')) { @@ -707,9 +714,9 @@ function print_progress_redraw($thisbarid, $done, $total, $width, $donetext='') } function upgrade_get_javascript() { - global $CFG; + global $CFG, $SESSION; - if (!empty($_SESSION['installautopilot'])) { + if (!empty($SESSION->installautopilot)) { $linktoscrolltoerrors = ''."\n"; } else { $linktoscrolltoerrors = ''."\n"; @@ -792,7 +799,9 @@ global $upgradeloghandle, $upgradelogbuffer; * @param int page reload timeout */ function upgrade_check_running($message, $timeout) { - if (!empty($_SESSION['upgraderunning'])) { + global $SESSION; + + if (!empty($SESSION->upgraderunning)) { print_header(); redirect(me(), $message, $timeout); } @@ -807,14 +816,14 @@ function upgrade_check_running($message, $timeout) { * This function may be called repeatedly. */ function upgrade_log_start() { - global $CFG, $upgradeloghandle; + global $CFG, $upgradeloghandle, $SESSION; - if (!empty($_SESSION['upgraderunning'])) { + if (!empty($SESSION->upgraderunning)) { return; // logging already started } @ignore_user_abort(true); // ignore if user stops or otherwise aborts page loading - $_SESSION['upgraderunning'] = 1; // set upgrade indicator + $SESSION->upgraderunning = 1; // set upgrade indicator if (empty($CFG->dbsessions)) { // workaround for bug in adodb, db session can not be restarted session_write_close(); // from now on user can reload page - will be displayed warning } @@ -833,9 +842,9 @@ function upgrade_log_start() { * This function may be called repeatedly. */ function upgrade_log_finish() { - global $CFG, $upgradeloghandle, $upgradelogbuffer; + global $CFG, $upgradeloghandle, $upgradelogbuffer, $SESSION; - if (empty($_SESSION['upgraderunning'])) { + if (empty($SESSION->upgraderunning)) { return; // logging already terminated } @@ -848,10 +857,10 @@ function upgrade_log_finish() { @fclose($upgradeloghandle); $upgradeloghandle = false; } - if (empty($CFG->dbsessions)) { - @session_start(); // ignore header errors, we only need to reopen session - } - $_SESSION['upgraderunning'] = 0; // clear upgrade indicator + @session_start(); // ignore header errors, we only need to reopen session + + $SESSION->upgraderunning = 0; // clear upgrade indicator + if (connection_aborted()) { die; } -- 2.39.5