Monday, August 4, 2014

Create a purge tab in Media Wiki



To purge a page in media wiki, add ?action=purge to the URL of the page you are viewing. For example:
 http://example.org/wiki/Main_Page?action=purge

  It is better to create a purge tab . To create a purge tab. frist create a Purge directory under extensions directory, then create file Purge.php under Purge directory.

In LocalSettings.php, my case
C:\xampp\htdocs\wiki\LocalSettings.php
add
require_once "$IP/extensions/Purge/Purge.php";
In Purge.php, my case
C:\xampp\htdocs\wiki\extensions\Purge\Purge.php
<?php
/**
 * An extension that adds a purge tab on each page
 *
cense http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 */

$wgExtensionCredits['other'][] = array(
        'path' => __FILE__,
        'name' => 'Purgepage',
        'descriptionmsg' => 'purge-desc'
);

$dir = dirname( __FILE__ ) . '/';
$wgHooks['SkinTemplateNavigation::Universal'][] = 'PurgeActionExtension::contentHook';

class PurgeActionExtension{
        public static function contentHook( $skin, array &$content_actions ) {
                global $wgRequest, $wgUser;

                // Use getRelevantTitle if present so that this will work on some special pages
                $title = method_exists( $skin, 'getRelevantTitle' ) ?
                        $skin->getRelevantTitle() : $skin->getTitle();
                if ( $title->getNamespace() !== NS_SPECIAL && $wgUser->isAllowed( 'purge' ) ) {
                        $action = $wgRequest->getText( 'action' );

                        $content_actions['actions']['purge'] = array(
                                'class' => $action === 'purge' ? 'selected' : false,
                                'text' =>  'purge' ,
                                'href' => $title->getLocalUrl( 'action=purge' )
                        );
                }

                return true;
        }
}
?>

A purge tab will be added in submenu of down arrow at the top menu globally.
Video: Create a purge tab in  Media Wiki

Install Media wiki in localhost



Media Wiki is a Wiki software based on PhP and MySSQL, download link
http://www.mediawiki.org/wiki/Download

You will get MediaWiki 1.23.2.tar.gz.
Using 7-zip to unzip to get tart file, unzip again to produce   mediawiki-1.23.2/mediawiki-1.23.2
directory, rename it to mediawiki-1.23.2/wiki and copy wiki directory to c::/xampp/htdocs/
assuming you have installed xampp.

1) Using PHpMyAdmin to create database wiki, user name wiki, password for example jiansen
2) run
localhost/wiki/mw-config/index.php
following instruction step by step. After installation complete, copy LocalSettings.php to wiki home directory
C:\xampp\htdocs\wiki\LocalSettings.php
You can change the configuration based on this file
3) After installation complete
to create a new page, search the page then create
4) To edit sidebar
 http://localhost/wiki/index.php?title=MediaWiki:Sidebar&action=edit
5) To create a template, for example Purgecontent
http://localhost/wiki/index.php/Template:Purgecontent
To use Purgecontent {{ Purgecontent}}
Video:  Install Media wiki in localhost