From 7495e181cef550df0c0d0f4dfff067830a82844c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 8 Dec 2005 11:27:43 +0000 Subject: [PATCH] * (bug 3946) Set page_random to RAND() if it equals 0 --- maintenance/updaters.inc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 97efd978f5..8c669e2ef6 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -672,6 +672,21 @@ function do_watchlist_null() { } +/** + * @bug 3946 + */ +function do_page_random_update() { + global $wgDatabase; + + echo "Setting page_random to a random value on rows where it equals 0..."; + + $page = $wgDatabase->tableName( 'page' ); + $wgDatabase->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", 'do_page_random_update' ); + $rows = $wgDatabase->affectedRows(); + + echo "changed $rows rows\n"; +} + function do_all_updates() { global $wgNewTables, $wgNewFields, $wgRenamedTables; @@ -720,6 +735,8 @@ function do_all_updates() { do_logging_timestamp_index(); flush(); + do_page_random_update(); flush(); + initialiseMessages(); flush(); } -- 2.20.1