From: Alexandre Emsenhuber Date: Tue, 29 Apr 2008 15:13:46 +0000 (+0000) Subject: Adding updater for new pf_memory field X-Git-Tag: 1.31.0-rc.0~48009 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=440947b4875d9e1c2b44077f9ba73ff797c8bcb7;p=lhc%2Fweb%2Fwiklou.git Adding updater for new pf_memory field --- diff --git a/maintenance/archives/patch-profiling-memory.sql b/maintenance/archives/patch-profiling-memory.sql new file mode 100644 index 0000000000..ddd851e1e9 --- /dev/null +++ b/maintenance/archives/patch-profiling-memory.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*$wgDBprefix*/profiling + ADD pf_memory float NOT NULL default 0; diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 936e34fa8e..8eeb212f60 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -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;