Adding updater for new pf_memory field
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 29 Apr 2008 15:13:46 +0000 (15:13 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 29 Apr 2008 15:13:46 +0000 (15:13 +0000)
maintenance/archives/patch-profiling-memory.sql [new file with mode: 0644]
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-profiling-memory.sql b/maintenance/archives/patch-profiling-memory.sql
new file mode 100644 (file)
index 0000000..ddd851e
--- /dev/null
@@ -0,0 +1,2 @@
+ALTER TABLE /*$wgDBprefix*/profiling
+  ADD pf_memory float NOT NULL default 0;
index 936e34f..8eeb212 100644 (file)
@@ -141,6 +141,7 @@ $wgMysqlUpdates = array(
        array( 'add_field', 'user_newtalk',  'user_last_timestamp', 'patch-user_last_timestamp.sql'),
        array( 'do_populate_parent_id' ),
        array( 'check_bin', 'protected_titles', 'pt_title',      'patch-pt_title-encoding.sql', ),
+       array( 'maybe_do_profiling_memory_update' ),
 );
 
 
@@ -980,6 +981,19 @@ function do_categorylinks_indices_update() {
        }
 }
 
+function maybe_do_profiling_memory_update() {
+       global $wgDatabase;
+       if ( !$wgDatabase->tableExists( 'profiling' ) ) {
+               // Simply ignore
+       } elseif ( $wgDatabase->fieldExists( 'profiling', 'pf_memory' ) ) {
+               echo "profiling table has pf_memory field.\n";
+       } else {
+               echo "Adding pf_memory field to table profiling...";
+               dbsource( archive( 'patch-profiling-memory.sql' ), $wgDatabase );
+               echo "ok\n";
+       }
+}
+
 function do_stats_init() {
        // Sometimes site_stats table is not properly populated.
        global $wgDatabase;