From: kaldari Date: Wed, 8 Jan 2014 19:51:54 +0000 (-0800) Subject: Add hook to allow extensions to modify the LonelyPages query X-Git-Tag: 1.31.0-rc.0~17331^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=6e139e0e4683d9f5caf45c72fa3b1c606bb6927e;p=lhc%2Fweb%2Fwiklou.git Add hook to allow extensions to modify the LonelyPages query First step to solving bug 3483. Bug: 3483 Change-Id: Ie8c5765ddc6b6028836024c426a0369e6966b25e --- diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 8dd9923c55..8dfbb5f7a8 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -42,6 +42,8 @@ production. * (bug 56033) Add content model to the page information. * Added Article::MissingArticleConditions hook to give extensions a chance to hide their (unrelated) log entries. +* Added LonelyPagesQuery hook to let extensions modify the query used to + generate Special:LonelyPages. * Added $wgOpenSearchDefaultLimit defining the default number of entries to show on action=opensearch API call. * For namespaces with $wgNamespaceProtection (including the MediaWiki diff --git a/docs/hooks.txt b/docs/hooks.txt index ebc412b655..bc09da7a0d 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1595,6 +1595,12 @@ $paramArray: Array of parameters that corresponds to logging.log_params field. &$revert: string that is displayed in the UI, similar to $comment. $time: timestamp of the log entry (added in 1.12) +'LonelyPagesQuery': Allow extensions to modify the query used by +Special:LonelyPages. +&$tables: tables to join in the query +&$conds: conditions for the query +&$joinConds: join conditions for the query + 'MaintenanceRefreshLinksInit': before executing the refreshLinks.php maintenance script. $refreshLinks: RefreshLinks object diff --git a/includes/specials/SpecialLonelypages.php b/includes/specials/SpecialLonelypages.php index 7c7771d723..f533234f28 100644 --- a/includes/specials/SpecialLonelypages.php +++ b/includes/specials/SpecialLonelypages.php @@ -49,36 +49,40 @@ class LonelyPagesPage extends PageQueryPage { } function getQueryInfo() { - return array( - 'tables' => array( - 'page', 'pagelinks', - 'templatelinks' + $tables = array( 'page', 'pagelinks', 'templatelinks' ); + $conds = array( + 'pl_namespace IS NULL', + 'page_namespace' => MWNamespace::getContentNamespaces(), + 'page_is_redirect' => 0, + 'tl_namespace IS NULL' + ); + $joinConds = array( + 'pagelinks' => array( + 'LEFT JOIN', array( + 'pl_namespace = page_namespace', + 'pl_title = page_title' + ) ), + 'templatelinks' => array( + 'LEFT JOIN', array( + 'tl_namespace = page_namespace', + 'tl_title = page_title' + ) + ) + ); + + // Allow extensions to modify the query + wfRunHooks( 'LonelyPagesQuery', array( &$tables, &$conds, &$joinConds ) ); + + return array( + 'tables' => $tables, 'fields' => array( 'namespace' => 'page_namespace', 'title' => 'page_title', 'value' => 'page_title' ), - 'conds' => array( - 'pl_namespace IS NULL', - 'page_namespace' => MWNamespace::getContentNamespaces(), - 'page_is_redirect' => 0, - 'tl_namespace IS NULL' - ), - 'join_conds' => array( - 'pagelinks' => array( - 'LEFT JOIN', array( - 'pl_namespace = page_namespace', - 'pl_title = page_title' - ) - ), - 'templatelinks' => array( - 'LEFT JOIN', array( - 'tl_namespace = page_namespace', - 'tl_title = page_title' - ) - ) - ) + 'conds' => $conds, + 'join_conds' => $joinConds ); }