mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Completed postgres binary upgrade block for wiki module
This commit is contained in:
parent
a83f9d2264
commit
08e1fad13f
@ -127,10 +127,22 @@ function wiki_upgrade($oldversion) {
|
||||
|
||||
if ($oldversion < 2006032900) {
|
||||
global $db;
|
||||
$data = $db->GetAll("SELECT id,refs FROM {$CFG->prefix}wiki_pages");
|
||||
table_column("wiki_pages",'','content_base64','text');
|
||||
table_column("wiki_pages",'','refs_base64','text');
|
||||
$olddebug = $db->debug;
|
||||
$db->debug = false;
|
||||
$data = $db->GetAll("SELECT id,content,refs FROM {$CFG->prefix}wiki_pages");
|
||||
foreach ($data as $d) {
|
||||
$db->AutoExecute("{$CFG->prefix}wiki_pages", array('refs_base64' => base64_encode($d['refs'])), 'UPDATE', 'id = '.$d['id']);
|
||||
$db->AutoExecute("{$CFG->prefix}wiki_pages", array('refs_base64' => base64_encode($d['refs']), 'content_base64' => base64_encode($d['content'])), 'UPDATE', 'id = '.$d['id']);
|
||||
}
|
||||
$db->debug = $olddebug;
|
||||
execute_sql("ALTER TABLE {$CFG->prefix}wiki_pages DROP COLUMN content");
|
||||
execute_sql("ALTER TABLE {$CFG->prefix}wiki_pages DROP COLUMN refs");
|
||||
table_column("wiki_pages",'','content','bytea');
|
||||
table_column("wiki_pages",'','refs','bytea');
|
||||
execute_sql("UPDATE {$CFG->prefix}wiki_pages SET refs = decode(refs_base64, 'base64'), content = decode(content_base64, 'base64')");
|
||||
execute_sql("ALTER TABLE {$CFG->prefix}wiki_pages DROP COLUMN content_base64");
|
||||
execute_sql("ALTER TABLE {$CFG->prefix}wiki_pages DROP COLUMN refs_base64");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user