Exemple #1
0
/**
 * Install for eliscore_etl
 * @return boolean
 */
function xmldb_eliscore_etl_install()
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    // Run upgrade steps from old plugin
    // Convert old tables to new
    static $tablemap = array('etl_user_activity' => 'eliscore_etl_useractivity', 'etl_user_module_activity' => 'eliscore_etl_modactivity');
    foreach ($tablemap as $oldtable => $newtable) {
        $oldtableobj = new xmldb_table($oldtable);
        if ($dbman->table_exists($oldtableobj)) {
            $newtableobj = new xmldb_table($newtable);
            $dbman->drop_table($newtableobj);
            $dbman->rename_table($oldtableobj, $newtable);
        }
    }
    // Copy any settings from old plugin
    $oldconfig = get_config('eliscoreplugins_user_activity');
    foreach ($oldconfig as $name => $value) {
        set_config($name, $value, 'eliscore_etl');
    }
    unset_all_config_for_plugin('eliscoreplugins_user_activity');
    // Ensure ELIS scheduled tasks is initialized.
    require_once $CFG->dirroot . '/local/eliscore/lib/tasklib.php';
    $DB->delete_records('local_eliscore_sched_tasks', array('plugin' => 'eliscoreplugins_user_activity'));
    elis_tasks_update_definition('eliscore_etl');
    return true;
}
Exemple #2
0
/**
 * Upgrade for eliscore_etl
 * @return boolean
 */
function xmldb_eliscore_etl_upgrade($oldversion)
{
    global $CFG, $DB;
    $result = true;
    // Ensure ELIS scheduled tasks is initialized.
    require_once $CFG->dirroot . '/local/eliscore/lib/tasklib.php';
    elis_tasks_update_definition('eliscore_etl');
    return $result;
}
Exemple #3
0
function xmldb_local_datahub_upgrade($oldversion = 0)
{
    global $DB, $CFG;
    $result = true;
    $dbman = $DB->get_manager();
    // Always upon any upgrade, ensure ELIS scheduled tasks is in good health
    if ($result && @file_exists($CFG->dirroot . '/local/eliscore/lib/tasklib.php')) {
        require_once $CFG->dirroot . '/local/eliscore/lib/tasklib.php';
        elis_tasks_update_definition('local_datahub');
    }
    // Migrate language strings
    if ($result && $oldversion < 2014030701) {
        $migrator = new \local_eliscore\install\migration\migrator('block_rlip', 'local_datahub');
        $result = $migrator->migrate_language_strings();
        upgrade_plugin_savepoint($result, 2014030701, 'local', 'datahub');
    }
    return $result;
}
Exemple #4
0
/**
 * ELIS(TM): Enterprise Learning Intelligence Suite
 * Copyright (C) 2008-2013 Remote-Learner.net Inc (http://www.remote-learner.net)
 *
 * This program 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.
 *
 * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    local_elisprogram
 * @author     Remote-Learner.net Inc
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @copyright  (C) 2008-2013 Remote Learner.net Inc http://www.remote-learner.net
 *
 */
function xmldb_local_elisprogram_install()
{
    global $CFG, $DB;
    $elisadminblockinstalled = file_exists($CFG->dirroot . '/local/elisprogram/lib/setup.php') && $DB->record_exists('block', array('name' => 'elisadmin'));
    if ($elisadminblockinstalled) {
        require_once $CFG->dirroot . '/blocks/elisadmin/lib.php';
    }
    require_once $CFG->dirroot . '/local/elisprogram/lib/lib.php';
    // Install custom context levels.
    \local_eliscore\context\helper::set_custom_levels(\local_elisprogram\context\contextinfo::get_contextinfo());
    \local_eliscore\context\helper::install_custom_levels();
    // Initialize custom context levels.
    context_helper::reset_levels();
    \local_eliscore\context\helper::reset_levels();
    \local_eliscore\context\helper::init_levels();
    // Migrate component.
    $migrator = new \local_elisprogram\install\migration\elis26();
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    //make sure the site has exactly one curr admin block instance
    //that is viewable everywhere
    if ($elisadminblockinstalled) {
        block_elisadmin_create_instance();
    }
    // make sure that the manager role can be assigned to all PM context levels
    update_capabilities('local_elisprogram');
    // load context levels
    pm_ensure_role_assignable('manager');
    pm_ensure_role_assignable('curriculumadmin');
    // Migrate dataroot files
    pm_migrate_certificate_files();
    // These notifications are default-on.
    pm_set_config('notify_addedtowaitlist_user', 1);
    pm_set_config('notify_enroledfromwaitlist_user', 1);
    pm_set_config('notify_incompletecourse_user', 1);
    // Ensure ELIS scheduled tasks is initialized.
    require_once $CFG->dirroot . '/local/eliscore/lib/tasklib.php';
    elis_tasks_update_definition('local_elisprogram');
    // Remove some lingering subplugins that were renamed
    unset_all_config_for_plugin('usersetenrol_manual');
    unset_all_config_for_plugin('usersetenrol_moodle_profile');
}
Exemple #5
0
/**
 * Initialise the ELIS scheduled tasks system for us, only if scheduled tasks is present and setup on the system.
 *
 * @param none
 * @return none
 */
function rlip_scheduling_init()
{
    global $CFG, $DB;
    // Check whether the scheduled tasks table exists
    $dbman = $DB->get_manager();
    $table = new xmldb_table('local_eliscore_sched_tasks');
    if (!$dbman->table_exists($table)) {
        return;
    }
    // If we haven't setup a scheduled task for the block yet, do so now
    if (!$DB->record_exists('local_eliscore_sched_tasks', array('plugin' => 'local_datahub'))) {
        require_once $CFG->dirroot . '/local/eliscore/lib/tasklib.php';
        // Add a cron task for the Datahub block
        elis_tasks_update_definition('local_datahub');
    }
}