Skip to content

Commit 972ff55

Browse files
authored
Merge pull request #149 from catalyst/moodleorg-publish-20201012
For Moodle.org release 2020101300
2 parents b7cfabd + eaac973 commit 972ff55

11 files changed

+160
-135
lines changed

classes/event/observer.php

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Event observers used in tool_crawler
1919
*
2020
* @package tool_crawler
21+
* @copyright Catalyst IT
2122
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2223
*/
2324
namespace tool_crawler\event;

classes/local/url.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

1717
/**
18-
* url class
19-
* defines the model for a url record, for CRUD operations on the url table
18+
* Url class model for a url record, CRUD operations and the url table
2019
*
2120
* @package tool_crawler
2221
* @author Kristian Ringer <[email protected]>
@@ -230,7 +229,7 @@ public function get_processed() {
230229

231230
/**
232231
* Hash a url
233-
* @param $url string the url to hash
232+
* @param string $url the url to hash
234233
* @return string the hashed url
235234
*/
236235
public static function hash_url($url) {

classes/robot/crawler.php

+116-113
Large diffs are not rendered by default.

classes/task/adhoc_crawl_task.php

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
/**
3232
* adhoc_crawl_task
33+
*
3334
* Crawl the queue
3435
*
3536
* @package tool_crawler

classes/task/crawl_task.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030

3131
/**
3232
* crawl_task
33+
*
3334
* Creates a batch of crawls to be done in an ad hoc task.
34-
* This gives us control over how parallel it is, and also when the workload is processed (eg at night).
35+
*
36+
* This gives us control over how parallel it is, and also when the workload is
37+
* processed (eg at night).
3538
*
3639
* @package tool_crawler
3740
* @copyright 2016 Brendan Heywood <[email protected]>

constants.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

1717
/**
18+
* Definitions of constants for tool_crawler
19+
*
1820
* @package tool_crawler
1921
* @copyright 2019 Nicolas Roeser, Ulm University <[email protected]>
2022
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

db/events.php

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* This file defines observers needed by the plugin tool_crawler
1919
*
2020
* @package tool_crawler
21+
* @copyright Catalyst IT
2122
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2223
*/
2324

db/upgrade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function xmldb_tool_crawler_upgrade($oldversion) {
148148
$dbman->add_field($table, $field);
149149
}
150150

151-
// level and external are reserved words in mssql.
151+
// Fields level and external are reserved words in mssql.
152152
$table = new xmldb_table('tool_crawler_url');
153153
$field = new xmldb_field('level', XMLDB_TYPE_INTEGER, '1', null, null, null, '2', 'priority');
154154

tabs.php

+12-6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@
2525
defined('MOODLE_INTERNAL') || die();
2626

2727
$rows = [
28-
new tabobject('settings', new moodle_url('/admin/settings.php?section=tool_crawler'), get_string('settings', 'tool_crawler')),
29-
new tabobject('index', new moodle_url('/admin/tool/crawler/index.php'), get_string('status', 'tool_crawler')),
30-
new tabobject('queued', new moodle_url('/admin/tool/crawler/report.php?report=queued'), get_string('queued', 'tool_crawler')),
31-
new tabobject('recent', new moodle_url('/admin/tool/crawler/report.php?report=recent'), get_string('recent', 'tool_crawler')),
32-
new tabobject('broken', new moodle_url('/admin/tool/crawler/report.php?report=broken'), get_string('broken', 'tool_crawler')),
33-
new tabobject('oversize', new moodle_url('/admin/tool/crawler/report.php?report=oversize'), get_string('oversize', 'tool_crawler')),
28+
new tabobject('settings', new moodle_url('/admin/settings.php?section=tool_crawler'),
29+
get_string('settings', 'tool_crawler')),
30+
new tabobject('index', new moodle_url('/admin/tool/crawler/index.php'),
31+
get_string('status', 'tool_crawler')),
32+
new tabobject('queued', new moodle_url('/admin/tool/crawler/report.php?report=queued'),
33+
get_string('queued', 'tool_crawler')),
34+
new tabobject('recent', new moodle_url('/admin/tool/crawler/report.php?report=recent'),
35+
get_string('recent', 'tool_crawler')),
36+
new tabobject('broken', new moodle_url('/admin/tool/crawler/report.php?report=broken'),
37+
get_string('broken', 'tool_crawler')),
38+
new tabobject('oversize', new moodle_url('/admin/tool/crawler/report.php?report=oversize'),
39+
get_string('oversize', 'tool_crawler')),
3440
];
3541

3642
$section = optional_param('section', '', PARAM_RAW);

tests/phpunit/robot_crawler_test.php

+18-9
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
*/
4040
class tool_crawler_robot_crawler_test extends advanced_testcase {
4141

42+
/**
43+
* Setup robot crawler testcase and parent setup
44+
*/
4245
protected function setUp() {
4346
parent::setup();
4447
$this->resetAfterTest(true);
@@ -193,7 +196,7 @@ public function test_reset_queries() {
193196

194197
$nodeid = $persistent->get('id');
195198

196-
// Record should exist
199+
// Record should exist.
197200
$found = $DB->record_exists('tool_crawler_url', ['id' => $nodeid]);
198201
self::assertTrue($found);
199202

@@ -349,6 +352,8 @@ public function priority_provider() {
349352
* @dataProvider priority_provider
350353
*
351354
* Test for issue #108 - passing node crawl priority to child nodes when parsing html.
355+
*
356+
* @param int $parentpriority the priority of the parent queue item
352357
*/
353358
public function test_parse_html_priority_inheritance($parentpriority) {
354359
global $CFG, $DB;
@@ -506,7 +511,7 @@ public function test_url_creates_hash() {
506511
public function crawler_url_string_matches_provider() {
507512
return [
508513
['/index.php', '/index.php', true],
509-
['/some/dir/index.php', '/index.php', true], // Different from core function
514+
['/some/dir/index.php', '/index.php', true], // Different from core function.
510515
['/course/view.php', '/course/view.php', true],
511516
['/view.php', '/course/view.php', false],
512517
['/mod/forum', '/mod/forum/*', false],
@@ -519,14 +524,14 @@ public function crawler_url_string_matches_provider() {
519524
['/mod/one/two/view.php', '*/view.php', true],
520525
['/foo.php', '/foo.php,/bar.php', true],
521526
['/bar.php', '/foo.php,/bar.php', true],
522-
['/foo/bar.php', "/foo.php,/bar.php", true], // Different from core function
527+
['/foo/bar.php', "/foo.php,/bar.php", true], // Different from core function.
523528
['/foo/bar.php', "/foo.php,*/bar.php", true],
524529
['/foo/bar.php', "/foo*.php,/bar.php", true],
525-
['/foo.php', "/foo.php\n/bar.php", false], // Different from core function
526-
['/bar.php', "/foo.php\n/bar.php", false], // Different from core function
530+
['/foo.php', "/foo.php\n/bar.php", false], // Different from core function.
531+
['/bar.php', "/foo.php\n/bar.php", false], // Different from core function.
527532
['/foo/bar.php', "/foo.php\n/bar.php", false],
528-
['/foo/bar.php', "/foo.php\n*/bar.php", false], // Different from core function
529-
['/foo/bar.php', "/foo*.php\n/bar.php", false], // Different from core function
533+
['/foo/bar.php', "/foo.php\n*/bar.php", false], // Different from core function.
534+
['/foo/bar.php', "/foo*.php\n/bar.php", false], // Different from core function.
530535
];
531536
}
532537

@@ -560,10 +565,11 @@ public function url_validity_check_provider() {
560565

561566
/**
562567
* @dataProvider url_validity_check_provider
568+
*
563569
* Check url validity
564570
*
565-
* @param $expected
566-
* @param $url
571+
* @param string $url the url to test
572+
* @param $expected the expected result
567573
*/
568574
public function test_invalid_url($url, $expected) {
569575
$baseurl = 'https://www.example.com/moodle';
@@ -591,6 +597,9 @@ public function page_title_validity_check_provider() {
591597
* @dataProvider page_title_validity_check_provider
592598
*
593599
* Test for Issue #143: invalid character in page title.
600+
*
601+
* @param $url the url to test
602+
* @param $expected
594603
*/
595604
public function test_check_page_title_validity($node, $expected) {
596605
$this->resetAfterTest(true);

version.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
defined('MOODLE_INTERNAL') || die();
2828

2929

30-
$plugin->version = 2020100100; // The current plugin version (Date: YYYYMMDDXX)
31-
$plugin->release = 2020100100; // The current plugin version (Date: YYYYMMDDXX)
30+
$plugin->version = 2020101300; // The current plugin version (Date: YYYYMMDDXX)
31+
$plugin->release = 2020101300; // The current plugin version (Date: YYYYMMDDXX)
3232
$plugin->requires = 2016021800; // Requires this Moodle version.
3333
$plugin->component = 'tool_crawler'; // To check on upgrade, that module sits in correct place.
3434
$plugin->maturity = MATURITY_STABLE;

0 commit comments

Comments
 (0)