Merge branch 'MDL-52777-master-bug' of github.com:andrewnicols/moodle

This commit is contained in:
Dan Poltawski
2016-10-20 08:02:08 +01:00
2 changed files with 13 additions and 20 deletions
-20
View File
@@ -561,11 +561,6 @@ class manager {
public static function get_matching_tours(\moodle_url $pageurl) {
global $DB, $PAGE;
if (self::tour_upgrade_pending()) {
// Do not show tours whilst upgrades are pending agains the plugin.
return null;
}
$sql = <<<EOF
SELECT * FROM {tool_usertours_tours}
WHERE enabled = 1
@@ -587,21 +582,6 @@ EOF;
return null;
}
/**
* Determine whether the tour plugin is pending an upgrade.
*
* @return bool
*/
public static function tour_upgrade_pending() {
$plugin = new \stdClass();
include(dirname(__DIR__) . '/version.php');
$manager = \core_plugin_manager::instance();
$plugininfo = $manager->get_plugin_info('tool_usertours');
return ($plugin->version != $plugininfo->versiondb);
}
/**
* Import the provided tour JSON.
*
@@ -243,6 +243,19 @@ class manager_testcase extends advanced_testcase {
$tourconfig->id = null;
$tour = \tool_usertours\tour::load_from_record($tourconfig, true);
$tour->persist(true);
$stepconfig = (object) [
'id' => null,
'tourid' => $tour->get_id(),
'title' => '',
'content' => '',
'targettype' => \tool_usertours\target::TARGET_UNATTACHED,
'targetvalue' => '',
'sortorder' => 0,
'configdata' => '',
];
$step = \tool_usertours\step::load_from_record($stepconfig, true);
$step->persist(true);
}
$match = \tool_usertours\manager::get_matching_tours(new moodle_url($url));