How to configure a replica of this Wiki

Aus i2pwiki.mk16.de
Zur Navigation springen Zur Suche springen

<languages />

<translate>

Introduction[Bearbeiten]

Why a replica? Why let others make replicas? Why help copy and distribute copies of this project?

The short answer: To survive!

The longest: To survive! </translate>
<translate>

Mediawiki Installation[Bearbeiten]

A mini guide to install MediaWiki on a debian based system.<ref>https://www.mediawiki.org/wiki/Manual:Installation_guide</ref>

</translate>

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-php5
$ sudo apt-get install php-apc php5-intl imagemagick phpmyadmin vsftpd php5-cli

<translate> Below is discharged and becomes the first configuration of mediawiki
Replace x by the latest version number of MediaWiki

</translate>

$ cd Downloads
$ wget http://releases.wikimedia.org/mediawiki/1.xx/mediawiki-1.xx.x.tar.gz
$ tar -xvzf /pathtofile/mediawiki-*.tar.gz
$ sudo mkdir /var/lib/mediawiki
$ sudo mv mediawiki-*/* /var/lib/mediawiki
$ cd /var/www/html
$ sudo ln -s /var/lib/mediawiki mediawiki

<translate> Optionally you can configure other variables

</translate>

$ sudo nano /etc/php5/apache2/php.ini
upload_max_filesize = 2M
memory_limit = 128M

<translate> The config file used by I2PWiki </translate>

# This file was automatically generated by the MediaWiki 1.25.2
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# https://www.mediawiki.org/wiki/Manual:Configuration_settings
error_reporting(E_ALL);
ini_set("log_errors", 1);
ini_set("error_log", "/tmp/wiki-error.log");
# Protect against web entry

if ( !defined( 'MEDIAWIKI' ) ) {
	exit;
}

# Enables use of WikiEditor by default but still allows users to disable it in preferences
$wgDefaultUserOptions['usebetatoolbar'] = 1;

# Enables link and table wizards by default but still allows users to disable them in preferences
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;

# Displays the Preview and Changes tabs
$wgDefaultUserOptions['wikieditor-preview'] = 1;

# Displays the Publish and Cancel buttons on the top right side
$wgDefaultUserOptions['wikieditor-publish'] = 1;

$wgShowIPinHeader = false;
$wgPutIPinRC = false;
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;

$wgSitename = "I2PWiki";
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgScriptExtension = ".php";
//$wgArticlePath      = "/wiki/$1";
$wgUsePathInfo      = false;

//$wgFavicon = "$wgScriptPath/favicon.ico";

$actions = array( 'edit', 'watch', 'unwatch', 'delete','revert', 'rollback',
  'protect', 'unprotect', 'markpatrolled', 'render', 'submit', 'history', 'purge', 'info',
  'page', 'translate' );

/*foreach ( $actions as $action ) { 
  $wgActionPaths[$action] = "/wiki/$action/$1";
}*/

## The protocol and server name to use in fully-qualified URLs
$wgServer = "http://i2pwiki.i2p";
#"http://nrbnshsndzb6homcipymkkngngw4s6twediqottzqdfyvrvjw3pq.b32.i2p";

## The relative URL path to the skins directory
$wgStylePath = "$wgScriptPath/skins";
$wgResourceBasePath = $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 = "$wgResourceBasePath/resources/assets/logo_wiki.png";

## UPO means: this is also a user preference option

$wgEnableEmail = false;
$wgEnableUserEmail = false; # UPO

$wgEmergencyContact = "apache@127.0.0.1";
$wgPasswordSender = "apache@127.0.0.1";

$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;

## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "yourDBname";
$wgDBuser = "yourDBuser";
$wgDBpassword = "yourDBpassword";

# MySQL specific settings
$wgDBprefix = "wik_";

# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=utf8";

# Experimental charset support for MySQL 5.0.
$wgDBmysql5 = false;

## Shared memory settings
$wgMainCacheType = CACHE_ACCEL;//CACHE_MEMCACHED;
$wgMemCachedServers = array( '127.0.0.1:11211' );

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
#$wgUseImageMagick = true;
#$wgImageMagickConvertCommand = "/usr/bin/convert";

# InstantCommons allows wiki to use images from http://commons.wikimedia.org
$wgUseInstantCommons = false;

## If you use ImageMagick (or any other shell command) on a
## Linux server, this will need to be set to the name of an
## available UTF-8 locale
$wgShellLocale = "en_US.utf8";

## If you want to use image uploads under safe mode,
## create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment
## this, if it's not already uncommented:
#$wgHashedUploadDirectory = false;

## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publically accessible from the web.
#$wgCacheDirectory = "$IP/cache";

# Site language code, should be one of the list in ./languages/Names.php
$wgLanguageCode = "en";

$wgSecretKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "xxxxxxxxxxxxxxxx";

## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "https://creativecommons.org/publicdomain/zero/1.0/";
$wgRightsText = "Creative Commons Zero (Public Domain)";
$wgRightsIcon = "$wgResourceBasePath/resources/assets/licenses/cc-0.png";

# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
$wgDefaultSkin = "vector";

# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'CologneBlue' );
wfLoadSkin( 'Modern' );
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Vector' );


# End of automatically generated settings.
# Add more configuration options below.

/**
 * Disable links to talk pages of anonymous users (IPs) in listings on special
 * pages like page history, Special:Recentchanges, etc.
 */
## $wgDisableAnonTalk = true;
$EXT = "$IP/extensions";

if (!$wgCommandLineMode) {
wfLoadExtension( 'WikiEditor' );
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
$wgNamespacesWithSubpages[NS_MAIN] = true;
require_once "$EXT/Html2Wiki/Html2Wiki.php";
}
//require_once "$EXT/Multilang/Multilang.php";
//require_once "$EXT/Polyglot/Polyglot.php";
/*$wgPolyglotLanguages = array('en', 'de', 'fr');
require_once "$EXT/LanguageSelector/LanguageSelector.php";
$wgLanguageSelectorLanguages=array('en', 'de', 'fr');
$wgLanguageSelectorDetectLanguage = LANGUAGE_SELECTOR_USE_CONTENT_LANG;*/
//$wgLanguageSelectorLocation = LANGUAGE_SELECTOR_MANUAL;
//$wfPolyglotFollowRedirects = true;

$wgExtensionAssetsPath = "{$wgScriptPath}/extensions";
//require_once "$EXT/Babel/Babel.php";

require_once "$EXT/cldr/cldr.php";

/*wfLoadExtension( 'CleanChanges' );
$wgCCUserFilter = false;
$wgCCTrailerFilter = true;*/
$wgDefaultUserOptions['usenewrc'] = 1;

require_once "$EXT/LocalisationUpdate/LocalisationUpdate.php";
$wgLocalisationUpdateDirectory = "$IP/cache";

require_once "$EXT/Translate/Translate.php";
$wgGroupPermissions['user']['translate'] = true;
$wgGroupPermissions['user']['translate-messagereview'] = true;
$wgGroupPermissions['user']['translate-groupreview'] = true;
$wgGroupPermissions['user']['translate-import'] = true;
$wgGroupPermissions['sysop']['pagetranslation'] = true;
$wgGroupPermissions['sysop']['translate-manage'] = true;
$wgTranslateDocumentationLanguageCode = 'qqq';
$wgExtraLanguageNames['qqq'] = 'Message documentation'; # No linguistic content. Used for documenting messages
require_once "$EXT/UniversalLanguageSelector/UniversalLanguageSelector.php";
$wgULSGeoService = false;
//$wgShowExceptionDetails = true;  //enable for error details
//require_once "$EXT/Random/Random.php";
require_once "$EXT/RandomInclude/RandomInclude.php";
$wgRandomInclude['pattern'] = '*';    // default pattern to use as boundary between items (use '----' to get previous behaviour)
$wgRandomInclude['separator'] = '';   // default separator rendered between items
$wgRandomInclude['count'] = 1;        // default number of items
$wgRandomInclude['limit'] = 20;       // default limit on runaway loop
$wgRandomInclude['seed'] = 'none';      // default seed value
$wgRandomInclude['hash'] = 'none';      // default hash value
$wgRandomInclude['period'] = 'none';    // default period as minute, hour, day, week or seconds (integer)
$wgRandomInclude['mode'] = 'none';         // default mode is none or ordered depending on count
$wgRandomInclude['cache'] = 'disable';// default cache strategy, set to 'disable' to do no caching
$wgRandomInclude['format'] = 'none';  // default format string, set to 'none' to do no formatting of output
wfLoadExtension( 'HitCounters' );
require_once "$EXT/ConfirmEdit/ConfirmEdit.php";
wfLoadExtension( 'ConfirmEdit/FancyCaptcha' );
$wgCaptchaClass = 'FancyCaptcha';
$wgCaptchaDirectory = "/path/to/captcha";
$wgCaptchaDirectoryLevels = 0; // Set this to a value greater than zero to break the images into subdirectories
$wgCaptchaSecret = "xxxxxxxxxx"; // same value you used in --key option in captcha.py
$wgCaptchaTriggers['edit']          = true; 
$wgCaptchaTriggers['create']        = true; 
$wgCaptchaTriggers['addurl']        = true; 
$wgCaptchaTriggers['createaccount'] = true;
$wgCaptchaTriggers['badlogin']      = true;
wfLoadExtension( 'Cite' );
wfLoadExtension( 'ParserFunctions' );

<translate> Restart the web server

</translate>

$ sudo apache2ctl restart

<translate> And we should be in a position to start mediawiki.

http://localhost/wiki

After completing the basic settings we can move the config file with these.

</translate>

$ sudo mv /var/lib/mediawiki/config/LocalSettings.php /var/lib/mediawiki

<translate>

Make a replica[Bearbeiten]

We are currently analyzing the ways to make replicas of I2PWiki without compromising security or central server or any mirrors.

We have discovered the following methods: </translate>
<translate>

Copy Hand[Bearbeiten]

OK, it's really slow and hard work having to open each item and copy one to one to the new wiki. </translate>
<translate>

Special:Export[Bearbeiten]

1. Open Special:SpecialPages

2. Go to Special:Export

3. Type the title off all the pages you want to export and select the button export to obtain a XML

4. Now, you can easily import the XML in your Wiki

http://your.wiki/wiki/index.php/Special:Import

You only need to choose the files downloaded from the download folder and upload it. After a few seconds, these should be availables locally.

I2PWiki XML DUMP[Bearbeiten]

Dump script help:
Manual:DumpBackup.php<ref>https://www.mediawiki.org/wiki/Manual:DumpBackup.php</ref>

Cron job made every 6 hours:
php /path/to/the/script/dumpBackup.php --current --include-files --uploads --output=gzip:/path/to/xml_dump/i2pwiki_current.xml.gz
php /path/to/the/script/dumpBackup.php --full --include-files --uploads --output=gzip:/path/to/xml_dump/i2pwiki_full.xml.gz

Dumps download page:
http://bf6ixuhfjftzk5hhag3etgwdchyvmwtnzp7ekx63nhfjmuuyql5a.b32.i2p/

To restore/import in a running MediaWiki:
Manual:Importing_XML_dumps<ref>https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps</ref>

</translate>
<translate>

Tahoe-LAFS[Bearbeiten]

Tahoe (on I2P) has the advantage of being a distributed storage service universally available.

I2PWiki begins to regularly upload a XML file with all articles of the wiki, you can import as is described in the previous section.

The only condition is that you must have access to tahoe via I2P.

The recommended procedure is described here to install and use Tahoe-LAFS-I2P.

2. This way you can access

 URI:DIR2-RO:eohydthxwqknod3zbkqmilgqzm:eoe4bknkwto5bmbjgqekawfadycqo7s7smtdexv575cwcay4zamq/

3. In that directory are located the files i2p_wiki_current.xml.gz and i2pwiki_full.xml.gz and multipart zip archives

4. You can download it manually or by default, use the following command with a crontab to download

$ tahoe cp URI:DIR-RO..../i2pwiki_current.xml.gz ./ </translate>
<translate>

La replica estatica de un sitio, nosotros lo entendemos como el tener todas (o la mayoria) de las paginas (o links internos) de la web (o el servidor) alojados en un directorio unico, y que sea navegable.

Al descargar las paginas que componen un sitio web, generalmente son legibles individualmente, pero no permiten pasar de una pagina a otra, sin salir de el. Con algo de suerte hemos conseguido encontrar una posibilidad para esto <ref>http://camwebb.info/blog/2012-12-20</ref>.

El siguiente comando nos permitira descargar todas las paginas que componen la Wiki:

$ 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://lawiki2p.i2p/index.php\?title=Main_Page.htm"

Toda la wiki quedara en el directorio

$ cd lawiki2p.i2p
$ cp index.php\?title=Main_Page.html index.html

Por ultimo se deben hacer unos retoques menores para que ciertas variables y paginas de estilo funcionen correctamente.

 $ 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

Ahora ya deberian estar casi todas las paginas de la web funcionando de forma mas o menos bien. Por ultimo, queda solo subir la carpeta principal a algun servidor para compartir estos conocimientos con la comunidad. --> </translate>
<translate>

See also[Bearbeiten]

</translate>
<translate>

References[Bearbeiten]

</translate> <references />