summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/database.txt4
-rw-r--r--docs/hooks.txt226
-rw-r--r--docs/memcached.txt7
-rw-r--r--docs/php-memcached/Documentation2
-rw-r--r--docs/upload.txt40
5 files changed, 211 insertions, 68 deletions
diff --git a/docs/database.txt b/docs/database.txt
index 60e268c5..e80a4940 100644
--- a/docs/database.txt
+++ b/docs/database.txt
@@ -74,7 +74,7 @@ want to write code destined for Wikipedia.
It's often the case that the best algorithm to use for a given task
depends on whether or not replication is in use. Due to our unabashed
Wikipedia-centrism, we often just use the replication-friendly version,
-but if you like, you can use $wgLoadBalancer->getServerCount() > 1 to
+but if you like, you can use wfGetLB()->getServerCount() > 1 to
check to see if replication is in use.
=== Lag ===
@@ -110,7 +110,7 @@ in the session, and then at the start of each request, waiting for the
slave to catch up to that position before doing any reads from it. If
this wait times out, reads are allowed anyway, but the request is
considered to be in "lagged slave mode". Lagged slave mode can be
-checked by calling $wgLoadBalancer->getLaggedSlaveMode(). The only
+checked by calling wfGetLB()->getLaggedSlaveMode(). The only
practical consequence at present is a warning displayed in the page
footer.
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 286ed7e2..04b1e2ac 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -198,6 +198,10 @@ system (LDAP, another PHP program, whatever), you could do:
Returning false makes less sense for events where the action is complete, and
will normally be ignored.
+Note that none of the examples made use of create_function() as a way to
+attach a function to a hook. This is known to cause problems (notably with
+Special:Version), and should be avoided when at all possible.
+
==Using hooks==
A calling function or method uses the wfRunHooks() function to run the hooks
@@ -234,6 +238,9 @@ to add events to the MediaWiki code.
$autoblockip: The IP going to be autoblocked.
$block: The block from which the autoblock is coming.
+'AbortDiffCache': Can be used to cancel the caching of a diff
+&$diffEngine: DifferenceEngine object
+
'AbortLogin': Return false to cancel account login.
$user: the User object being authenticated against
$password: the password being submitted, not yet checked for validity
@@ -265,6 +272,10 @@ before showing the edit form ( EditPage::edit() ). This is triggered
on &action=edit.
$EditPage : the EditPage object
+'APIAfterExecute': after calling the execute() method of an API module.
+Use this to extend core API modules.
+&$module: Module object
+
'APIEditBeforeSave': before saving a page with api.php?action=edit,
after processing request parameters. Return false to let the request
fail, returning an error message or an <edit result="Failure"> tag
@@ -273,6 +284,24 @@ $EditPage : the EditPage object
$text : the new text of the article (has yet to be saved)
$resultArr : data in this array will be added to the API result
+'APIGetAllowedParams': use this hook to modify a module's parameters.
+&$module: Module object
+&$params: Array of parameters
+
+'APIGetParamDescription': use this hook to modify a module's parameter
+descriptions.
+&$module: Module object
+&$desc: Array of parameter descriptions
+
+'APIQueryAfterExecute': after calling the execute() method of an
+action=query submodule. Use this to extend core API modules.
+&$module: Module object
+
+'APIQueryGeneratorAfterExecute': after calling the executeGenerator()
+method of an action=query submodule. Use this to extend core API modules.
+&$module: Module object
+&$resultPageSet: ApiPageSet object
+
'APIQueryInfoTokens': use this hook to add custom tokens to prop=info.
Every token has an action, which will be used in the intoken parameter
and in the output (actiontoken="..."), and a callback function which
@@ -295,6 +324,17 @@ associated Revision object. In the hook, just add your callback to the
$tokenFunctions array and return true (returning false makes no sense)
$tokenFunctions: array(action => callback)
+'APIQueryRecentChangesTokens': use this hook to add custom tokens to list=recentchanges.
+Every token has an action, which will be used in the rctoken parameter
+and in the output (actiontoken="..."), and a callback function which
+should return the token, or false if the user isn't allowed to obtain
+it. The prototype of the callback function is func($pageid, $title, $rc)
+where $pageid is the page ID of the page associated to the revision the
+token is requested for, $title the associated Title object and $rc the
+associated RecentChange object. In the hook, just add your callback to the
+$tokenFunctions array and return true (returning false makes no sense)
+$tokenFunctions: array(action => callback)
+
'ArticleAfterFetchContent': after fetching content of an article from the database
$article: the article (object) being loaded from the database
$content: the content (string) of the article
@@ -315,6 +355,11 @@ $id: id of the article that was deleted
'ArticleEditUpdateNewTalk': before updating user_newtalk when a user talk page was changed
$article: article (object) of the user talk page
+'ArticleEditUpdates': when edit updates (mainly link tracking) are made when an article has been changed
+$article: the article (object)
+$editInfo: data holder that includes the parser output ($editInfo->output) for that page after the change
+$changed: bool for if the page was changed
+
'ArticleEditUpdatesDeleteFromRecentchanges': before deleting old entries from recentchanges table, return false to not delete old entries
$article: article (object) being modified
@@ -375,6 +420,7 @@ $oldPageID: the page ID of the revision when archived (may be null)
$article: the article that was edited
$user: the user who did the rollback
$revision: the revision the page was reverted back to
+$current: the reverted revision
'ArticleSave': before an article is saved
$article: the article (object) being saved
@@ -396,17 +442,6 @@ $section: (No longer used)
$flags: Flags passed to Article::doEdit()
$revision: New Revision of the article
-'ArticleSaveComplete': after an article is saved
-$article: the article (object) saved
-$user: the user (object) who saved the article
-$text: the new article text
-$summary: the article summary (comment)
-$isminor: minor flag
-$iswatch: watch flag
-$section: section #
-
-wfRunHooks( 'ArticleSaveComplete', array( &$this, &$wgUser, $text, $summary, $flags & EDIT_MINOR, null, null, &$flags, $revision ) );
-
'ArticleUndelete': When one or more revisions of an article are restored
$title: Title corresponding to the article restored
$create: Whether or not the restoration caused the page to be created
@@ -471,13 +506,6 @@ rendered inline in wiki pages or galleries in category pages.
&$parser: Parser object
&$ig: ImageGallery object
-'BeforeWatchlist': Override watchlist display or add extra SQL clauses.
-$nondefaults: Assoc array with the following keys:
- days, hideOwn, hideBots, hideMinor, namespace
-$wgUser: wgUser.
-&$hookSql: a string which will be inserted without sanitation into the SQL query
- used to get the watchlist, at the end of the WHERE part.
-
'BlockIp': before an IP address or user is blocked
$block: the Block object about to be saved
$user: the user _doing_ the block (not the one being blocked)
@@ -490,18 +518,6 @@ $user: the user who did the block (not the one being blocked)
$isbn: ISBN to show information for
$output: OutputPage object in use
-'BrokenLink': Before the HTML is created for a broken (i.e. red) link
-&$linker: Linker instance
-$nt: the page title
-$query: the URL query string passed in
-&$u: the URL of this link
-&$style: the inline CSS style
-&$prefix: a prefix prepended to the linked text
-&$text: the text placed by the user in the wiki-link
-&$inside: any additional alphanumeric characters placed after the wiki-link,
-that are made part of the link text
-&$trail: text placed immediately after the HTML link
-
'CategoryPageView': before viewing a categorypage in CategoryPage::view
$catpage: CategoryPage instance
@@ -544,6 +560,17 @@ $newRev: Revision object of the "new" revision
$article: article (object) being viewed
$oldid: oldid (int) being viewed
+'DoEditSectionLink': Override the HTML generated for section edit links
+$skin: Skin object rendering the UI
+$title: Title object for the title being linked to (may not be the same as
+ $wgTitle, if the section is included from a template)
+$section: The designation of the section being pointed to, to be included in
+ the link, like "&section=$section"
+$tooltip: The default tooltip. Escape with htmlspecialchars() before using.
+ By default, this is wrapped in the 'editsectionhint' message.
+$result: The HTML to return, prefilled with the default plus whatever other
+ changes earlier hooks have made
+
'EditFilter': Perform checks on an edit
$editor: Edit form (see includes/EditPage.php)
$text: Contents of the edit box
@@ -589,19 +616,17 @@ sections.
'EditPageBeforeEditButtons': allows modifying the edit buttons below the textarea in the edit form
&$editpage: The current EditPage object
&$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff"
+&$tabindex: HTML tabindex of the last edit check/button
-'EditSectionLink': Override the return value of Linker::editSectionLink()
-$skin: Skin rendering the UI
-$title: Title being linked to
-$section: Section to link to
-$link: Default link
-$result: Result (alter this to override the generated links)
+'EditPageBeforeEditChecks': allows modifying the edit checks below the textarea in the edit form
+&$editpage: The current EditPage object
+&$checks: Array of edit checks like "watch this page"/"minor edit"
+&$tabindex: HTML tabindex of the last edit check/button
-'EditSectionLinkForOther': Override the return value of Linker::editSectionLinkForOther()
+'EditSectionLink': Do not use, use DoEditSectionLink instead.
$skin: Skin rendering the UI
$title: Title being linked to
$section: Section to link to
-$hint: Anchor title/tooltip attributes
$link: Default link
$result: Result (alter this to override the generated links)
@@ -692,6 +717,9 @@ $result: User permissions error to add. If none, return true.
'getUserPermissionsErrorsExpensive': Absolutely the same, but is called only
if expensive checks are enabled.
+'HTMLCacheUpdate::doUpdate': After cache invalidation updates are inserted into the job queue.
+$title: Title object, pages linked to this title are purged.
+
'ImageBeforeProduceHTML': Called before producing the HTML created by a wiki
image insertion. You can skip the default logic entirely by returning
false, or just modify a few things using call-by-reference.
@@ -726,6 +754,7 @@ $title: Title object ($wgTitle)
$request: WebRequest
$ignoreRedirect: boolean to skip redirect check
$target: Title/string of redirect target
+$article: Article object
'InitPreferencesForm': called at the end of PreferencesForm's constructor
$form: the PreferencesForm
@@ -762,6 +791,35 @@ $lang: laguage code (string)
$specialPageAliases: associative array of magic words synonyms
$lang: laguage code (string)
+'LinkBegin': Used when generating internal and interwiki links in
+Linker::link(), before processing starts. Return false to skip default proces-
+sing and return $ret. See documentation for Linker::link() for details on the
+expected meanings of parameters.
+$skin: the Skin object
+$target: the Title that the link is pointing to
+&$text: the contents that the <a> tag should have (raw HTML); null means "de-
+ fault"
+&$customAttribs: the HTML attributes that the <a> tag should have, in associa-
+ tive array form, with keys and values unescaped. Should be merged with de-
+ fault values, with a value of false meaning to suppress the attribute.
+&$query: the query string to add to the generated URL (the bit after the "?"),
+ in associative array form, with keys and values unescaped.
+&$options: array of options. Can include 'known', 'broken', 'noclasses'.
+&$ret: the value to return if your hook returns false.
+
+'LinkEnd': Used when generating internal and interwiki links in Linker::link(),
+just before the function returns a value. If you return true, an <a> element
+with HTML attributes $attribs and contents $text will be returned. If you re-
+turn false, $ret will be returned.
+$skin: the Skin object
+$target: the Title object that the link is pointing to
+$options: the options. Will always include either 'known' or 'broken', and may
+ include 'noclasses'.
+&$text: the final (raw HTML) contents of the <a> tag, after processing.
+&$attribs: the final HTML attributes of the <a> tag, after processing, in asso-
+ ciative array form.
+&$ret: the value to return if your hook returns false.
+
'LinkerMakeExternalImage': At the end of Linker::makeExternalImage() just before the return
&$url: the image url
&$alt: the image's alt text
@@ -829,6 +887,10 @@ $magicWords: array of strings
'MagicWordwgVariableIDs': When definig new magic words IDs. DEPRECATED: Use LanguageGetMagic hook instead
$variableIDs: array of strings
+'MakeGlobalVariablesScript': called right before Skin::makeVariablesScript is executed
+&$vars: variable (or multiple variables) to be added into the output
+ of Skin::makeVariablesScript
+
'MarkPatrolled': before an edit is marked patrolled
$rcid: ID of the revision to be marked patrolled
$user: the user (object) marking the revision as patrolled
@@ -870,6 +932,7 @@ $tools: array of tools
$article: the article edited
$rev: the new revision
$baseID: the revision ID this was based off, if any
+$user: the editing user
'NormalizeMessageKey': Called before the software gets the text of a message
(stuff in the MediaWiki: namespace), useful for changing WHAT message gets displayed
@@ -879,6 +942,11 @@ $baseID: the revision ID this was based off, if any
whether to use the content language (true) or site language (false) (bool)
&$transform: whether or not to expand variables and templates in the message (bool)
+'OldChangesListRecentChangesLine': Customize entire Recent Changes line.
+&$changeslist: The OldChangesList instance.
+&$s: HTML of the form "<li>...</li>" containing one RC entry.
+&$rc: The RecentChange object.
+
'OpenSearchUrls': Called when constructing the OpenSearch description XML.
Hooks can alter or append to the array of URLs for search & suggestion formats.
&$urls: array of associative arrays with Url element attributes
@@ -888,6 +956,9 @@ the resulting HTML is about to be displayed.
$parserOutput: the parserOutput (object) that corresponds to the page
$text: the text that will be displayed, in HTML (string)
+'OutputPageCheckLastModified': when checking if the page has been modified since the last visit
+&$modifiedTimes: array of timestamps, the following keys are set: page, user, epoch
+
'OutputPageParserOutput': after adding a parserOutput to $wgOut
$out: OutputPage instance (object)
$parserOutput: parserOutput instance being added in $out
@@ -1046,6 +1117,8 @@ $text : Current text being indexed
$term : Search term string
&$title : Outparam; set to $title object and return false for a match
+'SetupAfterCache': Called in Setup.php, after cache objects are set
+
'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views
$text: Text being shown
$title: Title of the custom script/stylesheet page
@@ -1065,6 +1138,17 @@ $skin: Skin object
&$text: bottomScripts Text
Append to $text to add additional text/scripts after the stock bottom scripts.
+'SkinAfterContent': Allows extensions to add text after the page content and
+article metadata.
+&$data: (string) Text to be printed out directly (without parsing)
+This hook should work in all skins. Just set the &$data variable to the text
+you're going to add.
+
+'SkinBuildSidebar': At the end of Skin::buildSidebar()
+$skin: Skin object
+&$bar: Sidebar contents
+Modify $bar to add or modify sidebar portlets.
+
'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle()
$skin: Skin object
&$subpages: Subpage links HTML
@@ -1142,24 +1226,6 @@ $movePage: MovePageForm object
$oldTitle: old title (object)
$newTitle: new title (object)
-'SpecialPageExecuteAfterPage': called after executing a special page
-Warning: Not all the special pages call this hook
-$specialPage: SpecialPage object
-$par: paramter passed to the special page (string)
-$funct: function called to execute the special page
-
-'SpecialPageExecuteBeforeHeader': called before setting the header text of the special page
-Warning: Not all the special pages call this hook
-$specialPage: SpecialPage object
-$par: paramter passed to the special page (string)
-$funct: function called to execute the special page
-
-'SpecialPageExecuteBeforePage': called after setting the special page header text but before the main execution
-Warning: Not all the special pages call this hook
-$specialPage: SpecialPage object
-$par: paramter passed to the special page (string)
-$funct: function called to execute the special page
-
'SpecialPage_initList': called when setting up SpecialPage::$mList, use this hook to remove a core special page
$list: list (array) of core special pages
@@ -1168,7 +1234,7 @@ $list: list (array) of core special pages
$opts: FormOptions for this request
'SpecialRecentChangesQuery': called when building sql query for SpecialRecentChanges
-&$conds: array of where conditionals for query
+&$conds: array of WHERE conditionals for query
&$tables: array of tables to be queried
&$join_conds: join conditions for the tables
$opts: FormOptions for this request
@@ -1187,6 +1253,16 @@ $term: string of search term
'SpecialVersionExtensionTypes': called when generating the extensions credits, use this to change the tables headers
$extTypes: associative array of extensions types
+'SpecialWatchlistQuery': called when building sql query for SpecialWatchlist
+&$conds: array of WHERE conditionals for query
+&$tables: array of tables to be queried
+&$join_conds: join conditions for the tables
+&$fields: array of query fields
+
+'TitleArrayFromResult': called when creating an TitleArray object from a database result
+&$titleArray: set this to an object to override the default object returned
+$res: database result used to create the object
+
'TitleMoveComplete': after moving an article (title)
$old: old title
$nt: new title
@@ -1234,6 +1310,11 @@ string &$error: output: HTML error to show if upload canceled by returning false
'UploadComplete': Upon completion of a file upload
$uploadForm: Upload form object. File can be accessed by $uploadForm->mLocalFile.
+'User::mailPasswordInternal': before creation and mailing of a user's new temporary password
+$user: the user who sent the message out
+$ip: IP of the user who sent the message out
+$u: the account whose new password will be set
+
'UserArrayFromResult': called when creating an UserArray object from a database result
&$userArray: set this to an object to override the default object returned
$res: database result used to create the object
@@ -1254,9 +1335,21 @@ $user: User (object) whose permission is being checked
'UserClearNewTalkNotification': called when clearing the "You have new messages!" message, return false to not delete it
$user: User (object) that'll clear the message
+'UserComparePasswords': called when checking passwords, return false to override the default password checks
+&$hash: String of the password hash (from the database)
+&$password: String of the plaintext password the user entered
+&$userId: Integer of the user's ID or Boolean false if the user ID was not supplied
+&$result: If the hook returns false, this Boolean value will be checked to determine if the password was valid
+
'UserCreateForm': change to manipulate the login form
$template: SimpleTemplate instance for the form
+'UserCryptPassword': called when hashing a password, return false to implement your own hashing method
+&$password: String of the plaintext password to encrypt
+&$salt: String of the password salt or Boolean false if no salt is provided
+&$wgPasswordSalt: Boolean of whether the salt is used in the default hashing method
+&$hash: If the hook returns false, this String will be used as the hash
+
'UserEffectiveGroups': Called in User::getEffectiveGroups()
$user: User to get groups for
&$groups: Current effective groups
@@ -1275,6 +1368,9 @@ $user: User object
'UserGetImplicitGroups': Called in User::getImplicitGroups()
&$groups: List of implicit (automatically-assigned) groups
+'UserGetReservedNames': allows to modify $wgReservedUsernames at run time
+*&$reservedUsernames: $wgReservedUsernames
+
'UserGetRights': Called in User::getRights()
$user: User to get rights for
&$rights: Current rights
@@ -1283,10 +1379,13 @@ $user: User to get rights for
$user: user object
$name: user name
-'UserLoadFromSession': called to authenticate users on external/environmental means
+'UserLoadFromSession': called to authenticate users on external/environmental means; occurs before session is loaded
$user: user object being loaded
&$result: set this to a boolean value to abort the normal authentification process
+'UserLoadAfterLoadFromSession': called to authenticate users on external/environmental means; occurs after session is loaded
+$user: user object being loaded
+
'UserLoginComplete': after a user has logged in
$user: the user object that was created on login
$inject_html: Any HTML to inject after the "logged in" message.
@@ -1307,6 +1406,17 @@ $user : User object that was changed
$add : Array of strings corresponding to groups added
$remove: Array of strings corresponding to groups removed
+'UserrightsChangeableGroups': allows modification of the groups a user may add or remove via Special:UserRights
+$userrights : UserrightsPage object
+$user : User object of the current user
+$addergroups : Array of groups that the user is in
+&$groups : Array of groups that can be added or removed. In format of
+ array(
+ 'add' => array( addablegroups ),
+ 'remove' => array( removablegroups ),
+ 'add-self' => array( addablegroups to self ),
+ 'remove-self' => array( removable groups from self )
+ )
'UserRetrieveNewTalks': called when retrieving "You have new messages!" message(s)
$user: user retrieving new talks messages
$talks: array of new talks page(s)
diff --git a/docs/memcached.txt b/docs/memcached.txt
index b31554cc..2a904872 100644
--- a/docs/memcached.txt
+++ b/docs/memcached.txt
@@ -97,13 +97,6 @@ this is mentionned below.
(incomplete, out of date)
-Ajax Search:
- key: $wgDBname:ajaxsearch:md5( $search )
- ex: wikidb:ajaxsearch:9565814d5d564fa898dd6111b94fae0b
- stores: array with the result of research of a given text
- cleared by: nothing
- expiry: 30 minutes
-
Date Formatter:
key: $wgDBname:dateformatter
ex: wikidb:dateformatter
diff --git a/docs/php-memcached/Documentation b/docs/php-memcached/Documentation
index 4782807b..c9056053 100644
--- a/docs/php-memcached/Documentation
+++ b/docs/php-memcached/Documentation
@@ -165,7 +165,7 @@ EXAMPLE:
<?php
require("MemCachedClient.inc.php");
-// set the servers, with the last one having an interger weight value of 3
+// set the servers, with the last one having an integer weight value of 3
$options["servers"] = array("10.0.0.15:11000","10.0.0.16:11001",array("10.0.0.17:11002", 3));
$options["debug"] = false;
diff --git a/docs/upload.txt b/docs/upload.txt
new file mode 100644
index 00000000..e92ca786
--- /dev/null
+++ b/docs/upload.txt
@@ -0,0 +1,40 @@
+Special:Upload:
+
+wfSpecialUpload
+ new UploadForm
+ mUpload = new UploadFrom...
+ execute()
+ $wgEnableUploads
+ isAllowed(upload)
+ isBlocked()
+ wfReadOnly()
+ processUpload()
+ internalProcessUpload()
+ wfRunHooks(UploadForm:BeforeProcessing)
+ mUpload->getTitle()
+ wfStripIllegalFilenameChars
+ splitExtensions()
+ checkFileExtension()
+ Title::makeTitleSafe
+ getUserPermissionsErrors(edit; upload; create)
+ mUpload->verifyUpload()
+ empty(mFileSize)
+ getTitle()
+ checkOverwrite()
+ verifyFile()
+ checkMacBinary()
+ wfRunHooks(UploadVerification)
+ if(!ignoreWarning) mUpload->checkWarnings()
+ getInitialPageText()
+ mUpload->performUpload()
+ mLocalFile->upload()
+ if(isGood() && $watch) addWatch()
+ if(isGood()) wfRunHooks(UploadComplete)
+ wfRunHooks(SpecialUploadComplete)
+
+Changes:
+ * "Your file will be renamed to $1" check now done on the result of
+ Title::makeTitleSafe instead of filteredName
+ * getExistWarning only really does existence checks
+ * Other stuff forgotten to be documented
+ \ No newline at end of file