Extension:HelpCommons

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
HelpCommons
Release status: unmaintained
Implementation API, Hook
Description Fetches help pages from an external or local help wiki and includes them into your wikis
Author(s) Tim Weyer (SVGtalk)
Latest version 1.4.0 (2017-10-29)
MediaWiki 1.23+
Database changes No
License GNU General Public License 2.0 or later
Download
Parameters
  • $wgHelpCommonsFetchingWikis
  • $wgHelpCommonsEnableLocalDiscussions
  • $wgHelpCommonsShowCategories
  • $wgHelpCommonsProtection
Hooks used
BeforePageDisplay
ArticleViewHeader
SkinTemplateTabs
SkinTemplateNavigation
getUserPermissionsErrors
LinkBegin
Translate the HelpCommons extension if it is available at translatewiki.net
Check usage and version matrix.

The HelpCommons extension provides fetching help namespace from an external or local wiki and inserts these pages into your wiki(s). The pages will not be created locally, just fetched from help wiki. HelpCommons allows configuring help wikis by project's language code.

Configuration[edit]

All help pages and their talks that exist on the help wiki can be protected from editing by setting $wgHelpCommonsProtection = 'existing';. If you want to protect the help namespace completely, just set $wgHelpCommonsProtection = 'all';. The default value is $wgHelpCommonsProtection = false;. The [edit] (edit section) links associate to the help wiki for easy editing. The talks of existing help pages on the help wiki can either always be redirected to the help wiki by setting $wgHelpCommonsEnableLocalDiscussions = false; or an extra tab can be added (default: create an extra tab: $wgHelpCommonsEnableLocalDiscussions = true;). Links to existing help pages or talks look blue as they would be existent locally. You can also show categories from help wiki if the help wiki bases on MediaWiki 1.17+. The categories will be re-localized to help wiki. If you don't want to show categories, just set $wgHelpCommonsShowCategories = false;.


It's preferable to set the both hooks in Title.php below because your help pages will look "completely known" (namespace tabs are also blue) if they are existent on help wiki.


Always set no-prefix if your help wiki does not use a prefix and no-database if you don't use a database name.

To install this extension, add the following to LocalSettings.php or GlobalSettings.php/CommonSettings.php/SharedSettings.php:

require_once ( "$IP/extensions/HelpCommons/HelpCommons.php" );

// Help wiki(s) where the help namespace is fetched from
// You only need to give a database if you use help pages from your own wiki family so help pages are not fetched for help wiki from help wiki
// Examples:
// https://meta.wikimedia.org/w/api.php
// $wgHelpCommonsFetchingWikis['en']['no-database']['https://meta.wikimedia.org']['w'] = 'Help Wiki';
// http://de.community.wikiunity.com/api.php
// $wgHelpCommonsFetchingWikis['de']['dewiki']['http://de.community.wikiunity.com']['no-prefix'] = 'dem deutschsprachigen Hilfe Wiki';
// http://fr.wikiunity.com/api.php
// $wgHelpCommonsFetchingWikis['fr']['no-database']['http://fr.wikiunity.com']['no-prefix'] = 'Wikiunity Aidé';
// http://meta.wikimedia.org/w/api.php
// $wgHelpCommonsFetchingWikis['ja']['no-database']['http://meta.wikimedia.org']['w'] = 'Help Wiki';
$wgHelpCommonsFetchingWikis
['language code of receiving wiki(s)']
['database of help wiki']
['url of help wiki']
['prefix of help wiki']
= 'freely selectable title of help wiki';

// Enable local discussions and add an extra tab to help wiki's talk or redirect local discussions to help wiki?
$wgHelpCommonsEnableLocalDiscussions = true;

// Show re-localized categories from help wiki?
// Help wiki (not receiving wiki) needs to be based on MW 1.17+ for this, otherwise you need to set it to false
$wgHelpCommonsShowCategories = true;

// Protection levels for the help namespace and its talk namespace
// $wgHelpCommonsProtection = 'existing'; => all existing help pages and their discussions
// $wgHelpCommonsProtection = 'all'; => every help page and every help page discussion
$wgHelpCommonsProtection = false;


Not really required but it looks much better with this changes in Title.php:

--- /includes/Title.php
+++ /includes/Title.php
@@ -3860,6 +3860,13 @@
 				// isn't needed. So we strip the language part away.
 				list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 );
 				return (bool)wfMsgWeirdKey( $basename );  // known system message
+			// HelpCommons extension changes begin
+			// Add hooks to make help pages and help talks "completely known" if they are existent on help wiki
+			case NS_HELP:
+				return wfRunHooks( 'TitleHelpCommonsPageIsKnown', array( $this ) );
+			case NS_HELP_TALK:
+				return wfRunHooks( 'TitleHelpCommonsTalkIsKnown', array( $this ) );
+			// HelpCommons extension changes end
 			default:
 				return false;
 		}