MediaWiki  1.23.2
Go to the documentation of this file.
1 <?php
25 require_once __DIR__ . '/../';
26 require_once '';
27 require_once '';
41 function rebuildLanguage( $languages, $code, $write, $listUnknown, $removeUnknown,
42  $removeDupes, $dupeMsgSource, $messagesFolder
43 ) {
44  $messages = $languages->getMessages( $code );
45  $messages = $messages['all'];
46  if ( $removeDupes ) {
47  $messages = removeDupes( $messages, $dupeMsgSource );
48  }
50  $messages,
51  $code,
52  $write,
53  $listUnknown,
54  $removeUnknown,
56  );
57 }
66 function removeDupes( $oldMsgArray, $dupeMsgSource ) {
67  if ( file_exists( $dupeMsgSource ) ) {
68  include $dupeMsgSource;
69  if ( !isset( $dupeMessages ) ) {
70  echo "There are no duplicated messages in the source file provided.";
71  exit( 1 );
72  }
73  } else {
74  echo "The specified file $dupeMsgSource cannot be found.";
75  exit( 1 );
76  }
77  $newMsgArray = $oldMsgArray;
78  foreach ( $oldMsgArray as $key => $value ) {
79  if ( array_key_exists( $key, $dupeMessages ) ) {
80  unset( $newMsgArray[$key] );
81  }
82  }
84  return $newMsgArray;
85 }
87 # Show help
88 if ( isset( $options['help'] ) ) {
89  echo <<<TEXT
90 Run this script to rewrite the messages array in the files
91 languages/messages/MessagesXX.php.
92 Parameters:
93  * lang: Language code (default: the installation default language).
94  You can also specify "all" to check all the languages.
95  * help: Show this help.
96 Options:
97  * dry-run: Do not write the array to the file.
98  * no-unknown: Do not list the unknown messages.
99  * remove-unknown: Remove unknown messages.
100  * remove-duplicates: Remove duplicated messages based on a PHP source file.
101  * messages-folder: An alternative folder with MediaWiki messages.
103 TEXT;
104  exit( 1 );
105 }
107 # Get the language code
108 if ( isset( $options['lang'] ) ) {
109  $wgCode = $options['lang'];
110 } else {
111  $wgCode = $wgContLang->getCode();
112 }
114 # Get the duplicate message source
115 if ( isset( $options['remove-duplicates'] ) && ( strcmp( $options['remove-duplicates'], '' ) ) ) {
116  $wgDupeMessageSource = $options['remove-duplicates'];
117 } else {
118  $wgDupeMessageSource = '';
119 }
121 # Get the options
122 $wgWriteToFile = !isset( $options['dry-run'] );
123 $wgListUnknownMessages = !isset( $options['no-unknown'] );
124 $wgRemoveUnknownMessages = isset( $options['remove-unknown'] );
125 $wgRemoveDuplicateMessages = isset( $options['remove-duplicates'] );
126 $messagesFolder = isset( $options['messages-folder'] ) ? $options['messages-folder'] : false;
128 # Get language objects
129 $languages = new Languages();
131 # Write all the language
132 if ( $wgCode == 'all' ) {
133  foreach ( $languages->getLanguages() as $languageCode ) {
135  $languages,
136  $languageCode,
141  $wgDupeMessageSource,
143  );
144  }
145 } else {
147  $languages,
148  $wgCode,
153  $wgDupeMessageSource,
155  );
156 }
in this case you re responsible for computing and outputting the entire conflict i the difference between revisions and your text headers and sections and Diff overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
Definition: hooks.txt:1038
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
The ContentHandler facility adds support for arbitrary content types on wiki instead of relying on wikitext for everything It was introduced in MediaWiki Each kind of and so on Built in content types as usual *javascript user provided javascript code *css user provided css code *text plain text In PHP
Definition: contenthandler.txt:5
static writeMessagesToFile( $messages, $code, $write, $listUnknown, $removeUnknown, $messagesFolder=false)
Write a messages array as a PHP text and write it to the messages file.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. Handler functions that modify $result should generally return false to further attempts at conversion. 'ContribsPager you ll need to handle error messages
Definition: hooks.txt:896
Definition: LogTests.i18n.php:8
Definition: rebuildLanguage.php:126
Definition: rebuildLanguage.php:124
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
Definition: hooks.txt:93
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero based
Definition: hooks.txt:1956
rebuildLanguage( $languages, $code, $write, $listUnknown, $removeUnknown, $removeDupes, $dupeMsgSource, $messagesFolder)
Rewrite a messages array.
Definition: rebuildLanguage.php:41
Definition: rebuildLanguage.php:123
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1530
Definition: rebuildLanguage.php:129
Definition: styleTest.css.php:45
Definition: rebuildLanguage.php:125
removeDupes( $oldMsgArray, $dupeMsgSource)
Remove duplicates from a message array.
Definition: rebuildLanguage.php:66
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
Definition: maintenance.txt:1
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going on
Definition: hooks.txt:86
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify source
Definition: hooks.txt:1227
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of or an object and a method hook function The function part of a third party developers and administrators to define code that will be run at certain points in the mainline code
Definition: hooks.txt:23
Internationalisation code.
Definition: Language.php:74
Definition: rebuildLanguage.php:122