Release status: stable
|Description||Display a list of pages matching a given prefix together with additional information|
|Author(s)||Mathias Ertl (Mati talk)|
|MediaWiki||1.13.0 or later|
|License||GPL v3 or any later version.|
|Parameters||$wgSimilarNamedArticlesEnable, $wgSimilarNamedArticlesNamespaces, $wgSimilarNamedArticlesIncludeSubpages, $wgSimilarNamedArticlesAddInfoNamespaces, $wgSimilarNamedArticlesAddInfoCategories, $wgSimilarNamedArticlesAddInfoResources, $wgNamespaceHomes|
|Example||example in this wiki|
This extension is somewhat similar to Special:Prefixindex and in fact the algorithm used to find pages is copied from there. The difference is that this special page is able to display additional information such as categories, the namespace and how many resources a page has. The selection of pages displayed can also be finer tuned, either finding all pages in an explicitly given namespace or pages in a predefined set of namespaces. Additionally, you can choose not to display subpages.
This extension was written specially for the VorlesungsWiki and a lot of its functionality geared towards use in that Wiki. It is used to make "general" links to a course that is held by different professors, if only the course (and not who holds it) is relevant.
git clone https://github.com/mathiasertl/SimilarNamedArticles.git SimilarNamedArticles
Older versions are marked as tags, you can view available tags with git tag -l and move back to the current HEAD with git checkout <tag-name>. Versions for older versions of MediaWiki, if available, are managed as branches, use git branch and git checkout <branch> to move to a specific branch. To move back to the newest version, use git checkout master.
Note that GitHub allows you to download older different commits as tarball if you do not want to install git.
The installation is as simple as it could be: Simply download the extension into your extensions-directory, require_once and enable it in LocalSettings.php:
require_once("$IP/extensions/SimilarNamedArticles/SimilarNamedArticles.php"); $wgSimilarNamedArticlesEnable = true;
In its default configuration the extension finds, if no explicit prefix is given, all pages with the given prefix in the namespaces defined by $wgNamespacesToBeSearchedDefault (which is, in turn, only the main namespace per default). If you want to explicitly search in the main namespace only, prefix your search with ':'.
The extension is highly configurable. The names of the variables are (hopefully) self-explanatory, an example with a few comments is given here:
# if no explicit prefix is given, search in these namespaces: $wgSimilarNamedArticlesNamespaces = array( 100 => 1, 102 => 1 ); # do not include subpages in the result: $wgSimilarNamedArticlesIncludeSubpages = false; # Usually, the namespaces is not displayed, but you can add it $wgSimilarNamedArticlesAddInfoNamespaces = true; # it may be interesting if an article is in certain categories: $wgSimilarNamedArticlesAddInfoCategories = array('Stub', 'Veraltet'); # if you have enabled PerPageResources for this wiki, it is also # possible to display the number of resources for this wiki. $wgSimilarNamedArticlesAddInfoResources = true; # if you chose to set $wgSimilarNamedArticlesAddInfoNamespaces = true, # you may want to display the namespaces as links to other pages: $wgNamespaceHomes = array( 100 => "Alle LVAs (TU Wien)", 102 => "Alle LVAs (Uni Wien)" );
Given here are some examples of the usage of this special page. This also servers as a test-suite for this extension. All pages can be found here.
- Search for articles starting with "Fundamentals". This will only include pages in one of the namespaces defined by $wgSimilarNamedArticlesNamespaces (100, 102) and exclude subpages, since $wgSimilarNamedArticlesIncludeSubpages=false:
- Search for pages in the TU Wien namespace where the name starts with "Fundamentals":
- The parameter is always a prefix, the rest of the article-name is discarded. Thats why this search finds more pages than the previous searches:
- Search for pages in the main namespace where the name starts with "Fundamentals":
- Compatibility update for PHP 5.3
- Minimum software requirement is now MediaWiki-1.13.0, because of the MWNamespace class.
- Special:CreatePage is now in group "VoWi-Extensions" on Special:Specialpages
- Updated translation to work with all wiki/user language combinations.
- Updated to work with MediaWiki 1.11.1 and later by fixing LanguageGetSpecialPageAliases (This was a typo in 1.11.0, see Bug 11462)
- Updated link to this page (This wiki now uses Very short URLs)
- Subpage-handling is now way better. A page is only classified as subpage if the basepage exists.
- It is now possible to also display the number of resources by setting $wgSimilarNamedArticlesAddInfoResources to true ($wgResources must also be set to true)
- complete rewrite with an Algorithm that imitates that used in Special:Prefixindex. The code should be way faster.
- The extension is now split in two parts:
- This extension implements the basic functionality
- SimilarNamedArticlesHeader implements the display of SimilarNamedArticles on top of each page
- lots of new configuration variables
- Old version still using the search engine. I'm not aware of where this code can still be found.
- First version that didn't consider namespaces
- The SimilarNamedArticlesHeader-extension makes use of this extension.
GPL v3 or any later version.
- Make $wgSimilarNamedArticlesNamespaces a simple array instead of a dictionary
- we could add http-parameters to allow runtime-modifications of the inclusion of subpages etc. (i.e. ?subpages=true)