X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateArticleCount.inc.php;h=a847a2edb1e75cfb5afcc9cd8769736fc503a14c;hb=abfd4695a05e6ca0725e782f009ee95d986f46dd;hp=de19191eb2961f090dc17de2aa286e4f58bd650d;hpb=087a9f70c5c152b72dc6c539cf64e334a0f2d029;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateArticleCount.inc.php b/maintenance/updateArticleCount.inc.php index de19191eb2..a847a2edb1 100644 --- a/maintenance/updateArticleCount.inc.php +++ b/maintenance/updateArticleCount.inc.php @@ -38,7 +38,8 @@ class ArticleCounter { function makeSql() { list( $page, $pagelinks ) = $this->dbr->tableNamesN( 'page', 'pagelinks' ); $nsset = $this->makeNsSet(); - return "SELECT DISTINCT page_namespace,page_title FROM $page,$pagelinks " . + return "SELECT COUNT(DISTINCT page_namespace, page_title) AS pagecount " . + "FROM $page, $pagelinks " . "WHERE pl_from=page_id and page_namespace IN ( $nsset ) " . "AND page_is_redirect = 0 AND page_len > 0"; } @@ -50,15 +51,9 @@ class ArticleCounter { */ function count() { $res = $this->dbr->query( $this->makeSql(), __METHOD__ ); - if( $res ) { - $count = $this->dbr->numRows( $res ); - $this->dbr->freeResult( $res ); - return $count; - } else { - # Look out for this when handling the result - # - Actually it's unreachable, !$res throws an exception -- TS - return false; - } + $row = $this->dbr->fetchObject( $res ); + $this->dbr->freeResult( $res ); + return $row->pagecount; } }