Commit graph

292 commits

Author SHA1 Message Date
jenkins-bot
df85890b76 Merge "Make change tagging of edits in RecentChange::notifyNew/Edit" 2016-02-12 02:46:31 +00:00
jenkins-bot
7db5b40188 Merge "Get file from WikiFilePage, instead of ImagePage" 2016-02-11 04:06:09 +00:00
jenkins-bot
d4ecfc1a5c Merge "Don't modify $wgHooks on language object construction" 2016-02-11 04:05:56 +00:00
cenarium
b009e0af21 Make change tagging of edits in RecentChange::notifyNew/Edit
Change tags to apply to an edit can now be passed directly to the
WikiPage::doEditContent function. They are then passed to the
RecentChange::notifyNew/Edit functions where tagging is made
after the recent change is saved. This ensures that other callers
of doEditContent will not run into the same issue as T100248.
ApiRollback is fixed in this way.
In addition, we'll have to pass tags in this way for core tagging
of edits (I2e48bd458fc8d7c289f04dc276f9287516e0b987), and this makes
it possible to merge the arrays of tags and call ChangeTags::addTags
only once.

Change-Id: I829960c7a33b70464065839d7504d7529dfd0b72
2016-02-10 13:03:30 +01:00
Aaron Schulz
f4a4457403 Convert page modification to using startAtomic()/endAtomic()
A few semantic changes result from this:
* If multiple pages are edited in a request, the updates happen
  in the same order relative to each other, but all in one second
  step instead of after each page edit.
* If the same page is edited twice in a request, the WikiPage hook
  argument will reflect the last request edit, not always the edit
  that fired the hook.

Bug: T120718
Change-Id: I9429f29e5a90f24e4d7af5797a80e63a9cc34146
2016-02-09 00:03:05 +00:00
umherirrender
33f2990aaa Get file from WikiFilePage, instead of ImagePage
Change-Id: Ib28354fde2dc084ae9aff8cfa960785bb2012933
2016-02-06 23:08:26 +01:00
jenkins-bot
7a8fdad5cf Merge "Page is an interface not a class" 2016-02-04 19:24:54 +00:00
Thomas Arrow
2c2d6248f9 Split ImagePage.php into separate classes
Change-Id: Id2ca94c50b75d24da4d02fe82747a7ce7edccd9f
2016-02-04 12:26:36 +01:00
jenkins-bot
314fa3e2eb Merge "Pass WikiPage objects to ParserCache" 2016-02-03 12:01:09 +00:00
umherirrender
097b8ce76f Pass WikiPage objects to ParserCache
ParserCache::get is documented for WikiPage, so do it from Article class
This avoids magic calls due Article::__call

Change-Id: I92b91bd112383d1c0132530c3325b39596d95768
2016-02-02 20:38:36 +01:00
addshore
e95da15372 Page is an interface not a class
Change-Id: I299067320a2f8e541eba668464eb18c42bfb56e5
2016-02-02 19:13:39 +01:00
addshore
3540bf8f6c Unroll Article::__call again
Adds all public functions from WikiPage to Article

Adds all public functions from WikiFilePage that
are not in Article to ImagePage

WikiCategoryPage has no methods that need moving

Removed __call from Article

If extensions extend WikiPage and rely on the __call
method in Article they may break with this change.
They cal easily call $article->getPage()->method..

Change-Id: I8cd8d69d0d59c67f4879212535206688387bead4
2016-02-02 17:55:17 +01:00
Tyler Cipriani
2890689916 Revert "Unroll Article::__call"
This reverts commit 6051fcd383.

Bug: T125468
Change-Id: I9456c8e1b95ca3b2b2fa5d306f45a46210c4b1fc
2016-02-01 17:00:55 -08:00
Alex Monk
3e329182d1 Revert "Remove unused functions from unroll of Article::__call"
This reverts commit 0204a28443.

Change-Id: Ia058c91f808eedae28946b9561c826fbf09b386e
2016-02-01 20:05:38 +00:00
umherirrender
0204a28443 Remove unused functions from unroll of Article::__call
With I779aa1c017abc9a17047fd5335f2d082148daa6f all public functions from
WikiPage were copied as delegator into Article.

Now remove the unused functions and add a release notes

Change-Id: I9cc79acedecb003048e1add568e8bba96ddbb41a
2016-01-30 22:22:31 +01:00
umherirrender
6051fcd383 Unroll Article::__call
Add all public function from WikiPage to Article and replace the magic
__call

__call has the problem, that new functions to WikiPage will also be
available through Article.
It also makes deprecating of some functions harder. Having each function
as an own function will allow to add deprecated notice to just some and
maybe delete some functions earlier than others.

Also some static code analyzer can benefit from separately functions.

Change-Id: I779aa1c017abc9a17047fd5335f2d082148daa6f
2016-01-30 12:52:39 +01:00
Tim Starling
059fd9a2ae Don't modify $wgHooks on language object construction
Previously various language objects would install a hook to update the
shared conversion table cache when the object was constructed. This is
not a good idea since language objects may be constructed even when they
are not the content language, but only the content language is
associated with variant conversion and the conversion cache.

Instead, have WikiPage call a method on $wgContLang directly. I put this
with message cache update since the logic is almost identical.

Change-Id: Ief9c0ef993e39645e74a6e158cb4e6e2139ce91d
2016-01-29 15:03:56 +11:00
Aaron Schulz
36a87a8902 Convert page creation to using startAtomic()/endAtomic()
A few semantic changes result from this:

* If multiple pages are created in a request, the updates happen
  in the same order relative to each other, but all in one second
  step instead of after each page edit.
* If an extension set some extra Status info or errors via the
  PageContentInsertComplete hook, they will not be seen by the
  caller (unless it was a CLI script possibly). Few callers use
  $status at all, and I did not see any that mutated it. Since
  the page is already committed when this hooks run (as has always
  been) they cannot veto edits and callers do not care or know what
  to do with random hook-set status errors; there was never much use
  in changing the Status anyway.

Bug: T120718
Change-Id: Ieba35056be31b2f648c57f59d19d3cbbe58f1b05
2016-01-27 11:38:05 -08:00
Bartosz Dziewoński
6f9e6dd887 WikiFilePage: Remove weird useless comments
Change-Id: I0902ab6ddbfcec54f3385bdcdd5062503b5f1b95
2016-01-24 21:27:52 +01:00
cenarium
b06bd0511b Misc fixes for file patrol
This makes the following (minor) fixes to file patrol:
- If a documentation page for a file was recently created
before the file itself was uploaded, and the page creation
was patrolled, this now allows to patrol the file upload
from the file documentation footer.
- It attempts to retrieve a recent change for the latest
file upload, even if patrolled, so that this info can
be cached.
- It makes some extra code comments.

Change-Id: Ibdebcbbee7c081b99372c44ca64b5ddd86ae5ace
2016-01-20 19:59:26 +01:00
Florian
0acebab76c Remove WikiPage::getRawText()
Bug: T122754
Depends-On: I29ec61c482057c5b3b1048c834aedac182174929
Depends-On: I74e57d8e76149b452a9635ad8a6eca91c3df96a9
Depends-On: Ia624ffeb2d9b1862f943f7c3103df417d90001c5
Depends-On: I4a5a0d34156f9aae09a3edbe736fd924bc74773f
Depends-On: I2355b7d4a1b831cd752cbaa88bf1878e0d5554fb
Depends-On: I02051f0c74b4db93093f171f1250c03b99f6cec6
Depends-On: Ie88d05a6534ac1d02fb79494603cea17108e6bb9
Change-Id: Ie3247a7143859bf10580e67cd5383d152540a25b
2016-01-13 20:45:23 +00:00
Aaron Schulz
0b3e2ff21f Fix purge method used in purgePatrolFooterCache()
Change-Id: I62ed843ac9755e39c6693fa33594067689fd6e0f
2016-01-13 09:41:49 -08:00
This, that and the other
b2da5cf4e4 Update the WikiPage object with the new ID when undeleting
Issue introduced by 0aa6486cbf.

Change-Id: I2c4fde5e66f280a6bc2de1b13453f1c40385a20d
2016-01-13 00:30:33 +11:00
victorbarbu
0aa6486cbf Use ar_page_id on undeletion
Bug: T28123
Change-Id: I882b8ba09d68e7475e1d0934328730059574e292
2016-01-11 23:09:50 +00:00
jenkins-bot
6505e5f278 Merge "Allow patrol of uploads" 2016-01-07 01:06:02 +00:00
cenarium
c53f647658 Allow patrol of uploads
This allows to patrol file uploads, both new files and new file
versions, from the description page, provided $wgUseFilePatrol
is set to true. Special:NewFiles can be filtered to hide patrolled
files.

Bug: T11501
Change-Id: If71af58719a4461f12d125455b7bef07164525ca
2016-01-06 14:57:22 -08:00
Reedy
48db568102 WikiPage::testPreSaveTransform() was removed
Change-Id: Ibce32556b8213a36876dcb4c6f385afa6e6875aa
2016-01-02 20:56:43 +00:00
Reedy
07e384e490 WikiPage::updateRestrictions() was removed
Change-Id: If5bdf84b94fec928387ee12492fbec1f511ca059
2016-01-02 20:47:25 +00:00
Reedy
cfaf26e501 WikiPage::getUsedTemplates() was removed
Change-Id: I5c17a57042025b2f72083a97034a5a2dd6c8cfb5
2016-01-02 02:56:17 +00:00
Reedy
cc3d816a46 Removed Article::loadContent() (deprecated since 1.19)
All usages in extensions are removed

Change-Id: Ie03c384730f59a67a969aed0a866e2bf71247e87
2015-12-20 14:53:39 +00:00
Aaron Schulz
4860e1d5ac Move ArticleSaveComplete hook to doCreate()/doModify() methods
This makes it easier to migrate the methods to using atomic
sections without having the PageContentInsertComplete hook
change to ending up in separate transaction than
ArticleSaveComplete.

Bug: T120718
Change-Id: I492514413ec9c37c2f9343bb207798fc8e24a5a9
2015-12-13 04:42:46 -08:00
Aaron Schulz
4302b0419d Rename getSquidURLs() => getCdnUrls()
Change-Id: I433acc7990a5fcefd0d2ff5b14ba33dec0424706
2015-12-11 16:40:35 -08:00
Aaron Schulz
6af3c39c07 Replace "squid" with "CDN" in various comments
Change-Id: Idcc528daf28e119349155d36e30a9bcf61b2e7d5
2015-12-09 17:35:37 -08:00
jenkins-bot
538ba3deb5 Merge "Rename setSquidMaxage() => setCdnMaxage()" 2015-12-10 01:27:29 +00:00
Aaron Schulz
f606fd8d5c Rename setSquidMaxage() => setCdnMaxage()
Also updated the OutputPage member variable.

Change-Id: I0b41c66da58c6126c1bd96170c02d084a067383c
2015-12-09 17:11:23 -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
c655e38f75 Renamed confusing initial $status var in doEditContent()
Change-Id: I22cad9eb3fb4040e5506b0cccd573871d108d257
2015-12-07 19:10:17 -08:00
Aaron Schulz
ebc55440f9 Split out edit/create methods from doEditContent()
* Make the method sizes a bit more manageable.
  This will be useful for replacing the begin/commit
  calls later (with startAtomic/endAtomic).
* Cleaned up a few inconsistencies in code style.

Change-Id: I8d66503a5575ca369cd5feb56058af7d24001629
2015-12-06 19:49:40 -08:00
jenkins-bot
e0b8359250 Merge "Defer the redirect table update in WikiPage::insertRedirect()" 2015-12-04 19:30:05 +00:00
jenkins-bot
410d5e5cd2 Merge "Remove unused WikiPage::getLastNAuthors() method" 2015-12-04 19:20:33 +00:00
Aaron Schulz
afbff42aca Make CDN purge calls use DeferredUpdates
* Using addUpdate() makes sure purges are coalesced and
  de-duplicated.
* Also removed incosistent $wgUseSquid checks. If CDN caching
  is not used, then $wgSquidServers will just be empty anyway.

Bug: T119016
Change-Id: I8b448366f037f668385d252f9d68289b71d1a707
2015-12-04 19:09: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
Aaron Schulz
325faeea83 Defer the redirect table update in WikiPage::insertRedirect()
This avoids contention slams and synchronous master DB writes 
on HTTP GET requests.

Bug: T119742
Bug: T92357
Change-Id: I7b3ebac0d6a11542c47ddf3219911be54380c537
2015-12-02 22:53:07 +00:00
Aaron Schulz
068045a257 Remove unused WikiPage::getLastNAuthors() method
Change-Id: I06b617d7af5169046b484d22931922bf2f9a5b74
2015-12-01 01:58:57 -08:00
Aaron Schulz
fb4cb75e9f Split out WikiPage 'page' field for EditPage
* This fixes numerous IDEA warnings
* Also fixed some other warnings by fixing documentation

Change-Id: I2a76ce79c0d04a28a6cd74116dfce4e67435f44a
2015-11-25 16:14:01 -08:00
Aaron Schulz
9b386d2436 Race condition fixes for refreshLinks jobs
* Use READ_LATEST when needed to distinguish slave lag
  affecting new pages from page deletions that happened
  after the job was pushed. Run-of-the-mill mass backlink
  updates still typically use "masterPos" and READ_NORMAL.
* Search for the expected revision (via READ_LATEST)
  for jobs triggered by direct page edits. This avoids lag
  problems for edits to existing pages.
* Added a CAS-style check to avoid letting jobs clobber
  the work of other jobs that saw a newer page version.
* Rename and expose WikiPage::lock() method.
* Split out position wait logic to a separate protected
  method and made sure it only got called once instead of
  per-title (which didn't do anything). Note that there is
  normally 1 title per job in any case.
* Add FIXME about a related race-conditions.

Bug: T117332
Change-Id: Ib3fa0fc77040646b9a4e5e4b3dc9ae3c51ac29b3
2015-11-16 13:21:05 -08:00
Aaron Schulz
0686221b2d Remove 'bot' check before trying the edit stash
Some user groups, like the 'flood' one on wmf sites might
get caught up as false positives.

Change-Id: I31be62b2239477572bc063f1af0329f248bbcaf6
2015-11-05 21:36:02 -08:00
Aaron Schulz
25d821830c Remove WikiPage::doQuickEdit
Change-Id: If56f790b8a29b2262cba0feff7a96312c69cdb0c
2015-11-04 02:15:40 +00:00
Aaron Schulz
6da45bcaef Add updateRevisionOn() sanity check for existing pages too
Change-Id: I4f2fc07b0365183efb431a828d40c557b691b18c
2015-11-03 16:44:52 -08:00
jenkins-bot
b48f38a9fc Merge "Avoid use of rollback() in WikiPage::doEditContent()" 2015-11-03 23:36:53 +00:00