Commit graph

37 commits

Author SHA1 Message Date
Alangi Derick
0848d0e607 export: Fix return value of write() function in DumpOutput.php
Per http://php.net/manual/en/function.print.php, print always returns
1 (integer value of one) but write() doesn't actually return this value
to it's caller. So "@return bool" in this case doesn't make sense as
one will think it's returning a bool type. `write()` only takes a string
and prints it, and if we really want to return it's value (in this case),
it will be "@return int" not data of type bool.

Change-Id: I45b4a157cde2f768d77dda76d6ae0caa47e28f20
2018-12-03 12:28:48 +01:00
Jakub Vrana
3559bca6f7 export: Do not pass unused parameter
Found by PHPStan.

Change-Id: I0e4971a3d5a4170ada776cd88ea664806f23c6ed
2018-12-01 23:50:22 +00:00
Bill Pirkle
94ec06e0bf Fix for missing end tag </page> on some exports
T203424 replaced streaming mode with batched queries.
However, it did not properly handle some values of
the $wgExportMaxHistory config variable, and emitted
broken XML. This change fixes that issue.

Bug: T207974
Change-Id: Iade3fc603e513da51b7a970c16275516c02ede49
2018-10-31 18:02:02 -05:00
Ariel T. Glenn
1113b1203c fix stubs dump query to use straight join
regression from a combination of
https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/380669/
and
https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/459885/

We have to do a straight join for all stubs, since they all
now order revisions by rev_id after deployment of the second
patchset above.

Bug: T207628
Change-Id: I4d2a311c14c66d4813eb9fc3c587fa3ddb958454
2018-10-23 18:33:02 +03:00
Bill Pirkle
085b6e4787 Replace WikiExporter streaming (unbuffered) mode with batched queries
WikiExporter allows streaming mode, using unbuffered mode on
the database connection. We are moving away from this technique.
Instead, do multiple normal queries and retrieve the
information in batches.

Bug: T203424
Change-Id: I582240b67c91a8be993a68c23831c9d86617350e
2018-09-28 10:55:05 -05:00
daniel
7c2d0202ab Allow dumps to function with MCR in read-new mode.
This is a temporary fix that forces the dump code to continue to
use the old database schema, even when MCR is in
SCHEMA_COMPAT_READ_NEW mode. This will continue to function until
SCHEMA_COMPAT_WRITE_OLD  mode is disabled.

Bug: T198561
Change-Id: Ic54ee703f47d1843f70fdb7185ac1b098f148680
2018-09-07 14:18:40 +02:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Max Semenik
8a82749ce9 Don't use deprecated NS_IMAGE*
Change-Id: I3df00c8e55a79baa3f3727daeea6c9441113aebc
2018-03-16 22:58:58 -07:00
Brad Jorsch
27c61fb1e9 Add actor table and code to start using it
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
2018-02-23 10:06:20 -08:00
addshore
e5879da149 Pass $key into CommentStore methods and use MediawikiServices
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
2018-02-05 15:34:12 +00:00
Chad Horohoe
93d44c9a42 Move BaseDump into includes/export/
There's no reason for this to have to live in Maintenance land. It's
generally useful and lets us avoid some random require/include calls

Change-Id: I60419c7f9fc52313905053bbeb3aa81666c9160c
2018-01-08 22:10:25 -08:00
Albert221
6a47a03236 Fix autoloading of ExportProgressFilter
Bug: T177239
Change-Id: Ieb5d5aa78d569af8cd8f8bfa32ce10a33482cb84
2017-12-13 22:04:59 +01:00
Reedy
7a836958be Run strval() over the File description
Bug: T176090
Change-Id: I8488666c221a1bd4e4e063291e74819a07a4a20f
2017-09-18 01:00:10 +01:00
Brad Jorsch
11cf01dd9a Add comment table and code to start using it
A subsequent patch will remove the old columns.

Bug: T166732
Change-Id: Ic3a434c061ed6e443ea072bc62dda09acbeeed7f
2017-08-30 15:05:00 +10:00
Umherirrender
718e63694d Add missing @param and @return documentation
Change-Id: I1d1098eec3933df6561cceef646576013ddc08c8
2017-08-11 22:17:01 +02:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
Kunal Mehta
d1cf48a397 build: Update mediawiki/mediawiki-codesniffer to 0.10.1
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
2017-07-22 18:24:09 -07:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
jenkins-bot
22806b0a45 Merge "Handle missing namespace prefix in XML dumps more gracefully" 2017-03-08 05:07:57 +00:00
Aaron Schulz
e01fd44388 Move ResultWrapper subclasses to Rdbms
Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
2017-03-03 00:44:41 +00:00
Bartosz Dziewoński
ecdef925bb Miscellaneous indentation tweaks
I was bored. What? Don't look at me that way.

I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.

Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
2017-02-27 19:23:54 +01:00
Brad Jorsch
fb3ae6fbe3 Replace use of &$this
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
2017-01-31 23:01:54 -05:00
This, that and the other
ef8bc825c6 Handle missing namespace prefix in XML dumps more gracefully
If an XML dump of a wiki is exported using dumpBackup.php, and there are
pages in a namespace that is not registered (perhaps because of a missing
extension), they will appear in the dump in the form

<page> ... <title>PageTitle</title> <ns>1234</ns> ... </page>

This caused the ForeignTitle code to raise an undefined offset error,
because it assumed that the <title> element was of the form
"Namespace:PageTitle" when <ns> was nonzero. This assumption is not valid.

Now, the importation of such dumps will no longer throw errors and the
pages will be correctly imported, although possibly to unexpected
locations.

Bug: T114115
Change-Id: I0271435dc208e7ea118339584f8a0e359c96113a
2017-01-01 09:11:45 +00:00
jenkins-bot
c8d361a380 Merge "Export: Use BCP 47 language code for attribute xml:lang" 2016-12-14 09:21:35 +00:00
Fomafix
155ee515d4 Export: Use BCP 47 language code for attribute xml:lang
The patch changes for example
 https://crh.wikipedia.org/wiki/Mahsus:Export/Ba%C5%9F_Saife
from
 xml:lang="crh-latn"
to
 xml:lang="crh-Latn"

Change-Id: I2fb218fe026c5ffee081fb8aaee7b154a8732bdc
2016-12-13 20:23:25 +01:00
Fomafix
202f695f67 Update weblinks in comments from HTTP to HTTPS
Use HTTPS instead of HTTP where the HTTP link is a redirect to the HTTPS link.

Also update some defect links.

Change-Id: Ic3a5eac910d098ed5c2a21e9f47c9b6ee06b2643
2016-11-07 15:24:46 +01:00
Kevin Israel
be46ffa771 DumpStringOutput: Rename getOutput() to __toString()
Though getOutput() is what first came to mind, I do not particularly
like the name, partly because it is used in many, many places as a
method that returns an OutputPage object.

* Renamed the method to __toString(). This is appropriate because
  each instance, at any given time, corresponds to a single string
  value (and exceptions cannot occur during this conversion).
* Removed unnecessary variables from ApiQuery and ExportTest. In
  these and most other cases, it should no longer be necessary to
  call getOutput() explicitly.

Change-Id: Icf202743d1f332f8981338f42eb6e3e5a04abdf1
2016-07-14 06:28:16 -04:00
Kevin Israel
81d5d8adc2 ApiQuery: Don't mess with PHP output buffering
Specifically, it is not necessary to use output buffering functions
to capture XML generated by the export code because it is already
possible to set the "output sink" object to be used.

* Created a DumpStringOutput class, which appends all output to a
  string property rather than printing output immediately.
* Used that class, instead of ob_start() and ob_get_clean(), in
  ApiQuery and ExportTest.

Change-Id: I238f5d5ec7fd442c845b25cb59ef81ac3285099f
2016-07-08 18:30:55 -04:00
Ariel T. Glenn
327d8c8b54 add option to XML dump stubs of page ranges with explicit rev_id ordering
tested for stubs, text, logging with and without start/end values,
with and without orderrevs, seems to work as expected, with the
appropriate changes to the query.

Bug: T29112
Change-Id: I94ca4a06235bdbed384bb997deb7432bb5aaa5b9
2016-06-22 22:05:55 +03:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00: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
Andrew H
2490d6457a Add 7zip compression level param to BackupDumper
Adds a --7ziplevel param to dumpBackup.php and dumpTextPass.php,
used when an --output of type '7zip' is specified.

Bug: T78669
Change-Id: I9ee8169daf30b4d8251c7a344b593c29c81eb799
2015-12-31 18:18:18 +00:00
This, that and the other
4abb459392 Refactor dumpBackup.php and dumpTextPass.php to be Maintenance subclasses
Use the Maintenance class's new $orderedOptions and support for
passing options multiple times. This allows for option "chaining".

The BackupDumper and TextPassDumper class now extend Maintenance, but
should continue to function as before. The public function processArgs()
has been removed and replaced by processOptions(), which takes no
parameters. It is unlikely that users of these classes were calling
processArgs.

Inheritors of these classes that overrode processOption() will now need to
override processOptions() and use Maintenance::getOption() and friends.

The maintenance/backupTextPass.inc file has been deleted. Users should
include maintenance/dumpTextPass.php instead.

Bug: T122587
Change-Id: I2473ee119c185d1b2b00ac4b1e70ee8a6cafe4a3
2015-12-31 20:46:54 +11:00
Reedy
e7719c215c Fix corrupt ©
Change-Id: I2a875cf770e19834fdd22d57691ed945e524d7d7
2015-12-31 01:01:23 +00:00
mhutti1
c92aa31aab Split Export.php classes into seperate files
Moved classes in Export.php to seperate files in the new directory
includes/export/ and updated autoload.php to these new locations.

Bug: T122531
Change-Id: Idd3bba5a85d65c952f2ff503bea2ca76624c9b7f
2015-12-28 22:51:06 +00:00