本文整理汇总了PHP中upgrade_plugin_savepoint函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade_plugin_savepoint函数的具体用法?PHP upgrade_plugin_savepoint怎么用?PHP upgrade_plugin_savepoint使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade_plugin_savepoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmldb_enrol_guest_upgrade
function xmldb_enrol_guest_upgrade($oldversion)
{
global $CFG, $DB, $OUTPUT;
$dbman = $DB->get_manager();
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2011112901) {
// convert all null passwords to empty strings
$DB->set_field('enrol', 'password', '', array('enrol' => 'guest', 'password' => null));
upgrade_plugin_savepoint(true, 2011112901, 'enrol', 'guest');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例2: xmldb_portfolio_boxnet_upgrade
/**
* Upgrade function.
*
* @param int $oldversion the version we are upgrading from.
* @return bool result
*/
function xmldb_portfolio_boxnet_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2013110602) {
require_once $CFG->libdir . '/portfoliolib.php';
require_once $CFG->dirroot . '/portfolio/boxnet/db/upgradelib.php';
$existing = $DB->get_record('portfolio_instance', array('plugin' => 'boxnet'), '*', IGNORE_MULTIPLE);
if ($existing) {
// Only disable or message the admins when the portfolio hasn't been set for APIv2.
$instance = portfolio_instance($existing->id, $existing);
if ($instance->get_config('clientid') === null && $instance->get_config('clientsecret') === null) {
// Disable Box.net.
$instance->set('visible', 0);
$instance->save();
// Message the admins.
portfolio_boxnet_admin_upgrade_notification();
}
}
upgrade_plugin_savepoint(true, 2013110602, 'portfolio', 'boxnet');
}
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例3: xmldb_enrol_flatfile_upgrade
function xmldb_enrol_flatfile_upgrade($oldversion)
{
global $CFG, $DB;
$result = TRUE;
$dbman = $DB->get_manager();
if ($oldversion < 2010091400) {
// Define table enrol_flatfile to be created
$table = new xmldb_table('enrol_flatfile');
// Adding fields to table enrol_flatfile
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('action', XMLDB_TYPE_CHAR, '30', null, XMLDB_NOTNULL, null, null);
$table->add_field('roleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
$table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
$table->add_field('timestart', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('timeend', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
// Adding keys to table enrol_flatfile
$table->add_key('id', XMLDB_KEY_PRIMARY, array('id'));
$table->add_key('courseid-id', XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
$table->add_key('userid-id', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
$table->add_key('roleid-id', XMLDB_KEY_FOREIGN, array('roleid'), 'role', array('id'));
// Conditionally launch create table for enrol_flatfile
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// flatfile savepoint reached
upgrade_plugin_savepoint(true, 2010091400, 'enrol', 'flatfile');
}
return $result;
}
示例4: xmldb_theme_formal_white_upgrade
function xmldb_theme_formal_white_upgrade($oldversion)
{
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2012051503) {
$currentsetting = get_config('theme_formal_white');
if (isset($currentsetting->displaylogo)) {
// useless but safer
// Create a new config setting called headercontent and give it the current displaylogo value.
set_config('headercontent', $currentsetting->displaylogo, 'theme_formal_white');
unset_config('displaylogo', 'theme_formal_white');
}
if (isset($currentsetting->logo)) {
// useless but safer
// Create a new config setting called headercontent and give it the current displaylogo value.
set_config('customlogourl', $currentsetting->logo, 'theme_formal_white');
unset_config('logo', 'theme_formal_white');
}
if (isset($currentsetting->frontpagelogo)) {
// useless but safer
// Create a new config setting called headercontent and give it the current displaylogo value.
set_config('frontpagelogourl', $currentsetting->frontpagelogo, 'theme_formal_white');
unset_config('frontpagelogo', 'theme_formal_white');
}
upgrade_plugin_savepoint(true, 2012051503, 'theme', 'formal_white');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例5: xmldb_portfolio_picasa_upgrade
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_portfolio_picasa_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2012053000) {
// Delete old user preferences containing authsub tokens.
$DB->delete_records('user_preferences', array('name' => 'google_authsub_sesskey_picasa'));
upgrade_plugin_savepoint(true, 2012053000, 'portfolio', 'picasa');
}
if ($oldversion < 2012053001) {
$existing = $DB->get_record('portfolio_instance', array('plugin' => 'picasa'), '*', IGNORE_MISSING);
if ($existing) {
portfolio_picasa_admin_upgrade_notification();
}
upgrade_plugin_savepoint(true, 2012053001, 'portfolio', 'picasa');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
示例6: xmldb_filter_texwjax_upgrade
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_filter_texwjax_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2013120300) {
$settings = array('density', 'latexbackground', 'convertformat', 'pathlatex', 'convertformat', 'pathconvert', 'pathdvips', 'latexpreamble');
// Move tex settings to config_pluins and delete entries from the config table.
foreach ($settings as $setting) {
$existingkey = 'filter_texwjax_' . $setting;
if (array_key_exists($existingkey, $CFG)) {
set_config($setting, $CFG->{$existingkey}, 'filter_texwjax');
unset_config($existingkey);
}
}
upgrade_plugin_savepoint(true, 2013120300, 'filter', 'texwjax');
}
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例7: xmldb_assignfeedback_editpdf_upgrade
/**
* EditPDF upgrade code
* @param int $oldversion
* @return bool
*/
function xmldb_assignfeedback_editpdf_upgrade($oldversion)
{
global $CFG;
if ($oldversion < 2013110800) {
// Check that no stamps where uploaded.
$fs = get_file_storage();
$stamps = $fs->get_area_files(context_system::instance()->id, 'assignfeedback_editpdf', 'stamps', 0, "filename", false);
// Add default stamps.
if (empty($stamps)) {
// List of default stamps.
$defaultstamps = array('smile.png', 'sad.png', 'tick.png', 'cross.png');
// Stamp file object.
$filerecord = new stdClass();
$filerecord->component = 'assignfeedback_editpdf';
$filerecord->contextid = context_system::instance()->id;
$filerecord->userid = get_admin()->id;
$filerecord->filearea = 'stamps';
$filerecord->filepath = '/';
$filerecord->itemid = 0;
// Add all default stamps.
foreach ($defaultstamps as $stamp) {
$filerecord->filename = $stamp;
$fs->create_file_from_pathname($filerecord, $CFG->dirroot . '/mod/assign/feedback/editpdf/pix/' . $filerecord->filename);
}
}
upgrade_plugin_savepoint(true, 2013110800, 'assignfeedback', 'editpdf');
}
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例8: xmldb_assignfeedback_editpdf_upgrade
/**
* EditPDF upgrade code
* @param int $oldversion
* @return bool
*/
function xmldb_assignfeedback_editpdf_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016021600) {
// Define table assignfeedback_editpdf_queue to be created.
$table = new xmldb_table('assignfeedback_editpdf_queue');
// Adding fields to table assignfeedback_editpdf_queue.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('submissionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('submissionattempt', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
// Adding keys to table assignfeedback_editpdf_queue.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// Conditionally launch create table for assignfeedback_editpdf_queue.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Editpdf savepoint reached.
upgrade_plugin_savepoint(true, 2016021600, 'assignfeedback', 'editpdf');
}
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例9: xmldb_report_customlang_upgrade
/**
* Language customization report upgrades
*
* @package report
* @subpackage customlang
* @copyright 2010 David Mudrak <david.mudrak@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function xmldb_report_customlang_upgrade($oldversion)
{
global $CFG, $DB, $OUTPUT;
$dbman = $DB->get_manager();
$result = true;
/**
* Use proper plugin prefix for tables
*/
if ($oldversion < 2010111200) {
if ($dbman->table_exists('customlang')) {
$dbman->rename_table(new xmldb_table('customlang'), 'report_customlang');
}
if ($dbman->table_exists('customlang_components')) {
$dbman->rename_table(new xmldb_table('customlang_components'), 'report_customlang_components');
}
upgrade_plugin_savepoint(true, 2010111200, 'report', 'customlang');
}
/**
* Regenerate the foreign key after the tables rename
*/
if ($oldversion < 2010111500) {
$table = new xmldb_table('report_customlang');
$oldkey = new xmldb_key('fk_component', XMLDB_KEY_FOREIGN, array('componentid'), 'customlang_components', array('id'));
$newkey = new xmldb_key('fk_component', XMLDB_KEY_FOREIGN, array('componentid'), 'report_customlang_components', array('id'));
$dbman->drop_key($table, $oldkey);
$dbman->add_key($table, $newkey);
upgrade_plugin_savepoint(true, 2010111500, 'report', 'customlang');
}
return $result;
}
示例10: xmldb_editor_tinymce_upgrade
function xmldb_editor_tinymce_upgrade($oldversion)
{
global $CFG, $DB;
if ($oldversion < 2014062900) {
// We only want to delete DragMath from the customtoolbar setting if the directory no longer exists. If
// the directory is present then it means it has been restored, so do not remove any settings.
if (!check_dir_exists($CFG->libdir . '/editor/tinymce/plugins/dragmath', false)) {
// Remove the DragMath plugin from the 'customtoolbar' setting (if it exists) as it has been removed.
$currentorder = get_config('editor_tinymce', 'customtoolbar');
$newtoolbarrows = array();
$currenttoolbarrows = explode("\n", $currentorder);
foreach ($currenttoolbarrows as $currenttoolbarrow) {
$currenttoolbarrow = implode(',', array_diff(str_getcsv($currenttoolbarrow), array('dragmath')));
$newtoolbarrows[] = $currenttoolbarrow;
}
$neworder = implode("\n", $newtoolbarrows);
unset_config('customtoolbar', 'editor_tinymce');
set_config('customtoolbar', $neworder, 'editor_tinymce');
}
upgrade_plugin_savepoint(true, 2014062900, 'editor', 'tinymce');
}
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例11: xmldb_workshopform_comments_upgrade
/**
* Performs upgrade of the database structure and data
*
* @param int $oldversion the version we are upgrading from
* @return bool true
*/
function xmldb_workshopform_comments_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;
$dbman = $DB->get_manager();
if ($oldversion < 2010091700) {
// clean up orphaned dimensions
$orphans = $DB->get_records_sql("SELECT d.id
FROM {workshopform_comments} d
LEFT JOIN {workshop} w ON d.workshopid = w.id
WHERE w.id IS NULL");
if (!empty($orphans)) {
echo $OUTPUT->notification('Orphaned assessment form elements found - cleaning...');
$DB->delete_records_list('workshopform_comments', 'id', array_keys($orphans));
}
upgrade_plugin_savepoint(true, 2010091700, 'workshopform', 'comments');
}
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
示例12: xmldb_tinymce_spellchecker_upgrade
function xmldb_tinymce_spellchecker_upgrade($oldversion)
{
global $CFG, $DB;
require_once __DIR__ . '/upgradelib.php';
$dbman = $DB->get_manager();
if ($oldversion < 2012051800) {
tinymce_spellchecker_migrate_settings();
upgrade_plugin_savepoint(true, 2012051800, 'tinymce', 'spellchecker');
}
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例13: xmldb_repository_onenote_upgrade
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_repository_onenote_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2014103001) {
// Define table repository_onenote to be created.
$table = new xmldb_table('repository_onenote');
// Adding fields to table repository_onenote.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
// Adding keys to table repository_onenote.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// Conditionally launch create table for repository_onenote.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Onenote savepoint reached.
upgrade_plugin_savepoint(true, 2014103001, 'repository', 'onenote');
}
// Moodle v2.3.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.4.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
示例14: xmldb_auth_whia_upgrade
/**
* Custom authentication for WHIA project
*
* Upgrade script
*
* @package auth_whia
* @author Bevan Holman <bevan@pukunui.com>, Pukunui
* @copyright 2015 onwards, Pukunui
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function xmldb_auth_whia_upgrade($oldversion)
{
global $DB;
$dbman = $DB->get_manager();
/// Add a new table mdl_auth_whia_domain to plugin
if ($oldversion < 2016020802) {
// Define table auth_rsa_cpdlog to be created.
$table = new xmldb_table('auth_whia_domain');
// Adding fields to table auth_rsa_cpdlog.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('name', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, null, null);
// Adding keys to table auth_rsa_cpdlog.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// Conditionally launch create table for auth_rsa_cpdlog.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// WHIA savepoint reached.
upgrade_plugin_savepoint(true, 2016020802, 'auth', 'whia');
}
if ($oldversion < 2016020813) {
// Define field cohortid to be added to auth_whia_domain.
$table = new xmldb_table('auth_whia_domain');
$field = new xmldb_field('cohortid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'name');
// Conditionally launch add field cohortid.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Monitor savepoint reached.
upgrade_plugin_savepoint(true, 2016020813, 'auth', 'whia');
}
return true;
}
示例15: xmldb_local_enrolmentreminder_upgrade
function xmldb_local_enrolmentreminder_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2014051501) {
// Define field leadtime to be added to enrolmentreminder.
$table = new xmldb_table('enrolmentreminder');
$field = new xmldb_field('leadtime', XMLDB_TYPE_INTEGER, '7', null, XMLDB_NOTNULL, null, '259200', 'tmpltext');
// Conditionally launch add field leadtime.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Enrolmentreminder savepoint reached.
upgrade_plugin_savepoint(true, '2014051501', 'local', 'enrolmentreminder');
}
if ($oldversion < 2014072201) {
// Changing type of field tmpltext on table enrolmentreminder to text.
$table = new xmldb_table('enrolmentreminder');
$field = new xmldb_field('tmpltext', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, 'courseid');
// Launch change of type for field tmpltext.
$dbman->change_field_type($table, $field);
// Enrolmentreminder savepoint reached.
upgrade_plugin_savepoint(true, 2014072201, 'local', 'enrolmentreminder');
}
return true;
}