Commit graph

152 commits

Author SHA1 Message Date
jenkins-bot
5680816a08 Merge "import/export: Add documentation for nullable arguments" 2021-10-20 18:47:28 +00:00
Gergő Tisza
bdbc5d13eb
WikiImporter: improve error handling
This is an attempt at getting a more useful error message than
"Import failed Expected <mediawiki> tag, got"
(ie. XMLReader thinking that the root tag name is the empty string).

E.g. with the dump file I'm debugging at the moment, after applying
this patch I get "XML error at line 1: Extra content at the end of
the document" instead.

Change-Id: I365eebf78c30b644808eb5ac42d0946c8cf60778
2021-10-16 21:13:52 -07:00
Umherirrender
10e2f98a17 import/export: Add documentation for nullable arguments
Change-Id: Id8e4553a054a36011433d5705c699d1c2730456e
2021-10-16 21:49:18 +00:00
Derick Alangi
6407361b46 Migrate WikiPage::doEditUpdates() to using PageUpdaterFactory
WikiPage::doEditUpdates() has been deprecated. Using the PageUpdaterFactory's
newDerivedPageDataUpdater() is the new way forward. Also, I made sure to have
the `$options` array with the `causeAction` and `causeAgent` key/value pairs.

Change-Id: I9f2c212d7c83a46799f9f947dc372dc364289680
2021-10-07 11:17:43 +01:00
Umherirrender
0e4bb6d611 Change 'fromdbmaster' to WikiPage::READ_LATEST
Constants are harder to misspell

Change-Id: Ie1afcc8580cccf815df1cc97f05a5be81676d9f7
2021-09-26 19:27:33 +00:00
jenkins-bot
ae8522b34c Merge "Same code style and formatting for exists-style SQL queries" 2021-08-24 17:44:17 +00:00
jenkins-bot
5e227c9c61 Merge "WikiRevision: ensure that $comment is a string" 2021-08-14 16:36:00 +00:00
Daimona Eaytoy
96f346e00d WikiRevision: ensure that $comment is a string
It's documented as string only, but some code (possibly test code) is
passing null, causing failures for I0e7e4a48b56c3e5fde56f50693fd0cdc19c30dd0.

Change-Id: I07e2fc0c6249e8bcda3af99213fcf26f17e6df94
2021-08-14 16:17:03 +02:00
Umherirrender
ea607c6e09 import: Remove unused debug callback
Change-Id: Iaa9360939a7151851c69667b411ae12daa381dbb
2021-08-13 19:36:34 +00:00
Thiemo Kreuz
46f26dff03 Same code style and formatting for exists-style SQL queries
Queries that query a value "1" are expected to return either
that "1" (possibly as a string), or false. It's safe to simply
cast this to bool and use it as it is.

Queries for COUNT(*) are expected to return that number,
possibly as a string. It's not possible for such a query to
return false. And even if, casting to 0 is fine.

I found an existing code style where the table name and the
"1" are on the same line as the selectField() method name, and
applied it to all similar queries.

Change-Id: I9453196281871c03ef03f653f43762eb9284342f
2021-08-12 11:37:58 +02:00
jenkins-bot
56a2c16e48 Merge "Add missing spaces to imploded debug strings" 2021-07-28 13:44:04 +00:00
Matěj Suchánek
d71ff53639 Add missing spaces to imploded debug strings
Change-Id: I32d921aaa3a5799777ff62b35608cbedcfff907d
2021-07-28 11:07:17 +02:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
Alexander Vorwerk
401d26dfa8 Don't allow null values for services in WikiImporter
The fallback to global state for the services injected into
WikiImporter has been removed with Ide7693a411d, thus these
services need to be injected and are not allowed to be null.

Bug: T283530
Change-Id: Iff6e673f56c48bafad4f7dc5732e136b9359f149
2021-07-14 08:44:08 +02:00
Alexander Vorwerk
24039dab19 Remove fallback to global state in WikiImporter
Bug: T283530
Change-Id: Ide7693a411d76e11bd1611b2ffd269cb1f23799c
2021-07-12 15:04:33 +02:00
jenkins-bot
c309a5dd25 Merge "Remove the fallback for create rights (covered in PM edit rights check). Remove key to i18n message, no longer being used." 2021-06-30 15:16:39 +00:00
Roman Stolar
6ebaa5caf6 Remove the fallback for create rights (covered in PM edit rights check).
Remove key to i18n message, no longer being used.

Bug: T272079
Change-Id: Id6566e5241b06ba377c2eca083221ee02556365f
2021-06-30 17:30:30 +03:00
jenkins-bot
6eb8c5a6da Merge "Use IEC prefixes instead of SI prefixes for byte sizes (docs+backend)" 2021-06-29 10:34:41 +00:00
Fomafix
356f1b72ef Use IEC prefixes instead of SI prefixes for byte sizes (docs+backend)
This change doesn't change any UI messages.

Bug: T54687
Change-Id: Ia62899a2a6fe8910618c35cd667291e397ddb055
2021-06-28 11:59:09 +01:00
DannyS712
ab5d55c6d2 WikiImporter: Pass a user to WikiPage::prepareContentForEdit()
Need to rely on RequestContext::getMain() since no user is
available nor is injecting one simple to do (the calling method,
::finishImportPage, is used as a callback and extensions can
replace it with their own callbacks instead)

Bug: T285447
Change-Id: I02e01e52909da51e7001b4acee43567ae645d9a7
2021-06-27 01:01:27 +00:00
Alexander Vorwerk
acba631a90 Fix 'instances' typo
Change-Id: Iadcb20f76dc0d7623a60d9b8a63b097e6d5d7732
2021-06-03 01:15:43 +02:00
ZabeMath
3c978f6fc6 WikiImporter: inject services
This patch injects services into WikiImporter. It also adds
a WikiImporterFactory service for creating WikiImporter
instances.

Change-Id: I2966297e5728fca1ae8280361f1008cef6c6041b
2021-05-24 23:10:07 +02:00
daniel
282e4ede1a ImportReporter: replace Title in method signatures
Bug: T278459
Change-Id: I9ff5f1989e15a1fe3988845abae935e6372d40ac
2021-05-12 23:25:21 +02:00
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
Tim Starling
83e184670c Stop using legacy ActorMigration field "log_user"
Bug: T278917
Change-Id: I1b78bad7e1fa43f5f82908567a7daad9c6cc79b9
2021-04-28 16:29:04 +10:00
DannyS712
54cd9e478e Inject dependencies into some ImportTitleFactory classes
NaiveImportTitleFactory
NamespaceImportTitleFactory
SubpageImportTitleFactory

Change-Id: I0ab83d1c6361d5a6f06b0c765c0e997d16e3bdb5
2021-03-22 21:27:27 +00:00
DannyS712
69babb9350 NaiveForeignTitleFactory: inject content language
Rather than retrieving from MediaWikiServices in
the factory class, retrieve it in WikiImporter and inject
it, so that the factory uses proper DI and the
tests can eventually become unit tests

Change-Id: I6fe63829f0e65b261b6ae12e17f354333cde70b9
2021-03-13 09:50:44 +00:00
Reedy
a12c1bdb1b WikiImporter: Minor code style changes
Change-Id: I8001629ed8511b3d5ffaedea1041c8043cebb8f9
2021-02-08 00:09:15 +00:00
Reedy
0a9b320934 Remove unused variable from WikiImporter::doImport()
Change-Id: I98665fa692394c486aeb48df35369921c51cd9b1
Follows-Up: I52c1e597e1588941d50211d1c71fc19cc414d8e4
2021-02-08 00:03:06 +00:00
jenkins-bot
28365e1365 Merge "Improve and add documentation to import/export related classes" 2021-02-05 03:14:35 +00:00
Cindy Cicalese
5576727771 Make UserIdentity objects aware of which wiki they belong to.
Bug: T260933
Change-Id: Ic986640cc34e6ec6be239e410a8334f0e299c682
2021-02-02 16:10:51 +00:00
Umherirrender
56b2bd653a Improve and add documentation to import/export related classes
Change-Id: Ib2a74c1ac1a1902341e289961f4c1aa4dadd4bd8
2021-02-01 19:35:49 +00:00
Reedy
256e6ff0d9 Revert "Wrap libxml_disable_entity_loader() calls in version constraint"
This reverts commit a4c69bde13.

Reason for revert: Needs a bit more thinking about

Bug: T268847
Change-Id: I82a7bb2a4ef15adc65717d5ba173c8f3cfb0644c
2021-01-27 16:06:38 +00:00
Reedy
a4c69bde13 Wrap libxml_disable_entity_loader() calls in version constraint
Bug: T268847
Change-Id: I56684ce7b39aaebe1ae76811b833bc9183bc359b
2021-01-27 00:42:31 +00:00
Ariel T. Glenn
6df4b78e36 WikiRevision::model can be null so don't pass it as an arg
Use getModel() as the arg instead

Change-Id: Ie23d31885416abdcc639f4fc5028961ba80de495
2021-01-22 13:30:17 +02:00
Reedy
77f631ea5e composer.json: Add ext-libxml and ext-xmlreader to requires
Change-Id: I1c82ec4f2b521ff9dc2d4604cf1007847f32f7de
2020-12-27 22:01:02 +00:00
Ammar Abdulhamid
96bcbcd758 WikiImporter: Replace deprecated WikiRevision::setText
Change-Id: Ic1626a95f4dbb9ca848422e095e3098f2393cca9
2020-11-30 10:14:53 +00:00
jenkins-bot
29c1a731cf Merge "Simplify try-block and exception rethrow" 2020-11-20 06:29:11 +00:00
Ammar Abdulhamid
00e0b40213 Hard deprecate WikiRevision::importUpload
Soft deprecated since 1.31 and no longer in use save one usage
in WikiImporter which has been replaced too.

Change-Id: I88305fb7579d66fd402646f1717f2d528bf90d02
2020-11-20 04:45:19 +01:00
Ammar Abdulhamid
2defaa19ea Simplify try-block and exception rethrow
Since we only want close the reader and entity loader, there's
no need for catch and rethrow as finally can handle this as we want.

Change-Id: I52c1e597e1588941d50211d1c71fc19cc414d8e4
2020-11-20 04:32:40 +01:00
Umherirrender
539b6abba2 Replace deprecated WikiPage::factory in import/export related classes
Change-Id: I58c5d1bc7bfca872fe0bcfdc51828dcef5abdf02
2020-11-15 18:32:21 +00:00
Petr Pchelko
f11ed7e46f Add forgotten import hook interface
When making primitive tests for HookRunner in
I8d0a34e185aad79a391acdd47e506c8911c75257 I've
notived that coverage was not 100% and found that
this hook interface was forgotten.

Change-Id: Ic877fd1f2bbac5a1af708f283e9e0b7a49f89d88
2020-11-02 08:17:34 -07:00
daniel
2e57447c58 Document hook names in hook interfaces.
Bug: T258665
Change-Id: Ifddbf57f8aa2e3eb0d5845601376cbafa08ed407
2020-09-27 12:03:12 +02:00
DannyS712
e834b31b2b Use recordUpload3, hard deprecate recordUpload2
Also reduces references to $wgUser in importImages

Bug: T248813
Change-Id: I17c850000044f65f2fcfdfcfb82f852583a99000
2020-09-10 00:00:42 +00:00
Ed Sanders
7683f7d839 Use strict (in)equality with namespaces constants when LHS is definitely an integer
Change-Id: I8fede00dfe1270d93c5d78d3c36e788cddfc8a99
2020-07-31 18:03:28 +01:00
daniel
cd6d423eef Import: use master DB for loading slots.
We were using the master to load revision data from the revision
table, but not when loading slot data. We should use the master DB for
both, consistently.

Bug: T258666
Change-Id: I800adb852ec690b63fa926f40428de3272d69584
2020-07-23 18:34:34 +02:00
Cindy Cicalese
f3556c729e Remove backward compatibility code from ImportableOldRevisionImporter
The last constructor parameter is now mandatory.

Depends-on: Ifd5dbc2b947533a5e926c581e1c5a67e4af147dc
Bug: T220525
Change-Id: I47071440a9696f18568e542fe6eee32843c28210
2020-07-23 12:25:56 +00:00
Cindy Cicalese
c69489f44c Check for unknown slot.
Bug: T220525
Change-Id: I89ac1679ea70cb403433f8b97fe11e8eb6811280
2020-07-20 10:39:28 -04:00
daniel
7ffacacc6b MCR import
Bug: T220525
Change-Id: I7d41a8af12e33aed802526eb39a0880292c4f534
2020-07-18 20:34:16 -04:00
daniel
e6e0ad2472 Replace "@stable for implementation" with "@stable to implement"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: I17e5e92e24c708ffc846945a136347670a3a20c7
2020-07-13 11:05:49 +02:00