Jump to content

User:SamanthaNguyen/Guides/Writing special pages

From mediawiki.org

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

[edit]

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 abstract, while a concrete class does not have this keyword prefixed.
  • A concrete class can be instantiated using the new 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 abstract.

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

PHP class hierarchy

[edit]