本文整理汇总了PHP中XMLDBField类的典型用法代码示例。如果您正苦于以下问题:PHP XMLDBField类的具体用法?PHP XMLDBField怎么用?PHP XMLDBField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XMLDBField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: xmldb_assignment_upgrade
function xmldb_assignment_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2007072200) {
require_once $CFG->dirroot . '/mod/assignment/lib.php';
// too much debug output
$db->debug = false;
assignment_update_grades();
$db->debug = true;
}
if ($result && $oldversion < 2007091900) {
/// MDL-11268
/// Changing nullability of field data1 on table assignment_submissions to null
$table = new XMLDBTable('assignment_submissions');
$field = new XMLDBField('data1');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'numfiles');
/// Launch change of nullability for field data1
$result = $result && change_field_notnull($table, $field);
/// Changing nullability of field data2 on table assignment_submissions to null
$field = new XMLDBField('data2');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'data1');
/// Launch change of nullability for field data2
$result = $result && change_field_notnull($table, $field);
}
return $result;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:27,代码来源:upgrade.php
示例2: xmldb_ezproxy_upgrade
function xmldb_ezproxy_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 < 2009042403) {
/// Rebuild the course cache of every course which uses one of these modules in it to get
/// the new link.
if ($courseids = get_records_menu('ezproxy', '', '', 'course ASC', 'id, course')) {
/// Just get the unique course ID values.
$courseids = array_unique(array_values($courseids));
if (!empty($courseids)) {
require_once $CFG->dirroot . '/course/lib.php';
foreach ($courseids as $courseid) {
rebuild_course_cache($courseid);
// Does not return a bool
}
}
}
}
if ($result && $oldversion < 2009042404) {
$table = new XMLDBTable('ezproxy');
$field = new XMLDBField('serverurl');
$field->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, '', 'name');
$result = change_field_type($table, $field);
}
return $result;
}
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:31,代码来源:upgrade.php
示例3: xmldb_groupselect_upgrade
function xmldb_groupselect_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2009020600) {
/// Define field signuptype to be added to groupselect
$table = new XMLDBTable('groupselect');
$field = new XMLDBField('signuptype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'intro');
$result = $result && add_field($table, $field);
/// Define field timecreated to be added to groupselect
$table = new XMLDBTable('groupselect');
$field = new XMLDBField('timecreated');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timedue');
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2009030500) {
/// Define field targetgrouping to be added to groupselect
$table = new XMLDBTable('groupselect');
$field = new XMLDBField('targetgrouping');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
$result = $result && add_field($table, $field);
}
return $result;
}
开发者ID:rwijaya,项目名称:moodle-mod_groupselect,代码行数:25,代码来源:upgrade.php
示例4: xmldb_qtype_dragdrop_upgrade
function xmldb_qtype_dragdrop_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
/// }
// Add a field so that question authors can choose in how many columns
// the drag and drop media is arranged.
if ($result && $oldversion < 2008060501) {
$table = new XMLDBTable('question_dragdrop');
$field = new XMLDBField('arrangemedia');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0, 'feedbackmissed');
$result = $result && add_field($table, $field);
}
// Add a field so that question authors can choose where to place the media
// below or right beside the background.
if ($result && $oldversion < 2008060502) {
$table = new XMLDBTable('question_dragdrop');
$field = new XMLDBField('placemedia');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0, 'arrangemedia');
$result = $result && add_field($table, $field);
}
return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:29,代码来源:upgrade.php
示例5: xmldb_assignment_upgrade
function xmldb_assignment_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2007091900) {
/// MDL-11268
/// Changing nullability of field data1 on table assignment_submissions to null
$table = new XMLDBTable('assignment_submissions');
$field = new XMLDBField('data1');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'numfiles');
/// Launch change of nullability for field data1
$result = $result && change_field_notnull($table, $field);
/// Changing nullability of field data2 on table assignment_submissions to null
$field = new XMLDBField('data2');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'data1');
/// Launch change of nullability for field data2
$result = $result && change_field_notnull($table, $field);
}
if ($result && $oldversion < 2007091902) {
// add draft tracking default to existing upload assignments
$sql = "UPDATE {$CFG->prefix}assignment SET var4=1 WHERE assignmenttype='upload'";
$result = execute_sql($sql);
}
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2007101511) {
notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
// change grade typo to text if no grades MDL-13920
require_once $CFG->dirroot . '/mod/assignment/lib.php';
// too much debug output
$db->debug = false;
assignment_update_grades();
$db->debug = true;
}
return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:35,代码来源:upgrade.php
示例6: xmldb_block_file_manager_upgrade
function xmldb_block_file_manager_upgrade($oldversion = 0)
{
/// This function does anything necessary to upgrade
/// older versions to match current functionality
$result = true;
if ($result && $oldversion < 2008061700) {
/// Define field ownertype to be added to fmanager_link
$table = new XMLDBTable('fmanager_link');
$field = new XMLDBField('ownertype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'owner');
/// Launch add field ownertype
$result = $result && add_field($table, $field);
/// Define field ownertype to be added to fmanager_categories
$table = new XMLDBTable('fmanager_categories');
$field = new XMLDBField('ownertype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'owner');
/// Launch add field ownertype
$result = $result && add_field($table, $field);
/// Define field ownertype to be added to fmanager_folders
$table = new XMLDBTable('fmanager_folders');
$field = new XMLDBField('ownertype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'owner');
/// Launch add field ownertype
$result = $result && add_field($table, $field);
/// Define field ownertype to be added to fmanager_shared
$table = new XMLDBTable('fmanager_shared');
$field = new XMLDBField('ownertype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'owner');
/// Launch add field ownertype
$result = $result && add_field($table, $field);
}
return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:33,代码来源:upgrade.php
示例7: xmldb_ilpconcern_upgrade
function xmldb_ilpconcern_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
/// And upgrade begins here. For each one, you'll need one
if ($result && $oldversion < 2008072501) {
/// Define field courserelated to be added to ilptarget_posts
$table = new XMLDBTable('ilpconcern_posts');
$field = new XMLDBField('courserelated');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'course');
/// Launch add field courserelated
$result = $result && add_field($table, $field);
$field = new XMLDBField('targetcourse');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'courserelated');
/// Launch add field targetcourse
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008072200) {
/// Define field course to be added to ilptarget_posts
$table = new XMLDBTable('ilpconcern_status');
$field = new XMLDBField('modifiedbyuser');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'modified');
/// Launch add field course
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008052800) {
/// Define field course to be added to ilptarget_posts
$table = new XMLDBTable('ilpconcern_posts');
$field = new XMLDBField('course');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'setbyuserid');
/// Launch add field course
$result = $result && add_field($table, $field);
}
return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:35,代码来源:upgrade.php
示例8: xmldb_artefact_comment_upgrade
function xmldb_artefact_comment_upgrade($oldversion = 0)
{
$success = true;
if ($oldversion < 2011011201) {
$table = new XMLDBTable('artefact_comment_comment');
$field = new XMLDBField('rating');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED);
$success = $success && add_field($table, $field);
}
if ($oldversion < 2013072400) {
$table = new XMLDBTable('artefact_comment_comment');
$field = new XMLDBField('lastcontentupdate');
$field->setAttributes(XMLDB_TYPE_DATETIME);
$success = $success && add_field($table, $field);
$success = $success && execute_sql('update {artefact_comment_comment} acc
set lastcontentupdate = (
select a.mtime
from {artefact} a
where a.id = acc.artefact
)');
}
if ($oldversion < 2015081000) {
// Set default maxindent for threaded comments
set_config_plugin('artefact', 'comment', 'maxindent', 5);
}
return $success;
}
开发者ID:rboyatt,项目名称:mahara,代码行数:27,代码来源:upgrade.php
示例9: xmldb_wwassignment_upgrade
function xmldb_wwassignment_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
/// }
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2008092818) {
//Define field grade to be added to wwassignment
$table = new XMLDBTable('wwassignment');
$field = new XMLDBField('grade');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'webwork_set');
/// Launch add field grade
$result = $result && add_field($table, $field);
/// Define field timemodified to be added to wwassignment
$table = new XMLDBTable('wwassignment');
$field = new XMLDBField('timemodified');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grade');
/// Launch add field timemodified to wwassignment_bridge
$result = $result && add_field($table, $field);
//notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
// change grade typo to text if no grades MDL-13920
//require_once $CFG->dirroot.'/mod/wwassignment/lib.php';
// too much debug output
//$db->debug = false;
//wwassignment_update_grades();
//$db->debug = true;
}
return $result;
}
开发者ID:bjornbe,项目名称:wwassignment,代码行数:35,代码来源:upgrade.php
示例10: xmldb_block_accessibility_upgrade
function xmldb_block_accessibility_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 < 2009082500) {
/// Define field colourscheme to be added to accessibility
$table = new XMLDBTable('accessibility');
$field = new XMLDBField('colourscheme');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'fontsize');
/// Launch add field colourscheme
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2009071000) {
/// Changing type of field fontsize on table accessibility to number
$table = new XMLDBTable('accessibility');
$field = new XMLDBField('fontsize');
$field->setAttributes(XMLDB_TYPE_NUMBER, '4, 1', XMLDB_UNSIGNED, null, null, null, null, null, 'userid');
/// Launch change of type for field fontsize
$result = $result && change_field_type($table, $field);
}
return $result;
}
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:26,代码来源:upgrade.php
示例11: xmldb_artefact_resume_upgrade
function xmldb_artefact_resume_upgrade($oldversion = 0)
{
$status = true;
if ($oldversion < 2009122100) {
$table = new XMLDBTable('artefact_resume_employmenthistory');
$field = new XMLDBField('employeraddress');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('institutionaddress');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
}
if ($oldversion < 2010020300) {
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('qualtype');
$field->setAttributes(XMLDB_TYPE_TEXT);
change_field_notnull($table, $field);
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('qualname');
$field->setAttributes(XMLDB_TYPE_TEXT);
change_field_notnull($table, $field);
}
if ($oldversion < 2013071300) {
$table = new XMLDBTable('artefact_resume_book');
$field = new XMLDBField('url');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
}
if ($oldversion < 2013072900) {
execute_sql("UPDATE {blocktype_installed_category} SET category = 'internal' WHERE category = 'resume'");
}
return $status;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:34,代码来源:upgrade.php
示例12: xmldb_block_task_list_upgrade
function xmldb_block_task_list_upgrade($oldversion = 0)
{
$result = true;
if ($result and $oldversion < 2007011501) {
/// Define field format to be added to block_task_list
$table = new XMLDBTable('block_task_list');
$field = new XMLDBField('format');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'name');
/// Launch add field format
$result = $result and add_field($table, $field);
}
if ($result and $oldversion < 2007011503) {
/// Manually remove bad capabilities
$result = $result and delete_records('capabilities', 'name', 'block/tast_list:manage');
$result = $result and delete_records('capabilities', 'name', 'block/tast_list:checkofftasks');
}
if ($result and $oldversion < 2007011505) {
//TODO: The info field might be able to be removed, as it doesn't seem to be used anywhere, but in the meantime, change it to allow nulls
/// Changing nullability of field info on table block_task_list to allow null
$table = new XMLDBTable('block_task_list');
$field = new XMLDBField('info');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'checked');
/// Launch change of nullability for field info
$result = $result && change_field_notnull($table, $field);
}
return $result;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:27,代码来源:upgrade.php
示例13: xmldb_ilptarget_upgrade
function xmldb_ilptarget_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2008052906) {
/// Define field name to be added to ilptarget_posts
$table = new XMLDBTable('ilptarget_posts');
$field = new XMLDBField('name');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'data2');
/// Launch add field name
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008052904) {
/// Define field courserelated to be added to ilptarget_posts
$table = new XMLDBTable('ilptarget_posts');
$field = new XMLDBField('courserelated');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'course');
/// Launch add field courserelated
$result = $result && add_field($table, $field);
$field = new XMLDBField('targetcourse');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'courserelated');
/// Launch add field targetcourse
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008052902) {
/// Define field course to be added to ilptarget_posts
$table = new XMLDBTable('ilptarget_posts');
$field = new XMLDBField('course');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'setbyuserid');
/// Launch add field course
$result = $result && add_field($table, $field);
}
return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:34,代码来源:upgrade.php
示例14: xmldb_report_customsql_upgrade
/**
* Database upgrade script for the custom SQL report.
*
* @package report_customsql
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function xmldb_report_customsql_upgrade($oldversion = 0)
{
global $CFG, $db;
$result = true;
if ($result && $oldversion < 2009102802) {
/// Define field runable to be added to report_customsql_queries
$table = new XMLDBTable('report_customsql_queries');
$field = new XMLDBField('runable');
$field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'manual', 'lastexecutiontime');
/// Launch add field runable
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2009102900) {
/// Define field singlerow to be added to report_customsql_queries
$table = new XMLDBTable('report_customsql_queries');
$field = new XMLDBField('singlerow');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'runable');
/// Launch add field singlerow
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2009103000) {
/// Changing the default of field lastrun on table report_customsql_queries to 0
$table = new XMLDBTable('report_customsql_queries');
$field = new XMLDBField('lastrun');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'capability');
/// Launch change of default for field lastrun
$result = $result && change_field_default($table, $field);
}
return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:37,代码来源:upgrade.php
示例15: xmldb_block_student_gradeviewer_upgrade
function xmldb_block_student_gradeviewer_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2010070912) {
/// Define field opt to be dropped from block_teacher_referral_opt
$table = new XMLDBTable('block_teacher_referral_opt');
// First let's drop the index
$index = new XMLDBIndex('bloc_tea_usesec_uix');
$index->setAttributes(XMLDB_INDEX_UNIQUE, array('usersid', 'sectionsid'));
$failing_field = new XMLDBField('failing');
$lagging_field = new XMLDBField('lagging');
$usersid_field = new XMLDBField('usersid');
/// Launch drop field opt
$result = $result && drop_index($table, $index) && drop_field($table, $usersid_field) && drop_field($table, $lagging_field) && drop_field($table, $failing_field);
// Add the following fields
$fields = array('sectionsid', 'primary_instructor', 'non_primary_instructor', 'student', 'non_primary_control');
foreach (range(1, count($fields) - 1) as $index) {
$field = new XMLDBField($fields[$index]);
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', $fields[$index - 1]);
$result = $result && add_field($table, $field);
}
$index = new XMLDBIndex('bloc_tea_usesec_uix');
$index->setAttributes(XMLDB_INDEX_UNIQUE, array('sectionsid'));
$result = $result && add_index($table, $index);
}
return $result;
}
开发者ID:rrusso,项目名称:EARS,代码行数:28,代码来源:upgrade.php
示例16: xmldb_search_elasticsearch_upgrade
function xmldb_search_elasticsearch_upgrade($oldversion = 0)
{
if ($oldversion < 2015012800) {
// Adding indices on the table search_elasticsearch_queue
$table = new XMLDBTable('search_elasticsearch_queue');
$index = new XMLDBIndex('itemidix');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('itemid'));
add_index($table, $index);
}
if ($oldversion < 2015060900) {
log_debug('Add "status" and "lastprocessed" columns to search_elasticsearch_queue table');
$table = new XMLDBTable('search_elasticsearch_queue');
$field = new XMLDBField('status');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
$table = new XMLDBTable('search_elasticsearch_queue');
$field = new XMLDBField('lastprocessed');
$field->setAttributes(XMLDB_TYPE_DATETIME);
add_field($table, $field);
$table = new XMLDBTable('search_elasticsearch_queue');
$index = new XMLDBIndex('statusix');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('status'));
add_index($table, $index);
}
if ($oldversion < 2015072700) {
log_debug('Adding ability to search by "Text" blocks in elasticsearch');
// Need to add the 'block_instance' to the default types to index for elasticsearch
// Note: the $cfg->plugin_search_elasticsearch_types can be overriding this
// We don't want to run the re-indexing now as that will take ages for large sites
// It should be run from the Extensions -> Elasticsearch -> Configuration page
if ($types = get_field('search_config', 'value', 'plugin', 'elasticsearch', 'field', 'types')) {
$types = explode(',', $types);
if (!in_array('block_instance', $types)) {
$types[] = 'block_instance';
}
$types = implode(',', $types);
update_record('search_config', array('value' => $types), array('plugin' => 'elasticsearch', 'field' => 'types'));
log_warn(get_string('newindextype', 'search.elasticsearch', 'block_instance'), true, false);
}
}
if ($oldversion < 2015100800) {
log_debug('Adding ability to search by collection in elasticsearch');
// The code for this existed since the beginning but 'collection' was not
// added to the $cfg->plugin_search_elasticsearch_types
// We don't want to run the re-indexing now as that will take ages for large sites
// It should be run from the Extensions -> Elasticsearch -> Configuration page
if ($types = get_field('search_config', 'value', 'plugin', 'elasticsearch', 'field', 'types')) {
$types = explode(',', $types);
if (!in_array('collection', $types)) {
$types[] = 'collection';
}
$types = implode(',', $types);
update_record('search_config', array('value' => $types), array('plugin' => 'elasticsearch', 'field' => 'types'));
log_warn(get_string('newindextype', 'search.elasticsearch', 'collection'), true, false);
}
}
return true;
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:58,代码来源:upgrade.php
示例17: xmldb_hotquestion_upgrade
function xmldb_hotquestion_upgrade($oldversion = 0)
{
global $CFG, $DB;
$result = true;
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2007040100) {
/// Define field course to be added to hotquestion
$table = new XMLDBTable('hotquestion');
$field = new XMLDBField('course');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id');
/// Launch add field course
$result = $result && $table->add_field($field);
/// Define field intro to be added to hotquestion
$field = new xmldb_field('intro');
$field->set_attributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null, null, null, 'name');
/// Launch add field intro
$result = $result && $table->add_field($field);
/// Define field introformat to be added to hotquestion
$field = new xmldb_field('introformat');
$field->set_attributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
/// Launch add field introformat
$result = $result && $table->add_field($field);
}
if ($result && $oldversion < 2007040101) {
/// Define field timecreated to be added to hotquestion
$table = new xmldb_table('hotquestion');
$field = new xmldb_field('timecreated');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'introformat');
/// Launch add field timecreated
$result = $result && $table->add_field($field);
$field = new xmldb_field('timemodified');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timecreated');
/// Launch add field timemodified
$result = $result && $table->add_field($table, $field);
/// Define index course (not unique) to be added to hotquestion
$result = $result && $table->add_index('course', XMLDB_INDEX_NOTUNIQUE, array('course'));
}
if ($result && $oldversion < 2007040200) {
/// Add some actions to get them properly displayed in the logs
$rec = new stdClass();
$rec->module = 'hotquestion';
$rec->action = 'add';
$rec->mtable = 'hotquestion';
$rec->filed = 'name';
/// Insert the add action in log_display
$result = $DB->insert_record('log_display', $rec);
/// Now the update action
$rec->action = 'update';
$result = $DB->insert_record('log_display', $rec);
/// Now the view action
$rec->action = 'view';
$result = $DB->insert_record('log_display', $rec);
}
//===== 2.0 upgrade start here ======//
return $result;
}
开发者ID:hgthirty,项目名称:moodle-mod_hotquestion,代码行数:56,代码来源:upgrade.php
示例18: xmldb_interaction_forum_upgrade
function xmldb_interaction_forum_upgrade($oldversion = 0)
{
if ($oldversion < 2009062300) {
foreach (array('topic', 'forum') as $type) {
log_debug("Subscription upgrade for {$type}s");
// Add missing primary key to the subscription tables
// Step 1: remove duplicates
if ($dupes = get_records_sql_array('
SELECT "user", ' . $type . ', COUNT(*)
FROM {interaction_forum_subscription_' . $type . '}
GROUP BY "user", ' . $type . '
HAVING COUNT(*) > 1', array())) {
// We found duplicate subscriptions to a topic/forum
foreach ($dupes as $dupe) {
log_debug("interaction.forum: Removing duplicate {$type} subscription for {$dupe->user}");
delete_records('interaction_forum_subscription_' . $type, 'user', $dupe->user, $type, $dupe->{$type});
insert_record('interaction_forum_subscription_' . $type, (object) array('user' => $dupe->user, $type => $dupe->{$type}));
}
}
// Step 2: add the actual key
$table = new XMLDBTable('interaction_forum_subscription_' . $type);
$key = new XMLDBKey('primary');
$key->setAttributes(XMLDB_KEY_PRIMARY, array('user', $type));
add_key($table, $key);
// Add a 'key' column, used for unsubscriptions
$field = new XMLDBField('key');
$field->setAttributes(XMLDB_TYPE_CHAR, 50, XMLDB_UNSIGNED, null);
add_field($table, $field);
$key = new XMLDBKey('keyuk');
$key->setAttributes(XMLDB_KEY_UNIQUE, array('key'));
add_key($table, $key);
// Populate the key column
if ($records = get_records_array('interaction_forum_subscription_' . $type, '', '', '', '"user", ' . $type)) {
foreach ($records as $where) {
$new = (object) array('user' => $where->user, $type => $where->{$type}, 'key' => dechex(mt_rand()));
update_record('interaction_forum_subscription_' . $type, $new, $where);
}
}
// Now make the key column not null
$field->setAttributes(XMLDB_TYPE_CHAR, 50, XMLDB_UNSIGNED, XMLDB_NOTNULL);
change_field_notnull($table, $field);
}
}
if ($oldversion < 2009081700) {
if (!get_record('interaction_config', 'plugin', 'forum', 'field', 'postdelay')) {
insert_record('interaction_config', (object) array('plugin' => 'forum', 'field' => 'postdelay', 'value' => 30));
}
}
if ($oldversion < 2009081800) {
$subscription = (object) array('plugin' => 'forum', 'event' => 'creategroup', 'callfunction' => 'create_default_forum');
ensure_record_exists('interaction_event_subscription', $subscription, $subscription);
}
return true;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:54,代码来源:upgrade.php
示例19: xmldb_block_accessibility_upgrade
function xmldb_block_accessibility_upgrade($oldversion = 0)
{
global $CFG, $THEME, $DB;
$dbman = $DB->get_manager();
$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 < 2009071000) {
// Changing type of field fontsize on table accessibility to number
$table = new XMLDBTable('accessibility');
$field = new XMLDBField('fontsize');
$field->setAttributes(XMLDB_TYPE_NUMBER, '4, 1', XMLDB_UNSIGNED, null, null, null, null, null, 'userid');
// Launch change of type for field fontsize
$result = $result && $dbman->change_field_type($table, $field);
upgrade_block_savepoint(true, 2009071000, 'accessibility');
}
if ($result && $oldversion < 2009082500) {
// Define field colourscheme to be added to accessibility
$table = new xmldb_table('accessibility');
$field = new xmldb_field('colourscheme', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'fontsize');
// Launch add field colourschemea
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_block_savepoint(true, 2009082500, 'accessibility');
}
if ($oldversion < 2010121500) {
// Define field autoload_atbar to be added to accessibility
$table = new xmldb_table('accessibility');
$cs = new xmldb_field('colourscheme', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'fontsize');
$field = new xmldb_field('autoload_atbar', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'colourscheme');
if (!$dbman->field_exists($table, $cs)) {
$dbman->add_field($table, $cs);
}
// Conditionally launch add field autoload_atbar
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// accessibility savepoint reached
upgrade_block_savepoint(true, 2010121500, 'accessibility');
}
if ($oldversion < 2011122000) {
// Define table accessibility to be renamed to block_accessibility
$table = new xmldb_table('accessibility');
// Launch rename table for accessibility
$dbman->rename_table($table, 'block_accessibility');
// accessibility savepoint reached
upgrade_block_savepoint(true, 2011122000, 'accessibility');
}
return $result;
}
开发者ID:bystrikondica,项目名称:actnow,代码行数:53,代码来源:upgrade.php
示例20: xmldb_blocktype_externalfeed_upgrade
function xmldb_blocktype_externalfeed_upgrade($oldversion = 0)
{
if ($oldversion < 2008042100) {
// Add the 'image' column so that information about a feed's image can
// be stored
$table = new XMLDBTable('blocktype_externalfeed_data');
$field = new XMLDBField('image');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
}
return true;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:12,代码来源:upgrade.php
注:本文中的XMLDBField类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论