Skip to content

Commit

Permalink
MDL-58859 analytics: Subsystem and API db/ requirements added
Browse files Browse the repository at this point in the history
Part of MDL-57791 epic.
  • Loading branch information
David Monllao committed Jul 24, 2017
1 parent 8473b73 commit 40fcb36
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/classes/component.php
Expand Up @@ -415,6 +415,7 @@ protected static function fetch_subsystems() {
$info = array(
'access' => null,
'admin' => $CFG->dirroot.'/'.$CFG->admin,
'analytics' => $CFG->dirroot . '/analytics',
'antivirus' => $CFG->dirroot . '/lib/antivirus',
'auth' => $CFG->dirroot.'/auth',
'availability' => $CFG->dirroot . '/availability',
Expand Down Expand Up @@ -515,6 +516,7 @@ protected static function fetch_plugintypes() {
'gradeimport' => $CFG->dirroot.'/grade/import',
'gradereport' => $CFG->dirroot.'/grade/report',
'gradingform' => $CFG->dirroot.'/grade/grading/form',
'mlbackend' => $CFG->dirroot.'/lib/mlbackend',
'mnetservice' => $CFG->dirroot.'/mnet/service',
'webservice' => $CFG->dirroot.'/webservice',
'repository' => $CFG->dirroot.'/repository',
Expand Down
10 changes: 7 additions & 3 deletions lib/classes/plugin_manager.php
Expand Up @@ -1807,6 +1807,10 @@ public static function standard_plugins_list($type) {
'memberships', 'profile', 'toolproxy', 'toolsettings'
),

'mlbackend' => array(
'php', 'python'
),

'media' => array(
'html5audio', 'html5video', 'swf', 'videojs', 'vimeo', 'youtube'
),
Expand Down Expand Up @@ -1868,7 +1872,7 @@ public static function standard_plugins_list($type) {

'report' => array(
'backups', 'competency', 'completion', 'configlog', 'courseoverview', 'eventlist',
'log', 'loglive', 'outline', 'participation', 'progress', 'questioninstances',
'insights', 'log', 'loglive', 'outline', 'participation', 'progress', 'questioninstances',
'security', 'stats', 'performance', 'usersessions'
),

Expand Down Expand Up @@ -1902,8 +1906,8 @@ public static function standard_plugins_list($type) {
'tool' => array(
'assignmentupgrade', 'availabilityconditions', 'behat', 'capability', 'cohortroles', 'customlang',
'dbtransfer', 'filetypes', 'generator', 'health', 'innodb', 'installaddon',
'langimport', 'log', 'lp', 'lpimportcsv', 'lpmigrate', 'messageinbound', 'mobile', 'multilangupgrade', 'monitor',
'oauth2', 'phpunit', 'profiling', 'recyclebin', 'replace', 'spamcleaner', 'task', 'templatelibrary',
'langimport', 'log', 'lp', 'lpimportcsv', 'lpmigrate', 'messageinbound', 'mobile', 'models', 'multilangupgrade',
'monitor', 'oauth2', 'phpunit', 'profiling', 'recyclebin', 'replace', 'spamcleaner', 'task', 'templatelibrary',
'unittest', 'uploadcourse', 'uploaduser', 'unsuproles', 'usertours', 'xmldb'
),

Expand Down
54 changes: 54 additions & 0 deletions lib/classes/plugininfo/mlbackend.php
@@ -0,0 +1,54 @@
<?php
// This file is part of 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/>.

/**
* Defines classes used for plugin info.
*
* @package core
* @copyright 2017 David Monllao
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\plugininfo;

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

/**
* Class for analytics machine learning backend plugins
*
* @package core
* @copyright 2017 David Monllao
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mlbackend extends base {

/**
* Is uninstall allowed or not.
*
* @return bool
*/
public function is_uninstall_allowed() {
return true;
}

/**
* Returns the node name used in admin settings menu for this plugin settings (if applicable).
*
* @return null|string node name or null if plugin does not create settings node (default)
*/
public function get_settings_section_name() {
return 'mlbackendsetting' . $this->name;
}
}
18 changes: 18 additions & 0 deletions lib/db/access.php
Expand Up @@ -2305,6 +2305,24 @@
'manager' => CAP_ALLOW
),
),
'moodle/analytics:listinsights' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
'moodle/analytics:managemodels' => array(
'riskbitmask' => RISK_CONFIG,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW
),
),
'moodle/competency:templateview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSECAT,
Expand Down
9 changes: 9 additions & 0 deletions lib/db/caches.php
Expand Up @@ -312,6 +312,15 @@
),
),

// Caches analytic models that have already predicted stuff.
'modelswithpredictions' => array(
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
'staticaccelerationsize' => 1
),

// Caches message processors.
'message_processors_enabled' => array(
'mode' => cache_store::MODE_APPLICATION,
Expand Down
5 changes: 5 additions & 0 deletions lib/db/messages.php
Expand Up @@ -101,4 +101,9 @@

// A comment was left on a user competency.
'competencyusercompcomment' => array(),

// User insights.
'insights' => array (
'capability' => 'moodle/analytics:listinsights'
)
);

0 comments on commit 40fcb36

Please sign in to comment.