3 * This file contains dtabase upgrade code that is called from lib/db/upgrade.php,
4 * and also check methods that can be used for pre-install checks via
5 * admin/environment.php and lib/environmentlib.php.
7 * @copyright © 2007 The Open University
8 * @author T.J.Hunt@open.ac.uk
9 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
10 * @package package_name
14 * This test is becuase the RQP question type was included in core
15 * up to and including Moodle 1.8, and was removed before Moodle 1.9.
17 * Therefore, we want to check whether any rqp questions exist in the database
18 * before doing the upgrade. However, the check is not relevant if that
19 * question type was never installed, or if the person has chosen to
20 * manually reinstall the rqp question type from contrib.
22 * @param $version the version to test.
23 * @return null if the test is irrelevant, or true or false depending on whether the test passes.
25 function question_check_no_rqp_questions($result) {
28 if (empty($CFG->qtype_rqp_version
) ||
is_dir($CFG->dirroot
. '/question/type/rqp')) {
31 $result->setStatus(count_records('question', 'qtype', 'rqp') == 0);