本文整理汇总了PHP中XMLDBTable::addKeyInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLDBTable::addKeyInfo方法的具体用法?PHP XMLDBTable::addKeyInfo怎么用?PHP XMLDBTable::addKeyInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLDBTable
的用法示例。
在下文中一共展示了XMLDBTable::addKeyInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmldb_block_ajax_marking_upgrade
function xmldb_block_ajax_marking_upgrade($oldversion = 0)
{
//echo "oldversion: ".$oldversion;
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 < 2007052901) {
//New version in version.php
/// Define table block_ajax_marking to be created
$table = new XMLDBTable('block_ajax_marking');
/// Adding fields to table block_ajax_marking
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, null, null);
$table->addFieldInfo('assessmenttype', XMLDB_TYPE_CHAR, '40', null, null, null, null, null, null);
$table->addFieldInfo('assessmentid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, null, null);
$table->addFieldInfo('showhide', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, null, '1');
$table->addFieldInfo('groups', XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null);
/// Adding keys to table block_ajax_marking
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addKeyInfo('useridkey', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
/// Launch create table for block_ajax_marking
$result = $result && create_table($table);
}
// run this on every upgrade.
AMB_update_modules();
return $result;
}
示例2: xmldb_crlm_cluster_classification_upgrade
/**
* ELIS(TM): Enterprise Learning Intelligence Suite
* Copyright (C) 2008-2012 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 curriculummanagement
* @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_crlm_cluster_classification_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2010080502) {
/// Define table crlm_cluster_classification to be created
$table = new XMLDBTable('crlm_cluster_classification');
/// Adding fields to table crlm_cluster_classification
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('shortname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('params', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, null, null);
/// Adding keys to table crlm_cluster_classification
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addKeyInfo('shortname_idx', XMLDB_KEY_UNIQUE, array('shortname'));
/// Launch create table for crlm_cluster_classification
$result = $result && create_table($table);
}
if ($result && $oldversion < 2010080503) {
require_once $CFG->dirroot . '/curriculum/lib/customfield.class.php';
require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/lib.php';
require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/clusterclassification.class.php';
$field = new field(field::get_for_context_level_with_name('cluster', CLUSTER_CLASSIFICATION_FIELD));
// make sure we're set as owner
if (!isset($field->owners['cluster_classification'])) {
$owner = new field_owner();
$owner->fieldid = $field->id;
$owner->plugin = 'cluster_classification';
$owner->add();
}
// make sure we have a default value set
if (!field_data::get_for_context_and_field(NULL, $field)) {
field_data::set_for_context_and_field(NULL, $field, 'regular');
}
$default = new clusterclassification();
$default->shortname = 'regular';
$default->name = get_string('cluster', 'block_curr_admin');
$default->param_autoenrol_curricula = 1;
$default->param_autoenrol_tracks = 1;
$default->add();
}
// make sure 'manual' is an owner
if ($result && $oldversion < 2010080504) {
require_once $CFG->dirroot . '/curriculum/lib/customfield.class.php';
require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/lib.php';
require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/clusterclassification.class.php';
$field = new field(field::get_for_context_level_with_name('cluster', CLUSTER_CLASSIFICATION_FIELD));
$owner = new field_owner();
$owner->fieldid = $field->id;
$owner->plugin = 'manual';
$owner->param_view_capability = '';
$owner->param_edit_capability = 'moodle/user:update';
$owner->param_control = 'menu';
$owner->param_options_source = 'cluster_classifications';
$owner->add();
}
return $result;
}
示例3: xmldb_blocktype_taggedposts_upgrade
function xmldb_blocktype_taggedposts_upgrade($oldversion = 0)
{
if ($oldversion < 2015011500) {
$table = new XMLDBTable('blocktype_taggedposts_tags');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
$table->addFieldInfo('block_instance', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('tag', XMLDB_TYPE_CHAR, 128, null, XMLDB_NOTNULL);
$table->addFieldInfo('tagtype', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addIndexInfo('tagtagtypeix', XMLDB_INDEX_NOTUNIQUE, array('tag', 'tagtype'));
if (!table_exists($table)) {
create_table($table);
$rs = get_recordset('block_instance', 'blocktype', 'taggedposts', 'id', 'id, configdata');
while ($bi = $rs->FetchRow()) {
// Each block will have only one tag (because we combined this upgrade block
// with the upgrade block for the "multiple tags" enhancement.
$configdata = unserialize($bi['configdata']);
if (!empty($configdata['tagselect'])) {
$todb = new stdClass();
$todb->block_instance = $bi['id'];
$todb->tag = $configdata['tagselect'];
$todb->tagtype = PluginBlocktypeTaggedposts::TAGTYPE_INCLUDE;
insert_record('blocktype_taggedposts_tags', $todb);
}
}
}
}
return true;
}
示例4: xmldb_artefact_calendar_upgrade
function xmldb_artefact_calendar_upgrade($oldversion = 0)
{
if ($oldversion < 2013062404) {
$table = new XMLDBTable('artefact_calendar_reminder');
drop_table($table);
$table->addFieldInfo('user', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
$table->addFieldInfo('reminder_type', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL);
$table->addFieldInfo('reminder_date', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, '-1', null);
$table->addKeyInfo('reminder_pk', XMLDB_KEY_PRIMARY, array('user'));
if (!create_table($table)) {
throw new SQLException($table . " could not be created, check log for errors.");
}
execute_sql('ALTER TABLE {artefact_calendar_calendar} DROP COLUMN {reminder_status}');
}
if ($oldversion < 2013062501) {
execute_sql('ALTER TABLE {artefact_calendar_calendar} change {reminder_date} {reminder_date} int(4) NOT NULL;');
}
if ($oldversion < 2013063001) {
$table = new XMLDBTable('artefact_calendar_event');
$table->addFieldInfo('eventid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
$table->addFieldInfo('begin', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
$table->addFieldInfo('end', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
$table->addFieldInfo('whole_day', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL);
$table->addFieldInfo('repeat_type', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL);
$table->addFieldInfo('repeats_every', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL);
$table->addFieldInfo('end_date', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
$table->addFieldInfo('ends_after', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL);
$table->addKeyInfo('event_pk', XMLDB_KEY_PRIMARY, array('eventid'));
if (!create_table($table)) {
throw new SQLException($table . " could not be created, check log for errors.");
}
}
return true;
}
示例5: xmldb_qtype_rqp_upgrade
function xmldb_qtype_rqp_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2006032201) {
$table = new XMLDBTable('question_rqp_servers');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE);
$table->addFieldInfo('typeid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
$table->addFieldInfo('url', XMLDB_TYPE_CHAR, 255);
$table->addFieldInfo('can_render', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
$table->addFieldInfo('can_author', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addKeyInfo('typeid', XMLDB_KEY_FOREIGN, array('typeid'), 'rqp_types', array('id'));
$result = $result && create_table($table);
}
return $result;
}
示例6: wrsqz_create_program_table
function wrsqz_create_program_table($questionTypeProm)
{
global $CFG;
/// Define table question_wxxxxprom to be created
$promTable = new XMLDBTable('question_' . $questionTypeProm);
/// Adding fields to table question_wxxxxprom
$promTable->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$promTable->addFieldInfo('question', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
$promTable->addFieldInfo('program', XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null);
/// Adding keys to table question_wxxxxprom
$promTable->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
/// Adding indexes to table question_wxxxxprom
$promTable->addIndexInfo($CFG->prefix . 'ques' . substr($questionTypeProm, 0, 4) . '_que_ix', XMLDB_INDEX_NOTUNIQUE, array('question'));
/// Launch create table
return wrsqz_create_table($promTable);
}
示例7: xmldb_artefact_blog_upgrade
function xmldb_artefact_blog_upgrade($oldversion = 0)
{
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);
}
}
}
@rmdir($bloguploadbase);
}
}
if ($oldversion < 2009081800) {
$subscription = (object) array('plugin' => 'blog', 'event' => 'createuser', 'callfunction' => 'create_default_blog');
ensure_record_exists('artefact_event_subscription', $subscription, $subscription);
}
if ($oldversion < 2011091400) {
delete_records('artefact_cron', 'plugin', 'blog', 'callfunction', 'clean_post_files');
}
if ($oldversion < 2015011500) {
delete_records('institution_config', 'field', 'progressbaritem_blog_blog');
}
return true;
}
示例8: xmldb_format_fn_upgrade
function xmldb_format_fn_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2007060102) {
//New version in version.php
$table = new XMLDBTable('fn_coursemodule_extra');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null, null);
$table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id');
$table->addFieldInfo('cmid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'courseid');
$table->addFieldInfo('hideingradebook', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'cmid');
$table->addFieldInfo('mandatory', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'hideingradebook');
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addIndexInfo('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));
$table->addIndexInfo('cmid', XMLDB_INDEX_NOTUNIQUE, array('cmid'));
$result = create_table($table);
}
return $result;
}
示例9: xmldb_auth_oidc_upgrade
/**
* Update plugin.
*
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_auth_oidc_upgrade($oldversion)
{
$result = true;
if ($result && $oldversion < 2009072001) {
// Create the core services tables
$table = new \XMLDBTable('auth_oidc_state');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('sesskey', XMLDB_TYPE_CHAR, 10, null, null);
$table->addFieldInfo('state', XMLDB_TYPE_CHAR, 15, null, null);
$table->addFieldInfo('nonce', XMLDB_TYPE_CHAR, 15, null, null);
$table->addFieldInfo('timecreated', XMLDB_TYPE_INTEGER, 15, null, null);
$table->addFieldInfo('additionaldata', XMLDB_TYPE_TEXT, null);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addIndexInfo('state', XMLDB_INDEX_NOTUNIQUE, array('state'));
$table->addIndexInfo('timecreated', XMLDB_INDEX_NOTUNIQUE, array('timecreated'));
create_table($table);
}
return $result;
}
示例10: xmldb_block_php_report_upgrade
/**
* ELIS(TM): Enterprise Learning Intelligence Suite
* Copyright (C) 2008-2012 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 php_reports
* @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_block_php_report_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2011040600) {
/// Define table php_report_schedule to be created
$table = new XMLDBTable('php_report_schedule');
/// Adding fields to table php_report_schedule
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('report', XMLDB_TYPE_CHAR, '63', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('config', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, null);
/// Adding keys to table php_report_schedule
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
/// Adding indexes to table php_report_schedule
$table->addIndexInfo('report_idx', XMLDB_INDEX_NOTUNIQUE, array('report'));
/// Launch create table for php_report_schedule
$result = $result && create_table($table);
/// Define field userid to be added to php_report_schedule
$table = new XMLDBTable('php_report_schedule');
$field = new XMLDBField('userid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'id');
/// Launch add field userid
$result = $result && add_field($table, $field);
/// Define index userid_idx (not unique) to be added to php_report_schedule
$table = new XMLDBTable('php_report_schedule');
$index = new XMLDBIndex('userid_idx');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('userid'));
/// Launch add index userid_idx
$result = $result && add_index($table, $index);
}
if ($result && $oldversion < 2011042900) {
$query = "name " . sql_ilike() . " 'php_report%'";
$result = $result && delete_records_select('user_preferences', $query);
}
return $result;
}
示例11: xmldb_artefact_file_upgrade
//.........这里部分代码省略.........
}
if ($oldversion < 2014051200) {
require_once get_config('docroot') . '/lib/file.php';
$mimetypes = get_records_assoc('artefact_file_mime_types', '', '', '', 'description,mimetype');
// Re-examine only those files where their current identified mimetype is
// different from how we would identify their mimetype based on file extension
$rs = get_recordset_sql('
select a.id, aff.oldextension, aff.filetype
from
{artefact} a
inner join {artefact_file_files} aff
on a.id = aff.artefact
where a.artefacttype = \'archive\'
and not exists (
select 1 from {artefact_file_mime_types} afmt
where afmt.description = aff.oldextension
and afmt.mimetype = aff.filetype
)
order by a.id
');
$total = 0;
$done = 0;
while ($zf = $rs->FetchRow()) {
if ($done % 100 == 0) {
log_debug('Verifying filetypes: ' . $done . '/' . $rs->RecordCount());
}
$done++;
$file = artefact_instance_from_id($zf['id']);
$path = $file->get_path();
// Check what our improved file detection system thinks it is
$guess = file_mime_type($path, 'foo.' . $zf['oldextension']);
if ($guess != 'application/octet-stream') {
$data = new stdClass();
$data->filetype = $data->guess = $guess;
foreach (array('video', 'audio', 'archive') as $artefacttype) {
$classname = 'ArtefactType' . ucfirst($artefacttype);
if (call_user_func_array(array($classname, 'is_valid_file'), array($file->get_path(), &$data))) {
set_field('artefact', 'artefacttype', $artefacttype, 'id', $zf['id']);
set_field('artefact_file_files', 'filetype', $data->filetype, 'artefact', $zf['id']);
continue 2;
}
}
// It wasn't any of those special ones, so just make it a normal file artefact
set_field('artefact', 'artefacttype', 'file', 'id', $zf['id']);
set_field('artefact_file_files', 'filetype', $data->filetype, 'artefact', $zf['id']);
}
}
log_debug('Verifying filetypes: ' . $done . '/' . $rs->RecordCount());
$rs->Close();
}
if ($oldversion < 2014060900) {
$events = array((object) array('plugin' => 'file', 'event' => 'saveartefact', 'callfunction' => 'eventlistener_savedeleteartefact'), (object) array('plugin' => 'file', 'event' => 'deleteartefact', 'callfunction' => 'eventlistener_savedeleteartefact'), (object) array('plugin' => 'file', 'event' => 'deleteartefacts', 'callfunction' => 'eventlistener_savedeleteartefact'), (object) array('plugin' => 'file', 'event' => 'updateuser', 'callfunction' => 'eventlistener_savedeleteartefact'));
foreach ($events as $event) {
ensure_record_exists('artefact_event_subscription', $event, $event);
}
PluginArtefactFile::set_quota_triggers();
}
if ($oldversion < 2014061000) {
// Remove the not needed quota notify on update config trigger from previous update
if (is_postgres()) {
$sql = 'DROP TRIGGER IF EXISTS {unmark_quota_exeed_notified_on_update_setting_trigger} ON {artefact_config};';
} else {
$sql = 'DROP TRIGGER IF EXISTS {unmark_quota_exeed_notified_on_update_setting_trigger};';
}
execute_sql($sql);
}
if ($oldversion < 2014111200) {
// Create embedded images table
$table = new XMLDBTable('artefact_file_embedded');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE);
$table->addFieldInfo('fileid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL);
$table->addFieldInfo('resourcetype', XMLDB_TYPE_CHAR, '100', XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addFieldInfo('resourceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addKeyInfo('artefactfk', XMLDB_KEY_FOREIGN, array('fileid'), 'artefact', array('id'));
$status = $status && create_table($table);
}
if ($oldversion < 2015101900) {
log_debug('Need to consolidate "textbox" and "editnote" embedded resource types as they are in fact the same thing');
if ($records = get_records_sql_array('SELECT * FROM {artefact_file_embedded} WHERE resourcetype IN (?, ?)', array('editnote', 'textbox'))) {
$newrecords = array();
// Turn the results into something easier to check against
foreach ($records as $k => $v) {
$newrecords[$v->resourcetype . '_' . $v->resourceid . '_' . $v->fileid] = $v;
}
foreach ($newrecords as $nk => $nv) {
// need to sort out the 'editnote' options
if (preg_match('/^editnote_(.*)$/', $nk, $match)) {
// Check to see if there is a corresponding 'textbox' one - if not we need to make one
if (!array_key_exists('textbox_' . $match[1], $newrecords)) {
insert_record('artefact_file_embedded', (object) array('fileid' => $nv->fileid, 'resourcetype' => 'textbox', 'resourceid' => $nv->resourceid));
}
// now delete the 'editnote' one
delete_records('artefact_file_embedded', 'id', $nv->id);
}
}
}
}
return $status;
}
示例12: sync_users
/**
* Attemp to synchronize Users in Mahara with Users in the LDAP server
*
* @param boolean $dryrun dummy execution. Do not perform any database operations
* @return boolean
*/
public function sync_users($dryrun = false)
{
global $CFG;
require_once get_config('docroot') . 'lib/ddl.php';
require_once get_config('docroot') . 'lib/institution.php';
log_info('---------- started usersync for instance ' . $this->instanceid . ' at ' . date('r', time()) . ' ----------');
// If they haven't activated the cron, return
if (!$this->get_config('syncuserscron')) {
log_info('not set to sync users, so exiting');
return true;
}
// Create a temp table to store the users, for better performance
$temptable = new XMLDBTable('auth_ldap_extusers_temp');
$temptable->addFieldInfo('extusername', XMLDB_TYPE_CHAR, 64, null, false);
$temptable->addFieldInfo('firstname', XMLDB_TYPE_TEXT);
$temptable->addFieldInfo('lastname', XMLDB_TYPE_TEXT);
$temptable->addFieldInfo('email', XMLDB_TYPE_CHAR, 255);
$temptable->addFieldInfo('studentid', XMLDB_TYPE_TEXT);
$temptable->addFieldInfo('preferredname', XMLDB_TYPE_TEXT);
$temptable->addKeyInfo('extusers', XMLDB_KEY_PRIMARY, array('extusername'));
$tablecreated = create_temp_table($temptable, false, true);
if (!$tablecreated) {
log_warn('Could not create temp table auth_ldap_extusers_temp', false);
return false;
}
$extrafilterattribute = $this->get_config('syncusersextrafilterattribute');
$doupdate = $this->get_config('syncusersupdate');
$docreate = $this->get_config('syncuserscreate');
$tousersgonefromldap = $this->get_config('syncusersgonefromldap');
$dodelete = false;
$dosuspend = false;
switch ($tousersgonefromldap) {
case 'delete':
$dodelete = true;
break;
case 'suspend':
$dosuspend = true;
break;
}
if (get_config('auth_ldap_debug_sync_cron')) {
log_debug("config. LDAP : ");
var_dump($this->config);
}
// fetch ldap users having the filter attribute on (caution maybe mutlivalued
// do it on a scalable version by keeping the LDAP users names in a temporary table
$nbldapusers = $this->ldap_get_users_scalable('auth_ldap_extusers_temp', 'extusername', $extrafilterattribute);
log_info('LDAP users found : ' . $nbldapusers);
try {
$nbupdated = $nbcreated = $nbsuspended = $nbdeleted = $nbignored = $nbpresents = $nbunsuspended = $nberrors = 0;
// Define ldap attributes in user update
$ldapattributes = $this->get_ldap_user_fields();
// Match database and ldap entries and update in database if required
$fieldstoimport = array_keys($ldapattributes);
// we fetch only Mahara users of this institution concerned by this authinstance (either cas or ldap)
// and get also their suspended status since we may have to unsuspend them
// this search cannot be done by a call to get_institutional_admin_search_results
// that does not support searching by auth instance id and do not return suspended status
// and is not suitable for a massive number of users
if (!$doupdate) {
log_info('user auto-update disabled');
} else {
// users to update (known both in LDAP and Mahara usr table)
$sql = "\n select\n u.id as id,\n u.username as username,\n u.suspendedreason as suspendedreason,\n u.firstname as dbfirstname,\n u.lastname as dblastname,\n u.email as dbemail,\n u.studentid as dbstudentid,\n u.preferredname as dbpreferredname,\n e.firstname as ldapfirstname,\n e.lastname as ldaplastname,\n e.email as ldapemail,\n e.studentid as ldapstudentid,\n e.preferredname as ldappreferredname\n from\n {usr} u\n inner join {auth_ldap_extusers_temp} e\n on u.username = e.extusername\n where\n u.deleted = 0\n and u.authinstance = ?\n order by u.username\n ";
$rs = get_recordset_sql($sql, array($this->instanceid));
log_info($rs->RecordCount() . ' users known to Mahara ');
while ($record = $rs->FetchRow()) {
$nbpresents++;
$ldapusername = $record['username'];
$updated = false;
foreach ($fieldstoimport as $field) {
$ldapfield = "ldap{$field}";
$dbfield = "db{$field}";
$sanitizer = "sanitize_{$field}";
$record[$ldapfield] = $sanitizer($record[$ldapfield]);
if ($record[$ldapfield] != '' && $record[$dbfield] != $record[$ldapfield]) {
$updated = true;
if (!$dryrun) {
set_profile_field($record['id'], $field, $record[$ldapfield]);
}
}
}
if ($updated) {
log_debug('updating user ' . $ldapusername);
} else {
log_debug('no change for user ' . $ldapusername);
}
if (!$dryrun) {
if (!empty($record['ldapstudentid'])) {
// caution may be missing ?
set_field('usr_institution', 'studentid', $record['ldapstudentid'], 'usr', $record['id'], 'institution', $this->institution);
}
}
unset($ldapdetails);
$nbupdated++;
//.........这里部分代码省略.........
示例13: xmldb_dialogue_upgrade
function xmldb_dialogue_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2007100300) {
/// Define field recipientid to be added to dialogue_entries
$table = new XMLDBTable('dialogue_entries');
$field = new XMLDBField('recipientid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, '0', 'userid');
/// Launch add field recipientid
$result = $result && add_field($table, $field);
$index = new XMLDBIndex('dialogue_entries_recipientid_idx');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('recipientid'));
/// Launch add index dialogue_entries_recipientid_idx
$result = $result && add_index($table, $index);
}
if ($result && $oldversion < 2007100301) {
/// Define field lastrecipientid to be added to dialogue_conversations
$table = new XMLDBTable('dialogue_conversations');
$field = new XMLDBField('lastrecipientid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, '0', 'lastid');
/// Launch add field lastrecipientid
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2007100400) {
/// Define field attachment to be added to dialogue_entries
$table = new XMLDBTable('dialogue_entries');
$field = new XMLDBField('attachment');
$field->setAttributes(XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, null, null, 'text');
/// Launch add field attachment
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2007100800) {
/// Define field edittime to be added to dialogue
$table = new XMLDBTable('dialogue');
$field = new XMLDBField('edittime');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
/// Launch add field edittime
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2007110700) {
/// Define field groupid to be added to dialogue_conversations
$table = new XMLDBTable('dialogue_conversations');
$field = new XMLDBField('groupid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'subject');
/// Launch add field groupid
$result = $result && add_field($table, $field);
/// Define index dialogue_conversations_groupid_idx (not unique) to be added to dialogue_conversations
$index = new XMLDBIndex('dialogue_conversations_groupid_idx');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('groupid'));
/// Launch add index dialogue_conversations_groupid_idx
$result = $result && add_index($table, $index);
}
if ($result && $oldversion < 2007110800) {
/// Define field grouping to be added to dialogue_conversations
$table = new XMLDBTable('dialogue_conversations');
$field = new XMLDBField('grouping');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'groupid');
/// Launch add field grouping
$result = $result && add_field($table, $field);
/// Define index dialogue_conversations_grouping_idx (not unique) to be added to dialogue_conversations
$table = new XMLDBTable('dialogue_conversations');
$index = new XMLDBIndex('dialogue_conversations_grouping_idx');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('grouping'));
/// Launch add index dialogue_conversations_grouping_idx
$result = $result && add_index($table, $index);
}
if ($result && $oldversion < 2007111401) {
/// Define field timemodified to be added to dialogue_entries
$table = new XMLDBTable('dialogue_entries');
$field = new XMLDBField('timemodified');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', null, null, null, null, null, '0', 'timecreated');
/// Launch add field timemodified
$result = $result && add_field($table, $field);
$result = $result && ($result = execute_sql('UPDATE ' . $CFG->prefix . 'dialogue_entries SET timemodified = timecreated'));
}
if ($result && $oldversion < 2007112200) {
/// Define table dialogue_read to be created
$table = new XMLDBTable('dialogue_read');
/// Adding fields to table dialogue_read
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('entryid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('firstread', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('lastread', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, null);
/// Adding keys to table dialogue_read
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addKeyInfo('dialogueread_entryid_userid_uk', XMLDB_KEY_UNIQUE, array('entryid', 'userid'));
/// Launch create table for dialogue_read
$result = $result && create_table($table);
}
if ($result && $oldversion < 2007112201) {
/// Define field conversationid to be added to dialogue_read
$table = new XMLDBTable('dialogue_read');
$field = new XMLDBField('conversationid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, null, 'lastread');
/// Launch add field conversationid
$result = $result && add_field($table, $field);
/// Define key dialogueread_conversation_fk (foreign) to be added to dialogue_read
$table = new XMLDBTable('dialogue_read');
//.........这里部分代码省略.........
示例14: xmldb_local_upgrade
function xmldb_local_upgrade($oldversion)
{
global $CFG, $db;
$result = true;
$reassigncaps = false;
$resetcustomroles = false;
$resetstickyblocks = false;
// learning path approval status changes
if ($result && $oldversion < 2008091803) {
// fields added to the course table
$table = new XMLDBTable('course');
$field = new XMLDBField('approval_status_id');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, null, null, null, null, null, null, null);
//function setAttributes($type, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $enum=null, $enumvalues=null, $default=null, $previous=null) {
if (!field_exists($table, $field)) {
/// Launch add field shortname
$result = $result && add_field($table, $field);
}
}
if ($oldversion < 2008092100) {
// create the roles we need
$roles = array('superadmin' => array('name' => 'Super Admin', 'description' => 'The highest level site administrator', 'legacy' => 'admin'), 'headteacher' => array('name' => 'Head Teacher', 'description' => 'Oversees the professional development of the teachers at his/her school and other schools that s/he has been assigned to cover.'), 'headeditor' => array('name' => 'Head Editor', 'description' => 'Approves Learning Plans'), 'seniorteacher' => array('name' => 'Senior Teacher', 'description' => 'Has already achieved Participating Teacher and Master Teacher certification and is now pursuing Senior Teacher certification.'), 'masterteacher' => array('name' => 'Master Teacher', 'description' => 'Has already achieved Participating Teacher certification and is now pursuing Master Teacher certification. Is assigned to an Senior Teacher.'), 'participatingteacher' => array('name' => 'Participating Teacher', 'description' => 'Pursuing Participating Teacher certification. Is assigned to an Master Teacher.'), 'translator' => array('name' => 'Translator', 'description' => 'Localizes User Interface'));
foreach ($roles as $shortname => $roledata) {
if (!array_key_exists('legacy', $roledata)) {
$roledata['legacy'] = '';
}
$roles[$shortname]['id'] = create_role($roledata['name'], $shortname, $roledata['description'], $roledata['legacy']);
}
// boostrap superadmin to the same as admin
$admin = get_record('role', 'shortname', 'admin');
role_cap_duplicate($admin, $roles['superadmin']['id']);
}
// try to start over!!!
if ($result && $oldversion < 2008092400) {
$table = new XMLDBTable('course_status_history');
if (table_exists($table)) {
drop_table($table);
}
// fields added to the course table
$table = new XMLDBTable('course');
$field = new XMLDBField('approval_status_id');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, null, null, null, null, null, null, null);
/// Launch add field approval_status_id
if (!field_exists($table, $field)) {
$result = $result && add_field($table, $field);
}
/// Define table mdl_course_approval_status_history to be created
$table = new XMLDBTable('course_status_history');
/// Adding fields to table mdl_course_approval_status
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('timestamp', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('approval_status_id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('reason', XMLDB_TYPE_TEXT, '1000', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$result = $result && create_table($table);
}
if ($oldversion < 2008092401) {
$roles = get_records_select('role', "shortname IN ('headteacher', 'headeditor', 'seniorteacher', 'masterteacher', 'participatingteacher', 'translator')");
set_config('messageenabledroles', implode(',', array_keys($roles)));
}
if ($oldversion < 2008092500) {
// add course classification stuff
$table = new XMLDBTable('classification_type');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, 100, null, XMLDB_NOTNULL);
$table->addFieldInfo('type', XMLDB_TYPE_CHAR, 100, null, XMLDB_NOTNULL, false, true, array('filter', 'topcategory', 'secondcategory'), 'filter');
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$result = $result && create_table($table);
$table = new XMLDBTable('classification_value');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('type', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('value', XMLDB_TYPE_CHAR, 100, null, XMLDB_NOTNULL);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$result = $result && create_table($table);
$table = new XMLDBTable('course_classification');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('course', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('value', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$result = $result && create_table($table);
}
if ($oldversion < 2008092501) {
// bootstrap out classification system based on the TAO website.
$types = array(array('name' => 'Teaching strategies', 'type' => 'filter', 'values' => array('Connected Model', 'Constructivist Model', 'Integrated Model', 'Nested Model', 'Networked/Extended Model', 'Sequenced Model', 'Shared Model')), array('name' => 'Teaching methods', 'type' => 'filter', 'values' => array('Action-Oriented Learning', 'Active video work', 'Ball Bearings', 'Case Study', 'Creative writing', 'Discovery of learning', 'Excursion', 'Experiment', 'Free work', 'Group Puzzle', 'Learning Circle', 'Learning through teaching', 'Letter method', 'Mind mapping', 'Portfolio', 'Project Work', 'SOL method', 'Station Work', 'Traffic Lights', 'Using Tools and Resources', 'Web quest', 'Weekly Plan', 'Workshop', 'Other')), array('name' => 'Learning styles', 'type' => 'filter', 'values' => array('Visual/spatial', 'Verbal/linguistic', 'Logical/mathematical', 'Musical/rhythmic', 'Bodily/kinaesthetic', 'Interpersonal/social', 'Intrapersonal/introspective', 'Communication', 'Information', 'Simulation', 'Presentation', 'Production', 'Visualisation')), array('name' => 'Key Stages', 'type' => 'topcategory', 'values' => array('1 and 2', '3 and 4')), array('name' => 'Subject', 'type' => 'secondcategory', 'values' => array('English', 'Mathematics', 'Science', 'Design and Technology', 'ICT', 'History', 'Geography', 'Art and Design', 'Music', 'Physical Education')));
foreach ($types as $t) {
$values = $t['values'];
$newid = insert_record('classification_type', (object) $t);
foreach ($values as $v) {
insert_record('classification_value', (object) array('type' => $newid, 'value' => $v));
}
}
}
if ($result && $oldversion < 2008100703) {
// change course status values - seemingly have to drop and recreate the table to reset the serial with xmldb
$table = new XMLDBTable('course_approval_status');
if (table_exists($table)) {
drop_table($table);
}
//.........这里部分代码省略.........
示例15: xmldb_podcaster_upgrade
function xmldb_podcaster_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2008022501) {
// allow repositories to be tagged as public
$table = new XMLDBTable('podcaster_repository');
$field = new XMLDBField('public');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'license');
$result = $result && add_field($table, $field);
// metachannel table
$table = new XMLDBTable('podcaster_metachannel');
$table->comment = 'Podcaster meta channels';
$f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, NULL, NULL, NULL);
$f = $table->addFieldInfo('channel', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, NULL, NULL, NULL, NULL, NULL);
$f->comment = 'Associated channel';
$f = $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', NULL, NULL, NULL, NULL, NULL, NULL);
$f->comment = 'Name of meta channel';
$f = $table->addFieldInfo('path', XMLDB_TYPE_CHAR, '255', NULL, NULL, NULL, NULL, NULL, NULL);
$f->comment = '(Local) path of rss feed';
$f = $table->addFieldInfo('target', XMLDB_TYPE_CHAR, '255', NULL, NULL, NULL, true, array('repository', 'course'), NULL);
$f->comment = 'Target';
$f = $table->addFieldInfo('params', XMLDB_TYPE_CHAR, '255', NULL, NULL, NULL, NULL, NULL, NULL);
$f->comment = 'Target params, i.e.: csv list of repositories or course ids';
$f = $table->addFieldInfo('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, NULL, NULL, NULL, NULL, NULL);
$f = $table->addFieldInfo('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, NULL, NULL, NULL, NULL, NULL);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->addIndexInfo('target', XMLDB_INDEX_NOTUNIQUE, array('target'));
// Create the table
$result = $result && create_table($table);
// add a meta channel flag to table podcaster
$table = new XMLDBTable('podcaster');
$field = new XMLDBField('ismeta');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'course');
$result = $result && add_field($table, $field);
$field = new XMLDBField('format');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', NULL, XMLDB_NOTNULL, NULL, NULL, NULL, '', 'repository');
$result = $result && change_field_type($table, $field);
// fix some old field definitions
$table = new XMLDBTable('podcaster_repository');
$field = new XMLDBField('enabled');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'public');
$result = $result && change_field_type($table, $field);
$field = new XMLDBField('isdefault');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'enabled');
$result = $result && change_field_type($table, $field);
$field = new XMLDBField('name');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', NULL, XMLDB_NOTNULL, NULL, NULL, NULL, '', 'id');
$result = $result && change_field_type($table, $field);
$table = new XMLDBTable('podcaster_license');
$field = new XMLDBField('confirm');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'name');
$result = $result && change_field_type($table, $field);
$field = new XMLDBField('isdefault');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'confirm');
$result = $result && change_field_type($table, $field);
$field = new XMLDBField('name');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', NULL, XMLDB_NOTNULL, NULL, NULL, NULL, '', 'id');
$result = $result && change_field_type($table, $field);
$table = new XMLDBTable('podcaster_language');
$field = new XMLDBField('name');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', NULL, XMLDB_NOTNULL, NULL, NULL, NULL, '', 'language');
$result = $result && change_field_type($table, $field);
}
if ($result && $oldversion < 2008022502) {
$table = new XMLDBTable('podcaster');
$field = new XMLDBField('dirty');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'ismeta');
$result = $result && add_field($table, $field);
$table = new XMLDBTable('podcaster_repository');
$field = new XMLDBField('synchronize');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'public');
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008022503) {
$table = new XMLDBTable('podcaster_item');
$field = new XMLDBField('enclosureurl');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', NULL, NULL, NULL, NULL, NULL, '', 'enclosure');
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008022504) {
$table = new XMLDBTable('podcaster');
$field = new XMLDBField('imageurl');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', NULL, NULL, NULL, NULL, NULL, '', 'image');
$result = $result && add_field($table, $field);
$field = new XMLDBField('imagetype');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', NULL, NULL, NULL, NULL, NULL, '', 'imageurl');
$result = $result && add_field($table, $field);
$field = new XMLDBField('imagelength');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, NULL, NULL, NULL, NULL, '0', 'imagetype');
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008022505) {
$table = new XMLDBTable('podcaster_repository');
$field = new XMLDBField('shared');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, NULL, NULL, '0', 'public');
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008022506) {
$table = new XMLDBTable('podcaster');
//.........这里部分代码省略.........