User:Iritscen/PageCountAudit: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(moving note in from WikiFuture before deleting its section)
(table-fying NS page counts)
Line 1: Line 1:
{{update}}
This page looks into the math that is used by MediaWiki to give various page counts.
Note from the 1.31 section of WikiFuture: "The 'comma' value for $wgArticleCountMethod is no longer supported for performance reasons, and installations with this setting will now work as if it was configured with 'any'. Note that we are currently using the 'comma' option, but it appears that 'any' will return the same result, as it counts all pages that are not redirects."


==Magic words==
==Magic words==
Line 13: Line 12:
'''NUMBEROFARTICLES''': {{NUMBEROFARTICLES}}
'''NUMBEROFARTICLES''': {{NUMBEROFARTICLES}}


MW code says: From MW 1.18 on, if the count method global is set to 'link', the software gets a distinct count of the entries in the pagelinks table, "pl_from" field, that match those page ids. In other words, it filters out pages that do not link to other pages (the reasoning presumably being that "those aren't real wiki pages" if they're not connecting to anything else). It also filters out redirects. If the method is set to 'comma', it counts all non-blank pages (yes, really).
MW code says: If the count method global is set to 'link', the software gets a distinct count of the entries in the pagelinks table, "pl_from" field, that match those page ids. In other words, it filters out pages that do not link to other pages (the reasoning presumably being that "those aren't real wiki pages" if they're not connecting to anything else). It also filters out redirects. If the method is set to 'comma', it counts all non-blank pages (yes, really).


Iritscen says: Okay, $wgArticleCountMethod has now been set to 'comma'.
Iritscen says: Okay, $wgArticleCountMethod has now been set to 'comma'. (Note: As of MW 1.31, "The 'comma' value for $wgArticleCountMethod is no longer supported for performance reasons, and installations with this setting will now work as if it was configured with 'any'." It appears that 'any' will return the same result, counting all pages that are not redirects.)


'''PAGESINNS''', AKA PAGESINNAMESPACE: These counts agree with the number of pages displayed for each namespace on the [[Special:AllPages]] page, which provides some much-needed verifiability. However, since Allpages counts redirect pages, that means that PAGESINNS does too. Therefore, we can't use a straight sum of PAGESINNS results as our page count. See final section for the adjusted number.
'''PAGESINNS''', AKA PAGESINNAMESPACE: These counts agree with the number of pages displayed for each namespace on the [[Special:AllPages]] page, which provides some much-needed verifiability. However, since Allpages counts redirect pages, that means that PAGESINNS does too. Therefore, we can't use a straight sum of PAGESINNS results as our page count. See final section for the adjusted number.


PAGESINNS breakdown:
PAGESINNS breakdown:
*Namespace '''{{ns:-2}}''' has ID -2, but we can't get a page count
{| class="wikitable"
*Namespace '''{{ns:-1}}''' has ID -1, but we can't get a page count
! Namespace
*Namespace '''Main''' does not return an ID number, but apparently it's 0, because <nowiki>{{PAGESINNS:0}}</nowiki> returns {{PAGESINNS:0}} pages, which agrees with [[Special:AllPages]]
! ID
*Namespace '''{{ns:1}}''' has ID 1 and {{PAGESINNS:1}} pages
! Page count
*Namespace '''{{ns:2}}''' has ID 2 and {{PAGESINNS:2}} pages
|-
*Namespace '''{{ns:3}}''' has ID 3 and {{PAGESINNS:3}} pages
| Media
*Namespace '''{{ns:4}}''' has ID 4 and {{PAGESINNS:4}} pages
| -2
*Namespace '''{{ns:5}}''' has ID 5 and {{PAGESINNS:5}} pages
| <not available>
*Namespace '''{{ns:6}}''' has ID 6 and {{PAGESINNS:6}} pages
|-
*Namespace '''{{ns:7}}''' has ID 7 and {{PAGESINNS:7}} pages
| Special
*Namespace '''{{ns:8}}''' has ID 8 and {{PAGESINNS:8}} pages
| -1
*Namespace '''{{ns:9}}''' has ID 9 and {{PAGESINNS:9}} pages
| <not available>
*Namespace '''{{ns:10}}''' has ID 10 and {{PAGESINNS:10}} pages
|-
*Namespace '''{{ns:11}}''' has ID 11 and {{PAGESINNS:11}} pages
| Main
*Namespace '''{{ns:12}}''' has ID 12 and {{PAGESINNS:12}} pages
| 0
*Namespace '''{{ns:13}}''' has ID 13 and {{PAGESINNS:13}} pages
| {{PAGESINNS:0}}
*Namespace '''{{ns:14}}''' has ID 14 and {{PAGESINNS:14}} pages
|-
*Namespace '''{{ns:15}}''' has ID 15 and {{PAGESINNS:15}} pages
| Talk
*Namespace '''{{ns:100}}''' has ID 100 and {{PAGESINNS:100}} pages
| 1
*Namespace '''{{ns:101}}''' has ID 101 and {{PAGESINNS:101}} pages
| {{PAGESINNS:1}}
*Namespace '''{{ns:102}}''' has ID 102 and {{PAGESINNS:102}} pages
|-
*Namespace '''{{ns:103}}''' has ID 103 and {{PAGESINNS:103}} pages
| User
*Namespace '''{{ns:104}}''' has ID 104 and {{PAGESINNS:104}} pages
| 2
*Namespace '''{{ns:105}}''' has ID 105 and {{PAGESINNS:105}} pages
| {{PAGESINNS:2}}
*Namespace '''{{ns:108}}''' has ID 108 and {{PAGESINNS:108}} pages
|-
*Namespace '''{{ns:109}}''' has ID 109 and {{PAGESINNS:109}} pages
| User talk
*Namespace '''{{ns:110}}''' has ID 110 and {{PAGESINNS:110}} pages
| 3
*Namespace '''{{ns:111}}''' has ID 111 and {{PAGESINNS:111}} pages
| {{PAGESINNS:3}}
|-
| OniGalore
| 4
| {{PAGESINNS:4}}
|-
| OniGalore talk
| 5
| {{PAGESINNS:5}}
|-
| File
| 6
| {{PAGESINNS:6}}
|-
| File talk
| 7
| {{PAGESINNS:7}}
|-
| MediaWiki
| 8
| {{PAGESINNS:8}}
|-
| MediaWiki talk
| 9
| {{PAGESINNS:9}}
|-
| Template
| 10
| {{PAGESINNS:10}}
|-
| Template talk
| 11
| {{PAGESINNS:11}}
|-
| Help
| 12
| {{PAGESINNS:12}}
|-
| Help talk
| 13
| {{PAGESINNS:13}}
|-
| Category
| 14
| {{PAGESINNS:14}}
|-
| Category talk
| 15
| {{PAGESINNS:15}}
|-
| BSL
| 100
| {{PAGESINNS:100}}
|-
| BSL talk
| 101
| {{PAGESINNS:101}}
|-
| OBD
| 102
| {{PAGESINNS:102}}
|-
| OBD talk
| 103
| {{PAGESINNS:103}}
|-
| AE
| 104
| {{PAGESINNS:104}}
|-
| AE talk
| 105
| {{PAGESINNS:105}}
|-
| Oni2
| 108
| {{PAGESINNS:108}}
|-
| Oni2 talk
| 109
| {{PAGESINNS:109}}
|-
| XML
| 110
| {{PAGESINNS:110}}
|-
| XML talk
| 111
| {{PAGESINNS:111}}
|-
|}


'''All articlespaces''' (without File) totalled using PAGESINNS: {{#expr:{{PAGESINNS:0}}+{{PAGESINNS:2}}+{{PAGESINNS:4}}+{{PAGESINNS:8}}+{{PAGESINNS:10}}+{{PAGESINNS:12}}+{{PAGESINNS:14}}+{{PAGESINNS:100}}+{{PAGESINNS:102}}+{{PAGESINNS:104}}+{{PAGESINNS:108}}+{{PAGESINNS:110}}}}
'''All articlespaces''' (without File) totalled using PAGESINNS: {{#expr:{{PAGESINNS:0}}+{{PAGESINNS:2}}+{{PAGESINNS:4}}+{{PAGESINNS:8}}+{{PAGESINNS:10}}+{{PAGESINNS:12}}+{{PAGESINNS:14}}+{{PAGESINNS:100}}+{{PAGESINNS:102}}+{{PAGESINNS:104}}+{{PAGESINNS:108}}+{{PAGESINNS:110}}}}

Revision as of 20:12, 13 December 2021

This page looks into the math that is used by MediaWiki to give various page counts.

Magic words

These first two magic words provide easy answers to the amount of content on the wiki, but are they accurate and useful?

NUMBEROFPAGES: 4,605

MW code says: Simply count all entries in page table.

Iritscen says: Though problematic in the past, this magic word now matches the grand total (see below) of all PAGESINNS counts, including files and redirects. However, we don't really want to display that catch-all number on our main page.

NUMBEROFARTICLES: 896

MW code says: If the count method global is set to 'link', the software gets a distinct count of the entries in the pagelinks table, "pl_from" field, that match those page ids. In other words, it filters out pages that do not link to other pages (the reasoning presumably being that "those aren't real wiki pages" if they're not connecting to anything else). It also filters out redirects. If the method is set to 'comma', it counts all non-blank pages (yes, really).

Iritscen says: Okay, $wgArticleCountMethod has now been set to 'comma'. (Note: As of MW 1.31, "The 'comma' value for $wgArticleCountMethod is no longer supported for performance reasons, and installations with this setting will now work as if it was configured with 'any'." It appears that 'any' will return the same result, counting all pages that are not redirects.)

PAGESINNS, AKA PAGESINNAMESPACE: These counts agree with the number of pages displayed for each namespace on the Special:AllPages page, which provides some much-needed verifiability. However, since Allpages counts redirect pages, that means that PAGESINNS does too. Therefore, we can't use a straight sum of PAGESINNS results as our page count. See final section for the adjusted number.

PAGESINNS breakdown:

Namespace ID Page count
Media -2 <not available>
Special -1 <not available>
Main 0 740
Talk 1 113
User 2 122
User talk 3 51
OniGalore 4 15
OniGalore talk 5 2
File 6 2,637
File talk 7 17
MediaWiki 8 38
MediaWiki talk 9 0
Template 10 131
Template talk 11 6
Help 12 2
Help talk 13 2
Category 14 191
Category talk 15 6
BSL 100 64
BSL talk 101 6
OBD 102 191
OBD talk 103 36
AE 104 23
AE talk 105 15
Oni2 108 37
Oni2 talk 109 18
XML 110 125
XML talk 111 17

All articlespaces (without File) totalled using PAGESINNS: 1679

All talkspaces totalled using PAGESINNS: 272

All contentspaces (as currently defined in $wgContentNamespaces = {0, 2, 100, 102, 104, 108, 110}) totalled using PAGESINNS: 1302

The grand total for all namespaces (including File) is: 4605

Redirects

There were 305 redirects as of 4/5/13 according to Special:ListRedirects.

Redirect breakdown:

  • Main: 267
  • Talk: 0
  • Help: 1
  • Help talk: 1
  • File: 0
  • File talk: 0
  • AE: 5
  • AE talk: 1
  • BSL: 2
  • BSL talk: 0
  • OBD: 22
  • OBD talk: 0
  • OniGalore: 3
  • Oni2: 3
  • Oni2 talk: 0
  • User: 0
  • User talk: 0
  • XML: 0
  • XML talk: 0

Conclusion

NUMBEROFPAGES is too broad to be useful, but now that the page-count method is 'comma', I am able to reconcile NUMBEROFARTICLES with PAGESINNS. PAGESINNS in turn reconciles with AllPages, which lists each page onscreen and is thus verifiable by a direct count (which I have done in the past). So to see how the math works out, we can get the directly-verifiable count by using PAGESINNS on all "content" namespaces, and then manually subtracting redirects as counted above.

Namespaces Main, User, BSL, OBD, XML, AE, and Oni2 totaled using PAGESINNS: 1302

Minus redirects that I've counted in those namespaces: 1003

At the time of this writing (4/5/13), my personal total is only two higher than the value returned by NUMBEROFARTICLES, which is certainly an acceptable margin of error. So it looks like NUMBEROFARTICLES is reliable!