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


PHP XMLDBTable::findFieldInArray方法代码示例

本文整理汇总了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);
            //
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:67,代码来源:upgrade.php


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