Implementation of Doxygen-friendly format

Markdown format implemented in docs/magicword.md and docs/memcached.md
A section with helpful resources has been added in docs/Introduction.md

Whitespaces removed, Intoduction.md modified

Unnecessary whitespaces have been removed. Helpful resources section has been modified.

Headings fixed, Title changed in magicword.md

Title changed from "magicword.txt" to "Magic Words" in docs/magicword.md. 
Some H1 headers changed to H2 in docs/memcached.md and docs/Introduction.md. 
An unnecessary sentence removed in docs/Introduction.md.

Change-Id: I5c9e8663c922be4ca5f0eea9d5c2469b1b18281c
Task: T111298
This commit is contained in:
Arturek1 2019-12-03 16:04:33 -05:00
parent 1cedbd2c6f
commit c11b745435
4 changed files with 148 additions and 115 deletions

View file

@ -1,6 +1,11 @@
Introduction {#mainpage}
=======
===============================
Welcome to the MediaWiki autogenerated documentation system.
If you are looking to use, install or configure your wiki, see the main site: <https://www.mediawiki.org/>.
Helpful resources
-------------------------------
- [General information](https://www.mediawiki.org/)
- [Installation guide](https://www.mediawiki.org/wiki/Manual:Installation_guide)
- [Configuration](https://www.mediawiki.org/wiki/Special:MyLanguageManual:System_administration)
- [New Developers](https://www.mediawiki.org/wiki/New_Developers)

96
docs/magicword.md Normal file
View file

@ -0,0 +1,96 @@
Magic Words
====================================
Magic Words are some phrases used in the wikitext. They are used for two things:
* Variables (like {{PAGENAME}}, {{SERVER}}, ...): part of wikitext, that looks
like templates but that don't accept any parameter.
* Parser functions (like {{fullurl:...}}, {{#special:...}}): behaves like
functions and accepts parameters.
The localized arrays keys are the internal name, and the values are an array,
whose include their case-sensitivity and their alias forms. The first form
defined is used by the program, for example, when moving a page and its old name
should include #REDIRECT.
They can be added in several arrays:
* By adding a file to **$wgExtensionMessagesFiles** and defining there **$magicWords**.
This array is associative with the language code in the first dimension key
and then a "normal" array of magic words.
* Localized arrays (**languages/messages/LanguageXX.php**) include their different
names to be used by the users.
To add a new variable, you should use the **MagicWordwgVariableIDs** hook to add
the internal name to the **$magicWords** array. You'll need to define the value of
the variable with the **ParserGetVariableValueSwitch** hook.
For example to add a new variable:
Create a file called **ExtensionName.i18n.magic.php** with the following contents:
<?php
$magicWords = [];
$magicWords['en'] = [
// Case sensitive.
'mag_custom' => [ 1, 'CUSTOM' ],
];
$magicWords['es'] = [
'mag_custom' => [ 1, 'ADUANERO' ],
];
$wgExtensionMessagesFiles['ExtensionNameMagic'] = __DIR__ . '/ExtensionName.i18n.magic.php';
$wgHooks['MagicWordwgVariableIDs'][] = 'wfAddCustomMagicWordID';
$wgHooks['ParserGetVariableValueSwitch'][] = 'wfGetCustomMagicWordValue';
function wfAddCustomMagicWordID( &$magicWords ) {
$magicWords[] = 'mag_custom';
return true;
}
function wfGetCustomMagicWordValue( $parser, &$variableCache, $magicWordId, &$ret ){
if( $magicWordId == 'mag_custom' ){
$ret = $variableCache['mag_custom'] = "Custom value";
}
return true;
}
And to add a new parser function:
Create a file called **ExtensionName.i18n.magic.php** with the following contents:
<?php
$magicWords = [];
$magicWords['en'] = [
// Case insensitive.
'mag_custom' => [ 0, 'custom' ],
];
$magicWords['es'] = [
'mag_custom' => [ 0, 'aduanero' ],
];
$wgExtensionMessagesFiles['ExtensionNameMagic'] = __DIR__ . '/ExtensionName.i18n.magic.php';
$wgHooks['ParserFirstCallInit'][] = 'wfRegisterCustomMagicWord';
function wfRegisterCustomMagicWord( $parser ){
$parser->setFunctionHook( 'mag_custom', 'wfGetCustomMagicWordValue' );
return true;
}
function wfGetCustomMagicWordValue( $parser, $var1, $var2 ){
return "custom: var1 is $var1, var2 is $var2";
}
Note: the **ParserFirstCallInit** hook is only available since 1.12. To work with
an older version, you'll need to use an extension function.
- Online documentation (contains more informations):
- Magic words: <https://www.mediawiki.org/wiki/Manual:Magic_words>
- Variables: <https://www.mediawiki.org/wiki/Manual:Variable>
- Parser functions: <https://www.mediawiki.org/wiki/Manual:Parser_functions>

View file

@ -1,95 +0,0 @@
magicword.txt
Magic Words are some phrases used in the wikitext. They are used for two things:
* Variables (like {{PAGENAME}}, {{SERVER}}, ...): part of wikitext, that looks
like templates but that don't accept any parameter.
* Parser functions (like {{fullurl:...}}, {{#special:...}}): behaves like
functions and accepts parameters.
The localized arrays keys are the internal name, and the values are an array,
whose include their case-sensitivity and their alias forms. The first form
defined is used by the program, for example, when moving a page and its old name
should include #REDIRECT.
They can be added in several arrays:
* By adding a file to $wgExtensionMessagesFiles and defining there $magicWords.
This array is associative with the language code in the first dimension key
and then a "normal" array of magic words.
* Localized arrays (languages/messages/LanguageXX.php) include their different
names to be used by the users.
To add a new variable, you should use the "MagicWordwgVariableIDs" hook to add
the internal name to the $magicWords array. You'll need to define the value of
the variable with the "ParserGetVariableValueSwitch" hook.
For example to add a new variable:
Create a file called ExtensionName.i18n.magic.php with the following contents:
----
<?php
$magicWords = [];
$magicWords['en'] = [
// Case sensitive.
'mag_custom' => [ 1, 'CUSTOM' ],
];
$magicWords['es'] = [
'mag_custom' => [ 1, 'ADUANERO' ],
];
----
$wgExtensionMessagesFiles['ExtensionNameMagic'] = __DIR__ . '/ExtensionName.i18n.magic.php';
$wgHooks['MagicWordwgVariableIDs'][] = 'wfAddCustomMagicWordID';
$wgHooks['ParserGetVariableValueSwitch'][] = 'wfGetCustomMagicWordValue';
function wfAddCustomMagicWordID( &$magicWords ) {
$magicWords[] = 'mag_custom';
return true;
}
function wfGetCustomMagicWordValue( $parser, &$variableCache, $magicWordId, &$ret ){
if( $magicWordId == 'mag_custom' ){
$ret = $variableCache['mag_custom'] = "Custom value";
}
return true;
}
And to add a new parser function:
Create a file called ExtensionName.i18n.magic.php with the following contents:
----
<?php
$magicWords = [];
$magicWords['en'] = [
// Case insensitive.
'mag_custom' => [ 0, 'custom' ],
];
$magicWords['es'] = [
'mag_custom' => [ 0, 'aduanero' ],
];
----
$wgExtensionMessagesFiles['ExtensionNameMagic'] = __DIR__ . '/ExtensionName.i18n.magic.php';
$wgHooks['ParserFirstCallInit'][] = 'wfRegisterCustomMagicWord';
function wfRegisterCustomMagicWord( $parser ){
$parser->setFunctionHook( 'mag_custom', 'wfGetCustomMagicWordValue' );
return true;
}
function wfGetCustomMagicWordValue( $parser, $var1, $var2 ){
return "custom: var1 is $var1, var2 is $var2";
}
Note: the 'ParserFirstCallInit' hook is only available since 1.12. To work with
an older version, you'll need to use an extension function.
Online documentation (contains more informations):
Magic words: https://www.mediawiki.org/wiki/Manual:Magic_words
Variables: https://www.mediawiki.org/wiki/Manual:Variable
Parser functions: https://www.mediawiki.org/wiki/Manual:Parser_functions

View file

@ -1,29 +1,34 @@
Memcached
====================================
MediaWiki has optional support for memcached, a "high-performance,
distributed memory object caching system". For general information
on it, see: http://www.danga.com/memcached/
on it, see: <http://www.danga.com/memcached/>
Memcached is likely more trouble than a small site will need, but
for a larger site with heavy load, like Wikipedia, it should help
lighten the load on the database servers by caching data and objects
in memory.
== Installation ==
Installation
--------------------------------
Packages are available for Fedora, Debian, Ubuntu and probably other
Linux distributions. If there's no package available for your
distribution, you can compile it from source.
== Compilation ==
Compilation
--------------------------------
* PHP must be compiled with --enable-sockets
* libevent: http://www.monkey.org/~provos/libevent/
* libevent: <http://www.monkey.org/~provos/libevent/>
(as of 2003-08-11, 0.7a is current)
* optionally, epoll-rt patch for Linux kernel:
http://www.xmailserver.org/linux-patches/nio-improve.html
<http://www.xmailserver.org/linux-patches/nio-improve.html>
* memcached: http://www.danga.com/memcached/download.bml
* memcached: <http://www.danga.com/memcached/download.bml>
(as of this writing, 1.1.9 is current)
Memcached and libevent are under BSD-style licenses.
@ -33,7 +38,8 @@ can run multiple servers on one machine or on multiple machines on
a network; storage can be distributed across multiple servers, and
multiple web servers can use the same cache cluster.
********************* W A R N I N G ! ! ! ! ! ***********************
**W A R N I N G ! ! ! ! !**
Memcached has no security or authentication. Please ensure that your
server is appropriately firewalled, and that the port(s) used for
memcached servers are not publicly accessible. Otherwise, anyone on
@ -44,16 +50,20 @@ passwords and email addresses, or to make themselves a sysop and
install malicious javascript on the site. There may be other types
of vulnerability, no audit has been done -- so be safe and keep it
behind a firewall.
********************* W A R N I N G ! ! ! ! ! ***********************
== Setup ==
**W A R N I N G ! ! ! ! !**
Setup
--------------------------------
If you installed memcached using a distro, the daemon should be started
automatically using /etc/init.d/memcached.
automatically using
/etc/init.d/memcached
To start the daemon manually, use something like:
memcached -d -l 127.0.0.1 -p 11211 -m 64
memcached -d -l 127.0.0.1 -p 11211 -m 64
(to run in daemon mode, accessible only via loopback interface,
on port 11211, using up to 64MB of memory)
@ -70,12 +80,13 @@ to the array. To increase the weight of a server (say, because
it has twice the memory of the others and you want to spread
usage evenly), make its entry a subarray:
$wgMemCachedServers = [
"127.0.0.1:11211", # one gig on this box
[ "192.168.0.1:11211", 2 ] # two gigs on the other box
];
$wgMemCachedServers = [
"127.0.0.1:11211", # one gig on this box
[ "192.168.0.1:11211", 2 ] # two gigs on the other box
];
== PHP client for memcached ==
PHP client for memcached
--------------------------------
MediaWiki uses a fork of Ryan T. Dean's pure-PHP memcached client.
It also supports the PECL PHP extension for memcached.
@ -90,11 +101,13 @@ If you set one of these to CACHE_NONE, MediaWiki still creates a
BagOStuff object, but calls it to it are no-ops. If the cache daemon
can't be contacted, it should also disable itself fairly smoothly.
== Keys used ==
Keys used
--------------------------------
(incomplete, out of date)
Date Formatter:
key: $wgDBname:dateformatter
ex: wikidb:dateformatter
stores: a single instance of the DateFormatter class
@ -102,6 +115,7 @@ Date Formatter:
expiry: one hour
Difference Engine:
key: $wgDBname:diff:version:{MW_DIFF_VERSION}:oldid:$old:newid:$new
ex: wikidb:diff:version:1.11a:oldid:1:newid:2
stores: body of a difference
@ -109,6 +123,7 @@ Difference Engine:
expiry: one week
Interwiki:
key: $wgDBname:interwiki:$prefix
ex: wikidb:interwiki:w
stores: object from the interwiki table of the database
@ -116,6 +131,7 @@ Interwiki:
cleared by: nothing
Lag time of the databases:
key: $wgDBname:lag_times
ex: wikidb:lag_times
stores: array mapping the database id to its lag time
@ -123,6 +139,7 @@ Lag time of the databases:
cleared by: nothing
Localisation:
key: $wgDBname:localisation:$lang
ex: wikidb:localisation:de
stores: array of localisation settings
@ -131,9 +148,11 @@ Localisation:
cleared by: Language::loadLocalisation()
Message Cache:
See MessageCache.php.
Newtalk:
key: $wgDBname:newtalk:ip:$ip
ex: wikidb:newtalk:ip:123.45.67.89
stores: integer, 0 or 1
@ -142,6 +161,7 @@ Newtalk:
expiry: 30 minutes
Parser Cache:
access: ParserCache
backend: $wgParserCacheType
key: $wgDBname:pcache:idhash:$pageid-$renderkey!$hash
@ -160,6 +180,7 @@ Parser Cache:
expiry: The same as the ParserCache entry it points to.
Ping limiter:
controlled by: $wgRateLimits
key: $wgDBname:limiter:action:$action:ip:$ip,
$wgDBname:limiter:action:$action:user:$id,
@ -175,6 +196,7 @@ Ping limiter:
Proxy Check: (deprecated)
key: $wgDBname:proxy:ip:$ip
ex: wikidb:proxy:ip:123.45.67.89
stores: 1 if the ip is a proxy
@ -182,6 +204,7 @@ Proxy Check: (deprecated)
expiry: $wgProxyMemcExpiry
Revision text:
key: $wgDBname:revisiontext:textid:$id
ex: wikidb:revisiontext:textid:1012
stores: text of a revision
@ -189,6 +212,7 @@ Revision text:
expiry: $wgRevisionCacheExpiry
Sessions:
controlled by: $wgSessionsInObjectCache
key: $wgBDname:session:$id
ex: wikidb:session:38d7c5b8d3bfc51egf40c69bc40f8be3
@ -197,6 +221,7 @@ Sessions:
cleared by: session_destroy()
Sidebar:
access: WANObjectCache
controlled by: $wgEnableSidebarCache
key: $wgDBname:sidebar
@ -206,6 +231,7 @@ Sidebar:
cleared by: MessageCache::replace()
Special:Allpages:
key: $wgDBname:allpages:ns:$ns
ex: wikidb:allpages:ns:0
stores: array of pages in a namespace
@ -213,6 +239,7 @@ Special:Allpages:
cleared by: nothing
Special:Recentchanges (feed):
backend: $wgMessageCacheType
key: $wgDBname:rcfeed:$format:$limit:$hideminor:$target and
rcfeed:$format:timestamp
@ -224,4 +251,4 @@ Special:Recentchanges (feed):
Special:Recentchanges?action=purge&feed=atom,
but note need $wgGroupPermissions[...]['purge'] permission.
... more to come ...
... more to come ...