Extension talk:CategoryHits

From mediawiki.org
Latest comment: 13 years ago by Beta M in topic Different namespaces

Different namespaces[edit]

Firstly, i'd like to say that this is a good extension, and i'm happy that it was created. But there was a problem that it only counted Main namespace (0), and i wanted it to do more, hence i've done the following:

        $namespaces = 'page_namespace = '.NS_MAIN.
                ' OR page_namespace = '.NS_GALLERY.
                ' OR page_namespace = '.NS_IMAGE.
                ' OR page_namespace = '.NS_TEXT.
                ' OR page_namespace = '.NS_VIDEO;
        $query = 'select cl_to, sum(page_counter)pcount, count(page_id)pages from ' .
        '(select * from ' . $dbr->tableName('categorylinks') .
        ' left join (select page_id, page_namespace, page_title, page_counter from ' .
        $dbr->tableName('page') . ' where '.$namespaces.')mypages on cl_from = page_id ' .
        'order by cl_to asc)mytemptable group by cl_to order by pcount desc ';

I hope this will be helpful, perhaps i'll even make it configurable. Beta M 10:20, 12 June 2010 (UTC)Reply