Mediawiki/QuickReference
(→Add Zebra table) |
(→Add Zebra table) |
||
Line 172: | Line 172: | ||
} | } | ||
<!--</syntaxhighlight>--> | <!--</syntaxhighlight>--> | ||
+ | ====Add line to LocalSettings.php==== | ||
+ | require_once("$IP/extensions/NewPageCSS/NewPageCSS.php"); | ||
+ | ====Verify==== | ||
+ | Verify installation through [[Special:Version|Special:Version]] |
Revision as of 14:39, 8 January 2015
Edit sidebar, place after domain
/index.php?title=MediaWiki:Sidebar&action=edit
- Allow anonymous users to view all pages
- change the following in LocalSettings.php
$wgGroupPermissions['*']['read'] = true;
backup wiki mysql db
- wiki db name, username, & password can be found in the mediawiki config, LocalSettings.php
sudo -s mysqldump -u <user> -p <db name> --password > wikidatabasebackup.sql i.e. mysqldump -u wikiuser -p wikidb --password > /var/www/backup/wikidatabasebackup10_4_12.sql
backup mediawiki file system
- this tars everything in the webpage folder
sudo -s tar zcvhf <tar file> /<wiki local location> i.e. tar zcvhf wikidatabackup03_11_14.tgz /var/www/mediawiki/
backup XML data
- this backs up the content of the wiki, like pages and their revisions
sudo -s <location of maintenance folder>$ php dumpBackup.php --full > <backupfile.xml> i.e. sudo -s /var/www/mediawiki/maintenance$ php dumpBackup.php --full > XMLbackup03_11_14.xml
Remove the discussion tab from all pages.
- Add the following to the MediaWiki:Common.css page (which is accessible by typing that into the search box on the wiki - i.e. type MediaWiki:Common.css into the search field)
#ca-talk { display:none!important; }
Enable hide/delete history
- Add the following to /var/www/mediawiki/Localsettings.php
# Enabling Sysops (admins) to hide revisions and log items from users $wgGroupPermissions['sysop']['deletelogentry'] = true; $wgGroupPermissions['sysop']['deleterevision'] = true;
change upload limit
goto /etc/apache2/sites-available/mediawiki
add the following anywhere inside <Virtual Host>
php_value upload_max_filesize 20M php_value post_max_size 20M
add new file extension to be allowed for upload
goto /var/www/mediawiki/Localsettings.php
find $wgFileExtensions, add new extension to array surrounded by quotes ('txt')
# Allow certain file types to be uploaded, but not blacklisted files like # exe and certain MIME types like zip $wgFileExtensions = array('png','gif','jpg','jpeg','doc','xls','pdf','ppt','tiff','bmp','zip','docx');
restart apache2
enable email v1.20+
http://www.mediawiki.org/wiki/Manual:$wgSMTP
starting with v1.20 you can easily enable email by installing pear on your linux/apache config. Start by installing the required package:
~$ sudo yum install php-pear
Once installed, you then have to use pear to install a couple of dependencies, like so:
~$ sudo pear install mail ~$ sudo pear install Net_SMTP
Now let's edit LocalSettings.php. Some of these may already have values, but make sure that they have what is listed below.
$wgEnableEmail = true; $wgEmailAuthentication = true; $wgEmergencyContact = '[email protected]'; $wgPasswordSender = 'email address displayed as sender in password resets'; #Email Settings $wgSMTP = array ( 'IDHost' => 'can be your server fqdn or site name', //this is used to build the Message-ID mail header 'host' => 'smtp server host name', //this is the outgoing mail server name (SMTP server) 'localhost' => 'wiki server fqdn', //if you want the wiki to identify itself with a resolvable hostname instead of localhost 'port' => 25, //this is the port used by the SMTP server 'auth' => true, //if authentication is required to relay through the SMTP 'username' => 'username', //username for smtp server 'password' => 'password' //password for smtp server );
Password Reset 24 hour limit
http://www.mediawiki.org/wiki/Manual:$wgPasswordReminderResendTime
By default in v1.9+ you can only reset your password once every 24 hours. Use the following to change that:
#Email Password 24 hour resend limit. #To override the email password limit of once every 24 hours, the following is added. value is in hours: $wgPasswordReminderResendTime = 0;
wikiLogo
The default logo ($wgLogo) can be modified. You simply need to copy over a new image and give permissions to the appropriate user (apache or www-data depending on distro), then modify LocalSettings.php to have a new path to the image. For example:
~$ sudo cp ./image.png /var/www/html/mediawiki/images/ //copies the image to the images directory ~$ sudo chown apache:apache /var/www/html/mediawiki/images/image.png //give ownership to the apache user to read the file ~$ sudo vi /var/www/html/mediawiki/LocalSettings.php
Now add the following to LocalSettings.php.
## The relative URL path to the upload directory $wgUploadPath = "$wgScriptPath/images"; //define a relative path called $wgUploadPath using the existing relative path for the document root, $wgScriptPath ## The relative URL path to the logo. Make sure you change this from the default, ## or else you'll overwrite your logo when you upgrade! $wgLogo = "$wgUploadPath/expertlogo.png"; //define the image location using a relative path (thus the URL prefix change if needed during upgrade/migration)
collapsible table
{| class="mw-collapsible mw-collapsed wikitable" ! The header || remains visible |- | This content || is hidden |- | at first || load time |}
change site logo url
add the following to LocalSettings.php
#change URL of site-logo /* Change the main page url used in things like the logo to an absolute url */ $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'lfChangeMainPageURL'; function lfChangeMainPageURL( $sk, &$tpl ) { $tpl->data['nav_urls']['mainpage']['href'] = "http://www.your-desired-url.com/"; // Point the main page url to an absolute url return true; }
Add Zebra table
Create new directory
Create a directory NewPageCSS
in your $IP/extentions
directory
~$ mkdir /var/www/mediawiki/extensions/NewPageCSS
Create a new file in the NewPageCSS
directory called NewPageCSS.php
with the following code:
<?php /** * NewPageCSS extension - Provides a parser hook to add per-page CSS to pages with the <css> tag * @version 1.1.0 - 2012/02/16 * * @link http://www.mediawiki.org/wiki/Extension:NewPageCSS Documentation * * @file NewPageCSS.php * @ingroup Extensions * @package MediaWiki * @author Ævar Arnfjörð Bjarmason <[email protected]> * @author Julian Porter <[email protected]> * @copyright © 2005 Ævar Arnfjörð Bjarmason * @copyright © 2010 Julian Porter * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ if (!defined('MEDIAWIKI')) die(); $wgExtensionCredits['parserhook'][] = array( 'path' => __FILE__, 'name' => 'New Page CSS', 'version' => '1.1.0', 'url' => 'https://www.mediawiki.org/wiki/Extension:NewPageCSS', 'description' => 'Adds a parser hook to add per-page CSS using the <css> tag', 'author' => array( 'Julian Porter', '&AElig;var Arnfj&ouml;r&eth; Bjarmason' ), ); $wgHooks['ParserFirstCallInit'][] = 'CSS_setup'; function CSS_setup(&$parser) { $parser->setHook("css","CSS_include"); return true; } function CSS_include($content) { global $wgParser; $css = htmlspecialchars( trim( Sanitizer::checkCss( $content ) ) ); $wgParser->mOutput->addHeadItem( <<<EOT <style type="text/css"> /*<![CDATA[*/ {$css} /*]]>*/ </style> EOT ); return ; }
Add line to LocalSettings.php
require_once("$IP/extensions/NewPageCSS/NewPageCSS.php");
Verify
Verify installation through Special:Version