CommentStore->insert() takes the raw comment, not quoted, and returns
fields appropriate for passing as $a to IDatabase->insert() or $values
to ->update(). Such fields need to be passed through
IDatabase->addQuotes() to be appropriate for passing in $varMap to
IDatabase->insertSelect().
Change-Id: Ie64b279ee7cf9c8c396af385e46c826e0597ab1e
With the introduction of CommentStore, selects from various table
require certain joins or column aliases for proper operation.
Change-Id: I2ecb6030bf253664c3227d69b5ed2277596a83f0
It doesn't matter when $wgCommentTableSchemaMigrationStage is
MIGRATION_OLD, but it'll fail when we start changing that to later
migration stages.
Follows up I3447a412.
Change-Id: I6c010cefedd99324080ec078b83159d12709c1b1
Since the caller doesn't (and shouldn't) know whether CommentStore is
using the old or the new schema, it should leave truncation of comments
to CommentStore.
Change-Id: I92954c922514271d774518d6a6c28a01f33c88c2
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.
Change-Id: I994d11e05f202b880390723e148d79c72cca29f0
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168
Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||
Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
The new width/height override means that files without
any metadata can get content headers.
Bug: T150741
Change-Id: I92199a4aa9e0408572ebf7d8e4c04cd0196f0d0a
This allows us to populate X-Content-Dimensions without touching the
existing metadata format. Which makes the migration of existing content a lot faster by
only having to run refreshFileHeaders.
Bug: T150741
Change-Id: I2c0f39b2b01f364c3fab997ccc2f874b7f101d8a
For storage repos that support headers (such as Swift), this will store the original
media dimensions as an extra custom header, X-Content-Dimensions.
The header is formatted to minimize its length when dealing with multipage
documents, by expressing the information as page ranges keyed by dimensions.
Example for a multipage documents with some pages of different sizes:
X-Content-Dimensions: 1903x899:1-9,11/1903x873:10
Example for a single page document:
X-Content-Dimensions: 800x600:1
Bug: T150741
Change-Id: Ic4c6a86557b3705cf75d074753e9ce2ee070a6df
* Not a holistic solution, but these are the places that currently
assume a natural number for $page.
Bug: T100453
Change-Id: Ic611e5379dc8d138034b62ff8d678dfc68ced023
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
Use of &$this doesn't work in PHP 7.1. For callbacks to methods like
array_map() it's completely unnecessary, while for hooks we still need
to pass a reference and so we need to copy $this into a local variable.
Bug: T153505
Change-Id: I8bbb26e248cd6f213fd0e7460d6d6935a3f9e468
* 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
Refactoring handling of the rev_delete database field, which is not
needed to select, when the suppress option is set.
Also added a new const, to avoid a comment about that things should be
15 ...
Change-Id: Ia5bcb835172bf6c10e2e872555fc67e91806ebe1
* FSFile should not be responsible for handling this much logic.
* Make more MediaHandler classes aware of the fact that an object
other than File might be passed in. Use the FSFile instead of a
useless empty stdClass object.
* Also added more fields to FSFile::placeholderProps to make it
more complete.
Change-Id: I9fe764b2a7261af507c6555e6a57273cf7d00d36
Postgres needs a special timestamp format on sql which is handled by
Database::timestamp.
Bug: T145066
Change-Id: I8db958ecbea7c12af8caf8354490e59500975e4b
Changed the hashing for the keys to SHA-1, which also avoids
problems with old MediaWiki versions seeing the new WAN
versioned keys.
Also fixed a few annoying IDEA errors
Change-Id: Ie608fb86421bc96e05e4a3b352f39b4938a243e4
* This better handles delayed/lost cache purges by
having lower TTLs for entries that often changes.
* Use this for foreign upload description page caches,
we purges are never received from the source wiki.
* Also use this for User and LocalFile cache TTLs.
* Also move the Database::getCacheSetOptions() call in
User *before* doing the queries, which is preferred.
* Fixed some IDEA errors too, like the undeclared
mApiBase field.
Change-Id: I70f8ebb29ac853c2a530d9eedb9e7facc1b7b710
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 fa_id drift with statement
based replication.
Change-Id: Iaacb75d9931b4cd24b70bdcaadd0e3979c7e9c90
This prevents admins being able to view suppressed files, by simply
deleting them, and then undeleting only the file revision that they
want to view.
This dates back to r43288. Unclear if it was intentional.
Bug: T132926
Change-Id: Ib767de853a37099305db20529378fa756ee1bdfe
At the moment the job might start before the transaction
that creates the file's row in the DB has had a chance
to run.
Bug: T106740
Change-Id: If5b94e83d8bbcc6aebfe7193f7b580f03cbd627d
* 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
* Verify the DB updates and bail before doing anything instead
of relying on rollback() if something does not match up.
* Do the file copying before updating the DB so that there is
nothing to rollback if they fail.
* Improved failCount in case the current version is missing.
It should also reflect all the missing old versions.
Change-Id: Ie2d316548d8e5584cc69bb9f1425db108b05be5c
* This puts the complex logic here after the commit step for
all DBs, making the main multi-DB transaction more likely
to be atomic.
* Made some cleanups to AtomicSectionUpdate and made it cancel
if the transaction is rolled back as it should.
* Also cleaned up some closures for PHP 5.4.
Change-Id: If2f7bb6b1ba6daf1cfdc934f27c32b0b10431a3d
If the first query to the master DB is after lock() and DBO_TRX is
set, make sure that the LocalFile updates still join the implicit
transaction that the rest of the request is in.
This helps keep the commit step tight when multiple DBs are touched
by making sure that the main DB commits in commitMasterChanges()
along with any others.
Bug: T119736
Change-Id: I6cc29f9201947e4415336528d30cba7f88567b41
* Added onTransactionResolution() DB method.
* Use this method so that file unlocks fire on unlockAndRollback()
as well as on DB errors (via MWExceptionHandler::handleException).
This prevents locks from getting stuck for minutes when deadlocks
happen, since the LockManager::destruct() method is not reliable.
* Fix broken reference counting which always released locks on the
first unlock() call, even if there were 2+ lock() calls.
* Added some type hints to IDatabase methods.
* Fixed DatabaseBase::__destruct() logging to include all callbacks.
Bug: T132921
Change-Id: I684706957f4d794cb6fe61505b0d26b7893de706