Merge "Make Linker::formatLinksInComment format links to other wikis"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 9 Jan 2015 19:34:37 +0000 (19:34 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 9 Jan 2015 19:34:37 +0000 (19:34 +0000)
21 files changed:
includes/installer/Installer.php
includes/installer/MssqlUpdater.php
includes/installer/MysqlUpdater.php
includes/installer/OracleUpdater.php
includes/installer/PostgresUpdater.php
includes/installer/SqliteUpdater.php
includes/specials/SpecialWhatlinkshere.php
languages/i18n/en.json
languages/i18n/qqq.json
maintenance/archives/patch-drop-page_counter.sql [new file with mode: 0644]
maintenance/archives/patch-drop-ss_total_views.sql [new file with mode: 0644]
maintenance/dictionary/mediawiki.dic
maintenance/mssql/tables.sql
maintenance/oracle/tables.sql
maintenance/postgres/compare_schemas.pl
maintenance/postgres/tables.sql
maintenance/sqlite/archives/initial-indexes.sql
maintenance/sqlite/archives/patch-drop-page_counter.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-drop-ss_admins.sql
maintenance/sqlite/archives/patch-drop-ss_total_views.sql [new file with mode: 0644]
maintenance/tables.sql

index 760254d..381f23c 100644 (file)
@@ -674,7 +674,6 @@ abstract class Installer {
                        'site_stats',
                        array(
                                'ss_row_id' => 1,
-                               'ss_total_views' => 0,
                                'ss_total_edits' => 0,
                                'ss_good_articles' => 0,
                                'ss_total_pages' => 0,
index ed11f8b..2d7afc1 100644 (file)
@@ -42,6 +42,9 @@ class MssqlUpdater extends DatabaseUpdater {
 
                        // 1.24
                        array( 'addField', 'page', 'page_lang', 'patch-page-page_lang.sql'),
+                       array( 'dropTable', 'hitcounter' ),
+                       array( 'dropField', 'site_stats', 'ss_total_views', 'patch-drop-ss_total_views.sql' ),
+                       array( 'dropField', 'page', 'page_counter', 'patch-drop-page_counter.sql' ),
                        // Constraint updates
                        array( 'updateConstraints', 'category_types', 'categorylinks', 'cl_type' ),
                        array( 'updateConstraints', 'major_mime', 'filearchive', 'fa_major_mime' ),
index c3dedbc..d7b0dec 100644 (file)
@@ -266,6 +266,9 @@ class MysqlUpdater extends DatabaseUpdater {
                                'patch-oi_major_mime-chemical.sql' ),
                        array( 'modifyField', 'filearchive', 'fa_major_mime',
                                'patch-fa_major_mime-chemical.sql' ),
+                       array( 'dropTable', 'hitcounter' ),
+                       array( 'dropField', 'site_stats', 'ss_total_views', 'patch-drop-ss_total_views.sql' ),
+                       array( 'dropField', 'page', 'page_counter', 'patch-drop-page_counter.sql' ),
                );
        }
 
@@ -516,7 +519,6 @@ class MysqlUpdater extends DatabaseUpdater {
                        page_namespace int NOT NULL,
                        page_title varchar(255) binary NOT NULL,
                        page_restrictions tinyblob NOT NULL,
-                       page_counter bigint(20) unsigned NOT NULL default '0',
                        page_is_redirect tinyint(1) unsigned NOT NULL default '0',
                        page_is_new tinyint(1) unsigned NOT NULL default '0',
                        page_random real unsigned NOT NULL,
@@ -598,9 +600,9 @@ class MysqlUpdater extends DatabaseUpdater {
                $this->output( "......Setting up page table.\n" );
                $this->db->query(
                        "INSERT INTO $page (page_id, page_namespace, page_title,
-                               page_restrictions, page_counter, page_is_redirect, page_is_new, page_random,
+                               page_restrictions, page_is_redirect, page_is_new, page_random,
                                page_touched, page_latest, page_len)
-                       SELECT cur_id, cur_namespace, cur_title, cur_restrictions, cur_counter,
+                       SELECT cur_id, cur_namespace, cur_title, cur_restrictions,
                                cur_is_redirect, cur_is_new, cur_random, cur_touched, rev_id, LENGTH(cur_text)
                        FROM $cur,$revision
                        WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold}",
index 1846854..c731d98 100644 (file)
@@ -102,6 +102,9 @@ class OracleUpdater extends DatabaseUpdater {
 
                        // 1.24
                        array( 'addField', 'page', 'page_lang', 'patch-page-page_lang.sql' ),
+                       array( 'dropTable', 'hitcounter' ),
+                       array( 'dropField', 'site_stats', 'ss_total_views', 'patch-drop-ss_total_views.sql' ),
+                       array( 'dropField', 'page', 'page_counter', 'patch-drop-page_counter.sql' ),
 
                        // KEEP THIS AT THE BOTTOM!!
                        array( 'doRebuildDuplicateFunction' ),
@@ -172,7 +175,6 @@ class OracleUpdater extends DatabaseUpdater {
                        'page_id' => 0,
                        'page_namespace' => 0,
                        'page_title' => ' ',
-                       'page_counter' => 0,
                        'page_is_redirect' => 0,
                        'page_is_new' => 0,
                        'page_random' => 0,
index 9e8ee94..3b1c579 100644 (file)
@@ -418,6 +418,9 @@ class PostgresUpdater extends DatabaseUpdater {
                        array( 'addPgField', 'pagelinks', 'pl_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ),
                        array( 'addPgField', 'templatelinks', 'tl_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ),
                        array( 'addPgField', 'imagelinks', 'il_from_namespace', 'INTEGER NOT NULL DEFAULT 0' ),
+                       array( 'dropTable', 'hitcounter' ),
+                       array( 'dropField', 'site_stats', 'ss_total_views', 'patch-drop-ss_total_views.sql' ),
+                       array( 'dropField', 'page', 'page_counter', 'patch-drop-page_counter.sql' ),
                );
        }
 
index 91cbb04..490cdb7 100644 (file)
@@ -137,6 +137,9 @@ class SqliteUpdater extends DatabaseUpdater {
                        array( 'addField', 'pagelinks', 'pl_from_namespace', 'patch-pl_from_namespace.sql' ),
                        array( 'addField', 'templatelinks', 'tl_from_namespace', 'patch-tl_from_namespace.sql' ),
                        array( 'addField', 'imagelinks', 'il_from_namespace', 'patch-il_from_namespace.sql' ),
+                       array( 'dropTable', 'hitcounter' ),
+                       array( 'dropField', 'site_stats', 'ss_total_views', 'patch-drop-ss_total_views.sql' ),
+                       array( 'dropField', 'page', 'page_counter', 'patch-drop-page_counter.sql' ),
                );
        }
 
index 11ec363..0986103 100644 (file)
@@ -58,6 +58,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                $opts->add( 'hidetrans', false );
                $opts->add( 'hidelinks', false );
                $opts->add( 'hideimages', false );
+               $opts->add( 'invert', false );
 
                $opts->fetchValuesFromRequest( $this->getRequest() );
                $opts->validateIntBounds( 'limit', 0, 5000 );
@@ -125,15 +126,17 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
 
                $useLinkNamespaceDBFields = $this->getConfig()->get( 'UseLinkNamespaceDBFields' );
                $namespace = $this->opts->getValue( 'namespace' );
+               $invert = $this->opts->getValue( 'invert' );
+               $nsComparison = ( $invert ? '!= ' : '= ' ) . $dbr->addQuotes( $namespace );
                if ( is_int( $namespace ) ) {
                        if ( $useLinkNamespaceDBFields ) {
-                               $conds['pagelinks']['pl_from_namespace'] = $namespace;
-                               $conds['templatelinks']['tl_from_namespace'] = $namespace;
-                               $conds['imagelinks']['il_from_namespace'] = $namespace;
+                               $conds['pagelinks'][] = "pl_from_namespace $nsComparison";
+                               $conds['templatelinks'][] = "tl_from_namespace $nsComparison";
+                               $conds['imagelinks'][] = "il_from_namespace $nsComparison";
                        } else {
-                               $conds['pagelinks']['page_namespace'] = $namespace;
-                               $conds['templatelinks']['page_namespace'] = $namespace;
-                               $conds['imagelinks']['page_namespace'] = $namespace;
+                               $conds['pagelinks'][] = "page_namespace $nsComparison";
+                               $conds['templatelinks'][] = "page_namespace $nsComparison";
+                               $conds['imagelinks'][] = "page_namespace $nsComparison";
                        }
                }
 
@@ -419,6 +422,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
 
                $target = $this->target ? $this->target->getPrefixedText() : '';
                $namespace = $this->opts->consumeValue( 'namespace' );
+               $nsinvert = $this->opts->consumeValue( 'invert' );
 
                # Build up the form
                $f = Xml::openElement( 'form', array( 'action' => wfScript() ) );
@@ -450,6 +454,15 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                        )
                );
 
+               $f .= '&#160;' .
+                       Xml::checkLabel(
+                               $this->msg( 'invert' )->text(),
+                               'invert',
+                               'nsinvert',
+                               $nsinvert,
+                               array( 'title' => $this->msg( 'tooltip-whatlinkshere-invert' )->text() )
+                       );
+
                $f .= ' ';
 
                # Submit
index 8712f44..2046929 100644 (file)
        "namespace": "Namespace:",
        "invert": "Invert selection",
        "tooltip-invert": "Check this box to hide changes to pages within the selected namespace (and the associated namespace if checked)",
+       "tooltip-whatlinkshere-invert": "Check this box to hide links from pages within the selected namespace.",
        "namespace_association": "Associated namespace",
        "tooltip-namespace_association": "Check this box to also include the talk or subject namespace associated with the selected namespace",
        "blanknamespace": "(Main)",
index 2b383ec..87e69a1 100644 (file)
        "namespace": "This message is located at [[Special:Contributions]].\n{{Identical|Namespace}}",
        "invert": "Displayed in [[Special:RecentChanges|RecentChanges]], [[Special:RecentChangesLinked|RecentChangesLinked]] and [[Special:Watchlist|Watchlist]].\n\nThis message means \"Invert selection of namespace\".\n\nThis message has a tooltip {{msg-mw|tooltip-invert}}\n{{Identical|Invert selection}}",
        "tooltip-invert": "Used in [[Special:Recentchanges]] as a tooltip for the invert checkbox. See also the message {{msg-mw|invert}}",
+       "tooltip-whatlinkshere-invert": "Used in [[Special:Whatlinkshere]] as a tooltip for the invert checkbox.\n\nSee also:\n* {{msg-mw|tooltip-invert}}\n* {{msg-mw|invert}}",
        "namespace_association": "Used in [[Special:Recentchanges]] with a checkbox which selects the associated namespace to be added to the selected namespace, so that both are searched (or excluded depending on another checkbox selection). The association is between a namespace and its talk namespace.\n\nThis message has a tooltip {{msg-mw|tooltip-namespace association}}",
        "tooltip-namespace_association": "Used in [[Special:Recentchanges]] as a tooltip for the associated namespace checkbox.\n\nSee also:\n* {{msg-mw|Namespace association}}",
        "blanknamespace": "Name for main namespace (blank namespace) in drop-down menus at [[Special:RecentChanges]] and other special pages.\n{{Identical|Main}}",
diff --git a/maintenance/archives/patch-drop-page_counter.sql b/maintenance/archives/patch-drop-page_counter.sql
new file mode 100644 (file)
index 0000000..1d8e701
--- /dev/null
@@ -0,0 +1,2 @@
+-- field is deprecated and no longer updated as of 1.25
+ALTER TABLE /*_*/page DROP COLUMN page_counter;
diff --git a/maintenance/archives/patch-drop-ss_total_views.sql b/maintenance/archives/patch-drop-ss_total_views.sql
new file mode 100644 (file)
index 0000000..0059193
--- /dev/null
@@ -0,0 +1,2 @@
+-- field is deprecated and no longer updated as of 1.24
+ALTER TABLE /*_*/site_stats DROP COLUMN ss_total_views;
\ No newline at end of file
index c6281fd..dd27c8c 100644 (file)
@@ -1811,7 +1811,6 @@ historysubmit
 historywarning
 hit
 hitcount
-hitcounter
 hits
 hlist
 hmac
index b9cd715..5b09ffd 100644 (file)
@@ -111,7 +111,6 @@ CREATE TABLE /*_*/page (
    page_namespace INT          NOT NULL,
    page_title     NVARCHAR(255)  NOT NULL,
    page_restrictions NVARCHAR(255) NOT NULL,
-   page_counter BIGINT            NOT NULL DEFAULT 0,
    page_is_redirect BIT           NOT NULL DEFAULT 0,
    page_is_new BIT                NOT NULL DEFAULT 0,
    page_random real     NOT NULL DEFAULT RAND(),
@@ -422,9 +421,6 @@ CREATE TABLE /*_*/site_stats (
   -- The single row should contain 1 here.
   ss_row_id int NOT NULL,
 
-  -- Total number of page views, if hit counters are enabled.
-  ss_total_views bigint default 0,
-
   -- Total number of edits performed.
   ss_total_edits bigint default 0,
 
@@ -452,18 +448,6 @@ CREATE TABLE /*_*/site_stats (
 CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id);
 
 
---
--- Stores an ID for every time any article is visited;
--- depending on $wgHitcounterUpdateFreq, it is
--- periodically cleared and the page_counter column
--- in the page table updated for all the articles
--- that have been visited.)
---
-CREATE TABLE /*_*/hitcounter (
-  hc_id int NOT NULL
-);
-
-
 --
 -- The internet is full of jerks, alas. Sometimes it's handy
 -- to block a vandal or troll account.
index 36be16e..12f6518 100644 (file)
@@ -69,7 +69,6 @@ CREATE TABLE &mw_prefix.page (
   page_namespace     NUMBER       DEFAULT 0 NOT NULL,
   page_title         VARCHAR2(255)           NOT NULL,
   page_restrictions  VARCHAR2(255),
-  page_counter       NUMBER         DEFAULT 0 NOT NULL,
   page_is_redirect   CHAR(1)           DEFAULT '0' NOT NULL,
   page_is_new        CHAR(1)           DEFAULT '0' NOT NULL,
   page_random        NUMBER(15,14) NOT NULL,
@@ -247,7 +246,6 @@ CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui02 ON &mw_prefix.iwlinks (iwl_prefix, i
 
 CREATE TABLE &mw_prefix.site_stats (
   ss_row_id         NUMBER  NOT NULL ,
-  ss_total_views    NUMBER            DEFAULT 0,
   ss_total_edits    NUMBER            DEFAULT 0,
   ss_good_articles  NUMBER            DEFAULT 0,
   ss_total_pages    NUMBER            DEFAULT -1,
@@ -257,10 +255,6 @@ CREATE TABLE &mw_prefix.site_stats (
 );
 CREATE UNIQUE INDEX &mw_prefix.site_stats_u01 ON &mw_prefix.site_stats (ss_row_id);
 
-CREATE TABLE &mw_prefix.hitcounter (
-  hc_id  NUMBER  NOT NULL
-);
-
 CREATE SEQUENCE ipblocks_ipb_id_seq;
 CREATE TABLE &mw_prefix.ipblocks (
   ipb_id                NUMBER      NOT NULL,
index 53aeb14..bb08237 100755 (executable)
@@ -395,7 +395,6 @@ ss_active_users  bigint INTEGER
 ss_good_articles bigint INTEGER
 ss_total_edits   bigint INTEGER
 ss_total_pages   bigint INTEGER
-ss_total_views   bigint INTEGER
 ss_users         bigint INTEGER
 
 ## True IP - keep an eye on these, coders tend to make textual assumptions
index 400050e..5391bd9 100644 (file)
@@ -81,7 +81,6 @@ CREATE TABLE page (
   page_namespace     SMALLINT       NOT NULL,
   page_title         TEXT           NOT NULL,
   page_restrictions  TEXT,
-  page_counter       BIGINT         NOT NULL  DEFAULT 0,
   page_is_redirect   SMALLINT       NOT NULL  DEFAULT 0,
   page_is_new        SMALLINT       NOT NULL  DEFAULT 0,
   page_random        NUMERIC(15,14) NOT NULL  DEFAULT RANDOM(),
@@ -262,7 +261,6 @@ CREATE INDEX langlinks_lang_title    ON langlinks (ll_lang,ll_title);
 
 CREATE TABLE site_stats (
   ss_row_id         INTEGER  NOT NULL  UNIQUE,
-  ss_total_views    INTEGER            DEFAULT 0,
   ss_total_edits    INTEGER            DEFAULT 0,
   ss_good_articles  INTEGER            DEFAULT 0,
   ss_total_pages    INTEGER            DEFAULT -1,
@@ -272,10 +270,6 @@ CREATE TABLE site_stats (
   ss_images         INTEGER            DEFAULT 0
 );
 
-CREATE TABLE hitcounter (
-  hc_id  BIGINT  NOT NULL
-);
-
 
 CREATE SEQUENCE ipblocks_ipb_id_seq;
 CREATE TABLE ipblocks (
index 954c85d..f322a03 100644 (file)
@@ -69,7 +69,6 @@ CREATE TABLE /*_*/page_tmp (
   page_namespace int NOT NULL,
   page_title varchar(255) binary NOT NULL,
   page_restrictions tinyblob NOT NULL,
-  page_counter bigint unsigned NOT NULL default 0,
   page_is_redirect tinyint unsigned NOT NULL default 0,
   page_is_new tinyint unsigned NOT NULL default 0,
   page_random real unsigned NOT NULL,
@@ -164,7 +163,6 @@ CREATE INDEX /*i*/ll_lang_title ON /*_*/langlinks_tmp (ll_lang, ll_title);
 
 CREATE TABLE /*_*/site_stats_tmp (
   ss_row_id int unsigned NOT NULL,
-  ss_total_views bigint unsigned default 0,
   ss_total_edits bigint unsigned default 0,
   ss_good_articles bigint unsigned default 0,
   ss_total_pages bigint default '-1',
diff --git a/maintenance/sqlite/archives/patch-drop-page_counter.sql b/maintenance/sqlite/archives/patch-drop-page_counter.sql
new file mode 100644 (file)
index 0000000..ac8151d
--- /dev/null
@@ -0,0 +1,31 @@
+-- field is deprecated and no longer updated as of 1.25
+CREATE TABLE /*_*/page_tmp (
+  page_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+  page_namespace int NOT NULL,
+  page_title varchar(255) binary NOT NULL,
+  page_restrictions tinyblob NOT NULL,
+  page_is_redirect tinyint unsigned NOT NULL default 0,
+  page_is_new tinyint unsigned NOT NULL default 0,
+  page_random real unsigned NOT NULL,
+  page_touched binary(14) NOT NULL default '',
+  page_links_updated varbinary(14) NULL default NULL,
+  page_latest int unsigned NOT NULL,
+  page_len int unsigned NOT NULL,
+  page_content_model varbinary(32) DEFAULT NULL,
+  page_lang varbinary(35) DEFAULT NULL
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/page_tmp
+  SELECT page_id, page_namespace, page_title, page_restrictions, page_is_redirect,
+    page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len,
+    page_content_model, page_lang
+  FROM /*_*/page;
+
+DROP TABLE /*_*/page;
+
+ALTER TABLE /*_*/page_tmp RENAME TO /*_*/page;
+
+CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title);
+CREATE INDEX /*i*/page_random ON /*_*/page (page_random);
+CREATE INDEX /*i*/page_len ON /*_*/page (page_len);
+CREATE INDEX /*i*/page_redirect_namespace_len ON /*_*/page (page_is_redirect, page_namespace, page_len);
index 9951e17..3960663 100644 (file)
@@ -1,7 +1,6 @@
 -- field is deprecated and no longer updated as of 1.5
 CREATE TABLE /*_*/site_stats_tmp (
   ss_row_id int unsigned NOT NULL,
-  ss_total_views bigint unsigned default 0,
   ss_total_edits bigint unsigned default 0,
   ss_good_articles bigint unsigned default 0,
   ss_total_pages bigint default '-1',
@@ -11,7 +10,7 @@ CREATE TABLE /*_*/site_stats_tmp (
 ) /*$wgDBTableOptions*/;
 
 INSERT INTO /*_*/site_stats_tmp
-       SELECT ss_row_id, ss_total_views, ss_total_edits, ss_good_articles,
+       SELECT ss_row_id, ss_total_edits, ss_good_articles,
                ss_total_pages, ss_users, ss_active_users, ss_images
                FROM /*_*/site_stats;
 
diff --git a/maintenance/sqlite/archives/patch-drop-ss_total_views.sql b/maintenance/sqlite/archives/patch-drop-ss_total_views.sql
new file mode 100644 (file)
index 0000000..ad80988
--- /dev/null
@@ -0,0 +1,21 @@
+-- field is deprecated and no longer updated as of 1.25
+CREATE TABLE /*_*/site_stats_tmp (
+  ss_row_id int unsigned NOT NULL,
+  ss_total_edits bigint unsigned default 0,
+  ss_good_articles bigint unsigned default 0,
+  ss_total_pages bigint default '-1',
+  ss_users bigint default '-1',
+  ss_active_users bigint default '-1',
+  ss_images int default 0
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/site_stats_tmp
+  SELECT ss_row_id, ss_total_edits, ss_good_articles, ss_total_pages,
+    ss_users, ss_active_users, ss_images
+  FROM /*_*/site_stats;
+
+DROP TABLE /*_*/site_stats;
+
+ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;
+
+CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id);
index caf8ecc..112ac05 100644 (file)
@@ -241,9 +241,6 @@ CREATE TABLE /*_*/page (
   -- can move or edit the page.
   page_restrictions tinyblob NOT NULL,
 
-  -- Number of times this page has been viewed.
-  page_counter bigint unsigned NOT NULL default 0,
-
   -- 1 indicates the article is a redirect.
   page_is_redirect tinyint unsigned NOT NULL default 0,
 
@@ -704,9 +701,6 @@ CREATE TABLE /*_*/site_stats (
   -- The single row should contain 1 here.
   ss_row_id int unsigned NOT NULL,
 
-  -- Total number of page views, if hit counters are enabled.
-  ss_total_views bigint unsigned default 0,
-
   -- Total number of edits performed.
   ss_total_edits bigint unsigned default 0,
 
@@ -733,19 +727,6 @@ CREATE TABLE /*_*/site_stats (
 -- Pointless index to assuage developer superstitions
 CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id);
 
-
---
--- Stores an ID for every time any article is visited;
--- depending on $wgHitcounterUpdateFreq, it is
--- periodically cleared and the page_counter column
--- in the page table updated for all the articles
--- that have been visited.)
---
-CREATE TABLE /*_*/hitcounter (
-  hc_id int unsigned NOT NULL
-) ENGINE=MEMORY MAX_ROWS=25000;
-
-
 --
 -- The internet is full of jerks, alas. Sometimes it's handy
 -- to block a vandal or troll account.