Commit graph

125 commits

Author SHA1 Message Date
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
Ricordisamoa
f76275febc Stop doing $that = $this in includes/deferred
Closures support $this as of PHP 5.4

Change-Id: I2632d0c2bdc9e2fec72f1c64c3868dcb442ba871
2016-02-10 17:53:29 +00:00
Aaron Schulz
621487f603 Make CDN purges send EventRelayer events
* Also create EventRelayerGroup class and config

Bug: T97562
Change-Id: Id7c9b0deb0ffd21277572a8e6407f87be6931a4d
2016-02-09 14:13:21 -08:00
jenkins-bot
fa7279c78d Merge "Small code cleanups to MWCallableUpdate" 2016-01-20 00:37:06 +00:00
Aaron Schulz
ec63f72c79 Add AtomicSectionUpdate deferred update class
This makes it easier to have deferred atomic DB transactions

Bug: T122115
Change-Id: I67afe335f03cc21fdce78abdf3f31fa67a368419
2016-01-14 10:32:39 +00:00
Aaron Schulz
3e4dbd3541 Small code cleanups to MWCallableUpdate
Change-Id: I269199f65ffc6ad50d16cb984c28b51a815e9a8f
2016-01-13 09:00:16 -08:00
Aaron Schulz
58cffd04b8 Pass __METHOD__ to load balancer commit/rollback methods
Change-Id: I3fd87908c2a493fae49de6a29efe79f8d433c112
2015-12-22 18:30:20 -08:00
Aaron Schulz
4302b0419d Rename getSquidURLs() => getCdnUrls()
Change-Id: I433acc7990a5fcefd0d2ff5b14ba33dec0424706
2015-12-11 16:40:35 -08:00
Aaron Schulz
8d17ad6b22 Use GAID_FOR_UPDATE for getArticleID() in LinksUpdate
Bug: T121228
Change-Id: I33addea4261d58cc93ab739621481065eb9c908d
2015-12-11 15:05:59 -08:00
Aaron Schulz
01c2b0a425 Add $wgCdnReboundPurgeDelay for more consistent CDN purges
Bug: T113192
Change-Id: I89deb4f8143c1cc6154cdd05bcee1f49d3e3a75a
2015-12-10 22:52:30 +00:00
Aaron Schulz
6af3c39c07 Replace "squid" with "CDN" in various comments
Change-Id: Idcc528daf28e119349155d36e30a9bcf61b2e7d5
2015-12-09 17:35:37 -08:00
Aaron Schulz
282c5fa9f3 Rename SquidUpdate => CdnCacheUpdate
Squid is not the only possible CDN

Change-Id: Ie2a2955847c5706e630322bbbab71c9d063b378f
2015-12-09 16:31:17 -08:00
Aaron Schulz
22476baa85 Remove obsolete category links code
* These calls and methods should no longer be needed
* Follow-up to 6dedffc2d7

Change-Id: Iff121263610117112c84edb5e575f039456d1ac8
2015-12-05 16:07:59 -08:00
Aaron Schulz
d2c33200f7 Remove DeferredUpdates::forceDeferral() testing hack
Change-Id: I7f2ad8190e1a746b6c39190b86fa9c83c5b921fe
2015-12-04 21:18:29 +00:00
jenkins-bot
e6b414ceab Merge "Add mergeable update support DeferredUpdates" 2015-12-04 19:19:05 +00:00
jenkins-bot
1c69c92a9e Merge "Add pre-send update support to DeferredUpdates" 2015-12-04 19:16:00 +00:00
Aaron Schulz
99610822d8 Add mergeable update support DeferredUpdates
* DeferrableUpdate classes can implement MergeableUpdate.
  Duplicate updates will be merged via the merge() method.
* Make SquidUpdate support merge() so that duplicate URL
  purges are now caught accross the entire pre-send request
  execution.

Change-Id: Idffdd3e71d89e4a0f28281e65a881113caae497c
2015-12-04 19:08:51 +00:00
Aaron Schulz
34dd248e28 Add pre-send update support to DeferredUpdates
* PRESEND/POSTSEND constants can now be used in addUpdate()
  and addCallableUpdate() to control when the update runs.
  This is useful for updates that may report errors the client
  should see or to just get a head start on queued or pubsub
  based updates like CDN purges. The OutputPage::output() method
  can easily take a few 100ms.
* Removed some argument b/c code from doUpdates().
* Also moved DeferrableUpdate to a separate file.

Change-Id: I9831fe890f9f68f9ad8c4f4bba6921a8f29ba666
2015-12-04 19:08:27 +00:00
jenkins-bot
10e1c76a97 Merge "Make HTMLCacheUpdate always use the job queue" 2015-12-04 19:07:58 +00:00
jenkins-bot
560b68c060 Merge "Move category membership RC updates to CategoryMembershipChangeJob" 2015-12-04 10:56:12 +00:00
aude
70c501bbab Don't load WikiPage (w/ READ_LATEST) if search-update is not supported
instead lazy load WikiPage, when needed.

Change-Id: If67057b0b76f0f889ed498d8bbedaaeae3b2785d
2015-12-03 14:24:03 +00:00
Aaron Schulz
6dedffc2d7 Move category membership RC updates to CategoryMembershipChangeJob
* Recursive link updates no longer mention an category changes.
  It's hard to avoid either duplicate mentioning of changes or
  confusing explicit and automatic category changes.
* LinksUpdate no longer handles this logic, but rather WikiPage
  decides to spawn this update when needed in doEditUpdates().
* Fix race conditions with calculating category deltas. Do not
  rely on the link tables for the read used to determine these
  writes, as they may be out-of-date due to slave lag. Using the
  master would still not be good enough since that would assume
  FIFO and serialized job execution, which is not garaunteed.
  Use the parser output of the relevant revisions to determine
  the RC rows. If 3 users quickly edit a page's categories, the
  old way could misattribute who actually changed what.
* Make sure RC rows are inserted in an order that matches that
  of the corresponding revisions.
* Better avoid mentioning time-based (parser functions) category
  changes so they don't get attributed to the next editor.
* Also wait for slaves between RC row insertions if there where
  many category changes (it theory it could well over 10K rows).
* Using a separate job better separates concerns as LinksUpdate
  should not have to care about recent changes updates.
* Added more docs to $wgRCWatchCategoryMembership.

Bug: T95501
Change-Id: I5863e7d7483a4fd1fa633597af66a0088ace4c68
2015-12-03 11:28:05 +00:00
aude
afc46abd78 Consolidate Title normalization code in SearchUpdate
and rename the private method to be more clear

Change-Id: Iec7b934babddd102402cfa7616accd91fd3422ff
2015-12-02 17:17:27 +01:00
aude
659961bb5d Do SearchUpdate::indexTitle after search-update is supported check
If the SearchEngine does not support search-update, then
$indexTitle is not used and thus no need to create it in
that case.

Change-Id: I487d06274e921223a3bcb5af846b48b7c2b8065e
2015-12-02 16:35:32 +01:00
Aaron Schulz
d03c5be5e3 Make HTMLCacheUpdate always use the job queue
* This puts these updates behind the JobRunner lag checks
* Made HTMLCacheUpdateJob::newForBacklinks() method, which,
  along with lazyPush(), obsoletes this class.

Bug: T95501
Change-Id: I934de63bb6fe9e9b7abae157f0b3b2dbfd3188e1
2015-11-30 17:14:04 -08:00
Aaron Schulz
27f5abac54 Make HTMLCacheUpdate callers more consistent
A few random callers were calling doUpdate() themselves
instead of using DeferredUpdates

Change-Id: If121e6afab9899dae92f0bf831b0b0c9967deeb5
2015-12-01 01:00:01 +00:00
Aaron Schulz
4769ad62ed SquidUpdate doc cleanups
Change-Id: Ia5b8060e8a93f40a2e31272e043b225f59fb6d50
2015-11-18 16:07:29 -08:00
jenkins-bot
65bffec808 Merge "Have SquidUpdate::newFromTitles use getSquidURLs" 2015-11-17 22:33:56 +00:00
Aaron Schulz
af5f784868 Reduce updateLinksTimestamp() DB contention
Do the LinksUpdateComplete hook updates in a separate
transaction as they may do slow SELECTs and updates.

A large amount of DBPerformance warnings were triggered
by such cases.

Bug: T95501
Change-Id: Ie4e6b7f6aefc21bafba270282c55571ff5385fe0
2015-11-17 02:36:37 +00:00
Matthew Flaschen
01589e15da Have SquidUpdate::newFromTitles use getSquidURLs
This causes it to add history, and trigger the TitleSquidURLs hook.

Bug: T116095
Change-Id: I41ebd2f34347a3f218f7d0bfc8962d286b943c16
2015-11-13 16:54:41 -05:00
Aaron Schulz
b71c537ef8 Merge "Add triggeringRevisionId to LinksUpdate JobSpec" 2015-11-07 00:51:00 +00:00
addshore
6a65ce223f Add triggeringRevisionId to LinksUpdate JobSpec
Bug: T117860
Change-Id: I8c730a434b8bdda7664fd1e3bb3fbc8840804950
2015-11-05 12:07:01 +00:00
Aaron Schulz
9bb575be70 Make DeferredUpdates exception handling more robust
Change-Id: Ica2b8dce0978818a2f51684b97c93a3ba845d81a
2015-11-03 13:05:41 -08:00
Aaron Schulz
6cc65335f3 Convert SiteStatsUpdate to using getMainStashInstance()
Also fixed various $wgMemc related comments

Change-Id: I20602b672f724c8df1e82bbe3c586cb899a54640
2015-10-31 13:05:03 -07:00
Kunal Mehta
c52e5a21f6 LinksUpdate: Keep track of the triggering User
So extensions like Echo are able to attribute post-edit link updates to
specific the users who triggered them.

Bug: T116485
Change-Id: I083736a174b6bc15e3ce60b2b107c697d0ac13da
2015-10-27 17:10:19 -07:00
Aaron Schulz
d705ae970a Fixes related to WikiPage::triggerOpportunisticLinksUpdate()
* Focus on updating links that would *not* already be updated
  by jobs, not those that already *will* be updated.
* Place the jobs into a dedicated queue so they don't wait
  behind jobs that actually have to parse every time. This
  helps avoid queue buildup.
* Make Job::factory() set the command field to match the value
  it had when enqueued. This makes it easier to have the same
  job class used for multiple queues.
* Given the above, remove the RefreshLinksJob 'prioritize' flag.
  This worked by overriding getType() so that the job went to a
  different queue. This required both the special type *and* the
  flag to be set if using JobSpecification or either ack() would
  route to the wrong queue and fail or the job would go in the
  regular queue. This was too messy and error prone. Cirrus jobs
  using the same pattern also had ack() failures for example.

Change-Id: I5941cb62cdafde203fdee7e106894322ba87b48a
2015-10-24 00:10:12 +00:00
jenkins-bot
be6aeaca9f Merge "Make LinksUpdate::__construct() use normal type hints" 2015-10-22 21:10:34 +00:00
Aaron Schulz
98b88146d7 Make LinksUpdate::__construct() use normal type hints
Change-Id: Ie5f4de95d07ac9f24e415f92c5116385863a47f9
2015-10-22 20:39:29 +00:00
Brian Wolff
4d3fb38bff Properly make LinksUpdate be recursive when done from job queue
New enqueue method of DeferredUpdates was turning LinksUpdate
updates into Jobs. However RefreshLinksJob was not properly
reconstructing the secondary updates as being recursive (if they
were recursive). This means that templates weren't having the pages
that were using them being updated.

See also related T116001.

Change-Id: Ia06246efb2034fdfe07232fd8c2334160edbcf02
2015-10-22 12:56:03 -06:00
Aaron Schulz
3339dec7c2 Make LinksUpdate job spec use "refreshLinksPrioritized"
This was missing in 4fcc427c10 due to being lost in PS4

Change-Id: I24641e7eccc1e61226777504dcfd75e1aa7f58c6
2015-10-21 21:59:47 -07:00
Aaron Schulz
a8590172c8 Make DeferredUpdates::doUpdates always commit per task
* All callers are either using commit already or would be fine
  using it (e.g. Maintenance scripts and JobRunner that have
  no real transaction open).

Change-Id: I9f54b27619da6dac2cb63d255995aabc4ee78002
2015-10-22 01:27:08 +00:00
Aaron Schulz
5b26e083b0 Push post-edit RefreshLinks jobs into 'refreshLinksPrioritized'
Previously the 'prioritize' flag was set in getAsJobSpecification()
but the job still went into the regular 'refreshLinks' queue. Since
the parser cache was just saved, they should be fast to run. The
separate queue stops them from getting stuck behind template updates.

Change-Id: I46c5760702d862dc9288618ee5eff3897f6e838b
2015-10-20 22:25:10 +00:00
jenkins-bot
682e2b9c6b Merge "Enable users to watch category membership changes #2" 2015-10-20 21:41:16 +00:00
addshore
d40cd42b9f Enable users to watch category membership changes #2
This is part of a chain that reverts:
e412ff5ecc.

NOTE:
- The feature is disabled by default
- User settings default to hiding changes
- T109707 Touching a file on wikisource adds and
      removes it from a category... Even when page
      has no changes.... WTF? See linked issue,
      marked as stalled with a possible way forward
      for this patch.
      @see https://gerrit.wikimedia.org/r/#/c/235467/

Changes since version 1:
- T109604 - Page names in comment are no longer
      url encoded / have _'s
- T109638 & T110338 - Reserved username now used
      when we can't determine a username for the change
      (we could perhaps set the user and id to be blank
      in the RC table, but who knows what this might do)
- T109688 - History links are now disabled in RC....
      (could be fine for the introduction and worked
      on more in the future)
- Categorization changes are now always patrolled
- Touching on T109672 in this change emails will never
      be sent regarding categorization changes. (this
      can of course be changed in a followup)
- Added $wgRCWatchCategoryMembership defaulting to true
      for enabling / disabling the feature
- T109700 - for cases when no revision was retrieved
      for a category change set the bot flag to true.
      This means all changes caused by parser functions
      & Lua will be marked as bot, as will changes that
      cant find their revision due to slave lag..

Bug: T9148
Bug: T109604
Bug: T109638
Bug: T109688
Bug: T109700
Bug: T110338
Bug: T110340
Change-Id: I51c2c1254de862f24a26ef9dbbf027c6c83e9063
2015-10-20 14:23:48 -07:00
jenkins-bot
4ca4ae9009 Merge "Deprecate redundant SquidUpdate::newSimplePurge()" 2015-10-19 19:19:52 +00:00
Aaron Schulz
7335005560 More SquidUpdate cleanups
* Remove $wgMaxSquidPurgeTitles; silently discarding URLs is 
  the wrong way to limit things. The purge methods already batch, 
  which HTCP pushing one at a time. Jobs already batch and have 
  $wgJobBackoffThrottling. If code does purge 500 URLs at once 
  with no limiting (flooding UDP), then it is already broken.
* Make the HTCP method protected.
* Rename $urlArr field.

Change-Id: I17cced187fe7e93f5a5188022f12202a7746bdb7
2015-10-19 16:50:14 +00:00
Aaron Schulz
670612f06c Deprecate redundant SquidUpdate::newSimplePurge()
Change-Id: Id6d92fca2a2b87e23930946f054cecd1f6d433be
2015-10-19 08:24:23 -07:00
Aaron Schulz
8008216439 SquidUpdate cleanups
* Actually implement DeferrableUpdate
* Remove unused parameter to __construct()
* Remove redundant check in newFromTitles()
* Short-circuit purge() if  is empty

Change-Id: I23b1f712001d72305dfa1c49063c3384ea67fb2f
2015-10-18 23:26:05 -07:00
Brad Jorsch
3ea8d8c63c Use specified pageId for LinksDeletionUpdate→DeleteLinksJob
Not page->getId() which may now be 0 due to the page having been
deleted.

Bug: T115586
Change-Id: I5a3482bbe1df23dda0f33e7d675b06d616395bb6
2015-10-15 09:09:02 -04:00
jenkins-bot
0e1c391d97 Merge "Change 1.26 to 1.27, mostly in doc comments" 2015-10-10 17:01:23 +00:00