User:Cheeyang/sandbox

Toolbox

 * 1) Upload file
 * 2) Special Pages

Page Tabs

 * 1) Read
 * 2) Discussion
 * 3) Edit
 * 4) View History

User Links

 * 1) My talk
 * 2) My Sandbox
 * 3) My preferences
 * 4) My watchlist
 * 5) My contributions
 * 6) Log out

Print Wiki content

 * 1) Create a Book
 * 2) Download as PDF

Wiki Editor
Wiki Editor should be enabled by default. If it still show old editor, turn on the following options in Special:Preferences:
 * 1) Use live preview (requires JavaScript) (experimental)
 * 2) Enable enhanced editing toolbar
 * 3) Enable dialogs for inserting links, tables and more

Reference: mw:Extension:WikiEditor

Visual Editor
Visual Editor is a WYSISYG wiki editor. It is under heavy development now. Visit Special:VisualEditorSandbox to try the editor.

Reference: mw:Extension:VisualEditor

Magic words
Magic words are wiki text that will rendered by Wiki engine to produce meaningful information for user.

Reference: mw:Help:Magic_words

Wiki formatting
The basic wiki tag and formatting like bold, italic, paragraph, leveling and etc.

Reference: mw:Help:Formatting

Source code highlighting
Wiki Text : Wiki Output :

Table of Contents
By default, a table of contents is automatically generated on a page when more than 3 sections headings are used.

Reference: mw:Manual:Table of Contents

Redirect a page
When a wiki site operate for a period of time, some topics may have outdated. However, those topics may have been referenced by others in numbers. It is not a good habit to rename the topic directly to make the URL reference dead. Instead, you should make old topic redirect to new topic: Reference: mw:Help:Redirects
 * 1) REDIRECT new_topic

Template
Wiki Template allow same looks and feels for structured wiki text. A common usage of template is showing an information box of particular object type. By using template, the looks and feels for structured wiki text may change easily by just changing the template. All wiki pages that implement the template remain unchange.

To define template, create a page like:

Template:MyTemplate

To implement the template in your wiki text, enter text like:

Reference: mw:Help:Templates

Export and Import
Special:Export allow users to export wiki pages and associated templates recursively into an XML file. The XML file may then import to another Wiki site.

Special:Import allow users to read a Wiki XML file and import into Wiki database.

A common usage of these functions are export templates from other wiki sites and import into your wiki site.

Reference: Special:Export, Special:Import

Interwiki
Interwiki links are links to pages of other projects, using a prefixed internal link style.

For example, a wiki text of: eStream Software will rendered HTML text of eStream Software and redirect URL of: http://www.google.com/search?q=estream

The usage of Interwiki reduce typing lengthy URL and provide a rather clean and neat wiki text.

To show a list of available Interwiki links, visit:

If an Interwiki extension is installed, the list of Interwiki may view in Special:Interwiki.

Reference: mw:Manual:Interwiki

Namespace
A namespace is a collection of pages which have content with a similar purpose.

Reference: mw:Manual:Namespace

Category
Mediawiki's categories provide automatic indexes that are useful as tables of contents.

To assign a category to a page, simply add a link like: to the page's wikitext. The usual place to add it is at the bottom of the page.

To create a link to a category, use a leading colon before the category name (without this colon, the current page would be added to the category):
 * &rarr;    :Help

Categories may also organize in a hierarchy by adding category wiki tag into category page.

To get categories information of a wiki site, visit Special:SpecialPages.

Reference: mw:Help:Categories

Change Page display title
A wiki page title always follow the page name by default. It can be change by placing a magic word in wiki text:

Host on both HTTP and HTTPS server
Initially, MediaWiki work nice with HTTP protocol. It may work with HTTPS protocol too or work with both protocols in same machine. The HTTPS protocol is important if you allow user login to the site. Sending plain text password over HTTP protocol is not secure. Once the HTTPS service has installed with proper certificate and key, the wiki site should start serve data via HTTPS.

In some situations especially a fresh install wiki, web browse may report un-secure content being transfer. This is due to $wgServer has been fixed work to http protocol most of the time:

Remove the line or mark $wgServer empty should make the wiki site work nice with both HTTP and HTTPS request.

Cache Control
MediaWiki has built in caching functions by default. This function always confuse users when a page has been edited or updated but it doesn't show changes immediately. To get rid of the problem, add or edit $wgCachePages in LocalSettings.php in wiki directory:

Short URL
A default wiki URL use the URL string like: http:///wiki/index.php/Main_Page To implement more clean RESTful URI should be something like: http:///wiki/Main_Page The above URL hide the unnecessary implementation of wiki site. It is neat and shorter.

The following example use different script path (/w) and article path (/wiki):

First, rename wiki installation directory to "w", and change the files:

File: LocalSettings

File: .htaccess in DocumentRoot of wiki site RewriteEngine On RewriteRule ^/?wiki(/.*)?$ w/index.php/$1 [L,QSA]

Reference: mw:Manual:ShortURL

Extensions
Extensions are always install in extensions directory of wiki root path. For example:

Most extension's configuration parameters are specified in LocalSettings.php.

Refer to each extension's wiki page for detail installation and configuration steps.

Source Code Highlighting
Install SyntaxHighlight GeSHi extension:

Namespaces
There is a list build-in namespaces in MediaWiki. MediaWiki also allow custom namespaces for ease of Wiki articles management. The custom namespaces are defined in LocalSettings.php, for example:

To enable search for namespace, add:

A CSS style (MediaWiki:Common.css) may define for a custom namespace to show unique looks and feels:

Hide namespace prefix
The namespace prefix always appear in namespace wiki page. If the namespace prefix is some kind of short form, it would make the wiki page harder to read. To hide namespace prefix in wiki pages, install mw:Extension:HidePrefix extension:

Reference: mw:Help:Namespaces

Disable Captcha
A new Wiki site may have ConfirmEdit extension installed. This extension have simple captcha enabled. If ConfirmEdit extension was installed, a simple math captcha prompt for answer when saving a wiki page that contain external URL link: Your edit includes new external links. To help protect against automated spam, please solve the simple sum below and enter the answer in the box:

100+5 =

The purpose of the captcha is to fight against spamming. The captcha prompt may seems unnecessary for wiki site enforce with strict editing policy. e.g: only authorized users may edit wiki text.

To disable it, simply comment the following line in LocalSettings.php:

Interwiki
Install Interwiki extension to ease interwiki management:

The following script grant sysops permissions to edit interwiki data:

Visit Special:Interwiki to manage Interwikis.

Reference: mw:Extension:Interwiki

PDF and Book
Install Collection extension to print friendly Wiki pages in PDF files. You may print a single topic and collect a group of topics to render in PDF file:

A Print/export section appears in SideBar after installation.

Sidebar
Access Sidebar to define navigation bar on the left side of wiki page.

Reference: mw:Manual:Sidebar

Wiki Editor
To turn on wiki editor by default for users, add these lines:

Enable file upload
Most file uploaded to wiki are image files. Those files are stored in OS file system rather than wiki database. To configure a directory storing uploaded file, make sure the web service process possess adequate permissions to store files.

Steps to enable file upload:
 * 1) Make sure images directory is writable by web server process:
 * 2) Change permission: chmod 777 wiki/images or
 * 3) Change owner/group: chown apache.apache wiki/images
 * 4) In Linux system, configure SELinux or disable it totally to make sure it won’t interrupt file written process.

A good practice to store uploaded files is keep them in separate directory and create a symbolic link "${IP}/images" to link to new image directory. This will make Mediawiki upgrade task easier.

In some situations, the upload might fail. Try install or update the following packages:

And add a line in LocalSettings.php:

Enable SVG image support
SVG image isn't support by MediaWiki by default. Add these lines in LocalSettings.php to enable SVG support: Reference: mw:Manual:Image_Administration

Allow changing page display title
To make DISPLAYTITLE magic word works: Add the following in LocalSettings.php:

Add personal sandbox link
In wikipedia site, a personal sandbox link appears on personal URLs when user login to the site. The personal sandbox link is not a standard feature of mediawiki. It is a customized feature but it's a useful feature. Follow the steps to add personal sandbox link like wikepedia:


 * 1) Install Gadgets extension:
 * 2) Visit MediaWiki:Gadgets-definition and edit the content to add gadgets. e.g.: * mySandbox[ResourceLoader|dependencies=mediawiki.util|default|rights=createpage]|mySandbox.js
 * 3) Visit Special:Gadgets to perform these 2 tasks:
 * 4) Add Gadget-mySandbox.js script (e.g.: wikipedia:MediaWiki:Gadget-mySandbox.js)
 * 5) Edit description for mySandbox gadget (e.g.: wikipedia:MediaWiki:Gadget-mySandbox)
 * 6) Wiki Users may visit Gadgets tab in Preferences page to enable or disable Gadgets.
 * 7) The Gadget-mySandbox.js script from wikipedia require a template: Template:User_sandbox. Export the template from wikipedia and import to your wiki site.
 * 8) Template User_sandbox require an image file: Essay.svg.

Import CSS
MediaWiki provides a specific place MediaWiki:Common.css to store customized CSS style sheet for wiki site. It is a common practice to import many nice templates from other wiki site (e.g.: Wikipedia). Combining CSS and templates makes the wiki pages much readable.

Import other wiki site's CSS is fine but it is not easy to maintain especially if you have private CSS for your wiki site. Mixing other CSS and private CSS in a single Common.CSS could be a nightmare for sysops.

A good practice to maintain and use other's CSS is using import url syntax in CSS:
 * 1) Import other wiki site's CSS (e.g.: wikipedia:MediaWiki:Common.css) to own wiki site (e.g.: MediaWiki:Wikipedia.css).
 * 2) Update own CSS (e.g.: MediaWiki:Common.css) by adding a line:
 * 3) More CSS may add to Common.css by using this method.

LDAP Accounts
yum install php-ldap service httpd restart

To enable LDAP authentication a wiki site, install LdapAuthentication extension and enable LDAP setting in LocalSettings.php: require_once( "$IP/extensions/LdapAuthentication/LdapAuthentication.php" );

$wgAuth = new LdapAuthenticationPlugin; $wgLDAPDomainNames = array( 'DOM'); $wgLDAPServerNames = array( 'DOM' =&gt; 'ldap.example.com'); $wgLDAPSearchAttributes = array( 'DOM' =&gt; 'uid'); $wgLDAPBaseDNs = array( 'DOM' =&gt; 'ou=staff,dc=example,dc=com'); $wgLDAPEncryptionType = array( 'DOM' =&gt; 'tls'); $wgMinimalPasswordLength = 1; There are 3 types of encryption available for $wgLDAPEncryptionType: ssl, tls and clear. The example use tls type. To use both local and LDAP authentication, set $wgLDAPUseLocal = true; To pull user preference, use something like this: $wgLDAPRetrievePrefs = array( 'DOM' =&gt; true ); $wgLDAPPreferences = array('DOM'=&gt;array( "email"=&gt;"mail","realname"=&gt;"cn","nickname"=&gt;"displayName")); MediaWiki in PHP platform requires the TLS certificate format in binary DER format (*.der) and not PEM format. 1.18 – master

The LdapAuthentication doesn’t support alias dereference. A workaround solution is to change line 230 of LdapAuthentication.php as follow: public static function ldap_search( $ldapconn, $basedn, $filter, $attributes=array, $attrsonly=null, $sizelimit=null, $timelimit=null, $deref=3 null ) Change $deref=null to $deref=3.

OpenID Accounts
To prevent users login with local account, add these lines:

Prevent anonymous users to create account
Once the above rule has been enforce, the "Create Account" link will not appear in Wiki pages (Top left corner). To create user account, login to user who has permissions to do so, and visit Special:UserLogin to create accounts.

Prevent anonymous users edit wiki contents
The Edit and View History tab will disappear in anonymous account after enforce the rule:

Namespace access control
Assume there a group of wiki topics that you want to make it accessible by a particular user group only, you may organize those topics in a namespace and use Lockdown extension for access control.

For example, define a namespace NS_PRIVATE in LocalSettings.php:

And define the namespace to be accessed by bureaucrat users only:

Rename tab name of a namespace
MediaWiki display namespace of an article on first tab of tab headers. The namespace may also show name other than namespace's name on tab header. For example, namespace Main shows "Page" instead of "Main" for a fresh MediaWiki installation.

The namespace description may change by edit the content of page:

Thus, to edit namespace Main's tab caption, visit MediaWiki:Nstab-main.

Hide Powered by Icon
Powered by icon are shown in wiki pages automatically. Add this line to hide it:

Hide IP and Talk links for anonymous users
Add this: