User:SamanthaNguyen/Guides/Writing special pages

If you have read the guide on how to write an extension already, continue on! Otherwise, please go back to it as it is a prerequisite for this guide.

Special pages are unique pages in MediaWiki that allow performing a certain function, such as protecting a page so only users with certain permissions can edit it, changing the password to your account, viewing the contributions to the wiki by a specific user, and so on.

Difference between concrete classes and abstract classes
This guide makes references to concrete classes and abstract classes. The following bullet points aim to explain the difference to programmers who are writing their first extension in PHP, and don't understand the difference yet. If you already understand these concepts, feel free to skip ahead to the next section.


 * A concrete class is considered "complete" as it has implementations for all of its methods, while an abstract does not have implementations for all of its methods.
 * An abstract class is prefixed at its declaration with, while a concrete class does not have this keyword prefixed.
 * A concrete class can be instantiated using the keyword, while abstract classes cannot be instantiated.
 * A concrete class is not necessarily meant to always be extended. An abstract class is always meant to be extended, where the subclass must implement all methods marked as.

In this special case, while is a concrete class, it is always meant to be extended.

PHP class hierarchy

 * : A concrete class that all special pages inherit from. Special pages that need extra functionality can extend one of the listed subclasses that are marked as stable to extend.
 * : An abstract class that special pages use for managing authentication requests and session requests.
 * : An abstract class that shares the logic to use between Special:UserLogin and Special:CreateAccount.
 * : An abstract class that special pages use to show a list of changes based on certain conditions. This is used by Special:RecentChanges and Special:Watchlist.
 * : An abstract class that is used to help create special pages with HTML forms, using the MediaWiki HTMLForm component. This includes by default, but is not limited to: Special:BotPasswords, Special:ChangeContentModel, and Special:ChangeEmail.
 * : A concrete class that can be extended to easily mark a special page as includable. An includable special page means its content can be inserted into another page, by writing two curly brackets on the side of a special page, and the name of a special page. For example, Special:Contributions is includable, and could be written as  (replace   with your own username in a sandbox page to test this out!)
 * : An abstract class for special pages that query the database.
 * : An abstract class that outputs a gallery for querying images. This by default includes Special:MostLinkedFiles, Special:UncategorizedFiles, and Special:UnusedFiles.
 * : An abstract class that renders an HTML link to each page in the queried list. This by default includes Special:DeadendPages, Special:LonelyPages, Special:UncategorizedPages (which Special:UncategorizedCategories and Special:UncategorizedTemplates both extend from), and Special:WithoutInterwiki.
 * : An abstract class for defining wanted pages. This by default includes Special:WantedFiles, Special:WantedPages, Special:WantedTemplates, and Special:WantedCategories.
 * : An abstract class for making a special page that is unlisted from Special:SpecialPages by default.
 * : A concrete class for marking a special page as disabled.
 * : An abstract class for defining an alias to a special page.
 * : An abstract class for redirecting to an article on the wiki, versus a special page (e.g. Special:Contributions, Special:Log, etc)
 * : An abstract class for redirecting to a special page on the wiki
 * : An abstract class for redirecting an action on the wiki.


 * SpecialAncientpages.php‎
 * SpecialBlock.php‎
 * SpecialBlockList.php‎
 * SpecialBookSources.php‎
 * SpecialChangeCredentials.php‎
 * SpecialChangePassword.php‎
 * SpecialContributions.php‎
 * SpecialEditWatchlist.php‎
 * SpecialEmailUser.php‎
 * SpecialImport.php‎
 * SpecialLog.php‎
 * SpecialLonelypages.php‎
 * SpecialMovepage.php‎
 * SpecialMute.php‎
 * SpecialNewpages.php‎
 * SpecialPage.php‎
 * SpecialPageFactory.php‎
 * SpecialPasswordReset.php‎
 * SpecialPreferences.php‎
 * SpecialRandompage.php‎
 * SpecialRecentChanges.php‎
 * SpecialResetTokens.php‎
 * SpecialSearch.php‎
 * SpecialShortpages.php‎
 * SpecialStatistics.php‎
 * SpecialTrackingCategories.php‎
 * SpecialUnblock.php‎
 * SpecialUndelete.php‎
 * SpecialUpload.php‎
 * SpecialUserLogin.php‎
 * SpecialUserlogout.php‎
 * SpecialUserrights.php‎
 * SpecialVersion.php‎
 * SpecialWantedpages.php‎
 * SpecialWatchlist.php‎