Commit graph

53 commits

Author SHA1 Message Date
Kunal Mehta
f503ab10b8 Have LinkCache::getMutableCacheKeys() accept LinkTarget
Change-Id: Id84590b3aa285e31a358877167fe8ff502077f3c
2018-08-14 22:56:27 -07:00
Aaron Schulz
b4c8614885 Convert LinkCache to using MapCacheLRU
Clean up the variable names while at it.

Change-Id: I3b7860c0657111d73567e247bcc1ebcbaef53e22
2018-07-16 21:16:00 +00:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Aaron Schulz
9b6168da53 Make LinkCache::invalidateTitle() use the instance WAN cache
Change-Id: Idefcee9b37dcb73b2f18351123b097f4ae68fa76
2018-06-14 21:00:38 -07:00
Aaron Schulz
d735dc562d Move Database and subclasses to Rdbms namespace
Change-Id: I52bef87512f9ddd155d1f4cc0052f6b7a0db5b42
2017-04-12 10:43:57 -07:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
Aaron Schulz
2e5eb693de objectcache: add WANObjectCacheReaper for assuring purges
* This fixes keys based on some sort of change log.
  Updates are wrapped in a mutex and keep track of the
  last known good position.
* Make WANObjectReapUpdate class that cleans up title
  related keys using the recentchanges table. This triggers
  as a deferred updates on RC view.

Change-Id: I7f14b9ca2533032147e62b1a3cc004a23da86579
2017-01-27 02:21:06 +00:00
Aaron Schulz
8ebec93fea Cache NS_TEMPLATE/NS_FILE titles in LinkCache persistently
Queries from parsing are the top use of selectRow() according
to reverse flame graphs on xenon. This does not bother with
pages in namespaces less likely to be included.

Change-Id: Ica5d6e52c830cd71effff21933b8c64691082c11
2016-09-07 00:20:26 -07:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Kunal Mehta
a50a2731cb LinkCache: Don't try looking up NS_SPECIAL
Change-Id: I1afe8c780c3b12ae806ac19c4efb37c7033951ca
2016-05-26 14:47:45 -07:00
Kunal Mehta
e8e2cc0ffc Add LinkCache::getSelectFields() and use it in a few places
Change-Id: Ic65b20cc2aa41f9b481e280918fe95c57da53221
2016-05-13 00:25:07 -07:00
Kunal Mehta
ef2a84e108 Remove now-unused LinkCache::$instance
Follows-up 449084ec4.

Change-Id: Ia43344beba0f1e5f98210d0e4e51e53e138495d1
2016-05-12 16:05:19 -07:00
Kunal Mehta
449084ec4e Add LinkCache to MediaWikiServices
LinkCache::singleton() is now deprecated, and the destroySingleton() and
setSingleton() methods were removed. They were not used in extensions,
and the usage in core was updated to use MediaWikiServices.

Change-Id: I08bb4f7913b03f71331ff683d0197c948aad6790
2016-05-12 15:44:33 -07:00
Kunal Mehta
f77cbc02b1 LinkCache: Use LinkTarget instead of Title
Change-Id: I9ed5a095fc50334a3c41fd52f6d05611dadbaf68
2016-05-12 11:36:54 -07:00
Kunal Mehta
cfea4137e9 LinkCache: Clarify in doc comments what format $title is
Sometimes $title is a Title object, sometimes it is the prefixed DB key
as a string.

Change-Id: I0e574f35f0c3193bc933e77250c42765626d3cbf
2016-04-27 14:34:18 -07:00
Kunal Mehta
07d4c17da3 LinkCache: Remove unncessary & from singleton() function
Change-Id: I9e9e530a59d7b9062d0214ba82146b313e6b10fd
2016-04-27 14:30:54 -07:00
Kunal Mehta
288e9d2280 LinkCache: Make clearBadLink() only clear that link
Calling clear() empties all of mBadLinks instead of the one that was
requested.

Change-Id: Iec7f7845704dd5742b5bdf4aff05678194e08054
2016-04-26 14:42:47 -07:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Florian
d237380021 Fix not-loaded DbPageLanguage when Title::getPageLanguage() get's called
If the Title object isn't the title of the current viewed WikiPage, the page_lang
field of the database isn't requested. This results in the problem, that
Title::getPageLanguage() always returns the default content language, even if
the page language is different (changed with Special:PageLanguage, if
wgPageLanguageUseDB is true). That is problematic for the Translate extension,
which relies on the correct page language.

This change makes sure, that getPageLanguage() always return the correct page
language. If the page language isn't loaded already, Title::getPageLanguage()
now does a database lookup (if $wgPageLanguageUseDB is true) to get the correct
page language. It will use LinkCache for the page_lang field.

Bug: T121666
Change-Id: I0ae5ea39f7a124ed427ca5dfb26c1a116b27a94e
2016-02-16 20:37:40 +00:00
Timo Tijhof
03a620004b LinkCache: Convert from MapCacheLRU to HashBagOStuff.
Change-Id: I28a9509ad4c6d724a12dc72bc50d3cf58642c651
2015-11-09 23:17:47 +00:00
Timo Tijhof
dcf8ec0283 LinkCache: Minor clean up of documentation and variable names
In preparation for conversion from MapCacheLRU to HashBagOStuff.

* Use early-return pattern for error and rejection cases.
* Add 'int' to @return for getGoodLinkFieldObj() per the
  values set in addGoodLinkObj().
* Add type hints for Title where possible.
* Avoid single-letter variables like $f and $s.
* Add visibility for public static methods.

Change-Id: Iab90539922f648c21cb147f749943a64f598e8de
2015-11-09 23:17:43 +00:00
Timo Tijhof
8b463047a9 LinkCache: Remove deprecated getBadLinks and getGoodLinks methods
Deprecated since MediaWiki 1.26 (32d1017e7d). These methods contain the
only remaining callers of MapCacheLRU::getAllKeys() which is the only odd
method of MapCacheLRU not supported by BagOStuff.

Change-Id: I64e054803595d49a5bd779accc94353924f7d87d
2015-11-03 06:08:36 +00:00
Kevin Israel
eb8d6eb754 Update description of LinkCache::forUpdate()
The $mForUpdate flag no longer causes the FOR UPDATE option to be added.
This was at first only true for some values of $wgAntiLockFlags (since
r9248 / ba8a00bcb833), though since 12757b50f8 (when the setting was
removed), is always the case.

The added text is based on the description for $wgAntiLockFlags.

Change-Id: I02a3e2df37ec40c7e36ae6210c8263f13d9e3e5b
2015-10-30 06:09:29 -04:00
Kevin Israel
3f516b5139 Remove unused private property LinkCache::$mClassVer
This was added in r2084 / c280ef342b for a "persistent link cache"
feature, which became obsolete in 1.4 and was removed in 1.5.

https://www.mediawiki.org/wiki/Manual:$wgEnablePersistentLC

Follows-up r9276 / cb45389b9c.

Change-Id: I2f27d6acc1a1f9a9382a47d56921f570107a7be9
2015-09-25 07:54:02 -04:00
Kunal Mehta
32d1017e7d Don't let LinkCache grow indefinitely
Especially in long running maintenance scripts, this can be problematic.

LinkCache is now LRU-based, and will store a maximum of 10,000 good titles,
and 10,000 bad ones.

LinkCache::getGoodLinks() and getBadLinks() are deprecated since they
problematic to support in this implementation and are unused.

Bug: T106998
Change-Id: I1328149d65a5e75a5d6e10cb2686a099562a1847
2015-07-27 10:26:46 -07:00
umherirrender
70f3afd548 Remove unneeded empty lines at begin of if/else/foreach body
An if body must not begin with an empty line

Change-Id: I62b058be337fcc85a120fcd3dadce564db59a271
2015-06-19 20:05:45 +02:00
Ricordisamoa
2ae155da52 Fix phpcs errors in includes/
Mostly Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

Change-Id: I678b2f0902f11cd1dfa1611b9da24e7237df9122
2015-01-08 20:15:07 +01:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Aaron Schulz
12757b50f8 Removed $wgAntiLockFlags to unify the code paths
Change-Id: Ia709ccdc9addc55c99cbff21a5ff3009b5fbb53c
2014-10-03 10:42:17 -07:00
Kevin Israel
dd5c1b7fb7 Title::getContentModel(): load from DB if necessary
Also don't cast $model to int in LinkCache::addGoodLinkObj(); content
model IDs are non-numeric strings, not integers, so that field was
always populated with the value 0. Because 0 is a falsy value, this
caused subsequent calls to Title::getContentModel() to return the
default model rather than the correct one.

Also (hopefully) fixed every single query that could cause a
LinkCache entry to be added without the content model.

Bug: 69789
Change-Id: I94f06baf406afa538cd2b10139598442f9fc6759
2014-08-20 19:44:17 -04:00
Siebrand Mazeland
2c04b0163b Remove incorrect return type for getGoodLinkID()
Change-Id: Ib9c0dcf5104fdc5f364e0b49d539b63bf2eb046c
2014-05-11 18:19:00 +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
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
cbb6648205 Update some documentation
Change-Id: I6a75964d2048de451e9b01a08f87cfe1ebd842ba
2013-12-03 14:59:45 +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
Siebrand Mazeland
8251479984 Update formatting
Change-Id: I9aa56cbe0989d6f302ee0f47c4a6154101f73e90
2013-11-17 21:46:55 +01:00
Antoine Musso
ca934127d7 LinkCache singleton can now be altered
This patch adds the ability to destroy the LinkCache singleton or to
replace the instance with a different object.  Note the $instance static
variable is now at the class level instead of at the method level.

Change-Id: Ib110ad061868834a52a6bac651976b3ffab4a6ce
2013-06-01 09:20:02 +02:00
umherirrender
1bfc8feb25 Fixed spacing in actions/cache/filebackend/filerepo/job folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Idb93d34e314e5f314223b79208968d6bcd30c40e
2013-04-20 19:18:13 +02:00
jenkins-bot
6114f05fc1 Merge "Correct case of Title::getPrefixedDBkey() calls" 2013-03-12 15:13:21 +00: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
Alexandre Emsenhuber
cd4dd7ca85 Correct case of Title::getPrefixedDBkey() calls
Change-Id: Ic9ef0cc6dbb0a8eb0ee93432299ef59759223e2c
2013-03-09 21:14:22 +01:00
daniel
906a1ba51f [bug 37746] string ids for content model and format.
The content model is stored as a varbinary(32), the format
as varbinary(64).

If the standard model resp. format is used, null is written
to the database instead of the actual id, saving space.

Change-Id: I32659b49a9ad3cb8ecae9019562cff7de42b65f9
2012-06-26 15:56:06 +02:00
daniel
f2b218381b make sure page_content_model gets loaded where appropriate in Title and LinkCache 2012-06-11 15:36:52 +02:00
Alexandre Emsenhuber
4471b93253 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I604ed8ddc572e89001e49df6740ab42307bc0330
2012-05-08 14:51:21 +02:00
Alexandre Emsenhuber
74b9522134 Declare constant default values directly in the class definition and removed the constructor since it's useless now 2011-12-21 18:53:00 +00:00
Niklas Laxström
efb7b817a7 I broke few parser tests in r97633 by overlooking the return value. This fixes them. 2011-09-20 16:26:39 +00:00
Niklas Laxström
c49610741d Added LinkCache::addGoodLinkObjFromRow, since addGoodLinkObj is not going to work much longer when new parameters are added 2011-09-20 15:19:18 +00:00
Niklas Laxström
95a2c1b398 No need to check isset before unset, shortens the code a bit, and added some whitespace 2011-09-20 13:52:47 +00:00
Sam Reed
2b676156ba And even more documentation 2011-05-28 18:58:51 +00:00