Created
May 16, 2015 08:45
-
-
Save timhunt/1ceb167c4cf69f97b8e8 to your computer and use it in GitHub Desktop.
A script to test that all the capabilities in this version of Moodle have a corresponding docs page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('NO_OUTPUT_BUFFERING', true); | |
require_once('config.php'); | |
require_once($CFG->libdir . '/filelib.php'); | |
require_login(); | |
require_capability('moodle/site:config', context_system::instance()); | |
$PAGE->set_context(context_system::instance()); | |
$PAGE->set_url('/testdocs.php'); | |
$OUTPUT->header(); | |
$OUTPUT->heading('Checking capability docs'); | |
$missing = array(); | |
foreach ($ACCESSLIB_PRIVATE->capabilities as $cap => $notused) { | |
$url = get_docs_url('Capabilities/' . $cap); | |
$docs = download_file_content($url); | |
if (strpos($docs, 'There is currently no text in this page') === false) { | |
$missing[] = html_writer::link($url, $url); | |
$OUTPUT->notification($cap . ' missing.'); | |
} else { | |
$OUTPUT->notification($cap . ' OK.'); | |
} | |
flush(); | |
} | |
if (empty($missing)) { | |
$OUTPUT->heading('All OK'); | |
} else { | |
$OUTPUT->heading('Missing docs pages'); | |
echo html_writer::alist($missing); | |
} | |
$OUTPUT->footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment