当前位置: 首页>>代码示例>>PHP>>正文


PHP install_from_xmldb_file函数代码示例

本文整理汇总了PHP中install_from_xmldb_file函数的典型用法代码示例。如果您正苦于以下问题:PHP install_from_xmldb_file函数的具体用法?PHP install_from_xmldb_file怎么用?PHP install_from_xmldb_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了install_from_xmldb_file函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 function setUp()
 {
     // Set db prefix for testing
     global $CFG, $USER;
     $this->beforeprefix = $CFG->prefix;
     $this->beforeuser = $USER;
     $CFG->prefix = self::TESTPREFIX;
     // Delete existing tables
     $this->delete_tables();
     // Install new wiki tables and core user table
     ob_start();
     install_from_xmldb_file(dirname(__FILE__) . '/../db/install.xml');
     ob_end_clean();
     load_test_table(self::TESTPREFIX . 'user', array(array('id', 'username', 'firstname', 'lastname'), array(1, 'u1', 'user', 'one'), array(2, 'u2', 'user', 'two'), array(3, 'u3', 'user', 'three')));
     $USER = get_record('user', 'id', 1);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:16,代码来源:test_comments.php

示例2: xmldb_block_tao_certification_path_upgrade

function xmldb_block_tao_certification_path_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    /// And upgrade begins here. For each one, you'll need one
    /// block of code similar to the next one. Please, delete
    /// this comment lines once this file start handling proper
    /// upgrade code.
    /// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
    ///     $result = result of "/lib/ddllib.php" function calls
    /// }
    if ($result && $oldversion < 2008111204) {
        //New version in version.php
        $table = new XMLDBTable('tao_user_certification_status');
        if (!table_exists($table)) {
            //this table doesn't exist so create it!
            $result = install_from_xmldb_file("{$CFG->dirroot}/blocks/tao_certification_path/db/install.xml");
        }
    }
    return $result;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:21,代码来源:upgrade.php

示例3: upgrade_blocks_plugins


//.........这里部分代码省略.........
                        notify('Upgrading block ' . $block->name . ' from ' . $currblock->version . ' to ' . $block->version . ' FAILED!');
                    }
                    echo '<hr />';
                } else {
                    upgrade_log_start();
                    error('Version mismatch: block ' . $block->name . ' can\'t downgrade ' . $currblock->version . ' -> ' . $block->version . '!');
                }
            }
        } else {
            // block not installed yet, so install it
            // If it allows multiples, start with it enabled
            if ($blockobj->instance_allow_multiple()) {
                $block->multiple = 1;
            }
            // Set the block cron on install
            $block->cron = !empty($blockobj->cron) ? $blockobj->cron : 0;
            // [pj] Normally this would be inline in the if, but we need to
            //      check for NULL (necessary for 4.0.5 <= PHP < 4.2.0)
            $conflictblock = array_search($blocktitle, $blocktitles);
            if ($conflictblock !== false && $conflictblock !== NULL) {
                // Duplicate block titles are not allowed, they confuse people
                // AND PHP's associative arrays ;)
                error('<strong>Naming conflict</strong>: block <strong>' . $block->name . '</strong> has the same title with an existing block, <strong>' . $conflictblock . '</strong>!');
            }
            if (empty($updated_blocks)) {
                $strblocksetup = get_string('blocksetup');
                print_header($strblocksetup, $strblocksetup, build_navigation(array(array('name' => $strblocksetup, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript(), false, '&nbsp;', '&nbsp;');
            }
            $updated_blocks = true;
            upgrade_log_start();
            print_heading($block->name);
            $db->debug = true;
            @set_time_limit(0);
            // To allow slow databases to complete the long SQL
            /// Both old .sql files and new install.xml are supported
            /// but we priorize install.xml (XMLDB) if present
            $status = false;
            if (file_exists($fullblock . '/db/install.xml')) {
                $status = install_from_xmldb_file($fullblock . '/db/install.xml');
                //New method
            } else {
                if (file_exists($fullblock . '/db/' . $CFG->dbtype . '.sql')) {
                    $status = modify_database($fullblock . '/db/' . $CFG->dbtype . '.sql');
                    //Old method
                } else {
                    $status = true;
                }
            }
            $db->debug = false;
            if ($status) {
                if ($block->id = insert_record('block', $block)) {
                    $blockobj->after_install();
                    $component = 'block/' . $block->name;
                    if (!update_capabilities($component)) {
                        notify('Could not set up ' . $block->name . ' capabilities!');
                    }
                    events_update_definition($component);
                    notify(get_string('blocksuccess', '', $blocktitle), 'notifysuccess');
                    echo '<hr />';
                } else {
                    error($block->name . ' block could not be added to the block list!');
                }
            } else {
                error('Block ' . $block->name . ' tables could NOT be set up successfully!');
            }
        }
        $blocktitles[$block->name] = $blocktitle;
    }
    if (!empty($notices)) {
        upgrade_log_start();
        foreach ($notices as $notice) {
            notify($notice);
        }
    }
    // Finally, if we are in the first_install of BLOCKS (this means that we are
    // upgrading from Moodle < 1.3), put blocks in all existing courses.
    if ($first_install) {
        upgrade_log_start();
        //Iterate over each course
        if ($courses = get_records('course')) {
            foreach ($courses as $course) {
                $page = page_create_object(PAGE_COURSE_VIEW, $course->id);
                blocks_repopulate_page($page);
            }
        }
    }
    if (!empty($CFG->siteblocksadded)) {
        /// This is a once-off hack to make a proper upgrade
        upgrade_log_start();
        $page = page_create_object(PAGE_COURSE_VIEW, SITEID);
        blocks_repopulate_page($page);
        delete_records('config', 'name', 'siteblocksadded');
    }
    upgrade_log_finish();
    if (!empty($updated_blocks)) {
        print_continue($continueto);
        print_footer('none');
        die;
    }
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:101,代码来源:blocklib.php

示例4: upgrade_plugin

/**
 * Upgrades the plugin to a new version
 *
 * @param object $upgrade   Information about the plugin to upgrade
 * @return bool             Whether the upgrade succeeded or not
 * @throws SQLException     If the upgrade failed due to a database error
 */
function upgrade_plugin($upgrade)
{
    global $db;
    $plugintype = '';
    $pluginname = '';
    list($plugintype, $pluginname) = explode('.', $upgrade->name);
    if ($plugintype == 'blocktype' && strpos($pluginname, '/') !== false) {
        list($artefactplugin, $blocktypename) = explode('/', $pluginname);
    }
    $location = get_config('docroot') . $plugintype . '/' . $pluginname . '/db/';
    db_begin();
    if (!empty($upgrade->install)) {
        if (is_readable($location . 'install.xml')) {
            install_from_xmldb_file($location . 'install.xml');
        }
    } else {
        if (is_readable($location . 'upgrade.php')) {
            require_once $location . 'upgrade.php';
            $function = 'xmldb_' . $plugintype . '_' . $pluginname . '_upgrade';
            if (!$function($upgrade->from)) {
                throw new InstallationException("Failed to run " . $function . " (check logs for errors)");
            }
        }
    }
    $installed = new StdClass();
    $installed->name = $pluginname;
    $installed->version = $upgrade->to;
    $installed->release = $upgrade->torelease;
    if ($plugintype == 'blocktype') {
        if (!empty($blocktypename)) {
            $installed->name = $blocktypename;
        }
        if (!empty($artefactplugin)) {
            // blocks come from artefactplugins.
            $installed->artefactplugin = $artefactplugin;
        }
    }
    if (property_exists($upgrade, 'requires_config')) {
        $installed->requires_config = $upgrade->requires_config;
    }
    if (property_exists($upgrade, 'requires_parent')) {
        $installed->requires_parent = $upgrade->requires_parent;
    }
    $installtable = $plugintype . '_installed';
    if (!empty($upgrade->install)) {
        insert_record($installtable, $installed);
    } else {
        update_record($installtable, $installed, 'name');
    }
    // postinst stuff...
    safe_require($plugintype, $pluginname);
    $pcname = generate_class_name($plugintype, $installed->name);
    if ($crons = call_static_method($pcname, 'get_cron')) {
        foreach ($crons as $cron) {
            $cron = (object) $cron;
            if (empty($cron->callfunction)) {
                throw new InstallationException("cron for {$pcname} didn't supply function name");
            }
            if (!is_callable(array($pcname, $cron->callfunction))) {
                throw new InstallationException("cron {$cron->callfunction} for {$pcname} supplied but wasn't callable");
            }
            $new = false;
            $table = $plugintype . '_cron';
            if (!empty($upgrade->install)) {
                $new = true;
            } else {
                if (!record_exists($table, 'plugin', $pluginname, 'callfunction', $cron->callfunction)) {
                    $new = true;
                }
            }
            $cron->plugin = $pluginname;
            if (!empty($new)) {
                insert_record($table, $cron);
            } else {
                update_record($table, $cron, array('plugin', 'callfunction'));
            }
        }
    }
    if ($events = call_static_method($pcname, 'get_event_subscriptions')) {
        foreach ($events as $event) {
            $event = (object) $event;
            if (!record_exists('event_type', 'name', $event->event)) {
                throw new InstallationException("event {$event->event} for {$pcname} doesn't exist!");
            }
            if (empty($event->callfunction)) {
                throw new InstallationException("event {$event->event} for {$pcname} didn't supply function name");
            }
            if (!is_callable(array($pcname, $event->callfunction))) {
                throw new InstallationException("event {$event->event} with function {$event->callfunction} for {$pcname} supplied but wasn't callable");
            }
            $exists = false;
            $table = $plugintype . '_event_subscription';
            $block = blocktype_namespaced_to_single($pluginname);
//.........这里部分代码省略.........
开发者ID:Br3nda,项目名称:mahara,代码行数:101,代码来源:upgrade.php

示例5: error_reporting

 /// return to original debugging level
 $CFG->debug = $origdebug;
 error_reporting($CFG->debug);
 upgrade_log_start();
 $db->debug = true;
 /// Both old .sql files and new install.xml are supported
 /// But we prioritise install.xml (XMLDB) if present
 change_db_encoding();
 // first try to change db encoding to utf8
 if (!setup_is_unicodedb()) {
     // If could not convert successfully, throw error, and prevent installation
     print_error('unicoderequired', 'admin');
 }
 $status = false;
 if (file_exists("{$CFG->libdir}/db/install.xml")) {
     $status = install_from_xmldb_file("{$CFG->libdir}/db/install.xml");
     //New method
 } else {
     if (file_exists("{$CFG->libdir}/db/{$CFG->dbtype}.sql")) {
         $status = modify_database("{$CFG->libdir}/db/{$CFG->dbtype}.sql");
         //Old method
     } else {
         error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by Moodle or install.xml is not present.  See the lib/db directory.");
     }
 }
 // all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
 set_config('unicodedb', 1);
 /// Continue with the instalation
 $db->debug = false;
 if ($status) {
     /// Groups install is now in core above.
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:index.php

示例6: xmldb_repository_alfresco_upgrade

/**
 * ELIS(TM): Enterprise Learning Intelligence Suite
 * Copyright (C) 2008-2009 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    elis
 * @subpackage File system
 * @author     Remote-Learner.net Inc
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2008-2012 Remote Learner.net Inc http://www.remote-learner.net
 *
 */
function xmldb_repository_alfresco_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    if ($result && $oldversion < 2007011900) {
        $result = install_from_xmldb_file($CFG->dirroot . '/repository/alfresco/db/install.xml');
    }
    if ($result && $oldversion < 2010030901) {
        $table = new XMLDBTable('alfresco_course_store');
        $table->comment = 'Stores course storage UUID values';
        $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
        $table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '10', false, XMLDB_NOTNULL, null, null, null, null);
        $table->addFieldInfo('uuid', XMLDB_TYPE_CHAR, '36', null, false, null, null, null, null);
        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->addKeyInfo('courseid', XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
        $table->addIndexInfo('courseid-uuid', XMLDB_INDEX_UNIQUE, array('courseid', 'uuid'));
        $result = $result && create_table($table);
        // Only proceed here if the Alfresco plug-in is actually enabled.
        if (isset($CFG->repository_plugins_enabled) && strstr($CFG->repository_plugins_enabled, 'alfresco')) {
            // Handle upgrading some things on the Alfresco repository.
            require_once $CFG->dirroot . '/file/repository/repository.class.php';
            if (!($repo = repository_factory::factory('alfresco'))) {
                debugging(get_string('couldnotcreaterepositoryobject', 'repository'), DEBUG_DEVELOPER);
                $result = false;
            }
            // Turn off "Inherit parent space permissions" for the special Moodle storage directories.
            $result = $result && $repo->node_inherit($repo->muuid, false);
            $result = $result && $repo->node_inherit($repo->suuid, false);
            $result = $result && $repo->node_inherit($repo->cuuid, false);
            // Make sure that all of the individual course directories are set to not interhit parent space permissions.
            $dir = $repo->read_dir($repo->cuuid);
            if (!empty($dir->folders)) {
                foreach ($dir->folders as $folder) {
                    if ((int) $folder->title != $folder->title || (int) $folder->title <= 1 || !($course = get_record('course', 'id', $folder->title, '', '', '', '', 'id,shortname'))) {
                        continue;
                    }
                    // Check if we need to add this node to the course store table.
                    if ($result && !record_exists('alfresco_course_store', 'courseid', $course->id)) {
                        $coursestore = new stdClass();
                        $coursestore->courseid = $course->id;
                        $coursestore->uuid = $folder->uuid;
                        $coursestore->id = insert_record('alfresco_course_store', $coursestore);
                        $result = !empty($coursestore->id);
                    }
                    $result = $result && $repo->node_inherit($folder->uuid, false);
                    $result = $result && alfresco_node_rename($folder->uuid, $course->shortname);
                }
            }
        }
    }
    if ($result && $oldversion < 2010032900) {
        // Only proceed here if the Alfresco plug-in is actually enabled.
        if (isset($CFG->repository_plugins_enabled) && strstr($CFG->repository_plugins_enabled, 'alfresco')) {
            // Handle upgrading some things on the Alfresco repository.
            require_once $CFG->dirroot . '/file/repository/repository.class.php';
            if (!($repo = repository_factory::factory('alfresco'))) {
                debugging(get_string('couldnotcreaterepositoryobject', 'repository'), DEBUG_DEVELOPER);
                $result = false;
            }
            $root = $repo->get_root();
            if (!empty($root->uuid)) {
                $dir = $repo->read_dir($root->uuid, true);
                if (!empty($dir->folders)) {
                    foreach ($dir->folders as $folder) {
                        // Process each of these directories to make sure that any non-privileged user cannot directly
                        // access them.
                        if ($folder->title == 'Data Dictionary' || $folder->title == 'Guest Home' || $folder->title == 'Sites') {
                            $a = new stdClass();
                            $a->uuid = $folder->uuid;
                            $a->name = $folder->title;
                            echo '<p>' . get_string('lockingdownpermissionson', 'repository_alfresco', $a) . '</p>';
                            if ($permissions = alfresco_get_permissions($folder->uuid, 'GROUP_EVERYONE')) {
                                foreach ($permissions as $permission) {
                                    // Make sure the node isn't inheriting parent node permissions.
                                    $repo->node_inherit($folder->uuid, false);
                                    // Construct the post data
//.........这里部分代码省略.........
开发者ID:remotelearner,项目名称:elis.alfresco,代码行数:101,代码来源:upgrade.php

示例7: upgrade_backup_db

function upgrade_backup_db($continueto)
{
    /// This function upgrades the backup tables, if necessary
    /// It's called from admin/index.php, also backup.php and restore.php
    global $CFG, $db;
    require_once "{$CFG->dirroot}/backup/version.php";
    // Get code versions
    if (empty($CFG->backup_version)) {
        // Backup has never been installed.
        $strdatabaseupgrades = get_string("databaseupgrades");
        $navlinks = array();
        $navlinks[] = array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc');
        $navigation = build_navigation($navlinks);
        print_header($strdatabaseupgrades, $strdatabaseupgrades, $navigation, "", upgrade_get_javascript(), false, "&nbsp;", "&nbsp;");
        upgrade_log_start();
        print_heading('backup');
        $db->debug = true;
        /// Both old .sql files and new install.xml are supported
        /// but we priorize install.xml (XMLDB) if present
        $status = false;
        if (file_exists($CFG->dirroot . '/backup/db/install.xml')) {
            $status = install_from_xmldb_file($CFG->dirroot . '/backup/db/install.xml');
            //New method
        } else {
            if (file_exists($CFG->dirroot . '/backup/db/' . $CFG->dbtype . '.sql')) {
                $status = modify_database($CFG->dirroot . '/backup/db/' . $CFG->dbtype . '.sql');
                //Old method
            }
        }
        $db->debug = false;
        if ($status) {
            if (set_config("backup_version", $backup_version) and set_config("backup_release", $backup_release)) {
                //initialize default backup settings now
                $adminroot = admin_get_root();
                apply_default_settings($adminroot->locate('backups'));
                notify(get_string("databasesuccess"), "green");
                notify(get_string("databaseupgradebackups", "", $backup_version), "green");
                print_continue($continueto);
                print_footer('none');
                exit;
            } else {
                error("Upgrade of backup system failed! (Could not update version in config table)");
            }
        } else {
            error("Backup tables could NOT be set up successfully!");
        }
    }
    /// Upgrading code starts here
    $oldupgrade = false;
    $newupgrade = false;
    if (is_readable($CFG->dirroot . '/backup/db/' . $CFG->dbtype . '.php')) {
        include_once $CFG->dirroot . '/backup/db/' . $CFG->dbtype . '.php';
        // defines old upgrading function
        $oldupgrade = true;
    }
    if (is_readable($CFG->dirroot . '/backup/db/upgrade.php')) {
        include_once $CFG->dirroot . '/backup/db/upgrade.php';
        // defines new upgrading function
        $newupgrade = true;
    }
    if ($backup_version > $CFG->backup_version) {
        // Upgrade tables
        $strdatabaseupgrades = get_string("databaseupgrades");
        $navigation = array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'));
        print_header($strdatabaseupgrades, $strdatabaseupgrades, build_navigation($navigation), '', upgrade_get_javascript());
        upgrade_log_start();
        print_heading('backup');
        /// Run de old and new upgrade functions for the module
        $oldupgrade_function = 'backup_upgrade';
        $newupgrade_function = 'xmldb_backup_upgrade';
        /// First, the old function if exists
        $oldupgrade_status = true;
        if ($oldupgrade && function_exists($oldupgrade_function)) {
            $db->debug = true;
            $oldupgrade_status = $oldupgrade_function($CFG->backup_version);
        } else {
            if ($oldupgrade) {
                notify('Upgrade function ' . $oldupgrade_function . ' was not available in ' . '/backup/db/' . $CFG->dbtype . '.php');
            }
        }
        /// Then, the new function if exists and the old one was ok
        $newupgrade_status = true;
        if ($newupgrade && function_exists($newupgrade_function) && $oldupgrade_status) {
            $db->debug = true;
            $newupgrade_status = $newupgrade_function($CFG->backup_version);
        } else {
            if ($newupgrade) {
                notify('Upgrade function ' . $newupgrade_function . ' was not available in ' . '/backup/db/upgrade.php');
            }
        }
        $db->debug = false;
        /// Now analyze upgrade results
        if ($oldupgrade_status && $newupgrade_status) {
            // No upgrading failed
            if (set_config("backup_version", $backup_version) and set_config("backup_release", $backup_release)) {
                notify(get_string("databasesuccess"), "green");
                notify(get_string("databaseupgradebackups", "", $backup_version), "green");
                print_continue($continueto);
                print_footer('none');
                exit;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:lib.php

示例8: xmldb_block_exabis_eportfolio_upgrade

function xmldb_block_exabis_eportfolio_upgrade($oldversion = 0, $tmp)
{
    global $CFG, $db;
    $result = true;
    //     if (empty($db)) {
    //         return false;
    //     }
    if ($oldversion < 2008090100 && !empty($db)) {
        // old tables
        $tables = array('block_exabeporpers', 'block_exabeporexte', 'block_exabeporcate', 'block_exabeporbooklink', 'block_exabeporcommlink', 'block_exabeporsharlink', 'block_exabeporbookfile', 'block_exabeporcommfile', 'block_exabeporsharfile', 'block_exabepornote', 'block_exabeporcommnote', 'block_exabeporsharnote');
        $tableNames = array();
        // rename tables to old_*
        foreach ($tables as $table) {
            $tableNames[$table] = 'old_' . $oldversion . '_' . $table;
            $xmltable = new XMLDBTable($table);
            rename_table($xmltable, $tableNames[$table]);
        }
        // add new tables
        install_from_xmldb_file(dirname(__FILE__) . '/install.xml');
        // import data from old tables
        $insert_type = 'REPLACE';
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporuser (id, user_id, persinfo_timemodified, description, user_hash)' . ' SELECT u.id, u.userid, u.timemodified, u.description, e.user_hash FROM ' . $CFG->prefix . $tableNames['block_exabeporpers'] . ' AS u LEFT JOIN ' . $CFG->prefix . $tableNames['block_exabeporexte'] . ' AS e ON u.userid = e.user_id');
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporcate (id, pid, userid, name, timemodified, courseid)' . ' SELECT id, pid, userid, name, timemodified, course FROM ' . $CFG->prefix . $tableNames['block_exabeporcate']);
        $file_id_start = 0;
        $note_id_start = get_field_select($tableNames['block_exabepornote'], 'MAX(id)', null) + 100;
        $link_id_start = get_field_select($tableNames['block_exabeporbooklink'], 'MAX(id)', null) + $note_id_start + 100;
        // combine item table
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitem' . ' (id, userid, type, categoryid, name, url, intro, attachment, timemodified, courseid, shareall, externaccess, externcomment)' . ' SELECT id+' . $file_id_start . ', userid, "file", category, name, url, intro, attachment, timemodified, course, shareall, externaccess, externcomment' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporbookfile']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitem' . ' (id, userid, type, categoryid, name, url, intro, attachment, timemodified, courseid, shareall, externaccess, externcomment)' . ' SELECT id+' . $note_id_start . ', userid, "note", category, name, url, intro, attachment, timemodified, course, shareall, externaccess, externcomment' . ' FROM ' . $CFG->prefix . $tableNames['block_exabepornote']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitem' . ' (id, userid, type, categoryid, name, url, intro, attachment, timemodified, courseid, shareall, externaccess, externcomment)' . ' SELECT id+' . $link_id_start . ', userid, "link", category, name, url, intro, attachment, timemodified, course, shareall, externaccess, externcomment' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporbooklink']);
        // combine comment table
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemcomm' . ' (id, itemid, userid, entry, timemodified)' . ' SELECT id, bookmarkid+' . $file_id_start . ', userid, entry, timemodified' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporcommfile']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemcomm' . ' (id, itemid, userid, entry, timemodified)' . ' SELECT id, bookmarkid+' . $note_id_start . ', userid, entry, timemodified' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporcommnote']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemcomm' . ' (id, itemid, userid, entry, timemodified)' . ' SELECT id, bookmarkid+' . $link_id_start . ', userid, entry, timemodified' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporcommlink']);
        // combine share table
        $ret = $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemshar' . ' (id, itemid, userid, original, courseid)' . ' SELECT id, bookid+' . $file_id_start . ', userid, original, course' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporsharfile']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemshar' . ' (id, itemid, userid, original, courseid)' . ' SELECT id, bookid+' . $note_id_start . ', userid, original, course' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporsharnote']);
        $db->Execute($insert_type . ' INTO ' . $CFG->prefix . 'block_exabeporitemshar' . ' (id, itemid, userid, original, courseid)' . ' SELECT id, bookid+' . $link_id_start . ', userid, original, course' . ' FROM ' . $CFG->prefix . $tableNames['block_exabeporsharlink']);
        $result = true;
    }
    if ($result && $oldversion < 2009010104) {
        // Add THEME support (nadavkav)
        //$result = execute_sql("ALTER TABLE `{$CFG->prefix}_block_exabeporview` ADD `theme` TEXT NULL DEFAULT NULL AFTER `description`");
        $table = new XMLDBTable('block_exabeporview');
        /// Adding fields to table block_exabeporview
        //$table->addFieldInfo('theme', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, null);
        $field = new XMLDBField('theme');
        $field->setAttributes(XMLDB_TYPE_CHAR, '25', null, null, null, null, null, null, 'description');
        /// Launch update table for block_exabeporview
        $result = $result && add_field($table, $field);
    }
    if ($result && $oldversion < 2009010105) {
        // Add THEME support (nadavkav)
        //$result = execute_sql("ALTER TABLE `{$CFG->prefix}_block_exabeporuser` ADD `emailnotification` TEXT NULL DEFAULT NULL AFTER `description`");
        $table = new XMLDBTable('block_exabeporuser');
        /// Adding fields to table block_exabeporview
        //$table->addFieldInfo('theme', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, null);
        $field = new XMLDBField('emailnotification');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'user_hash');
        /// Launch update table for block_exabeporview
        $result = $result && add_field($table, $field);
    }
    return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:64,代码来源:upgrade.php

示例9: xmldb_elluminate_upgrade

/**
 * Database upgrade code.
 *
 * @version $Id: upgrade.php,v 1.6 2009-06-05 20:12:38 jfilip Exp $
 * @author Justin Filip <jfilip@remote-learner.ca>
 * @author Remote Learner - http://www.remote-learner.net/
 */
function xmldb_elluminate_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $DB;
    $dbman = $DB->get_manager();
    /// loads ddl manager and xmldb classes
    //  We don't need this anymore. As per Moodle.org to upgrade to 2.0 having 1.9 is a requirement, so checks on old versions can be removed for this version (Moodle Integration 2.0.2)
    //	which is a compatibility release for Moodle 2.2.2.
    ///if ($oldversion < 2006062102) {
    /// This should not be necessary but it's included just in case.
    //    $result = install_from_xmldb_file($CFG->dirroot . '/mod/elluminate/db/install.xml');
    //}
    if ($result && $oldversion < 2009090801) {
        //updates to the elluminate table
        $elluminate_table = new xmldb_table('elluminate');
        $field = new xmldb_field('meetinginit');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'meetingid');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('groupmode');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'meetinginit');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('groupid');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'groupmode');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('groupparentid');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'groupid');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('sessionname');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, false, '0', 'groupparentid');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('customname');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, false, '0', 'sessionname');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('customdescription');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, false, '0', 'customname');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('timestart');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'customdescription');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('timeend');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'timestart');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('recordingmode');
        $field->set_attributes(XMLDB_TYPE_CHAR, '10', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'timeend');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('boundarytime');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'recordingmode');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('boundarytimedisplay');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'boundarytime');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('chairlist');
        $field->set_attributes(XMLDB_TYPE_TEXT, 'medium', XMLDB_UNSIGNED, null, false, null, 'boundarytimedisplay');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        $field = new xmldb_field('nonchairlist');
        $field->set_attributes(XMLDB_TYPE_TEXT, 'big', XMLDB_UNSIGNED, null, false, null, 'chairlist');
        $result = $result && $dbman->add_field($elluminate_table, $field);
        //Updates to the recordings table
        $recordings_table = new xmldb_table('elluminate_recordings');
        $field = new xmldb_field('description');
        $field->set_attributes(XMLDB_TYPE_CHAR, '255', XMLDB_UNSIGNED, null, false, '0', 'recordingid');
        $result = $result && $dbman->add_field($recordings_table, $field);
        $field = new xmldb_field('visible');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'description');
        $result = $result && $dbman->add_field($recordings_table, $field);
        $field = new xmldb_field('groupvisible');
        $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NULL, false, '0', 'visible');
        $result = $result && $dbman->add_field($recordings_table, $field);
        $table = new xmldb_table('elluminate_session');
        if ($dbman->table_exists($table)) {
            $status = $dbman->drop_table($table, true, false);
        }
        $table = new xmldb_table('elluminate_users');
        if ($dbman->table_exists($table)) {
            $status = $dbman->drop_table($table, true, false);
        }
        $table = new xmldb_table('elluminate_preloads');
        if ($dbman->table_exists($table)) {
            $status = $dbman->drop_table($table, true, false);
        }
        install_from_xmldb_file($CFG->dirroot . '/mod/elluminate/db/upgrade.xml');
        $meetings = $DB->get_records('elluminate');
        /// Modify all of the existing meetings, if any.
        if ($result && !empty($meetings)) {
            $timenow = time();
            foreach ($meetings as $meeting) {
                /// Update the meeting by storing values from the ELM server in the local DB.
                if (!($elmmeeting = elluminate_get_meeting_full_response($meeting->meetingid))) {
                    continue;
                }
                $meeting->meetinginit = 2;
                $meeting->groupmode = 0;
                $meeting->groupid = 0;
                $meeting->groupparentid = 0;
//.........这里部分代码省略.........
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:101,代码来源:upgrade.php

示例10: xmldb_artefact_blog_upgrade

function xmldb_artefact_blog_upgrade($oldversion = 0)
{
    // There was no database prior to this version.
    if ($oldversion < 2006120501) {
        install_from_xmldb_file(get_config('docroot') . 'artefact/blog/db/install.xml');
    }
    if ($oldversion < 2006121501) {
        $table = new XMLDBTable('artefact_blog_blogpost_file_pending');
        $table->addFieldInfo('file', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
        $table->addFieldInfo('when', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL);
        $table->addKeyInfo('blogpost_file_pending_pk', XMLDB_KEY_PRIMARY, array('file'));
        $table->addKeyInfo('filefk', XMLDB_KEY_FOREIGN, array('file'), 'artefact', array('id'));
        if (!create_table($table)) {
            throw new SQLException($table . " could not be created, check log for errors.");
        }
    }
    if ($oldversion < 2008012200) {
        // From 0.9, some files were not having their temporary download paths
        // translated to proper artefact/file/download.php paths. This upgrade
        // attempts to fix them. It should work in the vast majority of cases,
        // the largest assumption made is that artefacts were inserted in
        // ascending ID order when the post was created, which is a pretty safe
        // bet.
        if ($blogfiles = get_records_array('artefact_blog_blogpost_file', '', '', 'blogpost ASC, file ASC')) {
            $blogpostids = join(', ', array_map(create_function('$a', 'return $a->blogpost;'), $blogfiles));
            // Find all blogposts that have attached files
            if ($blogposts = get_records_select_array('artefact', 'id IN(' . $blogpostids . ')', null, 'id ASC')) {
                foreach ($blogposts as $post) {
                    log_debug("Checking post {$post->id}");
                    // Only doublecheck posts that are likely to have a broken URL in them
                    if (false !== strpos($post->description, 'createid')) {
                        log_debug(" * Looks like post " . $post->id . " has a createid in it");
                        $i = 0;
                        $body = $post->description;
                        foreach ($blogfiles as $file) {
                            if ($file->blogpost == $post->id) {
                                // This file is connected to this post, so likely it is to be displayed
                                $i++;
                                log_debug('* Replace uploadnumber = ' . $i . ' with artefact id ' . $file->file);
                                $regexps = array('/<img([^>]+)src="([^>]+)downloadtemp.php\\?uploadnumber=' . $i . '&amp;createid=\\d+/', '/alt="uploaded:' . $i . '"/');
                                $subs = array('<img$1src="' . get_config('wwwroot') . 'artefact/file/download.php?file=' . $file->file, 'alt="artefact:' . $file->file . '"');
                                $body = preg_replace($regexps, $subs, $body);
                            }
                        }
                        // Update the post if necessary
                        if ($body != $post->description) {
                            $postobj = new ArtefactTypeBlogPost($post->id, null);
                            $postobj->set('description', $body);
                            $postobj->commit();
                        }
                    }
                }
            }
        }
    }
    if ($oldversion < 2008020700) {
        $table = new XMLDBTable('artefact_blog_blog');
        drop_table($table);
        if (is_mysql()) {
            execute_sql('DROP INDEX {arteblogblog_blo2_ix} ON {artefact_blog_blogpost}');
            execute_sql('CREATE INDEX {arteblogblog_blo_ix} ON {artefact_blog_blogpost} (blogpost)');
            execute_sql('ALTER TABLE {artefact_blog_blogpost} DROP FOREIGN KEY {arteblogblog_blo2_fk}');
            // I can't quite get mysql to name this key correctly, so there
            // will be a difference in the database if you upgrade from 0.9
            // compared with installing from 1.0
            execute_sql('ALTER TABLE {artefact_blog_blogpost} ADD FOREIGN KEY (blogpost) REFERENCES {artefact} (id)');
        } else {
            // Rename indexes to keep things the same regardless of whether the
            // user installed or upgraded to this release
            execute_sql('DROP INDEX {arteblogblog_blo2_ix}');
            execute_sql('CREATE INDEX {arteblogblog_blo_ix} ON {artefact_blog_blogpost} USING btree (blogpost)');
            execute_sql('ALTER TABLE {artefact_blog_blogpost} DROP CONSTRAINT {arteblogblog_blo2_fk}');
            execute_sql('ALTER TABLE {artefact_blog_blogpost} ADD CONSTRAINT {arteblogblog_blo_fk} FOREIGN KEY (blogpost) REFERENCES {artefact}(id)');
        }
    }
    if ($oldversion < 2008101602) {
        $table = new XMLDBTable('artefact_blog_blogpost_file_pending');
        $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
        $table->addFieldInfo('oldextension', XMLDB_TYPE_TEXT, null);
        $table->addFieldInfo('filetype', XMLDB_TYPE_TEXT, null);
        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
        create_table($table);
    }
    if ($oldversion < 2009033100) {
        $bloguploadbase = get_config('dataroot') . 'artefact/blog/uploads/';
        if (is_dir($bloguploadbase)) {
            if ($basedir = opendir($bloguploadbase)) {
                while (false !== ($sessionupload = readdir($basedir))) {
                    if ($sessionupload != "." && $sessionupload != "..") {
                        $sessionupload = $bloguploadbase . $sessionupload;
                        $subdir = opendir($sessionupload);
                        while (false !== ($uploadfile = readdir($subdir))) {
                            if ($uploadfile != "." && $uploadfile != "..") {
                                $uploadfile = $sessionupload . '/' . $uploadfile;
                                unlink($uploadfile);
                            }
                        }
                        closedir($subdir);
                        rmdir($sessionupload);
                    }
//.........这里部分代码省略.........
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:101,代码来源:upgrade.php

示例11: xmldb_group_upgrade

function xmldb_group_upgrade($oldversion = 0)
{
    global $CFG;
    $result = true;
    if ($result && $oldversion < 2007012000) {
        /// Changing nullability of field description on table groups to null
        $table = new XMLDBTable('groups');
        $field = new XMLDBField('description');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'name');
        /// Launch change of nullability for field description
        $result = $result && change_field_notnull($table, $field);
        /// Changing nullability of field description on table groups_groupings to null
        $table = new XMLDBTable('groups_groupings');
        $field = new XMLDBField('description');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'name');
        /// Launch change of nullability for field description
        $result = $result && change_field_notnull($table, $field);
    }
    if ($result && $oldversion < 2007012100) {
        /// Changing precision of field lang on table groups to (30)
        $table = new XMLDBTable('groups');
        $field = new XMLDBField('lang');
        $field->setAttributes(XMLDB_TYPE_CHAR, '30', null, XMLDB_NOTNULL, null, null, null, 'en', 'enrolmentkey');
        /// Launch change of precision for field lang
        $result = $result && change_field_precision($table, $field);
    }
    /// Adding all the missing FK + Unique indexes (XMLDB will create the underlying indexes)
    if ($result && $oldversion < 2007012200) {
        /// Define index groupid-courseid (unique) to be added to groups_members
        $table = new XMLDBTable('groups_members');
        $index = new XMLDBIndex('groupid-courseid');
        $index->setAttributes(XMLDB_INDEX_UNIQUE, array('groupid', 'userid'));
        /// Launch add index groupid-courseid
        $result = $result && add_index($table, $index);
        /// Define key courseid (foreign) to be added to groups_courses_groups
        $table = new XMLDBTable('groups_courses_groups');
        $key = new XMLDBKey('courseid');
        $key->setAttributes(XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
        /// Launch add key courseid
        $result = $result && add_key($table, $key);
        /// Define key groupid (foreign) to be added to groups_courses_groups
        $table = new XMLDBTable('groups_courses_groups');
        $key = new XMLDBKey('groupid');
        $key->setAttributes(XMLDB_KEY_FOREIGN, array('groupid'), 'groups', array('id'));
        /// Launch add key groupid
        $result = $result && add_key($table, $key);
        /// Define index courseid-groupid (unique) to be added to groups_courses_groups
        $table = new XMLDBTable('groups_courses_groups');
        $index = new XMLDBIndex('courseid-groupid');
        $index->setAttributes(XMLDB_INDEX_UNIQUE, array('courseid', 'groupid'));
        /// Launch add index courseid-groupid
        $result = $result && add_index($table, $index);
        /// Define key courseid (foreign) to be added to groups_courses_groupings
        $table = new XMLDBTable('groups_courses_groupings');
        $key = new XMLDBKey('courseid');
        $key->setAttributes(XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
        /// Launch add key courseid
        $result = $result && add_key($table, $key);
        /// Define key groupingid (foreign) to be added to groups_courses_groupings
        $table = new XMLDBTable('groups_courses_groupings');
        $key = new XMLDBKey('groupingid');
        $key->setAttributes(XMLDB_KEY_FOREIGN, array('groupingid'), 'groups_groupings', array('id'));
        /// Launch add key groupingid
        $result = $result && add_key($table, $key);
        /// Define index courseid-groupingid (unique) to be added to groups_courses_groupings
        $table = new XMLDBTable('groups_courses_groupings');
        $index = new XMLDBIndex('courseid-groupingid');
        $index->setAttributes(XMLDB_INDEX_UNIQUE, array('courseid', 'groupingid'));
        /// Launch add index courseid-groupingid
        $result = $result && add_index($table, $index);
        /// Define key groupingid (foreign) to be added to groups_groupings_groups
        $table = new XMLDBTable('groups_groupings_groups');
        $key = new XMLDBKey('groupingid');
        $key->setAttributes(XMLDB_KEY_FOREIGN, array('groupingid'), 'groups_groupings', array('id'));
        /// Launch add key groupingid
        $result = $result && add_key($table, $key);
        /// Define key groupid (foreign) to be added to groups_groupings_groups
        $table = new XMLDBTable('groups_groupings_groups');
        $key = new XMLDBKey('groupid');
        $key->setAttributes(XMLDB_KEY_FOREIGN, array('groupid'), 'groups', array('id'));
        /// Launch add key groupid
        $result = $result && add_key($table, $key);
        /// Define index groupingid-groupid (unique) to be added to groups_groupings_groups
        $table = new XMLDBTable('groups_groupings_groups');
        $index = new XMLDBIndex('groupingid-groupid');
        $index->setAttributes(XMLDB_INDEX_UNIQUE, array('groupingid', 'groupid'));
        /// Launch add index groupingid-groupid
        $result = $result && add_index($table, $index);
    }
    if ($result && $oldversion < 2007012400) {
        if (table_exists(new XMLDBTable('groups_temp')) && file_exists($CFG->dirroot . '/group/db/install.xml')) {
            /// Need to drop foreign keys/indexes added in last upgrade, drop 'new' tables, then start again!!
            $result = $result && groups_drop_keys_indexes_db();
            $result = $result && groups_revert_db($renametemp = false);
            $result = $result && install_from_xmldb_file($CFG->dirroot . '/group/db/install.xml');
            $result = $result && groups_transfer_db();
        }
    }
    return $result;
}
开发者ID:veritech,项目名称:pare-project,代码行数:100,代码来源:upgrade.php

示例12: xmldb_elluminate_upgrade

/**
 * Database upgrade code.
 *
 * @version $Id: upgrade.php,v 1.6 2009-06-05 20:12:38 jfilip Exp $
 * @author Justin Filip <jfilip@remote-learner.ca>
 * @author Remote Learner - http://www.remote-learner.net/
 */
function xmldb_elluminate_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    if ($oldversion < 2006062102) {
        /// This should not be necessary but it's included just in case.
        $result = install_from_xmldb_file($CFG->dirroot . '/mod/elluminate/db/install.xml');
    }
    if ($result && $oldversion < 2009090801) {
        $meetings = get_records('elluminate');
        $table = new XMLDBTable('elluminate');
        if (table_exists($table)) {
            $status = drop_table($table, true, false);
        }
        $table = new XMLDBTable('elluminate_recordings');
        if (table_exists($table)) {
            $status = drop_table($table, true, false);
        }
        $table = new XMLDBTable('elluminate_session');
        if (table_exists($table)) {
            $status = drop_table($table, true, false);
        }
        $table = new XMLDBTable('elluminate_users');
        if (table_exists($table)) {
            $status = drop_table($table, true, false);
        }
        $table = new XMLDBTable('elluminate_preloads');
        if (table_exists($table)) {
            $status = drop_table($table, true, false);
        }
        install_from_xmldb_file($CFG->dirroot . '/mod/elluminate/db/upgrade.xml');
        /// Modify all of the existing meetings, if any.
        if ($result && !empty($meetings)) {
            $timenow = time();
            foreach ($meetings as $meeting) {
                /// Update the meeting by storing values from the ELM server in the local DB.
                if (!($elmmeeting = elluminate_get_meeting_full_response($meeting->meetingid))) {
                    continue;
                }
                //$mparams = elluminate_get_meeting_parameters($meeting->meetingid);
                $sparams = elluminate_get_server_parameters($meeting->meetingid);
                $umeeting = new stdClass();
                //$umeeting->id          = $meeting->id;
                $umeeting->meetingid = $meeting->meetingid;
                $umeeting->meetinginit = 2;
                $umeeting->course = $meeting->course;
                $umeeting->creator = $elmmeeting->creatorId;
                $umeeting->groupmode = '0';
                $umeeting->groupid = '0';
                $umeeting->sessionname = addslashes($meeting->name);
                $umeeting->timestart = substr($elmmeeting->startTime, 0, -3);
                $umeeting->timeend = substr($elmmeeting->endTime, 0, -3);
                $umeeting->nonchairlist = $elmmeeting->nonChairList;
                $umeeting->chairlist = $elmmeeting->chairList;
                $umeeting->recordingmode = $elmmeeting->recordingModeType;
                $umeeting->name = $meeting->name;
                $umeeting->description = addslashes($meeting->description);
                $umeeting->boundarytime = $elmmeeting->boundaryTime;
                $umeeting->boundarytimedisplay = 1;
                $umeeting->seats = $meeting->seats;
                $umeeting->private = $meeting->private;
                $umeeting->grade = $meeting->grade;
                $umeeting->timemodified = $meeting->timemodified;
                insert_record('elluminate', $umeeting);
                $newmeeting = get_record('elluminate', 'meetingid', $meeting->meetingid);
                $attendancerecords = get_records('elluminate_attendance', 'elluminateid', $meeting->id);
                if (!empty($attendancerecords)) {
                    foreach ($attendancerecords as $attendee) {
                        $attendee->ellumianteid = $newmeeting->id;
                        update_record('elluminate_attendance', $attendee);
                    }
                }
                $recordings = elluminate_list_recordings($meeting->meetingid);
                if ($result && !empty($recordings)) {
                    $timenow = time();
                    foreach ($recordings as $recording) {
                        $urecording = new stdClass();
                        $urecording->meetingid = $recording->meetingid;
                        $urecording->recordingid = $recording->recordingid;
                        $urecording->description = $recording->roomname;
                        $urecording->visible = '1';
                        $urecording->groupvisible = '0';
                        $urecording->created = $recording->created;
                        insert_record('elluminate_recordings', $urecording);
                    }
                }
            }
        }
        $timenow = time();
        $sysctx = get_context_instance(CONTEXT_SYSTEM);
        $adminrid = get_field('role', 'id', 'shortname', 'admin');
        $coursecreatorrid = get_field('role', 'id', 'shortname', 'coursecreator');
        $editingteacherrid = get_field('role', 'id', 'shortname', 'editingteacher');
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:upgrade.php


注:本文中的install_from_xmldb_file函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。