本文整理匯總了PHP中XMLDBTable::findFieldInArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLDBTable::findFieldInArray方法的具體用法?PHP XMLDBTable::findFieldInArray怎麽用?PHP XMLDBTable::findFieldInArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XMLDBTable
的用法示例。
在下文中一共展示了XMLDBTable::findFieldInArray方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: xmldb_wiki_upgrade
//.........這裏部分代碼省略.........
$field = new XMLDBField('evaluation');
$field->setAttributes(XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, '', 'groupid');
$result = add_field($table, $field);
// OLD SENTENCES
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki` ADD `studentmode` tinyint(1) NOT NULL default 0');
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki` ADD `teacherdiscussion` int(1) NOT NULL default 0');
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki` ADD `studentdiscussion` int(1) NOT NULL default 0');
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki` ADD `editanothergroup` tinyint(1) not null default 0');
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki` ADD `editanotherstudent` tinyint(1) not null default 0');
//
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki_pages` ADD `evaluation` MEDIUMTEXT default NULL AFTER `groupid`');
} else {
$table = new XMLDBTable('wiki_pages');
$field = new XMLDBField('evaluation');
$field->setAttributes(XMLDB_TYPE_TEXT, 'medium', null, null, null, null, null, '', 'ownerid');
$result = add_field($table, $field);
// OLD SENTENCE
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki_pages` ADD `evaluation` MEDIUMTEXT default NULL AFTER `ownerid`');
}
$table = new XMLDBTable('wiki');
$field = new XMLDBField('evaluation');
$field->setAttributes(XMLDB_TYPE_CHAR, '40', null, null, null, null, null, 'noeval', 'studentdiscussion');
$result = $result && add_field($table, $field);
$field = new XMLDBField('notetype');
$field->setAttributes(XMLDB_TYPE_CHAR, '40', null, null, null, null, null, 'quant', 'evaluation');
$result = $result && add_field($table, $field);
// OLD SENTECES
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki` ADD `evaluation` varchar(40) default "noeval" AFTER `studentdiscussion`');
// execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki` ADD `notetype` varchar(40) default "quant" AFTER `evaluation`');
}
if ($result && $oldversion < 2006060702 && empty($fromoldwiki)) {
//make sure we don't have ownerid in the DB (backward compatibility)
$table = new XMLDBTable('wiki_pages');
$field = $table->findFieldInArray('ownerid');
if (empty($field)) {
$field = new XMLDBField('ownerid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'groupid');
$result = add_field($table, $field);
$key = new XMLDBKey('wiki_pages_uk');
$key->setAttributes(XMLDB_KEY_UNIQUE, array('pagename', 'version', 'dfwiki', 'groupid', 'userid'));
$result = $result && drop_key($table, $key);
$key = new XMLDBKey('wiki_pages_uk');
$key->setAttributes(XMLDB_KEY_UNIQUE, array('pagename', 'version', 'dfwiki', 'groupid', 'userid', 'ownerid'));
$result = $result && add_key($table, $key);
$table = new XMLDBTable('wiki_synonymous');
$field = new XMLDBField('userid');
$result = $result && drop_field($table, $field);
$field = new XMLDBField('ownerid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', null);
$result = $result && add_field($table, $field);
$key = new XMLDBKey('wiki_synonymous_uk');
$result = $result && drop_key($table, $key);
$key = new XMLDBKey('wiki_synonymous_uk');
$key->setAttributes(XMLDB_KEY_UNIQUE, array('syn', 'dfwiki', 'groupid', 'ownerid'));
$result = $result && add_key($table, $key);
// OLD SENTENCES
// //make sure we don't have ownerid in the DB (backward compatibility)
// if(!get_records_sql('SELECT ownerid FROM '.$CFG->prefix.'wiki_pages LIMIT 0 , 30')){
// //adding new ownerid replacing userid
//- execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki_pages` ADD `ownerid` int(10) unsigned not null default 0 AFTER `groupid`');
//- execute_sql(" ALTER TABLE {$CFG->prefix}wiki_synonymous DROP userid;",false);
//- execute_sql('ALTER TABLE `'.$CFG->prefix.'wiki_synonymous` ADD `ownerid` int(10) unsigned not null default 0');
//
//- execute_sql(" ALTER TABLE {$CFG->prefix}wiki_pages DROP KEY wiki_pages_uk;",false);
//- execute_sql(" ALTER TABLE {$CFG->prefix}wiki_pages ADD UNIQUE KEY wiki_pages_uk (pagename, version, dfwiki, groupid, userid, ownerid);",false);
//