Add hook to allow extensions to modify the LonelyPages query

First step to solving bug 3483.

Bug: 3483
Change-Id: Ie8c5765ddc6b6028836024c426a0369e6966b25e
This commit is contained in:
kaldari 2014-01-08 11:51:54 -08:00
parent d0554cd521
commit 6e139e0e46
3 changed files with 36 additions and 24 deletions

View file

@ -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

View file

@ -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

View file

@ -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
);
}