[Mediawiki-l] When and how {{NUMBEROFARTICLES}} calculates results

Mark Krenz mark at suso.org
Tue Sep 12 13:36:38 UTC 2006


  Ok, I'm going to go on a small rant and also offer a solution to this.

  I too have found that the NUMBEROFARTICLES count is just wrong and
confusing.  For there to be a limit in bytes or any other qualifier is
silly.  I can understand that the article count is only based on
articles in the "Main space" and ones that aren't redirects.  For there
to be qualifications for what is an article in the "Main space" just
confuses people.  It should be a user configurable setting, like:

$ArticleQual_Bytes = 10;                # 10 bytes required
$ArticleQual_CategoryRequired = "true"; # Must be in category
$ArticleQual_IncludeInternalLink = "true";
$ArticleQual_IncludeImage = "true";

and so on.

  As one of the maintainers of Bloomingpedia (http://www.bloomingpedia.org/),
I couldn't rely on the article count so I had to create a special page
called PageCreateOrder that would give me an accurate count based on
this query:

 "SELECT 'PageCreateOrder' AS type, a.page_namespace AS namespace, a.page_title AS title,
   UNIX_TIMESTAMP(MIN(b.rev_timestamp)) AS value, rev_user_text
   FROM $page a, $revision b
   WHERE a.page_id=b.rev_page AND a.page_namespace=".NS_MAIN." AND a.page_is_redirect=0
   GROUP BY page_id";


  So this query only requires that articles be in the main namespace and
not a redirecting page.  If you want the full code, go here:

http://www.bloomingpedia.org/otherstuff/SpecialPageCreateOrder.php.txt

  The way mediawiki calculates the NUMBEROFARTICLES count is much
different and trying to trace back how its calculated is not
trivial. From looking at the code the count is stored in a column called
ss_good_articles in the table sitestats and it recalculates that every
time there is an edit, essentially determining if the article being
edited has "moved into the realm of becoming an article".  I can
understand that this may be more efficient, but its done in such a
complex way that it probably has bugs.

  I think it would be easy enough to create a new variable called
REALNUMBEROFARTICLES that calculates the real number based on my query
above.  I have a wiki with over 1200 articles and it only takes 0.07
seconds to run that query, so performance isn't a big deal.  Although I
guess it might be on wikipedia and other very large wikis.  But just
don't use it there if that's the case.
 


On Tue, Sep 12, 2006 at 10:30:46AM GMT, Filip Maljkovic [dungodung at gmail.com] said the following:
> Are you sure the articles you're making are *really* articles. Remember, 
> pages are only counted as articles if they contain an internal link, 
> category, image (i.e. they have "[["). Can you confirm that the new 
> articles you've been adding contain at least one double bracket pair and 
> are longer than a sentence (I think that there's a limit in bytes, too).
> 
> Filip
> 
> ?erých Jakub wrote:
> > Sorry {{NUMBEROFARTICLES}} is the right name of variable.
> >
> >
> >   
> >> I'm little bit confused by the {{NUMBEROFPAGES}} variable. 
> >> When I insert it
> >> to article on my MediaWiki server, it shows much less pages, 
> >> then there is in
> >> reality. When I add new article, it is not updated (it is not 
> >> problem of
> >> cached page). 
> >>
> >> Does anybody know how it calculates # of pages, how to 
> >> refresh it and if it
> >> is possible calculate atricle numbers separately in each namespace?
> >>
> >> Thanks for any help
> >>
> >> (MW which was moved from the old server to the new one and 
> >> updated from MW
> >> 1.6.8 to MW 1.7 at the same time)
> >>
> >> Jakub   
> 
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l


-- 
Mark Krenz
Bloomingpedia - A City Wiki for Bloomington, Indiana.
http://www.bloomingpedia.org/



More information about the MediaWiki-l mailing list