本文整理汇总了PHP中unset_all_config_for_plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP unset_all_config_for_plugin函数的具体用法?PHP unset_all_config_for_plugin怎么用?PHP unset_all_config_for_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unset_all_config_for_plugin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmldb_eliscore_etl_install
/**
* 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;
}
示例2: xmldb_dhfile_log_install
function xmldb_dhfile_log_install()
{
$result = true;
unset_all_config_for_plugin('rlipfile_log');
// Ensure that scheduling is setup correctly.
rlip_scheduling_init();
return $result;
}
示例3: xmldb_report_participation_install
function xmldb_report_participation_install() {
global $DB;
// this is a hack which is needed for cleanup of original coursereport_participation stuff
unset_all_config_for_plugin('coursereport_participation');
capabilities_cleanup('coursereport_participation');
// update existing block page patterns
$DB->set_field('block_instances', 'pagetypepattern', 'report-participation-index', array('pagetypepattern'=>'course-report-participation-index'));
}
示例4: xmldb_tool_unsuproles_install
function xmldb_tool_unsuproles_install()
{
global $CFG;
// this is a hack - this plugin used to live in admin/report/unsuproles,
// we want to remove the orphaned version info unless there is a new
// report type with the same name
if (!file_exists("{$CFG->dirroot}/report/report_unsuproles")) {
unset_all_config_for_plugin('report_unsuproles');
}
}
示例5: xmldb_tool_qeupgradehelper_install
function xmldb_tool_qeupgradehelper_install()
{
global $CFG;
// this is a hack - this plugin used to live in local/qeupgradehelper,
// we want to remove the orphaned version info and capability
// unless there is a local plugin type with the same name
if (!file_exists("{$CFG->dirroot}/local/qeupgradehelper")) {
unset_all_config_for_plugin('local_qeupgradehelper');
}
}
示例6: xmldb_block_enrolsurvey_install
/**
* ELIS(TM): Enterprise Learning Intelligence Suite
* Copyright (C) 2008-2014 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 block_enrolsurvey
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2008-2014 Remote-Learner.net Inc (http://www.remote-learner.net)
*/
function xmldb_block_enrolsurvey_install()
{
global $CFG, $DB;
$result = true;
$dbman = $DB->get_manager();
// Migrate block instances.
$oldrecord = $DB->get_record('block', array('name' => 'enrol_survey'), 'id');
if (!empty($oldrecord)) {
// Convert any existing old enrol_survey block instances to enrolsurvey blocks.
$sql = "UPDATE {block_instances} SET blockname = 'enrolsurvey' WHERE blockname = 'enrol_survey'";
$DB->execute($sql);
// Delete old enrol_survey record in block table.
$DB->delete_records('block', array('id' => $oldrecord->id));
}
// Migrate old config settings.
$settings = (array) get_config('block_enrol_survey');
if (!empty($settings)) {
foreach ($settings as $name => $val) {
set_config($name, $val, 'block_enrolsurvey');
}
}
unset_all_config_for_plugin('block_enrol_survey');
// Migrate old block_enrol_survey table if it exists.
$table = new xmldb_table('block_enrol_survey_taken');
// Old pre 2.6 table.
if ($dbman->table_exists($table)) {
$newtable = new xmldb_table('block_enrolsurvey_taken');
$dbman->drop_table($newtable);
$dbman->rename_table($table, 'block_enrolsurvey_taken');
}
// Migrate capabilities.
$oldcapprefix = 'block/enrol_survey';
$newcapprefix = 'block/enrolsurvey';
$sql = 'SELECT * FROM {role_capabilities} WHERE capability LIKE ?';
$params = array($oldcapprefix . '%');
$rolecaps = $DB->get_recordset_sql($sql, $params);
foreach ($rolecaps as $rolecaprec) {
$updaterec = new stdClass();
$updaterec->id = $rolecaprec->id;
$updaterec->capability = str_replace($oldcapprefix, $newcapprefix, $rolecaprec->capability);
$DB->update_record('role_capabilities', $updaterec);
}
$sql = 'SELECT * FROM {capabilities} WHERE name LIKE ?';
$caps = $DB->get_recordset_sql($sql, $params);
foreach ($caps as $cap) {
$cap->name = str_replace($oldcapprefix, $newcapprefix, $cap->name);
$cap->component = str_replace('block_enrol_survey', 'block_enrolsurvey', $cap->component);
$DB->update_record('capabilities', $cap);
}
// Migrate language strings
$migrator = new \local_eliscore\install\migration\migrator('block_enrol_survey', 'block_enrolsurvey');
$migrator->migrate_language_strings();
return $result;
}
示例7: xmldb_tool_unittest_install
function xmldb_tool_unittest_install()
{
global $CFG;
// this is a hack - this plugin used to live in admin/report/unittest,
// we want to remove the orphaned version info and capability
// unless there is a new report type with the same name
if (!file_exists("{$CFG->dirroot}/report/unittest")) {
unset_all_config_for_plugin('report_unittest');
capabilities_cleanup('report_unittest');
}
}
示例8: xmldb_dhexport_version1_uninstall
/**
* Uninstall hook for this export plugin
*/
function xmldb_dhexport_version1_uninstall()
{
global $DB;
$dbman = $DB->get_manager();
//remove the custom field mapping table
$mapping_table = new xmldb_table(RLIPEXPORT_VERSION1_FIELD_TABLE);
if ($dbman->table_exists($mapping_table)) {
$dbman->drop_table($mapping_table);
}
//clear config_plugins entries
unset_all_config_for_plugin('dhexport_version1');
return true;
}
示例9: xmldb_dhimport_version1elis_uninstall
/**
* Uninstall hook for this import plugin
*/
function xmldb_dhimport_version1elis_uninstall()
{
global $DB;
$dbman = $DB->get_manager();
//remove the field mapping table
$mapping_table = new xmldb_table(RLIPIMPORT_VERSION1ELIS_MAPPING_TABLE);
if ($dbman->table_exists($mapping_table)) {
$dbman->drop_table($mapping_table);
}
//clear config_plugins entries
unset_all_config_for_plugin('dhimport_version1elis');
return true;
}
示例10: xmldb_auth_drupalservices_upgrade
/**
* Authentication Plugin: Drupal Services Single Sign-on
*
* This module is based on work by Arsham Skrenes.
* This module will look for a Drupal cookie that represents a valid,
* authenticated session, and will use it to create an authenticated Moodle
* session for the same user. The Drupal user will be synchronized with the
* corresponding user in Moodle. If the user does not yet exist in Moodle, it
* will be created.
*
* PHP version 5
*
* @category CategoryName
* @package Drupal_Services
* @author Dave Cannon <dave@baljarra.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @link https://github.com/cannod/moodle-drupalservices
*
*/
function xmldb_auth_drupalservices_upgrade($oldversion)
{
if ($oldversion < 2014111400) {
// This module has been tracking variables using the wrong name syntax. this retroactively goes
// back and fixes them to be the proper plugin key upon upgrade
$config = get_config('auth/drupalservices');
foreach ((array) $config as $key => $value) {
set_config($key, $value, 'auth_drupalservices');
}
unset_all_config_for_plugin('auth/drupalservices');
}
upgrade_plugin_savepoint(true, 2014123000, 'auth', 'drupalservices');
}
示例11: xmldb_local_elisreports_install
/**
* Standard Moodle post install function defintion
* @return bool true on success, false otherwise
*/
function xmldb_local_elisreports_install()
{
global $DB;
$result = true;
$dbman = $DB->get_manager();
$table = new xmldb_table('php_report_schedule');
// Old pre 2.6 table
if ($dbman->table_exists($table)) {
$newtable = new xmldb_table('local_elisreports_schedule');
$dbman->drop_table($newtable);
$dbman->rename_table($table, 'local_elisreports_schedule');
$tables = array('local_eliscore_sched_tasks', 'elis_scheduled_tasks');
foreach ($tables as $table) {
$tableobj = new xmldb_table($table);
if ($dbman->table_exists($tableobj)) {
$tasks = $DB->get_recordset($table, array('plugin' => 'block/php_report'));
foreach ($tasks as $task) {
$task->plugin = 'local_elisreports';
$task->callfile = '/local/elisreports/runschedule.php';
$DB->update_record($table, $task);
}
}
}
}
// Migrate capabilities
$oldcapprefix = 'block/php_report';
$newcapprefix = 'local/elisreports';
$sql = 'SELECT * FROM {role_capabilities} WHERE capability LIKE ?';
$params = array($oldcapprefix . '%');
$rolecaps = $DB->get_recordset_sql($sql, $params);
foreach ($rolecaps as $rolecap) {
$rolecap->capability = str_replace($oldcapprefix, $newcapprefix, $rolecap->capability);
$DB->update_record('role_capabilities', $rolecap);
}
$sql = 'SELECT * FROM {capabilities} WHERE name LIKE ?';
$caps = $DB->get_recordset_sql($sql, $params);
foreach ($caps as $cap) {
$cap->name = str_replace($oldcapprefix, $newcapprefix, $cap->name);
$cap->component = str_replace('block_php_report', 'local_elisreports', $cap->component);
$DB->update_record('capabilities', $cap);
}
// Migrate language strings
$migrator = new \local_eliscore\install\migration\migrator('block_php_report', 'local_elisreports');
$migrator->migrate_language_strings();
// Remove the old block ...
$DB->delete_records('block', array('name' => 'php_report'));
unset_all_config_for_plugin('block_php_report');
return $result;
}
示例12: xmldb_dhimport_version1elis_install
/**
* Custom post-install method for the "Version 1 ELIS" Datahub import plugin
*/
function xmldb_dhimport_version1elis_install()
{
global $CFG, $DB;
$result = true;
$dbman = $DB->get_manager();
// Run upgrade steps from old plugin if applicable.
$oldversion = get_config('rlipimport_version1elis', 'version');
if ($oldversion !== false) {
if ($result && $oldversion < 2012080100) {
$table = new xmldb_table('rlipimport_version1elis_mapping');
$result = $result && !empty($table) && $dbman->table_exists($table);
if ($result) {
$dbman->rename_table($table, 'rlipimport_version1elis_map');
$result = $dbman->table_exists('rlipimport_version1elis_map');
}
// Plugin savepoint reached
upgrade_plugin_savepoint($result, 2012080100, 'rlipimport', 'version1elis');
}
}
// Migrate old rlipimport_version1elis_map if it exists.
$table = new xmldb_table('rlipimport_version1elis_map');
if ($dbman->table_exists($table)) {
$newtable = new xmldb_table('dhimport_version1elis_map');
$dbman->drop_table($newtable);
$dbman->rename_table($table, 'dhimport_version1elis_map');
}
$oldconfig = $DB->get_recordset('config_plugins', array('plugin' => 'rlipimport_version1elis'));
foreach ($oldconfig as $oldconfigrec) {
// We don't want version records.
if ($oldconfigrec->name === 'version') {
continue;
}
// Check if a setting already exists for this name, and delete if it does.
$newrec = $DB->get_record('config_plugins', array('plugin' => 'dhimport_version1elis', 'name' => $oldconfigrec->name));
if (!empty($newrec)) {
$DB->delete_records('config_plugins', array('id' => $newrec->id));
}
$updatedrec = new \stdClass();
$updatedrec->id = $oldconfigrec->id;
$updatedrec->plugin = 'dhimport_version1elis';
$DB->update_record('config_plugins', $updatedrec);
}
unset_all_config_for_plugin('rlipimport_version1elis');
return true;
}
示例13: xmldb_report_editdates_install
function xmldb_report_editdates_install()
{
global $DB;
// This is a hack to copy the permission from the old place, if they were present.
// If this report is installed into a new Moodle, we just do what it says in access.php
// and clone the permissions from moodle/site:viewreports, but if we are upgrading
// a Moodle that had the old course report plugin installed, then we get rid of the
// new cloned capabilities, and transfer the old permissions.
if ($DB->record_exists('role_capabilities', array('capability' => 'coursereport/editdates:view'))) {
$DB->delete_records('role_capabilities', array('capability' => 'report/editdates:view'));
$DB->set_field('role_capabilities', 'capability', 'report/editdates:view', array('capability' => 'coursereport/editdates:view'));
}
// This is a hack which is needed for cleanup of original coursereport_completion stuff.
unset_all_config_for_plugin('coursereport_editdates');
capabilities_cleanup('coursereport_editdates');
// Update existing block page patterns.
$DB->set_field('block_instances', 'pagetypepattern', 'report-editdates-index', array('pagetypepattern' => 'course-report-editdates-index'));
}
示例14: xmldb_local_elisprogram_install
/**
* 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');
}
示例15: xmldb_tool_customlang_install
function xmldb_tool_customlang_install()
{
global $CFG, $OUTPUT, $DB;
// this is a hack - this plugin used to live in admin/report/customlang,
// we want to remove the orphaned version info and capability
// unless there is a new report type with the same name
// the original tables can be dropped because they are used for caching only
if (!file_exists("{$CFG->dirroot}/report/customlang")) {
unset_all_config_for_plugin('report_customlang');
capabilities_cleanup('report_customlang');
$dbman = $DB->get_manager();
$table = new xmldb_table('report_customlang');
if ($dbman->table_exists($table)) {
$dbman->drop_table($table);
}
$table = new xmldb_table('report_customlang_components');
if ($dbman->table_exists($table)) {
$dbman->drop_table($table);
}
}
}