From a3d5dfe86e51c71a7b29776f48e107ccd6fabb31 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Fri, 25 Jan 2013 09:14:18 +0100 Subject: Replace all deprecated error() calls with print_error --- sqlbox/lang/en/sqlbox.php | 1 + sqlbox/report.php | 2 +- sqlbox/reportall.php | 2 +- sqlbox/version.php | 2 +- sqlbox/view.php | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sqlbox/lang/en/sqlbox.php b/sqlbox/lang/en/sqlbox.php index 8867d10..f1b4d9e 100644 --- a/sqlbox/lang/en/sqlbox.php +++ b/sqlbox/lang/en/sqlbox.php @@ -43,3 +43,4 @@ $string['pluginadministration'] = 'sqlbox administration'; $string['pluginname'] = 'sqlbox'; $string['viewresults'] = 'View Results'; $string['queryfailed'] = 'Query failed: {$a}'; +$string['dbconnectionfailed'] = 'Error: Database connection failed'; diff --git a/sqlbox/report.php b/sqlbox/report.php index ad907a2..d9371d9 100644 --- a/sqlbox/report.php +++ b/sqlbox/report.php @@ -10,7 +10,7 @@ if ($id) { $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $sqlbox = $DB->get_record('sqlbox', array('id' => $cm->instance), '*', MUST_EXIST); } else { - error('You must specify a course_module ID or an instance ID'); + print_error('invalidcourse'); } require_login($course, true, $cm); diff --git a/sqlbox/reportall.php b/sqlbox/reportall.php index 659da9c..b11a422 100644 --- a/sqlbox/reportall.php +++ b/sqlbox/reportall.php @@ -10,7 +10,7 @@ if ($id) { $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $sqlbox = $DB->get_record('sqlbox', array('id' => $cm->instance), '*', MUST_EXIST); } else { - error('You must specify a course_module ID or an instance ID'); + print_error('invalidcourse'); } require_login($course, true, $cm); diff --git a/sqlbox/version.php b/sqlbox/version.php index 82e4d06..037f4f4 100644 --- a/sqlbox/version.php +++ b/sqlbox/version.php @@ -30,7 +30,7 @@ defined('MOODLE_INTERNAL') || die(); -$module->version = 2013012501; // The current module version (Date: YYYYMMDDXX) +$module->version = 2013012502; // The current module version (Date: YYYYMMDDXX) $module->requires = 2010031900; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) $module->component = 'mod_sqlbox'; // To check on upgrade, that module sits in correct place diff --git a/sqlbox/view.php b/sqlbox/view.php index f79b8dc..fababb7 100644 --- a/sqlbox/view.php +++ b/sqlbox/view.php @@ -44,7 +44,7 @@ if ($id) { $course = $DB->get_record('course', array('id' => $sqlbox->course), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('sqlbox', $sqlbox->id, $course->id, false, MUST_EXIST); } else { - error('You must specify a course_module ID or an instance ID'); + print_error('invalidcourse'); } require_login($course, true, $cm); @@ -96,7 +96,7 @@ if (isset($data->sqlbox_query)) { $db = pg_connect($con); if (!$db) - error("Failed to connect to sqlbox db"); + print_error('dbconnectionfailed', 'sqlbox'); $table = db_table_from_query($db, $data->sqlbox_query); if (strlen($sqlbox->query) > 0) { -- cgit