MDL-57007 behat: assume all capabilities during installation
[moodle.git] / admin / thirdpartylibs.php
blob0259d1770120247f5dba40adfbd0815f1245ed7e
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * List of 3rd party libs used in moodle and all plugins.
20 * @package admin
21 * @copyright 2013 Petr Skoda {@link http://skodak.org}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 require_once('../config.php');
26 require_once($CFG->libdir.'/adminlib.php');
27 require_once($CFG->libdir.'/tablelib.php');
29 admin_externalpage_setup('thirdpartylibs');
31 echo $OUTPUT->header();
32 echo $OUTPUT->heading(get_string('thirdpartylibs', 'core_admin'));
34 $files = array('core' => "$CFG->libdir/thirdpartylibs.xml");
36 $plugintypes = core_component::get_plugin_types();
37 foreach ($plugintypes as $type => $ignored) {
38 $plugins = core_component::get_plugin_list_with_file($type, 'thirdpartylibs.xml', false);
39 foreach ($plugins as $plugin => $path) {
40 $files[$type.'_'.$plugin] = $path;
44 $table = new html_table();
45 $table->head = array(
46 get_string('thirdpartylibrary', 'core_admin'), get_string('version'),
47 get_string('thirdpartylibrarylocation', 'core_admin'), get_string('license'));
48 $table->align = array('left', 'left', 'left', 'left');
49 $table->id = 'thirdpartylibs';
50 $table->attributes['class'] = 'admintable generaltable';
51 $table->data = array();
53 foreach ($files as $component => $xmlpath) {
54 $xml = simplexml_load_file($xmlpath);
55 foreach ($xml as $lib) {
56 $base = realpath(dirname($xmlpath));
57 $location = substr($base, strlen($CFG->dirroot)).'/'.$lib->location;
58 if (is_dir($CFG->dirroot.$location)) {
59 $location .= '/';
61 $version = '';
62 if (!empty($lib->version)) {
63 $version = $lib->version;
65 $license = $lib->license;
66 if (!empty($lib->licenseversion)) {
67 $license .= ' '.$lib->licenseversion;
70 $table->data[] = new html_table_row(array($lib->name, $version, $location, $license));
74 echo html_writer::table($table);
76 echo $OUTPUT->footer();