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
Trying to compare a string field with 0 (cast from false) raises an
error in PostgreSQL, and we're expecting it to not detect duplicates in
that situation anyway.
Change-Id: Ibff6daee6bbec00e37532e03c9ece041ba612de0
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 is to be used within the FileImporter extension to allow
adding custom loggers to this import process.
Change-Id: Ib094d4829764ccc8e5bd2619fb827d701ae06d43
This is to be used within the FileImporter extension to allow
adding custom loggers to this import process.
Change-Id: I4a6c573fc0a69b06d696cd2afca9226fb492a9bc
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
This makes things centralized to reduce maintenance cost and also
enables me to use this methods in Wikibase to handle RC injection
Bug: T185034
Change-Id: Ic8c602e316144ccb5b05c69a0cc607cd53e38912
Make the default notice implementation of notice() function to
send the notice to wfDebug() instead of simply echo to prevent XSS
Bug: T177997
Change-Id: I9ffb597e0642afc1603cdd15e2d09c6f2584b448
Importing revisions in MediaWiki has long been weird: if the username on
the imported revision exists locally it's automatically attributed to
the local user, while if the name does not exist locally we wind up with
revision table rows with rev_user = 0 and rev_user_text being a valid
name that someone might later create. "Global" blocks too create rows
with ipb_by = 0 an ipb_by_text being a valid name.
The upcoming actor table change, as things currently stand, would
regularize that a bit by automatically attributing those imported
revisions to the newly-created user. But that's not necessarily what we
actually want to happen. And it would certainly confuse CentralAuth's
attempt to detect its own global blocks.
Thus, this patch introduces "interwiki" usernames that aren't valid for
local use, of the format "iw>Example".[1] Linker will interpret these
names and generate an appropriate interwiki link in history pages and
the like, as if from wikitext like `[[iw:User:Example]]`.
Imports for non-existant local users (and optionally for existing local
users too) will credit the edit to such an interwiki name. There is also
a new hook, 'ImportHandleUnknownUser', to allow extension such as
CentralAuth to create local users as their edits are imported.
Block will no longer accept usable-but-nonexistent names for 'byText' or
->setBlocker(). CentralAuth's global blocks will be submitted with an
interwiki username (see Ieae5d24f9).
Wikis that have imported edits or CentralAuth global blocks should run
the new maintenance/cleanupUsersWithNoId.php maintenance script. This
isn't done by update.php because (1) it needs an interwiki prefix to use
and (2) the updater can't know whether to pass the `--assign` flag.
[1]: '>' was used instead of the more usual ':' because WMF wikis have
many existing usernames containing colons.
Bug: T9240
Bug: T20209
Bug: T111605
Change-Id: I5401941c06102e8faa813910519d55482dff36cb
Depends-On: Ieae5d24f9098c1977447c50a8d4e2cab58a24d9f
Prior to this change, the second parameter to WikiImporter was optional. If the parameter didn't exist, it would get filled in with a MediaWikiServices::getInstance()->getMainConfig(). It would also emit a hard deprecation warning. This behavior has existed since 1.25.
Bug: T61113
Change-Id: Ic15cc103c7d2b7fb499f1632c0001b8a3dbdf778
And auto-fix all errors.
The `<exclude-pattern>` stanzas are now included in the default ruleset
and don't need to be repeated.
Change-Id: I928af549dc88ac2c6cb82058f64c7c7f3111598a
Usage: php importDump.php --skip-to 271500 /path_to/dumpfile.xml.gz
When importing a database dump and the import process crashes
(for random reasons) after a certain number of pages, the
"--skip-to" parameter allows restarting the import process at
a certain page instead of starting the import from scratch.
Change-Id: Ib36063b69d6846fc197800bba44287493b0632c0
This was introduced in 436a028086
but was not used there.
It also currently looks unused.
We could go ahead and just remove this now, as anything that wants
to set the $user when the property is removed would still succeed.
But lets adhere to the deprecation policy here.
Change-Id: Id47323bb1ff480a16b46107825ed5f2f861ad976
This was introduced in 9b3128eb2b
but was not used there.
It also currently looks unused, even when grepping for possible
magic usages of 'importer' and "importer".
We could go ahead and just remove this now, as anything that wants
to set the $importer when the property is removed would still succeed.
But lets adhere to the deprecation policy here.
Change-Id: I5ac16dd87a95be6a3cdd4b16988d37d1d6104749
Cleanup from 43d5d3b682
This commit introduces both $fileIsTemp $isTemp
It would appear that the intent was to have one property here
and it looks like both of these are meant to do the same thing.
It also looks as if both public properties are actually unused
(only used by the getter and setters)
As isTemp will now sometimes return true line 766 $autoDeleteSource
will be true in new cases.
As a result $tmpFile->autocollect(); will be called in more cases
Change-Id: I8014172fb9fd7a0e4a89d0872bafdf6c50f92646
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
WikiRevision::getText() was wrongly marked deprecated in 1.21.
This has been fixed.
Bug: T152282
Bug: T61113
Change-Id: I3f0e0f7fe38bd4e2001efbe17cdba6bcc90b036f
Add comment discouraging use of the method. There are no problems
with deadlocks/timeouts in these code paths according to WMF logs.
Change-Id: I5b21cc423df584efa881361063000e01932cc2ea
$wgMaxArticleSize is defined as "maximum article size in kilobytes",
however the way it was being used in WikiImporter and EditPage was
actually allowing 1023 bytes more than the limit. Other code using the
variable was limiting it to the specified value.
Change-Id: I85e4d2146643c5ac65f27cf464a51b28d68440b0
* Check for blank $source variable more properly.
* Avoid use of ugly File::DELETE_SOURCE flag.
* Remove now-unused $flags parameter to uploadOld().
Change-Id: I6bc610cfead0036700b4f9a82e13f2bd9ab10f32
importTextFiles.php can be used to import pages from text files
containing wikitext.
Also, added $userObj to WikiRevision so that it can accept a User
object instead of just a username.
This is a GCI task.
Change-Id: I20eaf2005bdd3d041f55d8c0b108f001c064d638
It seems that when two simultaneous imports of the same page are started,
we get into the situation where $pageId is 0 (or at least something that
is transformed to 0 when inserted into the DB).
I can't reproduce this locally, so I can't tell you *why* this is
happening. But what is important is to stop it from happening.
Bug: T18674
Change-Id: I79406a1ef8e5db9a31f029438f8132ef590216fe