Page MenuHomePhabricator

Kill $wgAllowPageInfo; enable MediaWiki's info action by default
Closed, ResolvedPublic

Description

As documented at https://www.mediawiki.org/wiki/Requests_for_comment/Reimplement_info_action, the info action in MediaWiki was disabled by Tim in r4247 by putting it behind the global variable $wgAllowPageInfo and setting this global to false by default.

Now with years of hindsight, it's become clear that a more generic solution should have been used (e.g., $wgDisabledActions), however this bug is about killing (or deprecating) $wgAllowPageInfo and enabling action=info by default.

This requires marking the global as unused in DefaultSettings.php, removing the conditional code that relies on this global variable (fortunately it's not used in many places), and then disabling the expensive portions of the info action that caused the action to be flatly disabled so many years ago (namely disabling any properties that rely on unoptimized queries).

Relying on $wgMiserMode is one option. Another option is to introduce an array such as $wgDisabledInfoActionProperties or introduce another binary global such as $wgDisableExpensiveInfoActionProperties, though I'm very hesitant to add a binary global variable again.


Version: unspecified
Severity: normal

Details

Reference
bz38451

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:46 AM
bzimport set Reference to bz38451.
bzimport added a subscriber: Unknown Object (MLST).

We can MiserMode and call $dbw->estimateRowCount on the bad queries... ;)

The only really slow query is the distinct revision count, but even then this isn't too bad.

page_counter is useless for WMF usage... And is half based on $wgDisableCounters

https://gerrit.wikimedia.org/r/#/c/15840/
https://gerrit.wikimedia.org/r/#/c/15844/

mysql> explain select count(*) from watchlist where wl_title = 'Barack_Obama' AND wl_namespace = '0';
+----+-------------+-----------+------+-----------------+-----------------+---------+-------------+------+--------------------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

+----+-------------+-----------+------+-----------------+-----------------+---------+-------------+------+--------------------------+

1SIMPLEwatchlistrefnamespace_titlenamespace_title261const,const4060Using where; Using index

+----+-------------+-----------+------+-----------------+-----------------+---------+-------------+------+--------------------------+
1 row in set (0.00 sec)

mysql> select count(*) from watchlist where wl_title = 'Barack_Obama' AND wl_namespace = '0';
+----------+

count(*)

+----------+

2234

+----------+
1 row in set (0.00 sec)

mysql> select count(*) from watchlist where wl_namespace = '0' AND wl_title = 'Barack_Obama';
+----------+

count(*)

+----------+

2234

+----------+
1 row in set (0.00 sec)

mysql> select * from page where page_namespace = 0 and page_title = 'Barack_Obama';
+---------+----------------+--------------+-------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+

page_idpage_namespacepage_titlepage_restrictionspage_counterpage_is_redirectpage_is_newpage_randompage_touchedpage_latestpage_len

+---------+----------------+--------------+-------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+

5343660Barack_Obama0000.37939150462820120717194453502845086203903

+---------+----------------+--------------+-------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+
1 row in set (0.00 sec)

mysql> explain select count(rev_page) from revision where rev_page = 534366;
+----+-------------+----------+------+------------------------+----------------+---------+-------+-------+-------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

+----+-------------+----------+------+------------------------+----------------+---------+-------+-------+-------------+

1SIMPLErevisionrefPRIMARY,page_timestamppage_timestamp4const17160Using index

+----+-------------+----------+------+------------------------+----------------+---------+-------+-------+-------------+
1 row in set (0.00 sec)

mysql> select count(rev_page) from revision where rev_page = 534366;
+-----------------+

count(rev_page)

+-----------------+

22257

+-----------------+
1 row in set (0.01 sec)

mysql> explain select COUNT(DISTINCT rev_user_text) from revision where rev_page = 534366;
+----+-------------+----------+-------+------------------------+---------+---------+------+-------+-------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

+----+-------------+----------+-------+------------------------+---------+---------+------+-------+-------------+

1SIMPLErevisionrangePRIMARY,page_timestampPRIMARY4NULL38318Using where

+----+-------------+----------+-------+------------------------+---------+---------+------+-------+-------------+
1 row in set (0.02 sec)

mysql> select COUNT(DISTINCT rev_user_text) from revision where rev_page = 534366;
+-------------------------------+

COUNT(DISTINCT rev_user_text)

+-------------------------------+

5923

+-------------------------------+
1 row in set (1.03 sec)

mysql> select page_counter from revision where rev_page = 534366;
ERROR 1054 (42S22): Unknown column 'page_counter' in 'field list'
mysql> select page_counter from page where page_id = 534366;
+--------------+

page_counter

+--------------+

0

+--------------+
1 row in set (0.00 sec)

mysql> select * from page where page_id = 534366;
+---------+----------------+--------------+-------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+

page_idpage_namespacepage_titlepage_restrictionspage_counterpage_is_redirectpage_is_newpage_randompage_touchedpage_latestpage_len

+---------+----------------+--------------+-------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+

5343660Barack_Obama0000.37939150462820120717194453502845086203903

+---------+----------------+--------------+-------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+
1 row in set (0.00 sec)