Skip to content

Commit

Permalink
Merge branch 'MDL-25793' of git://github.com/samhemelryk/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jan 10, 2011
2 parents ff14fd7 + d481e2a commit 742d877
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
61 changes: 61 additions & 0 deletions mod/wiki/db/upgrade.php
Expand Up @@ -36,6 +36,36 @@
*
*/

/**
*
* TODO LIST:
*
* 1. Add needed fields to wiki table. DONE
* 2. Rename other wiki tables. DONE
* 3. Create new wiki tables. DONE BUT NOT FINISHED, WATING FOR NEW TABLES
* 4. Move/Adapt/Transform configurations info to new structure
* 5. Migrate wiki entries to subwikis. DONE
* 6. Fill pages table with latest versions of every page. DONE
* 7. Migrate page history to new table (transforming formats). DONE, BUT STILL WORKING
* 8. Fill links table
* 9. Drop useless information
*
* ADITIONAL THINGS AFTER CHAT WITH ELOY:
*
* 1. addField is deprecated. DONE
* 2. Fix SQL error at block 3. DONE
* 3. Merge set_field_select with previous update sentence. DONE
* 4. Don't insert id fields on database (it won't work on mssql, oracle, pg). DONE.
* 5. Use upgrade_set_timeout function.
* 6. Use grafic of progess
*
* OTHER THINGS:
*
* 1. Use recordset instead of record when migrating historic
* 2. Select only usefull data on block 06
*
* @global moodle_database $DB
*/
function xmldb_wiki_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;

Expand Down Expand Up @@ -323,6 +353,37 @@ function xmldb_wiki_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2010102800, 'wiki');
}

if ($oldversion < 2011011000) {
// Fix wiki in the post table after upgrade from 1.9
$table = new xmldb_table('wiki');

// name should default to Wiki
$field = new xmldb_field('name', XMLDB_TYPE_CHAR, 255, null, XMLDB_NOTNULL, null, 'Wiki', 'course');
if ($dbman->field_exists($table, $field)) {
$dbman->change_field_default($table, $field);
}

// timecreated field is missing after 1.9 upgrade
$field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'introformat');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// timemodified field is missing after 1.9 upgrade
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'timecreated');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// scaleid is not there any more
$field = new xmldb_field('scaleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', null);
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}

upgrade_mod_savepoint(true, 2011011000, 'wiki');
}

// TODO: Will hold the old tables so we will have chance to fix problems
// Will remove old tables once migrating 100% stable
// Step 10: delete old tables
Expand Down
2 changes: 1 addition & 1 deletion mod/wiki/version.php
Expand Up @@ -33,6 +33,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$module->version = 2010122700; // The current module version (Date: YYYYMMDDXX)
$module->version = 2011011000; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2010080300;
$module->cron = 0; // Period for cron to check this module (secs)

0 comments on commit 742d877

Please sign in to comment.