Skip to content

Commit

Permalink
Fix problems raised by travis
Browse files Browse the repository at this point in the history
  • Loading branch information
davosmith committed May 9, 2018
1 parent d537d28 commit 743f438
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 20 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
@@ -1,6 +1,6 @@
language: php

sudo: false
sudo: required

addons:
firefox: "47.0.1"
Expand All @@ -22,7 +22,6 @@ php:

env:
global:
- MOODLE_BRANCH=MOODLE_34_STABLE
- MOODLE_BRANCH=master
matrix:
- DB=pgsql
Expand Down
8 changes: 4 additions & 4 deletions autoupdate.php
Expand Up @@ -24,7 +24,7 @@
* Remove the '//' at the start of the next line to output lots of
* helpful information during automatic updates.
*/
//define("DEBUG_CHECKLIST_AUTOUPDATE", 1);
// define("DEBUG_CHECKLIST_AUTOUPDATE", 1);

function checklist_completion_update_checks($userid, $itemchecks, $newstate) {
global $DB;
Expand Down Expand Up @@ -127,9 +127,9 @@ function checklist_completion_autoupdate($cmid, $userid, $newstate) {
}

$sql = "SELECT i.id AS itemid, i.checklist, cl.teacheredit, ck.*
FROM {checklist_item} i
JOIN {checklist} cl ON i.checklist = cl.id
LEFT JOIN {checklist_check} ck ON (ck.item = i.id AND ck.userid = :userid)
FROM {checklist_item} i
JOIN {checklist} cl ON i.checklist = cl.id
LEFT JOIN {checklist_check} ck ON (ck.item = i.id AND ck.userid = :userid)
WHERE cl.autoupdate > 0 AND i.moduleid = :cmid AND i.itemoptional < :heading";
$itemchecks = $DB->get_records_sql($sql, ['userid' => $userid, 'cmid' => $cmid, 'heading' => CHECKLIST_OPTIONAL_HEADING]);
if (empty($itemchecks)) {
Expand Down
2 changes: 2 additions & 0 deletions backup/moodle2/backup_checklist_activity_task.class.php
Expand Up @@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

global $CFG;
require_once($CFG->dirroot.'/mod/checklist/backup/moodle2/backup_checklist_stepslib.php'); // Because it exists (must).
require_once($CFG->dirroot.'/mod/checklist/backup/moodle2/backup_checklist_settingslib.php'); // Because it exists (optional).
Expand Down
18 changes: 17 additions & 1 deletion backup/moodle2/backup_checklist_settingslib.php
@@ -1,5 +1,21 @@
<?php
// This file is part of the Checklist plugin for Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

// This activity has not particular settings but the inherited from the generic
// backup_activity_task so here there isn't any class definition, like the ones
// existing in /backup/moodle2/backup_settingslib.php (activities section)
// existing in /backup/moodle2/backup_settingslib.php (activities section).

defined('MOODLE_INTERNAL') || die();
2 changes: 2 additions & 0 deletions backup/moodle2/backup_checklist_stepslib.php
Expand Up @@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

/**
* Define all the backup steps that will be used by the backup_forum_activity_task
*/
Expand Down
2 changes: 2 additions & 0 deletions backup/moodle2/restore_checklist_stepslib.php
Expand Up @@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

class restore_checklist_activity_structure_step extends restore_activity_structure_step {

protected function define_structure() {
Expand Down
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Expand Up @@ -31,7 +31,7 @@
use core_privacy\local\request\transform;
use core_privacy\local\request\writer;

\defined('MOODLE_INTERNAL') || die();
defined('MOODLE_INTERNAL') || die();

class provider implements \core_privacy\local\metadata\provider,
\core_privacy\local\request\plugin\provider {
Expand Down
2 changes: 2 additions & 0 deletions db/access.php
Expand Up @@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

/**
* Capability definitions for the checklist module
*/
Expand Down
2 changes: 2 additions & 0 deletions db/upgrade.php
Expand Up @@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

function xmldb_checklist_upgrade($oldversion = 0) {
global $DB, $OUTPUT;

Expand Down
4 changes: 2 additions & 2 deletions lang/en/checklist.php
Expand Up @@ -103,9 +103,9 @@
An administrator can control who receives this email using the capability \'mod:checklist/emailoncomplete\' - by default all teachers and non-editing teachers have this capability.';
$string['emailoncompletesubject'] = 'User {$a->user} has completed checklist \'{$a->checklist}\'';
$string['emailoncompletesubjectown'] = 'You have completed checklist \'{$a->checklist}\'';
$string['emailoncompletebody'] = 'User {$a->user} has completed checklist \'{$a->checklist}\' in the course \'{$a->coursename}\'
$string['emailoncompletebody'] = 'User {$a->user} has completed checklist \'{$a->checklist}\' in the course \'{$a->coursename}\'
View the checklist here:';
$string['emailoncompletebodyown'] = 'You have completed checklist \'{$a->checklist}\' in the course \'{$a->coursename}\'
$string['emailoncompletebodyown'] = 'You have completed checklist \'{$a->checklist}\' in the course \'{$a->coursename}\'
View the checklist here:';
$string['enterurl'] = 'Enter url ...';
$string['eventchecklistcomplete'] = 'Checklist complete';
Expand Down
2 changes: 2 additions & 0 deletions lib.php
Expand Up @@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

/**
* Library of functions and constants for module checklist
* This file should have two well differenced parts:
Expand Down
9 changes: 6 additions & 3 deletions locallib.php
Expand Up @@ -26,8 +26,9 @@
use mod_checklist\local\checklist_item;
use mod_checklist\local\output_status;

require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once(dirname(__FILE__).'/lib.php');
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot.'/mod/checklist/lib.php');

define("CHECKLIST_TEXT_INPUT_WIDTH", 45);
define("CHECKLIST_OPTIONAL_NO", 0);
Expand Down Expand Up @@ -1785,6 +1786,7 @@ protected function setevent(checklist_item $item, $add) {
$event->delete();
} catch (dml_missing_record_exception $e) {
// Just ignore this error - the event is missing, so does not need deleting.
$event = null; // Do something here to stop codechecker complaining.
}
$item->eventid = 0;
if ($add) {
Expand Down Expand Up @@ -1829,7 +1831,8 @@ public function setallevents() {
}
}

protected function updateitem($itemid, $displaytext, $duetime = false, $linkcourseid = null, $linkurl = null, $grouping = null) {
protected function updateitem($itemid, $displaytext, $duetime = false, $linkcourseid = null, $linkurl = null,
$grouping = null) {
$displaytext = trim($displaytext);
if ($displaytext == '') {
return;
Expand Down
8 changes: 5 additions & 3 deletions renderer.php
Expand Up @@ -302,7 +302,8 @@ public function checklist_items($items, $useritems, $groupings, $intro, output_s
if (!$item->is_heading()) {
if ($status->is_showteachermark() && $item->teachertimestamp) {
if ($item->get_teachername()) {
echo '<span class="itemteachername" title="'.$strteachername.'">'.$item->get_teachername().'</span>';
echo '<span class="itemteachername" title="'.$strteachername.'">'.
$item->get_teachername().'</span>';
}
echo '<span class="itemteacherdate" title="'.$strteacherdate.'">'.
userdate($item->teachertimestamp, get_string('strftimedatetimeshort')).'</span>';
Expand Down Expand Up @@ -375,7 +376,8 @@ public function checklist_items($items, $useritems, $groupings, $intro, output_s
echo '</form>';
echo '</div>';

echo '<form style="display:inline;" action="'.$thispageurl->out_omit_querystring().'" method="get">';
echo '<form style="display:inline;" action="'.$thispageurl->out_omit_querystring().
'" method="get">';
echo html_writer::input_hidden_params($thispageurl);
echo '<input type="submit" name="canceledititem" value="'.
get_string('canceledititem', 'checklist').'" />';
Expand Down Expand Up @@ -863,7 +865,7 @@ function toggledate{$id}() {
year.removeAttribute('disabled');
}
}
toggledate{$id}();
toggledate{$id}();
</script>
ENDSCRIPT;

Expand Down
2 changes: 1 addition & 1 deletion settings.php
Expand Up @@ -33,7 +33,7 @@
$settings->add(new admin_setting_configcheckbox('checklist/showupdateablemymoodle',
get_string('showupdateablemymoodle', 'mod_checklist'),
get_string('configshowupdateablemymoodle', 'mod_checklist'), 1));

$settings->add(new admin_setting_configcheckbox('mod_checklist/linkcourses',
get_string('linkcourses', 'mod_checklist'),
get_string('linkcourses_desc', 'mod_checklist'), 0));
Expand Down
4 changes: 2 additions & 2 deletions tests/privacy_provider_test.php
Expand Up @@ -322,8 +322,8 @@ public function test_delete_data_for_user() {
$this->assertEquals($student->id, $DB->get_field('checklist_check', 'userid', []));

// Delete the data for the first student, for all checklists.
$contextlist = new \core_privacy\local\request\approved_contextlist($this->student, 'checklist',
[$ctxs[0]->id, $ctxs[1]->id, $ctxs[2]->id, $ctxs[3]->id]);
$contextids = [$ctxs[0]->id, $ctxs[1]->id, $ctxs[2]->id, $ctxs[3]->id];
$contextlist = new \core_privacy\local\request\approved_contextlist($this->student, 'checklist', $contextids);
provider::delete_data_for_user($contextlist);

// After deletion, we should have 1 checked off item, 1 custom item, 1 comment and 13 total items.
Expand Down
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
global $CFG;

$plugin->version = 2018042100; // The current module version (Date: YYYYMMDDXX)
$plugin->version = 2018042100; // The current module version (Date: YYYYMMDDXX).
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '3.4+ (Build: 2018042100)';
$plugin->requires = 2017111300; // Moodle 3.4+.
Expand Down

0 comments on commit 743f438

Please sign in to comment.