Mediawiki/QuickReference

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
(preformatting with controlled word wrap)
 
(13 intermediate revisions by one user not shown)
Line 235: Line 235:
 
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.
 
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.
 
<br><br>
 
<br><br>
If you want your preformatted text to have word wrap, then use a combination of <code>pre</code> and <code>nowiki</code>
+
If you want your preformatted text to have word wrap '''AND''' prevent any further wiki markup from being applied, then use a combination of <code>pre</code> and <code>nowiki</code>
 
{| class="wikitable" | style="table-layout: fixed; width: 100%"
 
{| class="wikitable" | style="table-layout: fixed; width: 100%"
 
! Description
 
! Description
Line 241: Line 241:
 
! width=40% | You get
 
! width=40% | You get
 
|-
 
|-
| '''Default''' preformatted text has a CSS attribute (<code>white-space: pre-wrap;</code>) to wrap the text according to available width
+
| '''Customized''' 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;"><nowiki>
 
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.
 
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.
&lt;/pre>
+
&lt;/nowiki>&lt;/pre>
 
</pre>
 
</pre>
 
|
 
|
<pre>
+
<pre style="white-space: pre-wrap;"><nowiki>
<translate><!--T:128--> 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>
+
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>
+
</nowiki></pre>
 
|-
 
|-
| <translate><!--T:126--> '''Customized''' preformatted text with '''disabled''' text wrapping</translate>
+
| '''Default''' preformatted text with '''disabled''' text wrapping
| <pre>
+
| <pre style="white-space: pre-wrap;">
<pre style="white-space: pre;">
+
<pre style="white-space: pre;"><nowiki>
<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>
+
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.
&lt;/pre>
+
&lt;/nowiki>&lt;/pre>
 
</pre>
 
</pre>
 
|
 
|
<pre style="white-space: pre;">
+
<pre style="white-space: pre;"><nowiki>
<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>
+
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>
+
</nowiki></pre>
 
|}
 
|}
 +
 +
==Collapsed content==
 +
<nowiki><div class="toccolours mw-collapsible mw-collapsed">
 +
This text is not collapsible; but the next is collapsible and hidden by default:
 +
<div class="mw-collapsible-content">{{Lorem}}</div>
 +
</div></nowiki>
 +
<div class="toccolours mw-collapsible mw-collapsed">
 +
This text is not collapsible; but the next is collapsible and hidden by default:
 +
<div class="mw-collapsible-content">{{Lorem}}</div>
 +
</div>
  
 
==DL380G5==
 
==DL380G5==
 
[http://vpxa.info/index.php/2015/09/08/install-esxi-6-0-on-a-dl380-g5-yes-it-works/ http://vpxa.info/index.php/2015/09/08/install-esxi-6-0-on-a-dl380-g5-yes-it-works/]
 
[http://vpxa.info/index.php/2015/09/08/install-esxi-6-0-on-a-dl380-g5-yes-it-works/ http://vpxa.info/index.php/2015/09/08/install-esxi-6-0-on-a-dl380-g5-yes-it-works/]

Latest revision as of 17:26, 4 December 2019

Contents

[edit] Edit sidebar, place after domain

Mediawiki Sidebar

/index.php?title=MediaWiki:Sidebar&action=edit


Allow anonymous users to view all pages
change the following in LocalSettings.php
$wgGroupPermissions['*']['read'] = true;


[edit] 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


[edit] 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/ 


[edit] 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 


[edit] 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; }

[edit] 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;

[edit] 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

[edit] 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

[edit] 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;

[edit] 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
);

[edit] 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;

[edit]

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)

[edit] collapsible table

 {| class="mw-collapsible mw-collapsed wikitable"
 ! The header || remains visible
 |-
 | This  content || is hidden
 |-
 | at first || load time
 |} 


[edit] 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;
}

[edit] 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.

[edit] 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', '&ampAElig;var Arnfj&ampouml;r&ampeth; 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 ;
}

[edit] Add line to LocalSettings.php

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

[edit] Verify

Verify installation through Special:Version
May not always show up

[edit] 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";
      }
    }
  }
});

[edit] 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>

[edit] Example wiki table

 <css>
  .stripe { background-color: #bbbbbb; }
 </css>
 {| class="zebra wikitable"
  ! Test || Table
  |-
  | Row 1 || 1
  |-
  | Row 2 || 2
  |-
  | Row 3 || 3
 |}

[edit] Make table cell clickable

[edit] Formatting

[edit] add color - text

<span style="color: red">This text is red</span>

This text is red

[edit] 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 AND prevent any further wiki markup from being applied, then use a combination of pre and nowiki

Description You type You get
Customized Preformatted text with a CSS attribute (white-space: pre-wrap;) to wrap the text according to available width
<pre style="white-space: pre-wrap;"><nowiki>
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.
</nowiki></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.
Default preformatted text with disabled text wrapping
<pre style="white-space: pre;"><nowiki>
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.
</nowiki></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.

[edit] Collapsed content

<div class="toccolours mw-collapsible mw-collapsed">
This text is not collapsible; but the next is collapsible and hidden by default:
<div class="mw-collapsible-content">{{Lorem}}</div>
</div>

This text is not collapsible; but the next is collapsible and hidden by default:

[edit] DL380G5

http://vpxa.info/index.php/2015/09/08/install-esxi-6-0-on-a-dl380-g5-yes-it-works/

Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Open Source Products
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
MagicMirror
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
Politics
Volkswagen
Covid
NCDMV
Toolbox