When aliasing a field to null, it has to be aliased to the string 'NULL'
rather than PHP null.
Bug: T198687
Change-Id: I6096f306b97022da781eaabeb15e502f391673a9
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '
(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)
Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).
Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
When uploading multiple file revisions with fitting text revisions to
core the UploadRevisionImporter will create a unwanted NullRevision on
the file page.
This NullRevision originates from LocalFile:upload() and is added there
in recordUpload2 as part of the normal upload process. There it is meant
to leave a hint on the text revision history.
This whole area is in need of heavy refactoring. But since the issue is
blocking the current implementation of the FileImporter extension, a
parameter is added to control the creation of that NullRevision.
Bug: T193621
Change-Id: I57c947eb63a7627ab1eec850cdf5e076f5f62df5
Storing the user name or IP in every row in large tables like revision
and logging takes up space and makes operations on these tables slower.
This patch begins the process of moving those into one "actor" table
which other tables can reference with a single integer field.
A subsequent patch will remove the old columns.
Bug: T167246
Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50
Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
This reduces the odds of having files without corresponding
wiki pages, given that the later is done in a deferred update.
Also made some documentation cleanups.
Bug: T187942
Change-Id: Iff516669f535713d37e0011e2d7ed285c667f1c5
This was incorrectly changed in I3abb62a5, createComment() is not one of
the methods that was adjusted in that patch.
Change-Id: I9c26e0ad69ffc6fa5349a6975a4134efb3cf0eff
This allows CommentStore to be added to MediaWikiServices
without the need of an aditional Factory.
This change includes a compatability layer to allow the behaviour
from 1.30 to continue to be used while deprecated.
CommentStore::newKey has been deprecated.
Keys are now passed into the public methods of CommentStore
where needed.
The following CommentStore methods have had their signatures changed
to introduced a $key parameter, but when used in conjunction with
CommentStore::newKey behaviour will remain unchanged:
* CommentStore::getFields
* CommentStore::getJoin
* CommentStore::getComment
* CommentStore::getCommentLegacy
* CommentStore::insert
* CommentStore::insertWithTemplate
Change-Id: I3abb62a5cfb0dcd456da9f4eb35583476ae41cfb
Several classes have a "selectFields()" static method to tell callers
which fields to select from the database. With the recent comment table
change and the upcoming actor table change, this pattern has become too
simplistic as a SELECT will need to join several tables to be able to
retrieve all the needed fields.
Thus, we deprecate the selectFields() methods in favor of getQueryInfo()
methods that return tables and join conditions in addition to the
fields.
Change-Id: Idcfd15568489d9f03a7ba4460e96610d33bc4089
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
When uploading a file, there are a few ways of checking for and blocking
(or at least warning about) duplicate uploads already.
However, it occasionally seems to happen that files get uploaded twice.
The exact same file, usually - submitted at (almost) the exact same time
(possibly some error in whatever submits the file upload, but still)
Given 2 uploads at (almost) the exact same time, both of them are stored,
even if they are the exact same files.
The last upload also ends up with a `logging` entry with `log_page = 0`.
I don’t believe such upload should go through: if we do find that a file
is an exact duplicate of something that already exists, I don’t see any
reason it should go through.
Note that with this patch, it will become impossible to reupload a file
with the exact same hash (which was possible before.)
If we still want to allow same-file reuploads while also blocking these
kind of race-condition same-uploads, we could make the check more strict
(e.g. also check timestamps, or check if page already exists, or …)
Bug: T158480
Change-Id: I76cbd2c64c3b893997f1f85974d6f82cbfe121e1
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