Commit graph

41 commits

Author SHA1 Message Date
Alangi Derick
b4ecf374fe Fix PHPDoc type for instance variables and methods
Should be "string" not "String" and "array" not "Array" in
@param, @return and @var use cases. Also, minor typo fixes.

Change-Id: I9d5ebc5b741c6560907b95f7c0c4039da2861f4a
2018-10-21 13:00:25 +01:00
Cormac Parle
23ead9bbd6 Clear the backlink cache on file delete
When a file is deleted pages that link to the file
(backlinks) are purged. The set of backlinks for a file
is cached in the backlink cache, and this is where the set
of backlinks that need purging is read from. If, at file delete
time, there is a backlink cache for the file but it is not
up to date, then backlinks missing from the set of cached
backlinks for that file will not be purged, leading to
broken links.

This patch clears the backlink cache on file delete before
initiating purging of backlinks.

Bug: T183478
Change-Id: I3bbd79e5a8fa14bf80ceee81e944108edada322e
2018-01-16 09:32:28 +00:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Aaron Schulz
82e2c924e4 Remove "@author Aaron Schulz" annotations
Bug: T139301
Change-Id: Ib5248e8e27d60611c7373bce4b29dd5e85aa3489
2017-06-27 15:24:14 -07:00
Aaron Schulz
33bc3e7dfb Use makeKey() in BacklinkCache
Change-Id: I23c000c8c2c77aa538fe258ea34eb764987eb52d
2017-04-20 12:26:23 -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
e01fd44388 Move ResultWrapper subclasses to Rdbms
Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
2017-03-03 00:44:41 +00:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +00:00
Aaron Schulz
30f4b3c103 Replace DatabaseBase => Database in more places
Change-Id: If37a7909056bf2c31a8228cbc84f0fbbf5f1c517
2016-09-28 15:53:02 -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
Aaron Schulz
16266edff3 Change "slave" => "replica DB" in /includes
Change-Id: Icb716219c9335ff8fa447b1733d04b71d9712bf9
2016-09-05 21:01:01 +00:00
Amir Sarabadani
efa0d7af44 Clean up array() syntax in docs, part III
Also fixing some typos here and there

Change-Id: I29c29acf87f84ba9993ba75ebf2ad8091d981574
2016-08-13 05:40:40 +04:30
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00: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
Timo Tijhof
e6205019a4 BacklinkCache: Remove use of ProcessCacheLRU
Follows-up af89b09a06 and e40a90f0bc, and general phasing out
of MapCacheLRU and ProcessCacheLRU.

Use of ProcessCacheLRU seems redundant in this case as it is
essentially just a keyed singleton.

Change-Id: I7cc84cf6c76ecc422ea337dba2d216c3d7ebf281
2015-11-10 00:06:09 +00:00
Aaron Schulz
ac1325aa43 Improve BacklinkCache field docs
Change-Id: I8303d5577ac84b8882e5ad79ac3058d6bf49356f
2015-11-03 02:56:30 -08:00
Aaron Schulz
4f781c7bf9 Convert some users to WANObjectCache for consistency
These callers don't need to do purges, but can still perfectly
take advantage of this instance over a plain BagOStuff. Namely:
* Replication and snapshot lag awareness
* Preemptive regeneration
* Easy process cache support

The idea is for there to only be one caching class/factory
to use, instead of having rules for picking which one to use.

Change-Id: I8e362df451c0c28731fc853c044c4c4b8e097f01
2015-10-19 16:46:52 +00:00
Aaron Schulz
0f7893f877 Update various @params from DatabaseBase to IDatabase
Change-Id: I98e44cdffb0fc0d729f69f702799139afb988c20
2015-10-05 05:24:29 +00:00
Aaron Schulz
5806931375 Cleaned up int|INF doc type to avoid IDEA errors
* INF is not a class (technically a float, which would look confusing here)

Change-Id: I9c437ecd0f2fe1a2a3e15197d50829a638f3073a
2015-08-27 18:18:59 +00:00
jenkins-bot
badc035712 Merge "Drop outdated "documentation reviewed" tags" 2015-03-18 16:56:58 +00:00
Thiemo Mättig
40342aba58 Drop outdated "documentation reviewed" tags
We review documentation all the time. Even if this was a big, notable
review, it was 5 years ago. It's probably outdated again, e.g. because
methods changed but the corresponting documentaion did not. In my
opinion the fact that a review happened 5 years ago is not useful any
more.

Change-Id: I6f4fb88ea790520bf2443aae4144cdde394b5e78
2015-03-18 17:43:01 +01:00
Aaron Schulz
df5ef8b5d7 Removed doCascadeProtectionUpdates method to avoid DB writes on page views
* Use special prioritized refreshLinksJobs instead, which triggers when
  transcluded pages are changed
* Also added a triggerOpportunisticLinksUpdate() method to handle
  dynamic transcludes

bug: T89389
Change-Id: Iea952d4d2e660b7957eafb5f73fc87fab347dbe7
2015-02-22 13:36:13 -08: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
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08: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
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
umherirrender
e0b8d17b79 Simplify switch in BacklinkCache::getConditions
Change-Id: I9f1ddad705d1697dd81f74eb735dc386bab9d200
2013-12-01 11:55:44 +01: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
Siebrand Mazeland
8251479984 Update formatting
Change-Id: I9aa56cbe0989d6f302ee0f47c4a6154101f73e90
2013-11-17 21:46:55 +01:00
Aaron Schulz
a9dc4d943e BacklinkCache performance tweaks
* In partition(), avoid doing the JOIN since it is not needed and prevents
  index-only queries.
* Made numLinks() wrap partition when no $max is specified.
* Also fixed some docs

Change-Id: I05a83f71efb4c6e99e40883d7fa53da59184b13c
2013-11-09 12:35:07 -08: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
Aaron Schulz
4eb056d549 Cleanup and performance tweaks for BacklinkCache.
* Batch the queries to get the partitions.
* Improved caching of getNumLinks() with $max.
* Added a TTL to the ProcessCacheLRU use for sanity.
* Some small logic cleanups in partitionResult().
* Also cleaned up some code duplication.

Bug: 43452
Change-Id: I0b9710fe222b3d2cb4dc9ab2eeb0758873a8066c
2013-04-04 14:54:53 -07: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
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
umherirrender
909d61056a fix hardcoded quote in BacklinkCache
Also make the IS NULL in upper case, looks better and sql reservered
words often written in upper case

Change-Id: I844ec37bbf3fb00d95a43dfd6f58db1e67724d53
2013-02-18 08:35:26 +00:00
Aaron Schulz
5ef62175bf [JobQueue] Improved refreshLinks/htmlCacheUpdate job de-duplication.
* Added JobQueue::deduplicateRootJob() function which uses cache
  records of the last time a "root" job was initiated for a task
  in order to invalidate prior jobs for that task. For refreshLinks,
  the "task" is basically "enqueueing the refresh jobs for title X".
* (bug 27914) Also added new Job::getDeduplicationFields() function
  and made use of it with refreshLinks to exclude things like 'masterPos'
  from duplicate job check comparisons for refreshLinks.
* (bug 27914) Always resolve refreshLinks2 jobs down to refreshLinks jobs.
  For each affected pages, one of them will get their job popped
  first, which will remove the duplicates for that page unless
  one page is in a refreshLinks2 jobs and the other in refreshLinks.
* (bug 37731) Made LinksUpdate/HTMLCacheUpdate defer the large
  backlinks query by doing it in an outer job.
* (bug 42065) HTMLCacheUpdate will no longer purge pages that were
  already purged since the job was added.

Change-Id: I71b743e0a38e60a874ca856e80cb761bea06b689
2012-11-28 09:29:41 +00:00
Aaron Schulz
12b76fcabb Made BackLinkCache use object caching better.
* This way, we can actually get persistent cache hits for
the HTMLCacheUpdate queries rather than always hitting a DB.
* Also moved BacklinkCache under the /cache directory.

Change-Id: I0666ee575fb42675f1a7dd9cb52665f0a12a66a9
2012-11-27 09:41:50 -08:00
Renamed from includes/BacklinkCache.php (Browse further)