Commit graph

214 commits

Author SHA1 Message Date
Max Semenik
1e680456b4 Get rid of call_user_func(_array)(), part 3
Also cleaned up nearby code in a couple places.

Change-Id: Ibf44ee7c0ceb739d7e79406e4ff39303c316e285
2018-06-10 02:21:24 +00:00
Brad Jorsch
5c380739b2 Avoid recreating ar_revid index after it's replaced by ar_revid_uniq
Bug: T193180
Change-Id: I274e33de0a348c0ee42b08b349272db7e2151647
2018-06-05 11:35:03 -04:00
Kunal Mehta
a2c166cb51 Have class match filename in some maintenance scripts
Each of these scripts had a class name that was not referenced outside
of the script file itself, and are safe to rename as a result.

Change-Id: Id605aca11db51ee433baeaa998a0e33184c930ca
2018-05-23 19:36:51 -07:00
Brad Jorsch
1c7bf1baf0
Deduplicate archive.ar_rev_id
Old bugs and such may have left the archive table with multiple rows
using the same ar_rev_id, or rows that also exist in the revision table.
These need to be cleaned up for MCR.

The maintenance script added here will delete rows that appear to be
duplicates of the same change, and will assign new IDs to rows that do
not appear to be duplicates.

Bug: T193180
Change-Id: I39b0825c9469e074ded3df33a4f06a1ef0edb494
2018-05-16 14:34:11 +02:00
Brad Jorsch
aef72c5cf6 Populate externallinks.el_index_60 and drop default
Adds a maintenance script to populate the field, has that be
automatically run during update.php, and drops the no-longer-needed
default value on the column (where possible: mssql has some sort of
constraint thing going on that I have no idea how it works).

Bug: T59176
Change-Id: I971edf013a1a39466aca3b6e34c915cb24fd3aa7
2018-05-15 12:08:35 -04:00
jenkins-bot
2224e31507 Merge "Drop archive.ar_text and ar_flags" 2018-04-23 20:15:26 +00:00
Thiemo Kreuz
e6b6920cff Fix PHPDoc type hints in CacheTime, ParserOptions, and related
I'm intentionally not touching any code in this patch, only
documentation.

Change-Id: I6975194c218760031789d5335dfbb330017dc6fc
2018-04-18 15:10:31 +00:00
Kunal Mehta
ad136143c5 Unbreak creating extension tables from the web installer
The web installer loads extensions during
Installer::includeExtensions(), but then
DatabaseUpdater::loadExtensions() reloads them again. Use a constant
(MW_EXTENSIONS_LOADED) to indicate that we shouldn't load them again.

Also fix a minor issue in loadExtensions() that would accidentally
register a bogus yet harmless hook called 'wgHooks'.

Change-Id: Id72fc0ceea15ccea52b1709bef51918ce64f8b40
2018-04-10 20:10:22 -07:00
Brad Jorsch
21c6ae1163 Drop archive.ar_text and ar_flags
This should have been done long ago. Now it is being done.

This also changes ar_text_id to NOT NULL, since it should never be null
anymore, and DEFAULT 0 in preparation for MCR stopping writing it.

Bug: T33223
Change-Id: I18f1c740b7537c7dc3cfeba9b241d0a9f31caa34
2018-04-03 12:54:27 -04:00
Brad Jorsch
f78faf4566 Populate ar_rev_id and make it non-nullable
Revisions deleted before MediaWiki 1.5 do not have a value in this
field. This is going to be a problem for migration to the MCR schema, so
provide a maintenance script to clean this up.

Then, for good measure, change the schema to make the field
non-nullable.

Bug: T182678
Change-Id: Ie2e11f12a30f379db32c3e074658012c6f93adb0
2018-04-02 13:08:55 -04:00
jenkins-bot
113431287a Merge "Fix undefined $ok in DatabaseUpdater::migrateComments" 2018-03-02 16:36:26 +00:00
Reedy
9a37fb8e48 Fix undefined $ok in DatabaseUpdater::migrateComments
Change-Id: I608a693e688039526975ef5d3fe4c40c7679ed7b
2018-03-02 16:24:50 +00:00
daniel
218e8311d5 Pass '' instead of false for the $conds parameter in select calls.
Per documentation on IDatabase, $conds must be a string or an array.
Passing false for conds is confusing, since it's unclear whether this
should match everything or nothing.

Bug: T188314
Change-Id: I8be1ac4cbdaafc41aadc2a658be8a99b754b0268
2018-03-02 02:32:54 +00: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
Umherirrender
3124a990a2 Use ::class to resolve class names in includes files
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
2018-01-27 20:34:29 +01:00
Brad Jorsch
295b055ea3 Migrate ar_text to modern storage
This really should have been done a very long time ago.

This adds a maintenance script to migrate rows with ar_text_id null to
modern storage, either the text table or ExternalStore.

Bug: T36925
Change-Id: I5608c6b6d3ecad516b785e13d668427c1b762e41
2018-01-09 16:15:44 -05:00
Thiemo Mättig
fa15c98787 Improve (weak and strict) type hints invarious places
Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab
2017-12-28 16:31:56 +01:00
Roan Kattouw
99f1d55818 DatabaseUpdater: Add modifyExtensionTable()
We already had modifyExtensionField(), but to do a table modification
you still had to do
$updater->addExtensionUpdate( [ 'modifyTable', ... ] );

Change-Id: I20368bf3c007a01718513a435de24907dc0aaf81
2017-11-13 18:31:23 -08:00
Timo Tijhof
522b2908f3 installer: Add comments to purgeCache()
Change-Id: I791f220b49e3e1c7d6df9ccab7d70ff8a0031ef1
2017-10-06 21:00:13 +00:00
MusikAnimal
d09554b6ef Add basic IP range support to Special:Contributions
This works by using the new table introduced with T156318.

The only thing that differs from normal Special:Contribs is we are
showing the IP address next to each entry. This is it how it is
displayed if you request to see newbie contributions:
https://en.wikipedia.org/wiki/Special:Contributions?contribs=newbie

For the time being, Special:DeletedContributions does not support
IP ranges. Various other irrelevant links such as Uploads and Logs
are also hidden.

Refer to P4725 for a way to automate creation of edits by random
IPs in your dev environment.

IP::isValidBlock() has been deprecated with this dependent change:
https://gerrit.wikimedia.org/r/#/c/373165/

Bug: T163562
Change-Id: Ice1bdae3d16cf365da14c6df0e8d91d2b914e064
2017-09-05 16:15:33 -04: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
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
Reedy
0dc1184f46 Fix type hints for parameter documentation
Fix double space

Change-Id: Ied34a05b2043a3354ff0629d8bb47a1176d8a74e
2017-08-05 13:50:39 +00:00
jenkins-bot
4427b84407 Merge "Add a maintenance script for populating pp_sortkey" 2017-07-25 23:00:58 +00:00
Thiemo Mättig
91a920fd85 Remove auto-generated "Constructor" documentation on constructors
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.

This is similar to I994d11e. Even more trivial, because this here is
about comments that don't say anything but "constructor".

Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
2017-07-21 12:19:30 +02:00
mdew192837
993ce4d411 Add a maintenance script for populating pp_sortkey
The addition of a pp_sortkey field in T60032 necessitates an update
to old entries in the page_props table that don't have a pp_sortkey.
The script uses the pp_value as the sort key if it's numeric.
The script extends LoggedUpdateMaintenance so it only runs once.
Added the script to MysqlUpdater so that it automatically runs.

Bug: T66949
Change-Id: Id482dc73ec1963010324e51fe9273a72dd31a7f7
2017-07-13 22:55:26 +00:00
Eddie Greiner-Petter
7518475bb1 Add DatabaseUpdater::modifyTable
This introduces the function modifyTable to the DatabaseUpdater class
which will allow to alter multiple columns on the same table in a single
sql patch file. In favor of this new function, usage of
MssqlUpdater::updateSchema for mssql patches is discouraged for the
future.

Also fix T70786, which is about update rows being inserted regardless
whether applying the patch was successful or not (no retry on failure).
Now update rows only get inserted if applying the patch was successful.

Bug: T70786
Change-Id: Id2a1583cd9efa5ef271ae67238119bc24b76a3c6
2017-05-07 02:15:14 +02:00
Aaron Schulz
d735dc562d Move Database and subclasses to Rdbms namespace
Change-Id: I52bef87512f9ddd155d1f4cc0052f6b7a0db5b42
2017-04-12 10:43:57 -07:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
addshore
1236f24ec3 Add array typehint to 2 DatabaseUpdater methods
Change-Id: I29abd4525b46e9b47cf3933e5fcb791fd6ea3fb5
2017-03-15 13:50:27 +00:00
addshore
cd40724c5e DatabaseUpdater add missing $maintenance property
Change-Id: I57b1fbbe2f85a74d56c49edef012a185d32ceb1a
2017-03-06 22:06:43 +01:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
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
2017-02-21 18:13:24 +00:00
Bartosz Dziewoński
b225a84ff9 DatabaseUpdater: Stop inserting junk into 'updatelog' every time the updater runs
Nothing ever looks at these rows, and if you have update.php in a Cron
job or a Git hook or something, they can accumulate in huge numbers.

Also remove a test which verified that the rows get inserted.

If you reached this place while trying to find out what the weird
"updatelist-1.28.0-14628929450" rows in your database are, rest
assured they are useless. If they're causing disk space problems,
you can delete them:

  DELETE FROM updatelog WHERE ul_key LIKE 'updatelist-%';

Change-Id: If94f243810e82ea3724cbd47b301bb96ba9a49d9
2016-11-30 20:13:30 +00:00
Gergő Tisza
afb8d6b488 Clarify phpdoc of DatabaseUpdater::addExtensionUpdate
Change-Id: Ibc9951e70b8388f5c23c3e05e31e20bd037beacb
2016-10-20 21:19:26 +00:00
Reedy
0f7668d61e Replace false for null in sourceFile() call
Bug: T147609
Change-Id: I79f556efbe9e75919c4d59beca621d7f8ac54bb8
2016-10-07 00:18:49 +00:00
Kunal Mehta
c86a06ae3b Add 'pmid' to the default interwiki list, and update 'rfc'
As an alternative to using magic links, PMID was added to the default
interwiki list.

RFC already existed, but the URL in the default list was pointing to
rfc-editor.org, not the tools.ietf.org view like the RFC magic link or
Wikimedia interwiki map are.

Updating the default lists in maintenance/interwiki* only affects new
installations, so a post-database update maintenance script adds and
updates the two interwiki prefixes.

Bug: T147536
Change-Id: I5a2c2c9b0f989da62a4395c9516d880c7d923444
2016-10-06 15:15:29 -07:00
Aaron Schulz
30f4b3c103 Replace DatabaseBase => Database in more places
Change-Id: If37a7909056bf2c31a8228cbc84f0fbbf5f1c517
2016-09-28 15:53:02 -07:00
Aaron Schulz
5bbac35ed1 Replace DatabaseBase:: with Database:: and update type hints
Change-Id: I3919b04eb2de4fa0bf8a02239fb5bbf17d347511
2016-09-27 04:20:03 +00:00
Aaron Schulz
9e8f157ed2 Minor installer/upgrader cleanups
Change-Id: I6352d16dce242c94203bdf7d020f1c0279fec6e5
2016-09-24 02:06:20 +00:00
Aaron Schulz
3a839c5927 Inject schema vars into DatabaseMysql
Also fix broken patchSql.php maintenance script

Change-Id: I45bccb0e2e10bd06651a551fa08ed0c66d11eb6a
2016-09-22 21:07:27 +00:00
Aaron Schulz
acdfb5806a Move updater/installer specific methods out of DatabaseBase
Change-Id: I995799fc15d2797ce7ab9ce2aca8beeef409447c
2016-09-15 02:52:58 -07:00
jenkins-bot
eaeeea4b29 Merge "Unbreak the DB updater by removing transaction from doUpdates()" 2016-07-22 22:03:11 +00:00
Brad Jorsch
47e2ef34b0 Only store currently-existing categories in the categories table
A "currently-existing category" is defined as a category that either
contains any pages or has a description page. Thus:
* Category::initialize() now schedules an update to insert a row if the
  title exits but the row is missing.
* Category::refreshCounts() now removes the row if the title doesn't
  exist and the category is empty.
* WikiPage::onArticleCreate() loads the Category object, to trigger
  bullet #1.
* WikiPage::updateCategoryCounts() refreshes the counts if it results in
  the row showing 0 pages, to trigger bullet #2.
* LinksDeletionUpdate refreshes the counts if the row shows 0 pages, to
  trigger bullet #2.

A maintenance script is provided to update the category table for this
new definition.

Bug: T28411
Bug: T50824
Change-Id: I0f0adf124c181ae5d3c7c95b3b5fb275a725794c
2016-07-18 12:52:19 -04:00
Aaron Schulz
d82ef89249 Unbreak the DB updater by removing transaction from doUpdates()
Each update should manage its own transactions, which is necessary
when batching is needed. Previously, maintenance updates would try
to nest begin() and an exception would halt update.php.

Bug: T89363
Change-Id: Iaadf847dcef46654e25f89680072dccd4cb5998e
2016-07-10 23:28:42 +00:00
Thiemo Mättig
da9cf2df1a Make use of …::class feature in ContentHandler/DatabaseUpdater
Change-Id: Ic0d51a41c50f52e1fbdab58e3b63319caa5c7d1d
2016-03-14 16:54:50 +01: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
Aaron Schulz
3a15ecebea Migrate callers to waitForReplication()
Change-Id: I7b2b13b9315891561d2d8cc04a12ecad2dc73d70
2016-01-28 03:00:08 +00:00
Kunal Mehta
2986d47c90 Add script to fix content model of JSON pages
MediaWiki:Foo.json and User:Foo/bar.json pages now have a default
content model of JSON, but existing pages using those names will be set
to defaults of wikitext.

The content models of those pages are now set to "json", unless it has
invalid syntax, in which case it will be set to "wikitext".

For convenience, the script is automatically run as part of update.php.

Bug: T108663
Change-Id: I1412937ccea8e65dba58580beec79cbf2286ae01
2015-11-24 10:08:44 -08:00
Reedy
05ee7808c8 Add wfWaitForSlaves() call in DatabaseUpdater::runUpdates()
Related to bug T68887, but not the complete fix

Bug: T68887
Change-Id: I7320ca04d91f81fdf43d17e33c66cfc58c21a30c
2015-09-23 13:00:39 +00:00
Kunal Mehta
648ef0d868 Read extension.json files in the web updater
The web updater reads LocalSettings.php in function scope to figure out
what extensions have been loaded. This doesn't work for extensions being
loaded through the ExtensionRegistry since they're only added to a
queue.

This adds the ability for the installer to read and get information from
the current extension load queue. LocalSettings.php is still read for
extensions that have not been converted yet.

Other uses of Installer::getExistingLocalSettings() were audited and
determined to be safe with regards to extension usage.

Extensions that register hooks using explicit globals
($GLOBALS['wgHooks']['FooBar']) are still broken.

Bug: T100414
Change-Id: Icc574a38a7947a1e3aff8622a4889e9dcfd7a4b2
2015-07-25 22:32:27 +00:00