Mediawiki/QuickReference
(→preformatting with controlled word wrap) |
(→preformatting with controlled word wrap) |
||
Line 241: | Line 241: | ||
! width=40% | You get | ! width=40% | You get | ||
|- | |- | ||
− | | | + | | Preformatted text with a CSS attribute (<code>white-space: pre-wrap;</code>) to wrap the text according to available width |
| <pre style="white-space: pre-wrap;"> | | <pre style="white-space: pre-wrap;"> | ||
<pre style="white-space: pre-wrap;"> | <pre style="white-space: pre-wrap;"> | ||
Line 249: | Line 249: | ||
| | | | ||
<pre> | <pre> | ||
− | + | This long sentence is used to demonstrate text wrapping. This additional sentence makes the text even longer. This additional sentence makes the text even longer. | |
</pre> | </pre> | ||
|- | |- |
Revision as of 16:43, 7 January 2019
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
allow certain blacklisted file types to be uploaded
goto /var/www/mediawiki/Localsettings.php
Add the following:
# Allow certain blacklisted files to be uploaded, like zip $wgFileBlacklist = array_diff( $wgFileBlacklist, array ('zip') ); $wgStrictFileExtensions = false;
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
Here i'll be showing you how to add zebra tables to your wiki and be able to specify the alternating table color per page.
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
May not always show up
Common.js
Add the following to your MediaWiki:Common.js page:
// Tables with class=zebra $(document).ready(function() { // the "className" includes all the classes so we must use re; // CSS is case-sensitive anyway, so there is no point ignoring case: var re = /\bzebra\b/, t = document.getElementsByTagName("TABLE"), n = t.length, r, nr; for (var i=0; i<n; i++) { if ( re.test(t[i].className)) { r = t[i].getElementsByTagName("TR"); nr = r.length; for (var j=1; j < nr; j+=2) { if (r[j].className) { r[j].className += " stripe";} else r[j].className = "stripe"; } } } });
add CSS
On the page the Zebra table will live, add the following above it. Adjust the color to whatever you desire.
<css> .stripe { background-color: #EFEEF2; } </css>
Example wiki table
<css> .stripe { background-color: #bbbbbb; } </css> {| class="zebra wikitable" ! Test || Table |- | Row 1 || 1 |- | Row 2 || 2 |- | Row 3 || 3 |}
Make table cell clickable
Formatting
add color - text
<span style="color: red">This text is red</span>
This text is red
preformatting with controlled word wrap
sometimes this is very useful to control, depending on if you are just showing a log file or if you are showing a single command. Obviously in both instances, you will probably want different behavior for either so that copying will not be negatively affected by the word wrap, or lack there of.
If you want your preformatted text to have word wrap, then use a combination of pre
and nowiki
Description | You type | You get |
---|---|---|
Preformatted text with a CSS attribute (white-space: pre-wrap; ) to wrap the text according to available width
|
<pre style="white-space: pre-wrap;"> This long sentence is used to demonstrate text wrapping. This additional sentence makes the text even longer. This additional sentence makes the text even longer. </pre> |
This long sentence is used to demonstrate text wrapping. This additional sentence makes the text even longer. This additional sentence makes the text even longer. |
<translate> Customized preformatted text with disabled text wrapping</translate> | <pre style="white-space: pre;"> <translate><!--T:130--> This long sentence is used to demonstrate text wrapping. This additional sentence makes the text even longer. This additional sentence makes the text even longer.</translate> </pre> |
<translate><!--T:131--> This long sentence is used to demonstrate text wrapping. This additional sentence makes the text even longer. This additional sentence makes the text even longer.</translate> |
DL380G5
http://vpxa.info/index.php/2015/09/08/install-esxi-6-0-on-a-dl380-g5-yes-it-works/