Go to the documentation of this file.
46 if ( !count( $modules ) ) {
54 $missing = array_diff( array_keys( $modules ), array_keys( $blobs ) );
87 'mr_resource' =>
$name,
89 'mr_timestamp' => $dbw->timestamp()
96 if ( $dbw->affectedRows() == 0 ) {
98 $blob = $dbw->selectField(
'msg_resource',
'mr_blob',
array(
99 'mr_resource' =>
$name,
110 'mrl_resource' =>
$name,
111 'mrl_message' => $key
114 $dbw->insert(
'msg_resource_links', $rows,
115 __METHOD__,
array(
'IGNORE' )
119 }
catch ( Exception
$e ) {
120 wfDebug( __METHOD__ .
" failed to update DB: $e\n" );
135 $row = $dbw->selectRow(
'msg_resource',
'mr_blob',
136 array(
'mr_resource' =>
$name,
'mr_lang' => $lang ),
144 $oldBlob = $row->mr_blob;
149 'mr_resource' =>
$name,
151 'mr_blob' => $newBlob,
152 'mr_timestamp' => $dbw->timestamp()
155 $dbw->replace(
'msg_resource',
163 $added = array_diff( $newMessages, $oldMessages );
164 $removed = array_diff( $oldMessages, $newMessages );
168 $dbw->delete(
'msg_resource_links',
array(
169 'mrl_resource' =>
$name,
170 'mrl_message' => $removed
175 $newLinksRows =
array();
177 foreach ( $added
as $message ) {
178 $newLinksRows[] =
array(
179 'mrl_resource' =>
$name,
180 'mrl_message' => $message
184 if ( $newLinksRows ) {
185 $dbw->insert(
'msg_resource_links', $newLinksRows, __METHOD__,
189 }
catch ( Exception
$e ) {
190 wfDebug( __METHOD__ .
" failed to update DB: $e\n" );
211 foreach ( $updates
as $k => $update ) {
215 $success = $dbw->update(
'msg_resource',
217 'mr_blob' => $update[
'newBlob'],
218 'mr_timestamp' => $dbw->timestamp() ),
220 'mr_resource' => $update[
'resource'],
221 'mr_lang' => $update[
'lang'],
222 'mr_timestamp' => $update[
'timestamp'] ),
229 if ( !(
$success && $dbw->affectedRows() == 0 ) ) {
231 unset( $updates[$k] );
234 }
while ( count( $updates ) );
238 }
catch ( Exception
$e ) {
239 wfDebug( __METHOD__ .
" failed to update DB: $e\n" );
249 $dbw->delete(
'msg_resource',
'*', __METHOD__ );
250 $dbw->delete(
'msg_resource_links',
'*', __METHOD__ );
251 }
catch ( Exception
$e ) {
252 wfDebug( __METHOD__ .
" failed to update DB: $e\n" );
266 if ( is_null( $prevUpdates ) ) {
269 array(
'msg_resource',
'msg_resource_links' ),
270 array(
'mr_resource',
'mr_lang',
'mr_blob',
'mr_timestamp' ),
271 array(
'mrl_message' => $key,
'mr_resource=mrl_resource' ),
281 foreach ( $prevUpdates
as $update ) {
282 $twoD[$update[
'resource']][$update[
'lang']] =
true;
285 $res = $dbw->select(
'msg_resource',
286 array(
'mr_resource',
'mr_lang',
'mr_blob',
'mr_timestamp' ),
287 $dbw->makeWhereFrom2d( $twoD,
'mr_resource',
'mr_lang' ),
295 foreach (
$res as $row ) {
297 'resource' => $row->mr_resource,
298 'lang' => $row->mr_lang,
299 'timestamp' => $row->mr_timestamp,
300 'newBlob' => self::reencodeBlob( $row->mr_blob, $key, $row->mr_lang )
317 $decoded[$key] =
wfMessage( $key )->inLanguage( $lang )->plain();
336 $res =
$dbr->select(
'msg_resource',
337 array(
'mr_blob',
'mr_resource',
'mr_timestamp' ),
338 array(
'mr_resource' => $modules,
'mr_lang' => $lang ),
342 foreach (
$res as $row ) {
346 throw new MWException( __METHOD__ .
' passed an invalid module name' );
350 if ( array_keys(
FormatJson::decode( $row->mr_blob,
true ) ) !== array_values( array_unique( $module->getMessages() ) ) ||
354 $retval[$row->mr_resource] = $row->mr_blob;
static generateMessageBlob(ResourceLoaderModule $module, $lang)
Generate the message blob for a given module in a given language.
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
static insertMessageBlob( $name, ResourceLoaderModule $module, $lang)
Generate and insert a new message blob.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static updateMessage( $key)
Update a single message in all message blobs it occurs in.
wfProfileIn( $functionname)
Begin profiling of a function.
static getFromDB(ResourceLoader $resourceLoader, $modules, $lang)
Get the message blobs for a set of modules from the database.
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 but section is usually empty its values are the globals values my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled also a ContextSource error or success such as when responding to a resource loader request or generating HTML output & $resourceLoader
wfProfileOut( $functionname='missing')
Stop profiling of a function.
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 noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Allows to change the fields on the form that will be generated $name
getMessages()
Get the messages needed for this module.
static updateModule( $name, ResourceLoaderModule $module, $lang)
Update the message blob for a given module in a given language.
static reencodeBlob( $blob, $key, $lang)
Reencode a message blob with the updated value for a message.
Abstraction for resource loader modules, with name registration and maxage functionality.
Dynamic JavaScript and CSS resource loading system.
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
This class provides access to the resource message blobs storage used by the ResourceLoader.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
static getUpdatesForMessage( $key, $prevUpdates=null)
Create an update queue for updateMessage()
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e