Extension:PageAssessments

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
PageAssessments
Release status: stable
Implementation Parser function, Database
Description An extension for storing article assessments (e.g. for WikiProjects) in a new database table.
Author(s) Niharika Kohli
Frances Hocutt
Ryan Kaldari
Database changes Yes
Tables page_assessments
page_assessments_projects
License GNU General Public License 2.0 or later
Download
Parameters
$wgPageAssessmentsOnTalkPages Whether to expect assessments on talk pages or article pages. Default: true (i.e. use talk pages).
Translate the PageAssessments extension if it is available at translatewiki.net
Check usage and version matrix.
Issues Open tasks · Report a bug

This extension is for storing article assessments (e.g. for WikiProjects) in a structured and query-able way. For an example of how article assessments are done, see the guidelines on English Wikipedia.

Installation[edit]

  • Download and place the file(s) in a directory called PageAssessments in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'PageAssessments' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'PageAssessments' );, you need to use:

require_once "$IP/extensions/PageAssessments/PageAssessments.php";

You can also use these configuration options in your LocalSettings.php:

  • $wgPageAssessmentsOnTalkPages - If assessments are normally recorded on the pages themselves rather than on talk pages, set this to false. (default: true)
  • $wgPageAssessmentsSubprojects - If projects on your wiki have subprojects or task forces that you would like to record separate assessments for, set this to true. (default: false)

Usage[edit]

The parser function for creating a new assessment is: {{#assessment: <name of the wikiproject> | <class> | <importance>}}.

  • name of the wikiproject - a short name for the project assessing the article, for example, 'Medicine' or 'Hungarian culture‎'. Can be up to 128 characters long.
  • importance - a ranking of how important the article is to the project, for example, 'Low' or 'High'. Can be up to 20 characters long.

The assessment parser function is expected to be on the talk page of the page under review, however it may be included on the page itself. A page may have more than one assessment function for different projects.

Note: If an assessment template is already in use on multiple pages, the parser function can be embedded inside the template instead of having to edit each individual article's talk page.

Example usage[edit]

The importance/priority of an article might be different depending on the WikiProject:

{{#assessment:Medicine|A|Low}}
{{#assessment:Biology|B|High}}

API[edit]

The PageAssessments extension includes three API query modules: pageassessments, projectpages, and projects.

Pageassessments[edit]

pageassessments is a new property query for the MediaWiki action API. It is used to retrieve assessment metadata for one or more pages.

Examples[edit]

Get project and assessment data for page Apple.

api.php?action=query&prop=pageassessments&titles=Apple

Get project and assessment data for pages Apple and Pear, using the newer API result format.

api.php?action=query&prop=pageassessments&titles=Apple|Pear&formatversion=2

Get project and assessment data for page Apple, including subprojects and task forces (only available if $wgPageAssessmentsSubprojects is true).

api.php?action=query&prop=pageassessments&titles=Apple&pasubprojects=true

Projectpages[edit]

projectpages is a new list query. It is used to retrieve all the pages assessed by a particular WikiProject. This query can be used as a generator. By adding wppassessments=true, you can also get the assessment metadata for each of the pages.

Examples[edit]

Get first 10 pages associated with any WikiProject.

api.php?action=query&list=projectpages

Get first 10 pages associated with WikiProject Medicine, including assessment data.

api.php?action=query&list=projectpages&wppprojects=Medicine&wppassessments=true

Get page info for first 10 pages associated with WikiProject Textile Arts.

api.php?action=query&generator=projectpages&prop=info&gwppprojects=Textile%20Arts

Projects[edit]

projects is a new list query. It is used to retrieve a list of all the WikiProjects on a wiki. The results are returned as an array of project names.

Examples[edit]

Get a list of all the WikiProjects.

api.php?action=query&list=projects

Get a list of all the WikiProjects, including subprojects and task forces (only available if $wgPageAssessmentsSubprojects is true).

api.php?action=query&list=projects&pjsubprojects=true

Special page[edit]

PageAssessments also provides an on-wiki interface for retrieving assessment data at Special:PageAssessments.

Database tables[edit]

PageAssessments creates two new database tables:

  • page_assessments
  • page_assessments_projects

page_assessments stores the assessment metadata, while page_assessments_projects stores the names of WikiProjects (so that they don't have to be recorded in full as part of each assessment record in the page_assessments table). Both tables are required for proper functioning of the parser function and APIs. The tables should exist on any wiki that has the PageAssessments extension installed. If PageAssessments is uninstalled, both tables can be dropped safely.

The purgeUnusedProjects.php maintenance script can be run to remove projects from the page_assessments_projects table that are no longer used by any assessments.

See also[edit]