Difference between revisions of "MediaWiki"

From wiki.linuxonlinehelp.eu
Jump to navigation Jump to search
Line 209: Line 209:
  
 
== Custom Search Engine on Mediawiki ==
 
== Custom Search Engine on Mediawiki ==
 +
 +
edit LocalSettings.php set DuckDuckGo to reduce DB Load:
 +
<pre>
 +
$wgDisableTextSearch = true;
 +
$wgVectorUseSimpleSearch= false;
 +
$wgSearchForwardUrl = 'https://duckduckgo.com/?q=$1' .
 +
                      ' site:https://wiki.linuxonlinehelp.de';
 +
</pre>

Revision as of 03:58, 23 November 2017

MediaWiki Howtos

Howto add Informations into this Wiki?

You must have a Login Account to create a new Site Sample URL

 http://wiki.linuxonlinehelp.de/index.php/newsitetitle

Edit the New Site and add your Content, later Save and Exit..

External Images are NOT allowed and blocked by the Admin Settings!

Navigationbar edit

open URL Sample:

https://wiki.linuxonlinehelp.de/index.php/?title=MediaWiki:Sidebar

or enter into search box:

MediaWiki:Sidebar 

User Password reset

1. Login via SSH to the Webspace

2. go Maintenance Path

cd /maintenance/

3. enter

php changePassword.php --user=user --password=newpass

Create New User as Admin

https://wiki.linuxonlinehelp.de/index.php/Special:CreateAccount

Disable Account Create by everyone

edit LocalSettings.php set:

$wgGroupPermissions['*']['createaccount'] = false;

Disable edit by anonymous

edit localsettings.php set:

$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['sysop']['edit'] = false;

More Details: https://www.mediawiki.org/wiki/Manual:User_rights

Change Username on MySQL Console

login into the MySQL Server, change database and enter (table prefix wiki_*):

use wikidatabasename; #change database
show tables;          #check prefix

update wikiprefix_user set user_name = 'NewName' where user_name = 'OldName';
update wikiprefix_revision set rev_user_text = 'NewName' where rev_user_text = 'OldName';
update wikiprefix_recentchanges set rc_user_text = 'NewName' where rc_user_text = 'OldName';

Now login as new Username and test the Settings, History Changes. All entries should show the new Username!

Disable Talk at Mediawiki (Spam)

Anyway, if you want to disable Talk in media wiki follow the next steps.

1. cd your_mediawiki_dir/include

2. cp SkinTemplate.php SkinTemplate.back (just in case)

3. mcedit/vi SkinTemplate.php

4. search for $content_actions['talk']

5. uncomment this lines:

/* $content_actions['talk'] = $this->tabAction(
$talkpage,
'talk',
$this->mTitle->isTalkPage() &&
!$prevent_active_tabs,
'',
true);
*/

or login as Admin User and enter into Searchbox:

MediaWiki:Common.css

set:

#ca-talk {
    display: none !important;
}

Change Main Page

Login as Admin User and enter into Searchbox:

MediaWiki:Common.css

edit here the Common.css and paste:

.page-Wiki_Home .mw-redirectedfrom {
  display: none;
}

now go to Main Page and select "move to" new article post! Save and logout! Check the new Index Page! (Refresh Browsers Cache F5)

Add a new Site to Media Wiki

Howto

Enable Mobile Frontend for MediaWiki

Install the Frontende Extension to Extensions Folder and enable on LocalSettings.php

Source: Download MediaWiki Mobile Extension

wfLoadExtension( 'MobileFrontend' );
$wgMFAutodetectMobileView = true;

Protect MediaWiki after Setup

If you have Setup the MediaWiki successful by URL Sample:

https://wiki.linuxonlinehelp.de/w/mw-config/index.php

don't forget to purge or rename the mw-config Folder!! Alternate set:

$sudo chmod 000 mw-config

Create Sitemap Script for Cronjob

Create a Bash Script for cron usage, like sitemapwiki.sh, enter:

#!/bin/bash
cd /webspace/wiki/  #go to wiki path
rm -rf sitemap      #purge old sitemaps
mkdir sitemap       #create new directory for sitemaps
php maintenance/generateSitemap.php \
   --skip-redirects \
   --fspath sitemap \
   --server https://wiki.linuxonlinehelp.de \
   --urlpath https://wiki.linuxonlinehelp.de/sitemap
exit 0

Remark: Add the Sitemaps URL to Google/Bing Webmaster Tools! Check at the sitemaps path the Name of YOUR XML File Name!! Depends on MySQL Database Name! URL: https://wiki.linuxonlinehelp.de/sitemap/sitemap-index-databasename-wiki_.xml

Enable Apache24 Sitemap Access

add to vhosts Config of the Wiki:

<Directory "/webspace/wiki/sitemap/">
Require all granted
AllowOverride All
Options -Indexes
</Directory>

Table of Contents TOC force

By DEFAULT the Table is shown after 4 Articles

but to force TOC create insert inside a Page:

__FORCETOC__

Last Modify Date hide

go on search MediaWiki:Lastmodifiedat and purge:

<nnowiki>This page was last modified on $1, at $2</nnowiki>

Create Static Mediawiki Snapshot

Source:Source

How to host Mediawiki on a Raspi ? You can put the /var/www to a RAM TMPFS! and do:

nohup wget --recursive --page-requisites --html-extension \
      --convert-links --no-parent -R "*Special*" -R "*action=*" \
      -R "*printable=*"  -R "*oldid=*" -R "*title=Talk:*" \
      -R "*limit=*" "http://wiki.linuxonlinehelp.de/wiki/index.php\?title=Main_Page.htm"

copy Skins:

$ cp skins/common/shared.css?207  skins/common/shared.css
$ cp skins/monobook/main.css\?207 skins/monobook/main.css
$ sed -i 's/shared\.css\%3F207/shared.css/g' *.html
$ sed -i 's/main\.css\%3F207/main.css/g' *.html

or:

wget --mirror --convert-links --html-extension --no-parent --header "Cookie: JSESSIONID=0000k9lkMxmvmG-75Pd8CuvTIBv:-1" --page-requisites  https://wiki.linuxonlinehelp.de

Custom Search Engine on Mediawiki

edit LocalSettings.php set DuckDuckGo to reduce DB Load:

$wgDisableTextSearch = true;
$wgVectorUseSimpleSearch= false;
$wgSearchForwardUrl = 'https://duckduckgo.com/?q=$1' .
                      ' site:https://wiki.linuxonlinehelp.de';