Commit graph

244 commits

Author SHA1 Message Date
withoutaname
ad1d07f34f Rename Parser_DiffTest class to ParserDiffTest
Change-Id: I5fca44a3fffbc60a66be32fad9ed6d1713056d81
2014-06-22 13:14:01 -07:00
Siebrand Mazeland
2c04b0163b Remove incorrect return type for getGoodLinkID()
Change-Id: Ib9c0dcf5104fdc5f364e0b49d539b63bf2eb046c
2014-05-11 18:19:00 +02:00
Jeff Janes
0582e3339d PostgreSQL: Make l10n_cache.lc_value binary
Change-Id I427c6de5a0a29b43cff755db0eb8a750db620173 increases the
probability that a null byte will attempt to be stored in the
lc_value column.  PostgreSQL does not allow that byte in a text
column, so convert the column to bytea.

If the column already contains corrupted data, the upgrade routine
might fail.  To prevent this, delete the contents of the table before
changing the type.

Bug: 62098
Change-Id: Ie8368bde398b2ae4d3cfc9ee7bf35874bd2ded68
2014-05-05 11:20:52 -07:00
Siebrand Mazeland
f994817f6b Pass phpcs-strict on various files in includes/
These files have all had treatment before, and these occurrences have either
been missed or have been introduced after.

Change-Id: I06cdab4616b5bff47c85152df28f18c861730a23
2014-04-24 21:50:01 +02:00
umherirrender
fd66273c94 Fixed some @params documentation (includes/[cache|objectcache])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I86fd10e3f2d4bb80e7432533038d124693acfb3c
2014-04-19 01:19:46 +02:00
Kevin Israel
e0043257c0 Skip loading PHP shims for JSON i18n files
For now, non-message data (e.g. special page aliases, magic words) belong
in separate files having their own keys in $wgExtensionMessagesFiles. It
is unnecessary to read any PHP files listed under keys that exist in
$wgMessagesDirs; they are merely compatibility shims.

Bug: 63926
Change-Id: I92013d0a45e83ad0f5ac483a3db867806eb71f8a
2014-04-14 20:37:51 -04:00
Alexandre Emsenhuber
6ea0417cef Fix language statistics after messages have been moved to JSON
Statistics are now showing always no messages since languages.inc
does not manage to load the JSON messages.

Had to make LocalisationCache::readJSONFile() public so that it can
be used in  languages.inc; since all methods from LocalisationCache
return localisations merged with fallbacks, which is not what we
want here.

Fix for I918cfdc46c (0dd91d5).

Change-Id: Ib52287db618b9d072e847130070d165a3e7ae44b
2014-04-02 20:05:51 +02:00
Siebrand Mazeland
8e0c0a9fc9 Preparations for migrating core to use JSON based i18n
LocalisationCache and Language have to take the JSON files into account
in deciding if a language is present or not.

Standardizing language validity checking with isSupportedLanguage
and isValidBuiltInCode.

Co-Authored-By: Niklas Laxström <niklas.laxstrom@gmail.com>
Co-Authored-By: Siebrand Mazeland <siebrand@kitano.nl>
Change-Id: I35bbb3a7a145fc48d14fff620407dff5ecfdd4fc
2014-04-01 14:22:03 -07:00
jenkins-bot
ed8668b925 Merge "Add missing line breaks to wfDebug() calls" 2014-03-31 11:50:41 +00:00
Alexandre Emsenhuber
19a9618589 Send the localisation store debug message to the "caches" log group
Rationale is the same as for Ifb6dc2666f (96b04ce): ability to
separate it form the main log group, as it always has a predicitible
value.

Change-Id: I0ac5baf5ab8fbe4d2025ccf6439b883dc82e9d5b
2014-03-29 17:42:08 +01:00
Alexandre Emsenhuber
449ee32451 Add missing line breaks to wfDebug() calls
Also removed true as second parameter to it from CloneDatabase.php
since it is the default value of that parameter.

Change-Id: I727ebae2bd4df0e26019985ce8c7ce73381c5642
2014-03-29 11:52:07 +01:00
jenkins-bot
2eefaf1705 Merge "Moved ProcessCacheLRU to /libs" 2014-03-18 17:22:34 +00:00
Alexandre Emsenhuber
c4ff5e4b6a Fix profiling error in LocalisationCache::readJSONFile()
Follow-up I8d137e15e1 (6380e81).

Also added more blank lines for better readability.

Change-Id: Iae7921b017f81d5512e71384d7999502154c034c
2014-03-18 09:41:45 +01:00
Aaron Schulz
400e4848ec Moved ProcessCacheLRU to /libs
Change-Id: I7052d04d9847f0310c1e62bd66365c813fddeab5
2014-03-16 16:32:34 -07:00
Niklas Laxström
a064f78053 New hook MessageCache::get
Example usage:

$wgHooks['MessageCache::get'][] = function( &$key ) {
	static $keys = null;
	if ( $keys === null ) {
		global $wgExtensionMessagesFiles;
		require( $wgExtensionMessagesFiles['OverrideMessages'] );
		$keys = array_flip( array_keys( $messages['en'] ) );
	}

	if ( isset( $keys["myprefix-$key"] ) ) {
		$key = "myprefix-$key";
	}

	return true;
}

Pros:
* Easy way to override standard core and extension messages without
  any changes to them
* Messages can be stored in a standard i18n file
* Messages can be translated easily with Translate
* Messages can be shared accross multiple wikis easily
* Takes advantage of the normal message cache behavior unlike the
  MessagePreLoad hook
* Missing translations fallback to the override, not to the
  uncustomized standard translation
* Do not need to handle conflicting message keys at translatewiki.net
  if adopted by WMF

Cons:
* This method is called often, so there will be small performance
  impact if no hooks are registered. Impact can be big if the
  implementation of hook subscriber is inefficient.

This can help with bugs like 36149. It doesn't remove the manual work
needed to detect those messages and adding them to the i18n file.

I have been using this patch in a wiki farm for months.

Change-Id: Ib39937a440e71ae7292cf992ab37a569189741e4
2014-02-10 15:51:52 +00:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
Alexandre Emsenhuber
8d701eeeea Remove trailing line breaks from wfDebugLog() messages
This is useless since the message is passed through trim() and a
line break is added afterwards.

Change-Id: I1a26b30a07f7c9c749fce5bb6b2b4b3d79901b7c
2014-02-04 22:16:13 +01:00
Alexandre Emsenhuber
a7a0883019 Enhance the destination control parameter of wfDebug() and wfDebugLog()
- The parameter is now a string, making is more understandable than
  boolean values
- It takes the same values in both wfDebug() and wfDebugLog() (except
  for 'private' which is only used in the latter)
- This adds a new possibility to wfDebugLog() to log the message either
  on the specific log or the general one, but not to the debug toolbar
- Old boolean values are still recognised for backward compatibility
- Also send the messages passed to wfDebugLog() to the debug toolbar
  when they are written to a specific log and not restricted to logs
- Updated the calls of and wfDebug() and wfDebugLog() with the last
  parameter to change it into a string
- Renamed MWDebug::sendWarning() to MWDebug::sendMessage() and added
  $group parameter to it; will not break anything since that method
  is marked as private
- Changed the call to wfDebug() from MWDebug::sendMessage() to use
  wfDebugLog() with 'log' as thrid parameter, so that those messages
  can be logged separately from the main log and they don't show up
  a second time on the "debug log" tab of the debug toolbar

Change-Id: I1be09d4c1d3408ed5b26a5db02691c17c0ec0926
2014-02-04 19:56:24 +00:00
Jacob Clark
cced9d13f9 Added wfSuppressWarnings and wfRestoreWarnings
Added wfSuppressWarnings and wfRestoreWarnings before and after the
ini_set call to apc cache by default to suppress errors if ini_set is
disabled.

Change-Id: If91e99c30fce3af14e69acd35112af188e62b6ac
2014-02-02 19:23:24 +00:00
MaxSem
0998c41943 Revert "Include short descriptions for extensions bundled in the release"
Contains var_dump(), self-merged non-trivial code.

This reverts commit 96b2c66e24.

Change-Id: Ie630466ef50e6bcdabf01daff28c283c764aae35
2014-01-12 23:59:44 +00:00
Mark A. Hershberger
96b2c66e24 Include short descriptions for extensions bundled in the release
Also fix styling for the list of extensions.

Bug: 43817
Change-Id: I5335225683ec8f1c163bb67f478787ebc52ee3a9
2014-01-12 18:21:55 -05:00
Siebrand Mazeland
8a096e3444 Random documentation tweaks
Change-Id: I57c3bde6551c14324cf34e4db003a319d6cebc47
2014-01-02 23:45:14 +01:00
Aaron Schulz
7bd3a8c576 Added $purgeBlobs flag to LocalisationCacheRecache hook
* This helps replace the WMF live hack to skip calling clear()

Change-Id: I37bd6cf87e72b6d32e4c6c261abe2a0ef43d067e
2013-12-30 21:45:59 +00:00
jenkins-bot
1728c1a698 Merge "Made Title cache use MapCacheLRU" 2013-12-26 22:24:14 +00:00
jenkins-bot
c9eaaf7093 Merge "Plural rules: updates for UTS #35 Rev 33" 2013-12-23 14:00:34 +00:00
Siebrand Mazeland
2f7b68ffde Rename $wgExtensionMessagesDirs to $wgMessagesDirs
This is a better name, as we'll also be adding core and the installer i18n
to this.

Change-Id: Ic4c5849654aef54f3e5aea01a2d68e47d148b9bd
2013-12-20 17:02:18 +01:00
jenkins-bot
b3970523a3 Merge "Add support for JSON i18n files" 2013-12-20 13:41:42 +00:00
Roan Kattouw
6380e81cd0 Add support for JSON i18n files
Implementation for https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format

Add $wgExtensionMessagesDirs, which tracks the directory
(or directories) where each extension stores it's JSON i18n files.
In this commit only support for messages is implemented, but adding
support for other i18n variables (e.g. magic words) is easy to do later.

To be backwards compatible, an extension can specify both
$wgExtensionMessagesFiles and $wgExtensionMessagesDirs. Older versions
of MediaWiki will just work, and newer versions will use the JSON files
while ignoring the PHP file (except if the PHP file contains non-message
data like magic words).

Misc changes:
* Updated mergeMessageFileList.php to output both
  $wgExtensionMessagesFiles and $wgExtensionMessagesDirs

Change-Id: I8d137e15e1670880a9847263e6ce796c62a4670d
2013-12-20 14:34:06 +01:00
Tim Starling
e571717e06 Plural rules: updates for UTS #35 Rev 33
* New operands i, v, w, f, t
* New operators =, !=, %
* Ignore "samples", which are basically unit tests embedded in rule
  specifications
* Ignore the new "other" rules, which have an empty condition. It
  doesn't really makes sense to parse them, since the empty condition
  means special handling should be done in the caller, it is not
  equivalent to an unconditional true or false.
* Trailing zero support requires that the input number be a string.
  Documented this.
* Fixed some comments
* Added test cases for new features

Bug: 56931
Change-Id: I96986c0c664f785e75b0a4ced2ec9e37b72681c1
2013-12-13 11:53:29 +11:00
Aaron Schulz
5ac27d708b Made Title cache use MapCacheLRU
Change-Id: I913238adc2b8471e247df77150cfd772da1ac3f4
2013-12-04 00:27:23 -08:00
Aaron Schulz
a0368b3762 Made RepoGroup use ProcessCacheLRU
Change-Id: I322a6cf15566bde4fc5ee5bfa1be5fdc680cd763
2013-12-03 12:24:50 -08:00
Aaron Schulz
77f7e9ba65 Added MapCacheLRU class, a simpler cousin to ProcessCacheLRU
Change-Id: Ibe1b44c8e168a086afb3481b4bb7660dc7d31ae7
2013-12-03 19:47:02 +00:00
jenkins-bot
bc5951e743 Merge "Update some documentation" 2013-12-03 17:10:21 +00:00
Siebrand Mazeland
db9ebea5ac Remove unused local variable
Change-Id: I5f13b3bf7e769d0b0960b44e15b9c2454d9eb165
2013-12-03 15:01:07 +01:00
Siebrand Mazeland
cbb6648205 Update some documentation
Change-Id: I6a75964d2048de451e9b01a08f87cfe1ebd842ba
2013-12-03 14:59:45 +01:00
jenkins-bot
01596b2bbf Merge "Fixed spacing" 2013-12-02 06:32:10 +00:00
umherirrender
5ca5672aac Fixed spacing
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs

Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
2013-12-01 20:58:51 +01:00
umherirrender
e0b8d17b79 Simplify switch in BacklinkCache::getConditions
Change-Id: I9f1ddad705d1697dd81f74eb735dc386bab9d200
2013-12-01 11:55:44 +01:00
Chad Horohoe
13d64f3cb1 Improved CdbException handling in LocalisationCache
Change-Id: If1ad9a982c2a4a7a1e9ca7739b3c215bb821211a
2013-11-26 13:54:24 -08:00
jenkins-bot
9e0c2a0658 Merge "Fixed "Undefined property: stdClass::$page_namespace" error" 2013-11-20 06:36:30 +00:00
Aaron Schulz
ddaffed317 Fixed "Undefined property: stdClass::$page_namespace" error
* BacklinkCache::fullResultCache should always have all the columns
* Fixes bug from a9dc4d943e

Change-Id: Ic0042ef6b1ce655bd97814362d95d8b0fe53affa
2013-11-19 15:37:06 -08:00
jenkins-bot
b6dd4a28f5 Merge "Declare visibility on class properties of LinkBatch" 2013-11-19 19:49:57 +00:00
Siebrand Mazeland
7f56ab1d7c Declare visibility on class properties of LinkBatch
Set to public. Usage in for example api/ApiPageSet.php.

Change-Id: I8d6b8a0728a465544b09832b2916235628a21b8e
2013-11-19 08:32:31 +00:00
Siebrand Mazeland
a0c583e408 Remove unused classes Title[List]Dependency
Classes TitleListDependency and TitleDependency that are currently not
used. Searched core and extensions in Gerrit.

Change-Id: I51404ce36c4ef55393588817d1673fd17c81b4a2
2013-11-18 21:46:23 +01:00
Siebrand Mazeland
4a4fc11008 Update LinkCache::addGoodLinkObj param defaults to int
Update the defaults for $revision and $model from bool to int, making it
consistent with the documented input. Also update docs and line length.
Change "inval( $x )" to preferred "(int) $x" while changing the method.

Change-Id: Ic19a408aa7c50fb03e2c3aca8df3fa7cedc2420b
2013-11-18 21:09:24 +01:00
jenkins-bot
4bed5565db Merge "Declare visibility on class properties of LCStore* classes" 2013-11-18 18:58:22 +00:00
jenkins-bot
618a686ae6 Merge "Declare visibility on class properties of LocalisationCache" 2013-11-18 18:56:27 +00:00
jenkins-bot
10b41a1fb0 Merge "Remove underscore from classes LCStore_*" 2013-11-18 18:54:25 +00:00
jenkins-bot
3f8d11fe84 Merge "Set visibility on class properties for *Dependency classes" 2013-11-18 18:46:48 +00:00
jenkins-bot
4910f271f1 Merge "Declare visibility for class properties of LocalisationCacheBulkLoad" 2013-11-18 18:45:10 +00:00