Commit graph

380 commits

Author SHA1 Message Date
Aaron Schulz
eaf2f36483 Make sure getMulti() returns an array per the class interface
Change-Id: Ic08f3ac37467a2743d7f8be5f5fb0032f84c3b82
2014-09-03 20:17:28 +00:00
umherirrender
63dc5abc9a Fixed spacing
- Added space after reserved words: function, foreach, if
- Combined 'else if' into elseif
- Added braces to one-line statements
- Added spaces after comma, before parentheses

Change-Id: Ie5bbf680d6fbe0f0872dab2700c16b1394906a72
2014-08-27 18:31:50 +02:00
Bryan Davis
d7c8c3446d Ensure that expiry times are given as integers
Fixes "Fatal error: Argument 4 passed to Memcached::cas() must be an
instance of int, float given".

Change-Id: Ibf1ea638ec1a4dcf009cdaea8aa66008c74ff30b
2014-08-22 09:55:59 -06:00
addshore
dfd4c8c2a2 Use public instead of var in classes
Change-Id: I16d1714ba37667d8c9c7c79a765c7199ea0023e4
2014-08-17 21:07:37 +01:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
jenkins-bot
088a8bd2b4 Merge "Revert "Made LCStoreDB try to use a separate DB connection"" 2014-08-13 21:01:36 +00:00
umherirrender
21e0c1c533 Correct variable names in @param to match method declarations
Some @param have a typo in the variable name,
some @param's were in wrong order.

Change-Id: Ie25806831027112b398f6f4a909c59147ac3a5fa
2014-08-13 21:48:28 +02:00
C. Scott Ananian
9c0fff5a4b Revert "Made LCStoreDB try to use a separate DB connection"
This commit broke `php tests/parserTests.php`.

This reverts commit 4c0871fa0e.

Bug: 69082
Change-Id: If0781f8f51681717a848ec359c7b8c70932ed72d
2014-08-03 17:40:03 -04:00
jenkins-bot
627e33ed36 Merge "Cleanup some docs (includes/[m-r])" 2014-07-25 17:14:53 +00:00
jenkins-bot
9fc8b2228e Merge "Check for boolean false result from database query in SqlBagOStuff" 2014-07-25 01:31:55 +00:00
umherirrender
dd8921c9d9 Cleanup some docs (includes/[m-r])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I8ebfbcea0e2ae2670553822acedde49c1aa7e98d
2014-07-24 19:43:25 +02:00
umherirrender
abfa0d7854 Standardize @todo
Always use lowercase @todo
Changed some "@FIXME" to "@todo FIXME: "

Change-Id: I016d1f9511e6f3bbd22427f0fffeccd77ab5e0db
2014-07-23 22:27:20 +02:00
Ori Livneh
a1f1850252 Check for boolean false result from database query in SqlBagOStuff
Database::select() can return false, so we should check for it before
attempting to iterate on the result or to call methods on it.

Change-Id: I0862493305e5b2784422e0e94b3e62e734267795
2014-07-21 15:13:31 +02:00
umherirrender
2b021dc48a Fixed spacing
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif

Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
2014-07-19 23:12:10 +02:00
Aaron Schulz
d9385014fe Avoid breaking DB transactions in SqlBagOStuff
* Callers still sees some decent time ordering since writes block
  until committed. This will not blindly flush transactions though.
* Basically reverts 59e8032

Change-Id: Ib9a91ac023f8e3fafb0bf0eef9dca6e31b867be9
2014-07-16 17:59:36 +00:00
Aaron Schulz
4c0871fa0e Made LCStoreDB try to use a separate DB connection
* This avoids breaking the main transaction in finishWrite().
* Also removed an unused variable in SqlBagOStuff.

Change-Id: Ia330ac362b080c1338616d95b793032c4752dc23
2014-07-15 19:20:01 -07:00
Erik Bernhardson
ca4690d823 Correct out of date comment
The comment claims there is no cas method, but that was
implemented in 74f581e348

Change-Id: I6ffdc255204bcb3a03b0468c18609b0d30b6269c
2014-07-11 20:07:00 -07:00
Aaron Schulz
f9ddcb0453 Made getMaxLag() use caching to reduce connection spam
* This method is currently hit when bots use the maxlag API parameter
* Also added a $fallback param to ObjectCache::newAccelerator so code
  does not have to keep reinventing that logic.

Change-Id: I45bf1085301c5cf69b29b494a146c6a067534581
2014-07-10 10:46:42 -07:00
Matthew Flaschen
737653546a Don't unserialize integer reply from Redis incrBy
It does not work with unserialize because RedisBagOStuff->unserialize
expects either strings of digits, or serialized strings.  A plain integer
is neither.

incr docs were incorrect, so fix and expand by copying from parent class.

Change-Id: Ifc9c7a36f221b251ceea0d9a79ae6c3ce5753dd4
2014-06-27 18:24:35 -04:00
jenkins-bot
ad6289a7e9 Merge "objectcache: Actually unserialize integers as integers in RedisBagOStuff" 2014-06-27 18:47:27 +00:00
Aaron Schulz
211d6062e1 Add some casts for sanity before BagOStuff::add() calls
Change-Id: I6ecb609c88e4fc1ef614e94c551199bd610ca360
2014-06-26 16:25:31 -07:00
Timo Tijhof
eb0a3b7830 objectcache: Actually unserialize integers as integers in RedisBagOStuff
Before:
> SET   (stored)    GET
>  5     5          (string) "5"
>  '5'   5          (string) "5"
>  'x'   s:1:"x";   (string) "x"

After:
> SET   (stored)    GET
>  5     5          (int) 5
>  '5'   s:1:"5";   (string) "5"
>  'x'   s:1:"x";   (string) "x"

Follows-up 2ceda41c57.

Bug: 60563
Change-Id: I2bb09381b2bb733ac5a89175e053cb10eca68b08
2014-06-26 23:06:39 +00:00
Niklas Laxström
cc0a51fd39 Don't die on empty keys in MWMemcached
Bug: 64287
Change-Id: Iedfec96286212577a181b83957cdc4545be206d2
2014-06-05 08:09:47 +00:00
Matthias Mullie
63b22fe634 Cached misses in getMulti should be omitted
SqlBagOStuff::getMulti currently returns an array with false values for missed
cache keys.
Default BagOStuff::getMulti (and other specific implementations like memcached),
however, just omit missed values.

e.g.:

    $cache->getMulti( array( 'goodkey' 'badkey' ) );

should return

    array( 'goodkey' => 'value' );

instead of

    array( 'goodkey' => 'value', 'badkey' => false );

Bug: 65637
Change-Id: Ib2de06a0f76421094707f7ad4218346087f4dc55
2014-05-22 17:19:22 +02:00
Siebrand Mazeland
a36be914c3 Pass phpcs-strict on includes/objectcache/
Change-Id: Ib99f2e34255df0cc846727b134d1788aec48529d
2014-05-11 16:52:18 +00:00
Kunal Mehta
c592011404 Add BagOStuff::setMulti for batch insertions
Includes implementions for Redis, Sql and MemcachedPecl,
other types will fallback to using $this->set repeatedly.

Change-Id: I0924a197b28ee69e883128ccd672343e5c041929
2014-04-25 15:12:22 -07:00
Aaron Schulz
89d85a4be4 Added pool counter support for all thumb.php requests
* This can limit how many workers work on a given file at once,
  regardless of which specific thumbnail parameters are requested.
* Also added a BagOStuff::incrWithInit() method per DRY.
* Tweaked the register_shutdown_function() callback to avoid
  File/MediaTransformOutput references, since they may involve
  TempFSFile objects.

Change-Id: Ic01461cb974ab23b179ac3b60cf6de12e36360f6
2014-04-23 20:57:17 +00:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00
umherirrender
b9cd789fce docs: closure -> Closure; callback -> callable
Changed closure to capital word Closure in doc and type hint,
also changed callback in docs to callable

Change-Id: I52c8e8f13d38a837052101c38b9986be780ca057
2014-04-19 08:43:31 +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
Bartosz Dziewoński
59002d8935 Consistently use '@deprecated since <version>'
Variants included 'in <version>', 'as of <version>' and just the
version number.

Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.

Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
2014-04-15 22:18:19 +02:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
Alexandre Emsenhuber
28fe01dcdc Remove trailing line break check from MemcachedBagOStuff::debugLog()
wfDebugLog() already does the same, so it's unnecessary here.

Change-Id: Ia7bbbd2806fcd638861d010835c33969322d262a
2014-04-05 20:28:06 +02:00
Aaron Schulz
4d7f18f6d5 Made BagOStuff fail fast in cas/lock on certain errors
* This avoids wasting time waiting on down servers

bug: 63058
Change-Id: Ia78a2036ffa7a20102ec9e8bf941cacb7fa63435
2014-04-01 13:26:44 -07:00
Aaron Schulz
587a98aa02 Lowered high lock timeout in mergeViaLock() and lock() in BagOStuff
Change-Id: Ib5cd0a98ce6ec47edb24f8cc9f4df2c941ce1c38
2014-03-25 17:14:33 +00:00
umherirrender
2000672ac3 Fixed spacing
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat

Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f
2014-03-20 20:37:30 +00:00
Ladsgroup
a90f1a2d79 Changing URLs of mediawiki.org in scripts to the SSL-based website
http://www.mediawiki.org --> https://www.mediawiki.org

Part 3

Change-Id: Ica633881b1744fa2854f4b012b79dbf5a7e5e7e2
2014-03-13 22:28:14 +00:00
Aaron Schulz
83dd6d7e3d Deprecated useless BagOStuff::replace method
* Almost nothing actually uses this (one extension)
  as it doesn't really solve race conditions like merge().
* Removed subclassed versions too.

Change-Id: I4d4123afcc0576a90a3cbf1e4e6daff7ebce39c3
2014-03-09 02:53:04 +00:00
Aaron Schulz
4265d8f23f Added simpler handleError() method in RedisConnectionPool
* Callers should not need to give $server since it is stored in RedisConnRef

Change-Id: I902d984d6a7f19dd0d8c71ee374cbed359de378e
2014-02-12 07:29:32 +00: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
tonythomas01
225f1b724c Removed version check for mysql 4.1.0 from SqlBahOStuff::createTables
Presently mysql v5.0.2 or later is supported.

Bug: 59125
Change-Id: I9043a6f792c6479a85411addbe9fd448ed5e02a6
2014-01-28 15:43:32 +05:30
Siebrand Mazeland
eabdda4fba Remove FakeMemCachedClient
Was deprecated in 1.18. Not used in core or Gerrit extensions.

Change-Id: I06bc9c6f01f21386c772fa7fad57b55a7c7b2fe4
2014-01-22 17:17:18 +00:00
Chad Horohoe
736820f8f2 Remove DBABagOStuff
Isn't useful outside of testing as the comments state, but it's
barely even useful for that. People who are testing the cache
code can use CACHE_DB if CACHE_MEMCACHED is too hard.

Change-Id: Ief0aa148376957fdd844c8bb585a133b854a012c
2014-01-16 11:43:59 -08:00
Chad Horohoe
19873e7693 Ehcache more like mehcache
mehcache isn't a caching system, it's a pun.

I'm removing Ehcache support because it's an experiment didn't pan out
and the code's just sitting here abandoned now.

Change-Id: Ief5728b4c61bb5ad8f5a5f0b55415b23ef6727eb
2014-01-16 18:44:09 +00:00
Matthias Mullie
2a4dfa169b Don't use complex datatypes as CAS tokens
For caches where CAS is not natively supported, we have a workaround, where the
CAS token is (based on) the stored value.

To confirm the data can be written to cache, the CAS token is compared against
"whatever is currently in cache", so we pull the cached data and rebuild the
value.

In the case of objects, we have now pulled & rebuilt (unserialized) 2 objects
that are actually the same object (for CAS purpose - it's the correct value to
overwrite), but in terms of ===, they're 2 different values.

This patch should make sure CAS tokens are always a serialized version of the
value we're saving (where no native CAS exists); these serialized versions can
reliably be compared.

Bug: 59941
Change-Id: I2760416c48f2ceb7a0e0c874dd70ec07b4dccdfc
2014-01-14 16:45:32 +01:00
Joel Natividad
bee00fcac9 changed memcached server parsing to allow for local unix domain socket connections
* This works with local memcached (e.g. unix:///var/run/memcached/memcached.sock:0 )
  and noticeably increases memcached mediawiki performance

Change-Id: Ie08c151caa09eb0a4269df88965d71c2367c398b
2013-12-31 11:10:53 -08:00
jenkins-bot
dd981eb7b5 Merge "Fixes to RedisBagOStuff" 2013-12-03 20:48:20 +00:00
Aaron Schulz
2ceda41c57 Fixes to RedisBagOStuff
* Avoid serializing scalars like the memcached client does.
  This means incr/decr can be fast and preserve the TTL.
* Properly call unwatch() in the cas() method.
* Made the expiry set on add() actually atomic.
* Also cleaned up the profiling calls.

bug: 56069
Change-Id: I3e0d1c4888062544c54aef32085f8ce608ff5423
2013-12-03 11:56:24 -08:00
umherirrender
0bc583af2c Move closing parenthesis from multi line if and function to own line
The Line continuation Coding conventions prefers the closing parenthesis
on the same line than the beginning curly braces. This is done for ifs
and functions.
Also move some boolean operator from the end of a line to the beginning
and changed some indentation to make the condition hopefully better
readable.

Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
2013-12-01 21:39:00 +01:00
Aaron Schulz
59e803274b Made SqlBagOStuff fully avoid transactions when possible
Change-Id: I775d872b522f68462496bbfa685665cc8faf9bf1
2013-11-21 16:26:24 -08:00
Matthew Flaschen
face4812c6 Fix Redis increment behavior by using BagOStuff->incr instead
Due to the PHP serialization, the Redis native INCR and INCRBY do not
work.  This instead falls back on the parent class's incr, which uses
lock and unlock, and incrementing on the PHP side.

Bug: 55986
Change-Id: I500199aeb935963ca118fde163bd7ba0cba8f79f
2013-10-22 17:39:00 -04:00
MatmaRex
df8ec1e216 No spaces after (casts)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
2013-09-04 20:05:43 +02:00
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
jeroendedauw
9104af80ef Fix return types in documentation
Change-Id: I726e6201a737ab406dd0e46754d2bbbd95e769b4
2013-06-28 23:48:31 +02:00
asher
dcf080c16d support setting Memcached::OPT_SERVER_FAILURE_LIMIT, Memcached::OPT_RETRY_TIMEOUT
Change-Id: Ib1fcae92b65e8fd23baee7af7ed64abd908b600e
2013-06-12 12:49:38 -07:00
csteipp
d02b5bd7f7 Add value to add() call when locking
When BagOStuff::lock() was called, it called $this->add() with only
two parameters, the key and the timeout. But BagOStuff::add() takes
three parameters (key, value, timeout), so all locks got an infinite
timeout.

Change-Id: I82bed11b0b799f2cda13a8a0bd0cd94908b6ce8e
2013-05-10 12:42:16 -07:00
umherirrender
6f79eef473 Fixed spacing around parenthesis in includes
Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
2013-04-28 15:50:07 +00:00
Matthias Mullie
edf169b448 Docs for Redis' ->exec() return value
I had to look up exactly why it'd return an array, figured someone else some day
might too

Change-Id: Iefb3a0f8292baf8846ed6a1b852432eb9daa92c2
2013-04-24 10:00:02 +02:00
Aaron Schulz
9157649022 Fixed return value for RedisBagOStuff::cas().
Change-Id: I3b180baaba8fb12ab2960e358c8b6d1a1eac05dd
2013-04-23 14:31:52 -07:00
umherirrender
892ee7a4af Fixed spacing in db/debug/diff/externalstore/objectcache folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I32a43c547630ce31b6b25cc1bc9eedc50e67b2d7
2013-04-20 22:28:52 +02:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
Tim Starling
9407284253 In SqlBagOStuff::getMulti(), catch connect errors
This case was somehow neglected in Ifba0d276. The other methods work
correctly.

Change-Id: If29f0212f07c13bd72469c580bb096a2a41a96b5
2013-04-03 09:56:42 +11:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
Matthias Mullie
01c1a11625 Docs for gerrit 47419
Change-Id: I021b7250418e60397127e1778107ee3da77ffb18
2013-03-07 18:54:12 +01:00
jenkins-bot
ba940af288 Merge "Read full memcached response before manipulating data" 2013-03-07 17:34:05 +00:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
Matthias Mullie
a8f00e5c97 Read full memcached response before manipulating data
Memcached response when fetching data typically looks like this:
VALUE <the stored value for whatever key you requested>
END

What the code used to do is read the first line (the VALUE) and re-
assemble the data being fetched there (like unserializing serialized
data). After that, it will read the next line (END).

The value could be a serialized object, which could have a __wakeup.
This __wakeup could have code which in turn executes Memcached-
related stuff. The problem is that, while that object is being
unserialized already, it's wakeup code is attempting to read new
stuff from Memcached, but we have yet to read the END of the data
we're attempting to unserialize (when we'll read a new value from
Memcached, the first thing we'd get is the END we have not yet read..)

The correct way to go about this would be to first read the full
Memcached response, and only unserialize the read data after that.
This is exactly what this patchset does.

Change-Id: I902809c6dde657091c8161a09df823170bd41f7a
2013-03-07 15:59:10 +01:00
Siebrand Mazeland
9b7889b84b Use American English spelling for behavior
Spotted in ipbreason-dropdown by Shirayuki.

Change-Id: I576ed4bc0abe5ab980aaee3fb9f9e4b43087311f
2013-03-04 10:24:57 +01:00
Reedy
b3e34e3c46 Add missing parameter in handleWriteError call
Change-Id: If3ebf6f77d66121bac8e11d43582f1dbb3e88e12
2013-02-27 09:48:32 +00:00
Aaron Schulz
36e186aa03 [BagOStuff] Converted RedisBagOStuff to RedisConnectionPool.
Change-Id: I9c269b77e51d335702146d15ebbfd38167c4ed1d
2013-02-26 20:45:13 +00:00
Aaron Schulz
0b442a82e8 [BagOStuff] De-breakified cas() for SqlBagOStuff.
* Seemed to be a functional merge conflict with sharding code.

Change-Id: I1e49790f6b82b09ea2cd6606ca918f0a620a191f
2013-02-15 14:31:19 +00:00
umherirrender
ca31ebad3f fix some spacing
Added/removed spaces after opening/before closing parentheses

Added a space after a comma

Removed unneeded parentheses in condition

Change-Id: I306091347ccaaf11dee0cdfda3019cb0c12be51b
2013-02-09 23:03:53 +01:00
umherirrender
48cd72819e fix some spacing
Change-Id: Ia9650be8b791fd2f0ccbc099436918a9d12d9968
2013-02-04 20:04:26 +00:00
Antoine Musso
f6b92231fd style: normalize end of files
By PSR2 PHP Standard, the files should ends with exactly one newline.
Some of our files have 2 or more and some other were missing a newline.

Fix almost all occurences of CodeSniffer sniff:
PSR2.Files.EndFileNewline.TooMany

I have not fixed the selenium files, I believe we will drop them.

Change-Id: I89fca8c1786fee94855b7b77bb0f364001ee84b6
2013-02-03 15:04:39 +01:00
Aaron Schulz
e2e6b16123 Improved BagOStuff docs.
Change-Id: I01c62de23b73e1bac96aede73cd6995df8ff1221
2013-01-25 11:50:02 -08:00
Brent Garber
0072e0efeb (bug 44024) ObjectCache changes break XCache 3.x support
Changes in the 1.20.x branch altered the add method to check for the return value of get against
false.  Xcache 3.x returns NULL for unset values and so this check was erroneously determining that
all values are set when they were not.

This was causing basic ObjectCache usage to fail.

Change-Id: I0975e5c6a60c2813dc2d02aca84245807b8fb828
2013-01-19 03:43:03 +00:00
Alexandre Emsenhuber
b1f8855078 Follow-up Id75401be (e32c8afe): no more need to prefix debug messages
Since that revision, messages sent through wfDebugLog() and without
a corresponding entry in $wgDebugLogGroups will be prefixed there
before being sent to wfDebug(), so it's no longer needed to have the
exact same checks for the debug messages in memcached clients.

Change-Id: Ia690a87bc6d1994fe371816470efde6d09e3b881
2013-01-16 20:08:16 +01:00
Demon
0e5f53d262 Merge "Removed useless keys() function from BagOStuff." 2013-01-14 11:48:31 +00:00
Platonides
671bb97746 Add wfProfileOut() missing in 74f581e34
Change-Id: Icc567e3f27dc8f9d0e405fcb9fa1103d9012acb3
2013-01-13 18:01:40 +01:00
Matthias Mullie
74f581e348 Added merge() function to BagOStuff for CAS-like functionality.
* merge() will use CAS if supported or use locking otherwise
* The lock()/unlock() methods now have a default implementation
* added unit tests for merge

Change-Id: Ic27088488f8532f149cb4b36e156516f22880134
2013-01-10 09:03:09 +01:00
Aaron Schulz
692e6103f2 Removed useless keys() function from BagOStuff.
Change-Id: Ie4249b2770de81377019ad383039ab85c0c5de7a
2013-01-07 17:32:27 -08:00
Tim Starling
7c4198805a Use consistent hashing for SqlBagOStuff servers
Also factor out consistent hash code from Redis and the new application
into a class called ArrayUtils. The name "ArrayUtils" is from
I0f4e7d7c, I expect that change will be rebased on top of this one at
some point.

Change-Id: I9375087f4d7a6e8e629d97bfb6b117d9cb7d1bcf
2013-01-04 18:07:07 +00:00
Tim Starling
30d6510f63 Multiple servers in one SqlBagOStuff
Added a multi-server feature to SqlBagOStuff.

Tests done:
* With both the "shard" and multi-server features enabled and
  $wgAllDBsAreLocalhost, tested getMulti, set, incr, decr, keys,
  garbageCollect, deleteAll. Tested wiki page views with
  $wgMainCacheType set to such a cache.
* Tested connection errors.
* In the plain CACHE_DB configuration, tested wiki page views.

Change-Id: Ifba0d276ef724cc9b33f687bc0adae4637054328
2012-12-28 19:13:21 +11:00
Reedy
d537d96868 Add numerous missing @throws to method documentation
Change-Id: Iba868e82a75fef7c7d011bc5be192bf059d037c0
2012-12-09 03:09:48 +00:00
Ori Livneh
8c313fe58b Fix typo: exipration => expiration
Change-Id: I73d19cfeed0596b66e16e4c383b3658594c211e3
2012-11-15 01:47:54 -08:00
Niklas Laxström
ac7e23b553 Typofix
Change-Id: I50bf84c3d7f75f6d2a0f3d4f8e86622486f2be28
2012-11-14 07:43:02 +00:00
Aaron Schulz
efda0b27be Added GET profiling to pecl memcached (like the PHP one has).
Change-Id: Ic92eb740240e2cb46688a174cdeda87c02d4d498
2012-11-07 13:42:40 -08:00
Aaron Schulz
29ab088e2f Merge "Stop php strict error warnings from MemcachedClient::_flush_read_buffer()" 2012-10-23 18:44:48 +00:00
umherirrender
c66d868e6d Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I166a171c196f4c2c75886be12f913ffa9a4a35ad
2012-10-19 22:10:42 +02:00
awjrichards
b7a9b77199 Stop php strict error warnings from MemcachedClient::_flush_read_buffer()
Change-Id: I467f293e3be30c7019111a368491c1a3a6a2af08
2012-10-12 11:46:41 -07:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Tim Starling
6a1a1698a5 Rationale for using MD5 hash
Just documenting some benchmark work I did.

Change-Id: Ic24edc5b857e06a8bfe83d70f2da0d7f4690c6af
2012-09-19 18:35:42 +02:00
Aaron Schulz
5c164069a3 Fixed warning spam in SqlBagOStuff.
Change-Id: Iac573980596349deab757eac859d9e28dc2963b6
2012-09-16 10:56:52 -07:00
IAlex
b8256e78fb Merge "Made DBABagOStuff return values match the base class better." 2012-09-08 05:46:50 +00:00
Aaron
feda536915 Made DBABagOStuff return values match the base class better.
Change-Id: I2e6fd79195c52e66f8345c5cc67c2e3dcc04578d
2012-09-05 12:50:09 -07:00
Aaron
676446ef90 Made default BagOStuff::incr() function more like memcached.
Change-Id: Ia216f20fdcf855448e2f2e4d99667e72c6254f82
2012-09-05 11:51:04 -07:00
Alexandre Emsenhuber
a75b6d53cd Improve documentation of maintenance scripts.
Also contains a fix for Ia5a38311 (fae0550).

Change-Id: I630c83b48b66c5d8c97411082cabd731f316f42d
2012-09-02 20:33:22 +02:00
Alexandre Emsenhuber
d3e0168c67 Added missing GPLv2 headers in new files.
Also improved file documentation.

Change-Id: Ia5a383110769cf51603305dc639616d904ebbab2
2012-09-01 21:56:38 +02:00
Vitaliy Filippov
359d2fd2f9 Bug 20595 - Fixed incr()/decr() functions for some caches.
* Preserve TTL in objectcache incr() method for APC, XCache and DBA.
  Do not serialize numeric values, since it breaks the counters.
* Also gave some DBABagOStuff functions explicit visibility.

Change-Id: I13856832f418c843afc8e42a6d77686331f6cb41
2012-08-29 18:35:24 -07:00
Aaron
ad183cc875 Catch exceptions in SqlBagOStuff and cache connection failures.
Change-Id: I443f1bed3f9ccb40c444dd01ec446b677caf9d03
2012-08-16 12:44:24 -07:00
Tim Starling
5800c37533 Added a Redis client for object cache storage
With sharding, failover and consistent hashing. Only supports the
extension (phpredis), since the pure PHP library Predis had about a
billion files and it made my eyes hurt.

Change-Id: I90fb4a41d15265b9c22f8e32ecd1d956f89f3ce8
2012-08-09 10:01:34 +10:00
Tim Starling
3b0132a649 Allow session expiry time to be configured
When $wgSessionsInObjectCache is enabled, use a configurable expiry time
instead of a hard-coded one-hour expiry.

Change-Id: Ia51962176d30fd87e298c47ec347a143cad80772
2012-08-08 11:20:30 +10:00
Tim Starling
6eb6313b6f Allow session storage to be configured independently
* Introduce $wgSessionCacheType to allow the session storage to be
  configured independently of $wgMemc.
* Renamed $wgSessionsInMemcached to $wgSessionsInObjectCache to reflect
  the new versatility.
* Modernized the relevant code, removing the explicit require_once(),
  used the autoloader instead. Moved it to ObjectCacheSessionHandler.
* Tested with memcached, external sharded MySQL and APC, it all seems to
  work just fine.

Change-Id: I473334bb56cafb4e21ac1c1304d69095676fc0c4
2012-08-08 10:25:56 +10:00
Tim Starling
76c3ab462f Memcached PHP client improvements
* When there is a read error, close the socket and mark the server dead,
  instead of continuing to send requests through it, causing a protocol
  violation.
* Also check for write errors.
* Increase the default stream and connect timeouts from 100ms to 500ms.
* Remove the commented-out _safe_fwrite() code that I wrote in 2005,
  that PHP bug is fixed now, so writes can be handled the same way as
  reads.
* Fix E_STRICT errors in get_multi() due to a resource being used as an
  array index.
* For performance, flush the read buffer less often (only on persistent
  connect).
* Move the fread() loop from _load_items() into its own new function.
* Be stricter about stripping expected newlines, don't just run trim() on
  everything.
* Make MemCachedClientforWiki into a simple alias since the distinction
  with MWMemcached was lost many years ago. We even renamed the class
  "MWMemcached".
* Remove vim modeline made incorrect by 19d6293 (Nov 2009).

Change-Id: I81de31049b87038999e37054d8d174a782c78a68
2012-08-03 21:24:55 +10:00
Antoine Musso
bbf703c4fa memcached: better error messaging
MemcachedClient output a generic error message: "Error parsing memcached
response\n" whenever it is not able to read from the socket. It is also
lacking the remote peer it is reading from.

This patch add a new message when fgets( <socket> ) return false, which
means we could not read from the file pointer. It also get the stream
remote name for debugging purposes.

Change-Id: I9b8a25a03af0d730aa3b4830a44b1ea739343274
2012-08-01 16:33:26 +02:00
Aaron Schulz
1caa1d7361 Revert "memcached: better error messaging"
This always issues PHP notices when the code is hit.

This reverts commit fe6da52a11
2012-07-25 19:28:08 +00:00
Antoine Musso
fe6da52a11 memcached: better error messaging
MemcachedClient output a generic error message: "Error parsing memcached
response\n" whenever it is not able to read from the socket. It is also
lacking the remote peer it is reading form.

This patch add a new message when fgets( <socket> ) return false and
attempt to get the remote peer address / port to append to the error
message. Might help us find out which memcached server is wild.

Change-Id: If918e824970aaa8231078e42fd28d31e8dd4e319
2012-07-13 18:20:00 +02:00
Antoine Musso
d5737f8f17 update @param @return doc in several files
Change-Id: I0e23227330f90dc4121fd2a313d2e9a33c3c97a7
2012-07-10 17:08:52 +02:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
Reedy
019e74a31a Flesh out parameter documentation etc
Remove some trailing whitespace

A bit of code simplification

Change-Id: Iea96a2482c53868713a43569be4e5de4c9edb2a2
2012-07-09 12:44:13 +00:00
saper
646a9490f7 (bug 27283) SqlBagOStuff breaks PostgreSQL txns
* SqlBagOStuff should not turn off automatic transaction
    control just like that. Keep previous
    connection for PostgreSQL and SQLite

* 94633ff448 introduced
    rollback on error to restore sanity
    for the connection. Don't do this
    if you are in the middle of INSERT IGNORE
    and we have a savepoint open.

    Making sure query syntax errors don't
    get silenced by our "wonderful" implementation
    of INSERT IGNORE is bug 35572.

Change-Id: I841b03895e1189c47307fefb1516c4c7c4102e25
2012-06-14 23:33:11 +02:00
Aaron
396be409e2 Fixed pecl memcached client in persistent mode.
* When using a persistend ID in the constructor, the object is effectively shared among
  the callers using that ID. If we always use __CLASS__, then this breaks when different
  BagOStuffs may be used. Instead, a hash of the settings is now used.
  See http://www.php.net/manual/en/memcached.construct.php.
* Don't keep adding servers to the pool, as the object is shared among callers. Once one thread
  initializes the object, it will already be initialized by the next thread. Calling addSever()
  again will cause an increasing number of duplicate servers to exist in the data structure, and
  thus an increasing number of socket connections over time.
* Also, use addServers() instead of multiple addServer() calls per
  http://www.php.net/manual/en/memcached.addserver.php.

Change-Id: I0e7510320cb79d9f152e8958ddd50400fa9da37f
2012-06-13 18:19:33 -07:00
Mark A. Hershberger
99fdc6e838 Bug 24985 use $wgTmpDirectory when available
We had two way to get a temporary directory:

 - $wgTempDirectory: more or less stable accross sessions
 - wfTempDir(): set through environnement variable and could potentially
   vary from a session to another one thanks to tempnam()

This patch makes wfTempDir() to always use the global $wgTempDirectory
first when it is available. Thus explicitly overriding tempnam() or any
environnement variable such as TMP or TEMP.

Hence, people who don't have access to a system wide directory
specificed by their environnement (such as /tmp) can specify an
alternative straight from the MediaWiki configuration.

The patch remove references to $wgTmpDirectory and replace them with
calls to wfTempDir().  Make wfTempDir() use $wgTmpDirectory first.

The default setting of $wgTmpDirectory was removed in favor of having it
initialized through Setup.php by calling wfTempDir.

Note: this may also address Bug 36475 - Generating thumbnails does not
work when there is no access to /tmp

Change-Id: Ifdc79e9c5d95f978025b237a5eeb95fd75092f46
2012-06-13 21:30:22 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Aaron Schulz
3c1495e968 Made default BagOStuff functions work consistently.
* Made getMulti() only return keys for items that exists.
* Made add() return false if the item already exist.
* Made replace() return false it the item does not already exist.

Change-Id: Idb9d9843ace0c81f71abfc22b90e30eb33d7579d
2012-06-03 16:29:39 -07:00
Alexandre Emsenhuber
3bbda787b8 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ic1ba00472ef62fa4fd746f8f590fe694d490ecd9
2012-05-20 17:56:43 +02:00
Aaron Schulz
6a460ed446 Renamed new BagOStuff getBatch() function to getMulti() for consistency.
Change-Id: Icfe673919f65192565aa114c165c90d97d33785a
2012-05-15 01:48:22 -07:00
Tim Starling
d3fd5db207 Minor PECL client fixes
* Fixed the check for igbinary presence. It's not enough for the
  extension to be loaded, the memcached extension also needs to be
  compiled with --enable-memcached-igbinary.
* When delete() is attempted on a key that doesn't exist, return true,
  as in the other BagOStuff implementations.

Change-Id: I298952f4a9925d860fa5673f632d073b1f20aa47
2012-05-15 14:13:58 +10:00
Tim Starling
3c62077fe2 Implemented a wrapper for the memcached PECL client
* Introduced a common base class for the two memcached clients, called
  MemcachedBagOStuff.
* Moved the expiry time normalisation from MemcachedClient.php to
  MemcachedBagOStuff since libmemcached needs the same workaround.

Change-Id: I507d4ec5a7fd863ae64a94f2c453981f9f03746c
2012-05-15 10:19:41 +10:00
Brion VIBBER
78a58988d4 Merge "Optimized SqlBagOStuff::getBatch() a bit." 2012-05-08 20:30:55 +00:00
Alexandre Emsenhuber
d7f3f6be14 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ib21f42166ae0841e04c8af4fdcf59c0fa06f1738
2012-05-02 10:51:15 +02:00
Aaron Schulz
253f8ff6a0 Optimized SqlBagOStuff::getBatch() a bit.
Change-Id: I046ce9e1156071233077296b66071fcc0876719c
2012-04-28 14:15:26 -07:00
Aaron
bb5e589600 Made delete() return True for NOT_FOUND memcached responses.
Change-Id: Ia1ec62721a3e42dd7a5bd21974e922d500d3f501
2012-04-27 16:41:20 -07:00
Aaron
a763553077 Improved BagOStuff documentation and made some return value tweaks.
Change-Id: I9d8f09c10ccc5e710bd8cae05b8f3da3c2d02056
2012-04-26 18:34:32 -07:00
Aaron Schulz
8019ebda16 Added getBatch() function to BagOStuff and optimized it for memcached.
Change-Id: Id8a3ed1ac7b22db7f7bf58ffde4be3285e8e2df9
2012-04-21 11:07:18 -07:00
Antoine Musso
ad240ebc22 group memcached debug logs
When enabling memcached debug logs ($wgMemCachedDebug), they are
unconditionally sent to the main $wgDebugLogFile.  This patch make it
possible to sent thoses specific log to an alternate file by setting
$wgDebugLogGroups['memcached']

Change-Id: I85d8ab92471ce3c31f8168dae83fe91e95e18dce
2012-04-19 15:50:44 +02:00
Sam Reed
c27fbf5330 Trim trailing whitespace
Add/improve documentation

Explicitly define a few variables

Change-Id: If0017770a0a47f8f6be178b5bde8ae6691f74b6a
2012-03-21 15:47:05 -07:00
Roan Kattouw
311200ee2c Revert r114067, r114071, r114075, r114079, r114081, r114082, r114084, r114086, r114088, r114089, r114101, r114118, r114137, r114147, r114164, r114172, r114175, r114180, r114208, r114209, r114215, r114219, r114226, r114321, r114322.
This reverts the SpecialCachedPage and formatDuration sagas, with some collateral damage here and there. All of these revisions are tagged with 'gerritmigration' and will be resubmitted into Gerrit after the Gerrit switchover. See also http://lists.wikimedia.org/pipermail/wikitech-l/2012-March/059124.html
2012-03-20 23:03:59 +00:00
Sam Reed
a2dc33a5a3 Trim trailing whitespace
Add/improve documentation

Explicitly define a few variables
2012-03-17 22:52:54 +00:00
Krinkle
ff2cc27e16 [ObjectCache.php] typo from r112985 2012-03-08 03:19:51 +00:00
Krinkle
5985cc9da7 [ObjectCache.php] Add comment describing that CACHE_ANYTHING will use whatever is configured on the wiki for $wgMainCacheType etc., and that if those are set to CACHE_NONE (which it is by default) then CACHE_ANYTHING is CACHE_DB. 2012-03-04 22:53:05 +00:00
Alexandre Emsenhuber
61a88f8c18 Pass __METHOD__ to DatabaseBase::begin(), DatabaseBase::commit() and DatabaseBase::rollback() 2012-02-26 17:19:11 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Sam Reed
0a626db6e1 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:29:36 +00:00
Sam Reed
f3cc77aaee Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:41:50 +00:00
Alexandre Emsenhuber
1a49741c20 Pass __METHOD__ to DatabaseBase::begin() and DatabaseBase::commit() 2012-01-17 11:38:00 +00:00
Antoine Musso
f874649556 (bug 32853) DBA cache broken in MW 1.18
DBABagOStuff was not refactored by r83140 which pass BagOStuff constructors
an array. This patch honor the 'dir' parameter to let you override the global
$wgTmpDirectory.

Need backport in REL1_18
2011-12-07 11:04:11 +00:00
Tim Starling
53d267b3dc purgeParserCache.php improvements:
* Do queries in batches of 100 rows instead of all at once. Note that if there are a lot of objects with the exact same expiry time, it might take multiple runs of the script to delete them all.
* Progress meter.
2011-12-02 02:59:11 +00:00
Chad Horohoe
de20376cc1 (bug 29747) eAccelerator shared memory caching has been removed since it is now disabled by default and is buggy. APC, XCache and WinCache are not affected.
As Brion points out in <https://bugzilla.wikimedia.org/show_bug.cgi?id=29747#c7>, the shared memory functions are very buggy. In fact, eAccelerator has disabled the shared memory functions by default for awhile now. I didn't touch APC, XCache or WinCache, but I imagine they suffer from the same problems.
2011-11-22 22:56:00 +00:00
Sam Reed
dd6062e75e Bug 13759 - memcached predefined hashes
Patch by Zac Bristow

Half of the patch was already applied. Updated documentation to match
2011-11-19 20:01:33 +00:00
Mark A. Hershberger
037f754c4a eol w/s 2011-11-03 13:58:29 +00:00
Mark A. Hershberger
d9537b113e Meant to include these: feed the OCD: eol w/s 2011-11-01 18:32:05 +00:00
Mark A. Hershberger
58a53f643e feed the OCD: eol w/s 2011-11-01 18:31:38 +00:00
Platonides
cccbb916b0 Parse error (missing ';') in r99938. 2011-10-16 19:53:30 +00:00
Sam Reed
9ceb44a598 Fixup some assignments in conditionals
Add/normalise some more return statements
2011-10-16 03:27:12 +00:00
Roan Kattouw
f8024445dd Per Domas, reinstate <1e9 check that was dropped in r94199. Also document what these checks are all about in more detail. 2011-10-06 14:07:57 +00:00
Aaron Schulz
a6999018e5 Added lock/unlock function stubs. Fixes:
PHP fatal error in /usr/local/apache/common-local/php-1.18/includes/objectcache/MemcachedPhpBagOStuff.php line 91: 
Call to undefined method MemCachedClientforWiki::lock()
2011-09-21 20:25:58 +00:00
Tim Starling
cac02778e4 * Added a script to reduce disk space on a MySQL parser cache setup such as the one at Wikimedia at the moment, by removing all objects which expire before a given time.
* Fixed unintentional shortcut evaluation in MultiWriteBagOStuff::doWrite(). It would have caused writes to be skipped on the second cache if the first cache failed, now writes should be attempted on all caches.
2011-09-09 03:51:45 +00:00
Roan Kattouw
e877e8f5e0 Merge r93797 to trunk, in a somewhat modified form: clamp expiries for memcached to 30 days, higher values give trouble apparently 2011-08-10 21:15:57 +00:00
Brion Vibber
53ab456ebf * (bug 30131) XCache with variable caching disabled no longer used for variable caching (CACHE_ACCEL)
Patch from John Du Hart: https://bugzilla.wikimedia.org/attachment.cgi?id=8849&action=diff

If XCache is present, but the xcache.var_size setting is off, we'll now consider it as xcache being disabled for CACHE_ACCEL purposes. It won't trigger view of the accelerator option in the installer, and at runtime if using CACHE_ACCEL and no other modules are available, it'll throw an error so you know that it doesn't work!
2011-07-31 01:52:38 +00:00
Alexandre Emsenhuber
cda248c53a Removed usage of error suppression operator 2011-07-06 16:29:27 +00:00
Tim Starling
9f4064540e Allow SqlBagOStuff data to be split over many tables, to avoid lock contention performance issues on servers with a high write load. See http://bugs.mysql.com/bug.php?id=61735 and http://bugs.mysql.com/bug.php?id=61736 . 2011-07-04 12:01:10 +00:00
Chad Horohoe
1187d3eeec Revert r87145, bug 28752: Xcache doesn't work in cli mode. As pointed out on CR, this didn't fix it, it just hid the issue. 2011-06-08 00:53:56 +00:00
Sam Reed
051198ce45 Followup r83140, fix undefined $id 2011-05-29 14:28:01 +00:00
Sam Reed
ba2c3a793d And even more documentation in various files 2011-05-29 14:25:20 +00:00
Sam Reed
4065e65d03 Even more documentation in various files 2011-05-29 14:24:27 +00:00
Sam Reed
296f3d3f4f And even more documentation 2011-05-28 18:59:42 +00:00
Sam Reed
3614ecfffb And more documentation. Yaaaay 2011-05-28 17:18:50 +00:00
Sam Reed
ba0cbdeeff More parameter documentation!! 2011-05-28 15:59:57 +00:00
Sam Reed
e514478ba5 Fix function level comments that start with /* not /** 2011-05-21 19:35:16 +00:00
Sam Reed
f985524076 More versions added to @deprecated tags
Couple of inbound calls fixed up

Some ancient code removed as it's been marked deprecated
2011-05-06 21:50:18 +00:00
Chad Horohoe
8ae2840afb Make this private since nothing outside here calls it 2011-04-29 22:40:31 +00:00
Chad Horohoe
2323830a03 (bug 28752) XCache doesn't work in CLI mode 2011-04-29 22:40:12 +00:00
Sam Reed
bc1c6d2a6b More parameter and return type hints 2011-04-25 22:41:54 +00:00
Platonides
ec455d68fa (Bug 28611) Don't die in SqlBagOStuff::incr() if there's a race condition. 2011-04-19 17:59:59 +00:00
Tim Starling
e27500be17 In SQLBagOStuff: make it possible to change the purge period, or disable purging altogether. At Domas's suggestion, for deployment to Wikimedia very soon. 2011-04-12 03:59:47 +00:00
Sam Reed
bccd879a46 Add/tweak/update documentation and add some explicit defintions with type descriptions 2011-03-25 10:56:54 +00:00
Platonides
4cba30ab1b Comment the var_dump() and add a comment.
Follow up r83208.
2011-03-08 00:20:26 +00:00
Platonides
8f0a89efcb Reorder so that wfProfileOut() is the last sentence before the return. 2011-03-06 23:29:29 +00:00
Platonides
9ced2d5c60 Follow up r83140. Add a clear() method to ObjectCache so that it can be used by ForkController. 2011-03-06 23:07:36 +00:00
Tim Starling
f509ce8060 * Added an Ehcache client.
* Fixed encoding of spaces in memcached keys, in r83140 they would have been encoded as "+".
2011-03-04 06:01:30 +00:00
Tim Starling
88161eff47 * When CACHE_ANYTHING is requested, return the cached instance, don't construct a new object for each use.
* In MemcachedSessions.php, register a shutdown function to shut down the session early, before $wgMemc is destroyed. I'm not sure why my recent changes caused this problem to show up now. 
* Use EmptyBagOStuff instead of FakeMemCachedClient in DefaultSettings.php for CACHE_NONE.
2011-03-03 15:24:51 +00:00
Chad Horohoe
10a2ec8072 Tweak debug() to use name of class in debug output 2011-03-03 12:52:30 +00:00
Tim Starling
be76d86932 * Rewrote ObjectCache.php to conform to the modern coding style, and to be less convoluted about how CACHE_ANYTHING and CACHE_ACCEL are resolved. Moved most functionality to static members of a new ObjectCache class.
* Moved the global functions to GlobalFunctions.php, where they are now just convenience wrappers. Made them return non-references. Updated callers (none found in extensions). 
* Added an advanced configuration method, $wgObjectCaches, which allows a lot more detail in the object cache configuration than $wgMainCacheType. 
* Made all object cache classes derive from BagOStuff. 
* Split the MWMemcached class into a generic client class and a MediaWiki-specific wrapper class. The wrapper class presents a simple BagOStuff interface to calling code, hiding memcached client internals, and will simplify the task of supporting the PECL extension.
* Added some extra constructor parameters to MWMemcached, configurable via $wgObjectCaches.
* Removed the *_multi() methods from BagOStuff, my grepping indicates that they are not used.
* Rewrote FakeMemCachedClient as a BagOStuff subclass, called EmptyBagOStuff.
* Added an optional "server" parameter to SQLBagOStuff. This allows the server holding the objectcache table to be different from the server holding the core DB.
* Added MultiWriteBagOStuff: a cache class which writes to multiple locations, and reads from them in a defined fallback sequence. This can be used to extend the cache space by adding disk-backed storage to existing in-memory caches.
* Made MWMemcached::get() return false on failure instead of null, to match the BagOStuff documentation and the other BagOStuff subclasses. Anything that was relying on it returning null would have already been broken with SqlBagOStuff.
* Fixed a bug in the memcached client causing keys with spaces or line breaks in them to break the memcached protocol, injecting arbitrary commands or parameters. Since the PECL client apparently also has this flaw, I implemented the fix in the wrapper class.
* Renamed BagOStuff::set_debug() to setDebug(), since we aren't emulating the memcached client anymore
* Fixed spelling error in MWMemcached: persistant -> persistent
2011-03-03 09:37:37 +00:00
Tim Starling
d3f36ffd4d More renames and splits for objectcache reorganisation. 2011-03-03 04:48:14 +00:00
Tim Starling
af04dde290 Start of ObjectCache reorganisation. Moved the object cache files to includes/objectcache/. Split BagOStuff.php into single-class files. 2011-03-03 04:38:17 +00:00