* Fixed linking in Namespace pages

* added paramters to cli interface
  --page={pagename}   only process that page
  --log : show some output about the process
  --debug : show debug output in cli
* changed pagecount on SpecialPage to use COUNT instead of selecting all rows
This commit is contained in:
c0nnex
2015-10-02 02:35:47 +02:00
parent 70c679f757
commit 124e92aafd
3 changed files with 95 additions and 36 deletions

View File

@@ -105,7 +105,7 @@ class SpecialLinkTitles extends SpecialPage {
else
{
// No end index was given. Therefore, count pages now.
$end = $this->countPages($dbr);
$end = $this->countPages($dbr, $namespacesClause );
};
array_key_exists('r', $postValues) ?
@@ -128,7 +128,7 @@ class SpecialLinkTitles extends SpecialPage {
// Iterate through the pages; break if a time limit is exceeded.
foreach ( $res as $row ) {
$curTitle = Title::makeTitle( $row->page_namespace, $row->page_title);
$curTitle = Title::makeTitleSafe( $row->page_namespace, $row->page_title);
LinkTitles::processPage($curTitle, $this->getContext());
$start += 1;
@@ -279,16 +279,17 @@ EOF
/// Counts the number of pages in a read-access wiki database ($dbr).
/// @param $dbr Read-only `Database` object.
/// @returns Number of pages in the default namespace (0) of the wiki.
private function countPages(&$dbr) {
private function countPages(&$dbr, $namespacesClause) {
$res = $dbr->select(
'page',
'page_id',
array('pagecount' => "COUNT(page_id)"),
array(
'page_namespace = 0',
'page_namespace IN ' . $namespacesClause,
),
__METHOD__
);
return $res->numRows();
return $res->current()->pagecount;
}
}