array( 'maybe_do_profiling_memory_update' ),
array( 'do_filearchive_indices_update' ),
array( 'update_password_format' ),
+
+ // 1.14
+ array( 'add_field', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
+ array( 'do_active_users_init' )
);
}
}
+function do_active_users_init() {
+ global $wgDatabase;
+ $activeUsers = $wgDatabase->selectField( 'site_stats', 'ss_active_users', false, __METHOD__ );
+ if( $activeUsers == -1 ) {
+ $activeUsers = $wgDatabase->selectField( 'recentchanges',
+ 'COUNT( DISTINCT rc_user_text )',
+ array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers'" ), __METHOD__
+ );
+ $wgDatabase->update( 'site_stats',
+ array( 'ss_active_users' => intval($activeUsers) ),
+ array( 'ss_row_id' => 1 ), __METHOD__, array( 'LIMIT' => 1 )
+ );
+ }
+ echo( "...ss_active_users user count set...\n" );
+}
+
function purge_cache() {
global $wgDatabase;
# We can't guarantee that the user will be able to use TRUNCATE,
array("archive", "ar_page_id", "INTEGER"),
array("archive", "ar_parent_id", "INTEGER"),
array("image", "img_sha1", "TEXT NOT NULL DEFAULT ''"),
- array("ipblocks", "ipb_anon_only", "CHAR NOT NULL DEFAULT '0'"),
+ array("ipblocks", "ipb_anon_only", "SMALLINT NOT NULL DEFAULT '0'"),
array("ipblocks", "ipb_by_text", "TEXT NOT NULL DEFAULT ''"),
- array("ipblocks", "ipb_block_email", "CHAR NOT NULL DEFAULT '0'"),
- array("ipblocks", "ipb_create_account", "CHAR NOT NULL DEFAULT '1'"),
+ array("ipblocks", "ipb_block_email", "SMALLINT NOT NULL DEFAULT '0'"),
+ array("ipblocks", "ipb_create_account", "SMALLINT NOT NULL DEFAULT '1'"),
array("ipblocks", "ipb_deleted", "SMALLINT NOT NULL DEFAULT 0"),
- array("ipblocks", "ipb_enable_autoblock", "CHAR NOT NULL DEFAULT '1'"),
+ array("ipblocks", "ipb_enable_autoblock", "SMALLINT NOT NULL DEFAULT '1'"),
array("filearchive", "fa_deleted", "SMALLINT NOT NULL DEFAULT 0"),
array("logging", "log_deleted", "SMALLINT NOT NULL DEFAULT 0"),
array("logging", "log_id", "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('log_log_id_seq')"),
array("revision", "rev_len", "INTEGER"),
array("revision", "rev_deleted", "SMALLINT NOT NULL DEFAULT 0"),
array("user_newtalk", "user_last_timestamp", "TIMESTAMPTZ"),
+ array("site_stats", "ss_active_users", "INTEGER DEFAULT '-1'"),
+ array("revision", "rev_parent_id", "INTEGER DEFAULT NULL"),
);
$wgDatabase->query("CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)");
}
else
- echo "... index \"pagelink_unique_index\" aready exists\n";
+ echo "... index \"pagelink_unique_index\" already exists\n";
if (pg_fkey_deltype("revision_rev_user_fkey") == 'r') {
echo "... constraint \"revision_rev_user_fkey\" is ON DELETE RESTRICT\n";
dbsource(archive('patch-revision_rev_user_fkey.sql'));
}
+ # Fix ipb_address index
+ if (pg_index_exists('ipblocks', 'ipb_address_unique' )) {
+ echo "... have ipb_address_unique\n";
+ } else {
+ echo "Adding ipb_address_unique index\n";
+ dbsource(archive('patch-ipb_address_unique.sql'));
+ }
+
global $wgExtNewTables, $wgExtPGNewFields, $wgExtNewIndexes;
# Add missing extension tables
foreach ( $wgExtNewTables as $nt ) {