Commit graph

37 commits

Author SHA1 Message Date
Umherirrender
55148b143e Use delete_and_move_reason in content language on move over redirect
Follows I9645f23c5d6132abb304e254b039036ebca4b064

Bug: T161993
Change-Id: I08426118947ef5a9ea887a973fdf0a9176639aab
2017-04-08 11:08:00 +02: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
This, that and the other
f3f2df07ec Add parameter to API modules to apply change tags to log entries
Adds support for tagging log entries for the block, import,
managetags, and move API modules, using a 'tags' parameter.

Bug: T97720
Change-Id: I9d75d2cece317a7704c4bc6d734ad3cafe24544e
2017-01-12 16:30:17 -06:00
MGChecker
2ee4c67286 Introduce separate log action for deleting pages on move
Since T106119, moves that overwrite a redirect produce a deletion log
entry. It should be possibleto identify such deletions within other ones.
Note that this patch only applies for actions in the future because there
is no way to easily identify these cases for the software (until now).

Bug: T145991
Change-Id: I3c006bca57351d82031c4fdce0c53f65d630b0d9
2016-11-13 01:27:04 +01:00
Aaron Schulz
0852a000a5 Add caching to ResourceLoaderWikiModule::preloadTitleInfo()
This is one of the top three DB queries showing up in xenon
reverse flamegraph profiling.

It works via a per-wiki check key that is bumped whenever
someone changes a .js or .css page on that wiki.

Change-Id: I73f419558864ba3403b4601a098f6aaf84a3e7c1
2016-10-20 20:54:11 +00:00
Kunal Mehta
f9b54ea843 MovePage: Check ContentHandler::canBeUsedOn()
If the old content model cannot be used on the new page title, the page
move should be disallowed.

Change-Id: I6078a4cde5a76a050dddedf59634d800765cbabf
2016-09-29 16:09:43 -07:00
Max Semenik
2b51bd1847 Fix function name case
Change-Id: Ibd4f682d2ed8500a50d85aae38f17281646f7c2d
2016-09-26 15:32:54 -07:00
Aaron Schulz
7cd8913897 Avoid INSERT..SELECT in MovePage
That construct has poor locking characteristics in terms of
auto-inc columns as well as not allowing such inserts concurrently
for statement-based replication. Also, the INSERT..SELECT did not
have an ORDER BY, which could lead to pr_id drift with statement
based replication.

Change-Id: I47ca89abcbe4598d3b56cf077a47055500a0647f
2016-08-19 11:31:44 -07:00
James D. Forrester
71e336981b MovePage: Fix old, old bug with moving over redirects
When moving over a redirect with no revs, there was a weird
hack to delete the old redirect page... without logs, or cleaning
up the orphaned revision. WHOOPS

Switched it to using the standard deletion, which seems to work.
Note this will produce a deletion log entry as well as a move log
entry. This may scare people.

Bug: T106119
Change-Id: I9645f23c5d6132abb304e254b039036ebca4b064
2016-07-30 12:08:26 +00:00
Aaron Schulz
3a922d36d8 Convert onTransactionIdle() callers to DeferredUpdate subclasses
* This puts the complex logic here after the commit step for
  all DBs, making the main multi-DB transaction more likely
  to be atomic. Previously, the idle callbacks could be hit
  bewteen DB commits.
* Enforce transactionality via AtomicSectionUpdate.
* Use $this instead of $that hacks for old PHP versions.

Change-Id: Idf7d54fdac6487f86907099680f5c1c4f5530b4e
2016-07-25 16:49:15 -07:00
addshore
818984e5cb Remove WatchedItemStore::getDefaultInstance
Change-Id: I0c7d706fabee8d1f6fcfbc4c568f375953de8058
2016-05-06 08:47:37 +00:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
addshore
fee0afdc8a Move WatchedItem logic to WatchedItemStore
This also removes assumptions that when a page
in one Namespace should be watched / removed
that the page in the talk / subject ns for the
page should have the same action applied

This should maintain all backward compatability
for the WatchedItem class

This also includes tests written by:
 - WMDE-leszek
 - Addshore

Bug: T127956
Change-Id: Iad9abafe4417bb479151a3bfbee6e1c78a3afe3c
2016-03-08 15:41:22 +00:00
Matthew Flaschen
793499cde0 Add TitleMoveStarting, mirroring TitleMoveCompleting
This is a pre-requisite to fix a Flow move regression, T127785.

This allows running an atomic entirely within the move with the correct
ordering.

Bug: T127785
Change-Id: Ie772f737f917854e4cfefe52ec3bea4669c9efe0
2016-02-25 13:31:04 -05: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
Aaron Schulz
87f54c37f1 Add $revision to TitleMoveCompleting for completeness
Follow up to 9cc2f62bf5.

Change-Id: Ibb48f6673b9be1863563262fff8bedc5aed7926c
2015-12-16 19:11:15 -08:00
Eric Evans
9cc2f62bf5 Pass created revision to TitleMoveComplete hook
The EventBus extension needs to forward the created (null) revision ID as
part of the page move event.  Looking this value up when the hook fires is
problematic, because without a connection to the master DB the query might
very well return nothing (if it races in before the entry is replicated to
the slave).

This changeset passes the newly created Revision on to the hook so that it
doesn't need to be queried separately.

Bug: T116786
Change-Id: I1b48e2904fc8d99f2cde604f274f79a2b47d7fc2
2015-12-16 18:35:56 -06:00
Aaron Schulz
d0b9ffed76 Make TitleMoveComplete hook events apply in transactions
* All updates for an event are atomic for the main DB.
* This follows-up 9e51328790 by reverting the auto-commit
  behavoir which was a side-effect of that change.
* Added TitleMoveCompleting hook with is a pre-commit version
  of the same hook. Various extension could benefit from the
  atomicity of running in the main transaction.

Change-Id: Ife5990bbedca1de78bcf83f2d6fdeeae8086ffad
2015-12-09 18:23:49 +00:00
Aaron Schulz
8f15bc8ec9 Restore TitleMoveComplete by-reference flags to avoid errors
They should be removed from extensions, but they don't
really hurt much for now.

Change-Id: I64b570e376062155afdf879c3ce85560127c6792
2015-10-27 18:15:39 +00:00
Aaron Schulz
9e51328790 Convert MovePage to startAtomic()/endAtomic()
* This makes moves of a page and its subpages atomic
  as one operation. Note that $wgMaximumMovedPages
  already bounds the number of page rows changed.
* The TitleMoveComplete hook will fire for all
  titles after the operation rather than after
  each title move.
* Remove LocalFile comment about it commiting the
  transaction because LocalFile::lock()/unlock()
  check trxLevel() and reference count.

Change-Id: Ic7f6964f94f0b0f0bedc27012e5b5b012a4afdb2
2015-10-21 18:34:26 +00:00
jenkins-bot
f6b7ffab94 Merge "Migrate move protect log to new log system" 2015-08-18 23:17:03 +00:00
umherirrender
3964b4cc05 Migrate move protect log to new log system
Migrate the move protect log as first sub type of the protection log,
because it does not have complex log parameter, which needs some way of
handling/migration.
It also keeps the gerrit change smaller and hopefully makes review
easier.
The other sub types of the protection log will be migrated in a later
patch set.

This allows use of gender on Special:Log. Old message is kept for use
in IRC. A test was added to ensure an unchanged IRC message.

Bug: T47988
Change-Id: I57b3bd8a7dc823acdbb56520d2364f5542283373
2015-08-18 22:20:35 +00:00
Kunal Mehta
0ce88ddfb2 Populate rev_content_model when a move causes default content model to change
If the default content model changes due to a page move, a NULL in
rev_content_model will now reference the new default, which is not how
the revision was serialized, causing an exception to be thrown.

This was caused by a5bc9f49cd, since previously NULL would use the
correct, but techncially inaccurate, page_content_model.

Bug: T105260
Change-Id: I0c29d0e657ad0b656e5da6ba365f337229ad4dfd
2015-07-24 15:58:22 -07:00
Kunal Mehta
75c813cc9a MovePage: Move target existence check into isValidMove()
The target existence check is not dependent upon the user who is making
the move, so move it into MovePage::isValidMove() instead of
MovePage::checkPermissions() which not all callers will call.

Bug: T97536
Change-Id: I3aad1455ad4c064cbeaf35221a00ca6baba97c33
2015-04-29 10:36:03 -07:00
Aaron Schulz
5085a4b5cf Made wfFindFile/wfLocalFile callers use explicit "latest" flags
* Callers that should not use caches won't
* Aliased the old "bypassCache" param to "latest"

bug: T89184
Change-Id: I9f79e5942ced4ae13ba4de0b4c62908cc746e777
2015-03-06 04:18:50 +00:00
Amir E. Aharoni
5238644610 Shorten long lines in MovePage.php to make phpcs pass
Change-Id: I4b6b2975f8e2b9508f0a78fb176093974c935cf1
2015-03-03 22:02:23 +00: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
jenkins-bot
c39aefd439 Merge "Fix fatal error in I0349cfe0e322" 2014-11-04 06:53:31 +00:00
This, that and the other
60fd612e0e Fix fatal error in I0349cfe0e322
Change-Id: I4ac41d56c2e0f98cd8f026c7deac1e8ab69e8d54
2014-11-04 17:44:19 +11:00
jenkins-bot
a5aa9f0b95 Merge "Update article count when pages are moved" 2014-11-04 06:25:07 +00:00
This, that and the other
f6f390cc7a Update article count when pages are moved
If a page is no longer countable (or becomes newly countable) after a move,
we need to update the site statistics (count of content pages).

Bug: 64333
Change-Id: I0349cfe0e32229706e01d654aacf8ccbe5ebabf3
2014-11-04 17:13:21 +11:00
Kunal Mehta
ac53e45035 Fully replace Title::moveTo() with MovePage
* AbortMove hook is removed in favor of two more specificly focused
  hooks: MovePageCheckPermissions and MovePageIsValidMove.
** MovePageIsValidMove is for extensions to specify whether a page
   cannot be moved for technical reasons, and should not be
   overridden.
** MovePageCheckPermissions is for checking whether the given user
   is allowed to make the move.

* Title::moveNoAuth() deprecated
* Title::moveTo() deprecated
* Title::isValidMoveOperation() broken down into
  MovePage::isValidMove() and MovePage::checkPermissions().

* Title::getTitleProtection() is now public, and returns
  unprefixed fields

Change-Id: Ic5026384b92a0d68d628397ffe1de6e5b6183f02
2014-10-28 12:52:36 -07:00
Kunal Mehta
e995e2ae4b MovePage: Properly return errors
Probably a copy-paste mistake when converting this function
to use Status instead of error arrays.

Change-Id: I796fc66ee637dd7d914a4182fe56992e59b90aba
2014-10-10 22:52:13 -07:00
umherirrender
df24b7209d Fixed spacing
- Added newline at end of file
- Removed double spaces/newlines
- Added space after if/function and parentheses/brackets
- Removed space before comma/cast
- Fixed indent of some lines

Change-Id: I29867ffdffdfb7d2b56997e9393497c7dc12f7d3
2014-09-29 20:46:19 +02:00
Kunal Mehta
39fffcedb0 Move non-user specific things from Title::isValidMoveOperation() to MovePage
Change-Id: Ieffeb0c7a15b202dcbdaf2a9d0b9bcdc10e360d2
2014-09-19 20:11:59 +00:00
Kunal Mehta
52f1d0d7b3 MovePage::move(): Return a Status object
Change-Id: I17e6f6d36ae2052bd09d21eb94546d94bda9bce9
2014-09-14 19:31:38 -07:00
Kunal Mehta
77698193f9 Start moving page move logic out of Title
This moves most of the Title::moveTo() function into a new MovePage
class, and the entirety of the Title::moveToInternal() function.

No actual code was changed except for requiring a User object in
function arguments instead of relying up on $wgUser, and changes
to "$this" as necessary.

Change-Id: I5479fa8f3920a51ddf789d55edae7dd0d9b24382
2014-09-14 19:29:53 -07:00