Bücher online kostenlos Kostenlos Online Lesen
Working With MediaWiki

Working With MediaWiki

Titel: Working With MediaWiki Kostenlos Bücher Online Lesen
Autoren: Yaron Koren
Vom Netzwerk:
block them “Indefinitely”, i.e. forever.
    On wikis with closed registration, blocking a user would ideally prevent them from being able to read any of the contents as well. Unfortunately, that’s not the case — and there’s no “block from reading” or “block from logging in” action, nor does there appear to be an extension to do it. But if you have a closed wiki, and want that ability, adding the following to LocalSettings.php should do the trick:
$wgHooks['UserGetRights'][] = 'blockFromReading'; static function blockFromReading( $user, &$rights ) {
if ( $user->isBlocked() ) {
foreach ( $rights as $i => $right ) {
if ( $right === ’read’ ) {
unset( $rights[$i] ); break;
} return true;
}
}
}

9  Browsing and searching
Viewing the set of all pages
    MediaWiki provides a standard way of seeing the entire set of pages in the wiki: the special page Special:AllPages. It lets you view an alphabetical list of pages in the wiki for each namespace, other than “Special:” — that includes all the namespaces, so you can also view categories, templates, files, etc. Figure 9.1 shows the top of the page Special:AllPages for mediawiki.org.
    Figure 9.1 Special:AllPages on mediawiki.org
    The listing of page ranges in Figure 9.1 keeps going like that for another 10 lines. Clicking on any of those names will display a list of all the pages within that row’s alphabetical range; that list is separated into three columns.
    You can also use the form at the top to display a manual list of pages within a certain alphabetical range.
    For pages in the "File:" namespace, i.e. pages for uploaded files, there’s an alternate way to see them listed: the pageSpecial:ListFiles. This special page has an advantage over Special:AllPages in that it also shows a thumbnail image for each file.
    Figure 9.2 shows how the page Special:ListFiles looks on mediawiki.org.
    Figure 9.2 Special:ListFiles on mediawiki.org
    For each file, the following information is shown: the date it was uploaded, or last uploaded if more than one version has been uploaded; a thumbnail of the file if it’s an image; its size; the user who last uploaded it; and a description of the file, if one was submitted during the upload. The name of each file is a link to that file’s page in the “File:” namespace, while the subsequent “(file)” link is a link directly to that file.

Searching
    MediaWiki search functionality is available via its search bar, which in the Vector skin shows up on the top of the page (Figure 9.3).
    Figure 9.3 Search bar in the Vector skin
    When a user does a search, they are sent to the page Special:Search, which handles all the actual search functionality. This page lets the user modify their search term, as well as change the set of namespaces that are being searched.
    Within Special:Search, assuming you’re using the Vector skin, the user will see an interface like the one shown in Figure 9.4.
    Figure 9.4 Special:Search page
    Searches always start out being done only for namespaces defined as being "content namespaces", which by default is just the main (blank) namespace. As an administrator, you can change that by adding to $wgContentNamespaces. For instance, to also get pages in the "Help:" namespace to be searched, you would add the following to LocalSettings.php:
$wgContentNamespaces = array( NS_MAIN, NS_HELP );
    Each link changes the set of namespaces being searched. MediaWiki’s search interface is case-insensitive. If a user enters text in the search box that exactly matches the name of a page, they will be sent directly to that page. Which is usually the right behavior; but what if the user wants to instead search on that text? This could be more obvious in the interface, but the way for the user to do it is to type in the search string, then wait for the autocompletion dropdown to show up, and select the last item, “containing... search-string ”.
    There’s another nice feature related to search: having autocompletion within the search input, based on page names in the wiki. You can see this behavior in Wikipedia, if you start typing text in the search box. Starting with MediaWiki 1.20, this is the default behavior. For earlier versions of MediaWiki, you can enable it by adding the following to LocalSettings.php:
$wgEnableMWSuggest = true;

Watchlist
    For larger wikis, monitoring recent changes is unwieldy — if there are more than, say, 10-20 edits a day, it becomes untenable to try to monitor all

Weitere Kostenlose Bücher