Commit graph

9783 commits

Author SHA1 Message Date
Ammarpad
48a9e85b01 Prevent passing empty array to max()
This raises ValueError in PHP8 and warning in earlier versions.

Change-Id: I0c0c6065e4c5440ab7f089d364437e2adc056f63
2021-07-26 05:24:40 +00:00
vladshapik
c7e6c67dc5 Hard deprecate User group methods
1) The following methods were hard deprecated:
- User::addAutopromoteOnceGroups
- User::getEffectiveGroups
- User::getAutomaticGroups
- User::getFormerGroups

2) User ::getGroups, ::getGroupMemberships, ::addGroup,
::removeGroup were replaced in the production code,
but they were not hard deprecated because of conflict
with UserRightsProxy class.

Bug: T275148
Change-Id: Ia69598316f5dc5dd9511f6112b5b13e1aa07575a
2021-07-23 15:00:16 +03:00
James D. Forrester
719cf161f2 More master -> primary documentation and internal var renaming
Bug: T254646
Change-Id: I63cc8895033714bdfbf09aee933a8f0a43b387f3
2021-07-15 11:20:20 +01:00
DannyS712
2cb212d31a deleteOrphanedRevisions: remove unneeded pass by reference
Change-Id: I1ca93a8039a7b3cac8cb43dfd58ba1dacf532834
2021-07-15 09:26:48 +00:00
James D. Forrester
597376e12c Replace getMasterDB methods with getPrimaryDB
Bug: T254646
Change-Id: I68198bc39b174ea1920b4acc2617cb6c6ce406e9
2021-07-14 16:21:04 -07:00
Tim Starling
d3d8dc9965 Schema migration for revison_actor_temp table removal
Introduce a new schema migration stage in which rev_actor is used
directly and the revision_actor_temp table is no longer needed. This
becomes the new "new" stage whereas the previous situation is now
termed SCHEMA_COMPAT_TEMP.

Introduce migrateRevisionActorTemp which copies data from
revision_actor_temp to rev_actor. The code is similar to
migrateImageCommentTemp.php except that it doesn't delete from the old
table.

Partial revert of c29909e59f. That change removed direct
references to $wgActorTableSchemaMigrationStage and made queries
involving revision_actor_temp be unconditional. Such changes need to be
reverted to make the use of revision_actor_temp be conditional again.

In ActorMigrationTest, I compacted provideGetJoin() and
provideGetWhere(), removing most of the duplication between expected
values. I gave all the stages a short name, and mostly used the name in
providers.

Bug: T275246
Change-Id: I7498107dd6433ab7de5bf2e7b3fe2aa5e10e345d
2021-07-14 08:29:04 +10:00
Reedy
cd45c0fc30 Add maintenance script to invalidate a users bot passwords
Bug: T269543
Change-Id: I5848466edf45d4a2d04b52d1643c35fb68b0da08
2021-07-13 15:39:11 +01:00
Reedy
bfb60b5f6d maintenance: Move username/userid validation into Maintenance class
Change-Id: Ie8f650eb03186feb7f69e7c71ef121c0d26404f5
2021-07-13 15:39:04 +01:00
DannyS712
b0ab985420 Fix some @stable for ... annotations to use @stable to ...
Bug: T257789
Change-Id: I3ba94a9d6b739cd57cd57afe5d397963127160a8
2021-07-08 02:54:59 +00:00
Amir Sarabadani
cf8ec9bcae Avoid using deprecated wfGetDB() in two maintenance scripts
Use the internal $this->getDB() instead.

Change-Id: Ie67a9ba819061c67d1e4cf0da64e164bbc938375
2021-07-07 16:42:15 +02:00
Petr Pchelko
e73769335d Don't access MWServices prematurely in Maintenence.php
In case of the referenced addWiki bug, the following was happening:
1. MWServices were initialized before Setup.php is complete
and before extensions were loaded. Deprecation warning was emitted.
2. onMWServices hook was run, thus hook container was created, but
without any extensions loaded.
3. When global MWServices instance was allowed, and services were
reset, hook container was salvaged. When that happens, already
instantiated handlers are preserved, so onMediaWikiServices handlers
(none at this point) were preserved.
4. GlobalPreferences refefine PreferencesFactory, but it was not
actually redefined, since onMediaWikiServices handler array was
salvaged in 3
5. The rest of the hooks work ok, since they are dynamically initialized
after extensions were loaded.
6. One of the hook handlers, implemented in GlobalPreferences,
expected PreferencesFactory to be redefined, but it was not.
7. Boom!

Bug: T285894
Bug: T275453
Change-Id: I8b16529e93dc12484e3501fab4fd34fca70114ea
2021-06-30 13:51:23 -07:00
jenkins-bot
29d38f949d Merge "Improvements to fixMergeHistoryCorruption.php" 2021-06-30 04:13:47 +00:00
Amir Sarabadani
128e55a5db Add --sleep option to refreshImageMetadata.php
For running long-term maintenance scripts, having waitForReplication()
is not enough as that method doesn't count for cross DC-replication and
replication the cloud making issues if kept running more than a couple
of hours. This mitigate the aforementioned problem.

Change-Id: Ifa0b31dde4a57a4d3f2b00c29410be568cfa6b91
2021-06-29 21:10:41 +02:00
jenkins-bot
650381c5cd Merge "Fix a bunch of random typos" 2021-06-29 13:46:58 +00:00
jenkins-bot
1ffb4ae93a Merge "Manual and automatic image metadata reserialization" 2021-06-29 13:12:35 +00:00
DannyS712
4f9970f30b Fix a bunch of random typos
* yeild -> yield
* paramter -> parameter
* seperator -> separator
* neccesary -> necessary
* inital -> initial
* intial -> initial
* repsonse -> response
* retreived -> retrieved

Bug: T201491
Change-Id: I461941b027590997448f3bdd8a137a48bb338beb
2021-06-29 11:32:04 +00: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
Tim Starling
4b9b522a38 Improvements to fixMergeHistoryCorruption.php
* Make the --ns option optional. I don't know why it was required. The
  bug affects any page that had its history merged.
* Reorganise the code so that dry run mode just skips the write queries,
  making it more obvious what delete mode will do.
* Skip invalid titles.

Bug: T263340
Change-Id: I0dc0d72b254f43ba5ca5b8af45747f9c349c7a15
2021-06-29 11:33:35 +10:00
jenkins-bot
beb4a4acaa Merge "TableCleanup: stop writing to $wgUser" 2021-06-28 16:11:52 +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
b45ddb2ab3 Use WikiPage::doUserEditContent() instead of ::doEditContent()
Results in passing a user where previously the fallback
to $wgUser was being used, mostly in tests.

Bug: T255507
Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
2021-06-28 00:11:30 -07:00
Tim Starling
9251f3c9e3 Manual and automatic image metadata reserialization
* Add automatic splitting of large metadata on upload or refresh. If
  the reserializeMetadata option is enabled, metadata stored with PHP
  serialization will be automatically reserialized to JSON.
* Inject configuration variable $wgUpdateCompatibleMetadata via
  LocalRepo instead of accessing it directly.
* In refreshImageMetadata.php and rebuildImages.php, construct a new
  LocalRepo with config overrides, instead of overwriting config
  globals. Add a helper to RepoGroup to help with this.
* In refreshImageMetadata.php, add new options --convert-to-json and
  --split which reserialize metadata and optionally split out large
  items to blob storage.

Also, refreshImageMetadata.php was totally broken in the non-force mode
since metadata refresh on page view was disabled in b814245d9f. The
maintenance script was relying on newFileFromRow() magically upgrading
the row, which doesn't happen anymore. So, call maybeUpgradeRow()
directly.

Bug: T275268
Change-Id: I7bf7d9cef71641e287ca4346b568b381f4ada50e
2021-06-26 22:50:17 +00:00
jenkins-bot
de58d92df3 Merge "Factor out LoggedUpdateMaintenance::setForce()" 2021-06-24 22:22:57 +00:00
Timo Tijhof
0545fdc3af purgeParserCache.php: Implement --tag for purging one server only
Large wiki farms may have to purge servers concurrently (instead of
one at a time) in order to keep up with new writes and delete expired
rows faster than new rows are written.

The parameter for this uses server tags for three reasons:

* Maintenance risk and complexity.
  This requires the least information about MW configuration to be
  hardcoded in the scheduled maintenance cronjob (compared to: server
  indexes which are a runtime concept, or specific hostnames/IP/
  tableprefixes which may change and should not require
  coordinating changes elsewhere).

* Operational convenience.
  By using server tags, the parameters don't have to vary between
  data centers.

* Code complexity.
  The current code for obtaining connections is based on server indexes,
  which are easy to mapped at runtime from server tags. Other ways
  of identifying shard like hostnames are either an awkward fit (as
  they don't uniquely identify a shard per-se, with multiple instances
  on the same hardware at WMF), or require SqlBagOStuff to store and
  maintain more information about connections than it currently has
  readily available.

Bug: T282761
Change-Id: I618bc1e8ca3008a4dd54778ac24aa5948f27c52e
2021-06-24 18:01:27 +01:00
Tim Starling
855593d203 Factor out LoggedUpdateMaintenance::setForce()
It's logically part of LoggedUpdateMaintenance. There are two copies
already, and I was considering adding a third.

Change-Id: Ib3686cb3d408a017cd17cde624df71edb379f07e
2021-06-24 16:21:53 +10:00
jenkins-bot
0929a95578 Merge "purgeParserCache.php: Print stats for time and iterations" 2021-06-24 01:17:15 +00:00
DannyS712
47d70dbfba Post Revision-removal cleanup
Updates for the removal of the Revision class itself
and the various methods/hooks/variables removed in the
process, including:

- Update some documentation removing most references
to the Revision class and updating the MCR migration
notes to reflect the past tense for Revision methods.

- Change some capitalization from "Revision" to "revision"
to make it clear comments are about revisions in general,
not the Revision class in particular.

- Minor code tweaks including removing unused variables that
were around for the old hooks that were removed, and
removing the use of DeprecatablePropertyArray where no
longer needed for anything.

- Fix incorrect documentation for PageUpdater::getStatus(),
the status value changed a while ago to have revision-record
in addition to revision, and recently to only have the
revision-record, but ironically PageUpdater was never updated.

- Removed Parser::$mRevisionObject, used to be a Revision object
and was deprecated in 1.35, missed earlier because it was no
longer being set to Revision objects, always null.

- Add RevisionRecord typehints in DummyLinker to match those
in the corresponding Linker methods

This should be a no-op in terms of functionality.

Bug: T247143
Change-Id: I03bbb94fc29085855448780b1a5ad9063911ecc4
2021-06-24 00:32:39 +00:00
Timo Tijhof
d192e0a8a9 purgeParserCache.php: Print stats for time and iterations
This emperical data will help confirm and gain confidence in our
understanding of how much time is spent in the delete operations under
various conditions, and by extent whether it'll be worth converting
the sleep duration logic to an interval that includes the time spent
in the delete operation itself.

Bug: T282761
Change-Id: I0406d9c0807bb9722623f3ec61f1e559dbe14aa9
2021-06-23 16:41:39 +01:00
Fomafix
ea1b06c150 Fix various typos in documentation
Bug: T201491
Change-Id: Ifa1b84b28ea97dfb4212658b02f24ee6881c1cb0
2021-06-21 00:26:07 +00:00
Tim Starling
9c3c0b704b Use array_fill_keys() instead of array_flip() if that reflects the developer's intention
array_fill_keys() was introduced in PHP 5.2.0 and works like
array_flip() except that it does only one thing (copying keys) instead
of two things (copying keys and values). That makes it faster and more
obvious.

When array_flip() calls were paired, I left them as is, because that
pattern is too cute. I couldn't kill something so cute.

Sometimes it was hard to figure out whether the values in array_flip()
result were used. That's the point of this change. If you use
array_fill_keys(), the intention is obvious.

Change-Id: If8d340a8bc816a15afec37e64f00106ae45e10ed
2021-06-15 00:11:10 +00:00
jenkins-bot
f448d93a0f Merge "Use the unserialized form of image metadata internally" 2021-06-09 02:33:55 +00:00
jenkins-bot
170f5c21a6 Merge "Rename change_tag indexes to have ct_ prefix" 2021-06-08 17:50:09 +00:00
Ammar Abdulhamid
1adaca51c3 Rename change_tag indexes to have ct_ prefix
Bug: T270033
Change-Id: I8a429726c99f6cadea0d671fd871f66b5611c856
2021-06-08 17:57:15 +01:00
jenkins-bot
0d1c1c7959 Merge "userOptions.php: allow specifying a user ID range to run on" 2021-06-08 12:30:03 +00:00
jenkins-bot
3b7471b659 Merge "userOptions.php: Properly filter and iterate query" 2021-06-08 12:23:27 +00:00
Tim Starling
b4849e03b7 Use the unserialized form of image metadata internally
Image metadata is usually a serialized string representing an array.
Passing the string around internally and having everything unserialize
it is an awkward convention.

Also, many image handlers were reading the file twice: once for
getMetadata() and again for getImageSize(). Often getMetadata()
would actually read the width and height and then throw it away.

So, in filerepo:

* Add File::getMetadataItem(), which promises to allow partial
  loading of metadata per my proposal on T275268 in a future commit.
* Add File::getMetadataArray(), which returns the unserialized array.
  Some file handlers were returning non-serializable strings from
  getMetadata(), so I gave them a legacy array form ['_error' => ...]
* Changed MWFileProps to return the array form of metadata.
* Deprecate the weird File::getImageSize(). It was apparently not
  called by anything, but was overridden by UnregisteredLocalFile.
* Wrap serialize/unserialize with File::getMetadataForDb() and
  File::loadMetadataFromDb() in preparation for T275268.

In MediaHandler:

* Merged MediaHandler::getImageSize() and MediaHandler::getMetadata()
  into getSizeAndMetadata(). Deprecated the old methods.
* Instead of isMetadataValid() we now have isFileMetadataValid(), which
  only gets a File object, so it can decide what data it needs to load.
* Simplified getPageDimensions() by having it return false for non-paged
  media. It was not called in that case, but was implemented anyway.

In specific handlers:

* Rename DjVuHandler::getUnserializedMetadata() and
  extractTreesFromMetadata() for clarity. "Metadata" in these function
  names meant an XML string.
* Updated DjVuImage::getImageSize() to provide image sizes in the new
  style.
* In ExifBitmapHandler, getRotationForExif() now takes just the
  Orientation tag, rather than a serialized string. Also renamed for
  clarity.
* In GIFMetadataExtractor, return the width, height and bits per channel
  instead of throwing them away. There was some conflation in
  decodeBPP() which I picked apart. Refer to GIF89a section 18.
* In JpegMetadataExtractor, process the SOF0/SOF2 segment to extract
  bits per channel, width, height and components (channel count). This
  is essentially a port of PHP's getimagesize(), so should be bugwards
  compatible.
* In PNGMetadataExtractor, return the width and height, which were
  previously assigned to unused local variables. I verified the
  implementation by referring to the specification.
* In SvgHandler, retain the version validation from unpackMetadata(),
  but rename the function since it now takes an array as input.

In tests:

* In ExifBitmapTest, refactored some tests by using a provider.
* In GIFHandlerTest and PNGHandlerTest, I removed the tests in which
  getMetadata() returns null, since it doesn't make sense when ported to
  getMetadataArray(). I added tests for empty arrays instead.
* In tests, I retained serialization of input data since I figure it's
  useful to confirm that existing database rows will continue to be read
  correctly. I removed serialization of expected values, replacing them
  with plain data.
* In tests, I replaced access to private class constants like
  BROKEN_FILE with string literals, since stability is essential. If
  the class constant changes, the test should fail.

Elsewhere:

* In maintenance/refreshImageMetadata.php, I removed the check for
  shrinking image metadata, since it's not easy to implement and is
  not future compatible. Image metadata is expected to shrink in
  future.

Bug: T275268
Change-Id: I039785d5b6439d71dcc21dcb972177dba5c3a67d
2021-06-08 17:04:01 +10:00
Ammarpad
a8c01d7726 Rename name_title index to have page_ prefix
Bug: T270033
Change-Id: Id70d0e0a37dd0d000079820d51cef2791f5ec42e
2021-06-05 20:21:07 +02:00
jenkins-bot
fdf4c44da2 Merge "Add index on oldimage.oi_timestamp" 2021-06-02 23:41:04 +00:00
Gergő Tisza
6ce6cfa188 userOptions.php: allow specifying a user ID range to run on
This can be useful for running in discrete batches, or running on
user cohorts by registration date.

Bug: T283867
Change-Id: I9ff593f4d9a98a2069df977b75e505ac9e4abb5d
2021-06-02 22:51:35 +02:00
Gergő Tisza
a2dd114952 userOptions.php: Properly filter and iterate query
See P16253 for an EXPLAIN.

Bug: T283867
Change-Id: I7f11b049601f40623b7950b1bf95b2d01907db78
2021-06-02 22:50:48 +02:00
DannyS712
e156a2f078 TableCleanup: stop writing to $wgUser
This class is not stable to extend, nor does codesearch reveal
any classes extending it outside of core, so we can just evaluate
if $wgUser needs to be set for this class and subclasses in core.

TableCleanup is not set up to be run directly, it requires that it
be subclassed and the subclass run as a maintenance script. Within
TableCleanup itself, nothing depends on $wgUser. Looking at the
subclasses in core:
* CleanupCaps overrides the execute method, so the code to set
$wgUser in TableCleanup::execute() is not being run
* CleanupImages, TitleCleanup, and ClenupWatchlist do not
appear to have any code that relies on anything related to the
current user or context

Since nothing is using the user in any form, simply remove the
write to $wgUser, no need to replace it with setting the context
user

Bug: T243708
Change-Id: I1a22f2ebab028822e663ab1fdcbd6c7b02331fef
2021-06-02 07:04:23 +00:00
Vlad.shapik
9763c48d17 Reapply "Hard Deprecate User ::getCanonicalName, ::isUsableName, ::isCreatableName""
This reverts commit ecf826a2ee.

Reason for revert: need to edit the patch and then it will be GTG in order to finish hard deprecating of User ::getCanonicalName, ::isUsableName, ::isCreatableName

Change-Id: I2f57f56728fcbeada96dc2228f07dc8bcaa5d4f6
2021-05-31 16:01:36 +03:00
Amir Sarabadani
7fdca7ce51 Add index on oldimage.oi_timestamp
Mirroring what happens on image table.

Bug: T279982
Change-Id: Ib67c32b10d3b88e09514d8fbb5dcb4f977108ba2
2021-05-29 20:44:32 +02:00
Amir Sarabadani
acd5076099 Migrate searchindex to abstract schema
For MySQL/Sqlite:
 - Nothing

For Postgres:
 - Introduce the table. It's not used but it'll be used in the future (T220450)

Bug: T164898
Bug: T230428
Bug: T220450
Change-Id: I9f33132676344f8cd813f7a438b3a6a078fd281c
2021-05-27 15:01:24 +02:00
jenkins-bot
be5631743e Merge "WikiImporter: inject services" 2021-05-26 16:45:59 +00:00
DannyS712
f057d2253c Replace deprecated uses of PermissionManager with GroupPermissionsLookup
In a few places where a PermissionManager is used
but only GroupPermissionsLookup is needed

Also update references to the class in PermissionManager
that referred to it as GroupPermissionLookup

Change-Id: I5d7a13900852a38768a106aeee1ce012c3a04ea2
2021-05-26 05:47:21 +00:00
Petr Pchelko
e5083b79ee Drop hard-deprecated and unused DatabaseBlock::chooseBlock
Change-Id: Ifc04faefc590404e30b509850b67073e1b1d64c0
2021-05-25 16:52:05 -07: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
jenkins-bot
6ee806063f Merge "Remove some unneeded uses of full User objects" 2021-05-24 15:37:39 +00:00
Ammarpad
c397868e3d Remove custom table options from 'revision' table
This is not useful anymore.

Follow-up: Ia07dd52e43123473a1728523a3f863280537db8e
Change-Id: Ib903c69e3e331e96783c78b2ec0ab32e05f7f0d5
2021-05-23 21:57:04 +01:00
DannyS712
19739de872 Remove some unneeded uses of full User objects
Change-Id: Ib86399445a77d3005f23ae87d87f3cf742b13b1f
2021-05-22 03:58:25 +00:00
Ammarpad
5954b380fc Migrate revision table to abstract schema
Postgres:
 - Drop foreign key from rev_page
 - Make rev_page not nullable
 - Change rev_comment_id from int to bigint
 - Change rev_actor from int to bigint
 - Sync rev_page_id index with MySQL

MySQL/SQlite:
 - Drop default from rev_timestamp

Additional changes in the generator script to handle more
formatting issues due to use of additional custom table options

Bug: T230428
Bug: T164898
Change-Id: Ia07dd52e43123473a1728523a3f863280537db8e
2021-05-20 14:52:15 -07:00
Aaron Schulz
12923c1cd5 objectcache: add last-modified token field to objectcache table
Also added token and flags fields. The token field can
be used as a tie-breaker for modtime and also for faster
cas() operations. The flags field makes serialization and
compression format changes easier in the future.

Bug: T274174
Change-Id: I45731a877b21835652993c2d285165a76eeae3e9
2021-05-18 20:06:37 -07:00
Reedy
275d1a44c5 fixMergeHistoryCorruption.php: Code cleanup
* Remove duplicated code
* Fix some indenting

Change-Id: I116fd9bc3bdde9c895bac161d7805a21a344ca7f
Follows-Up: I51abc295e37030ab181d4380f62c30d7998f1b9e
2021-05-18 02:28:14 +01:00
Ammar Abdulhamid
12870e98c9 Add maintenance script to delete corrupted pages
These are rows in page_table that have 'page_latest' entry with
corresponding 'rev_id' but no associated 'rev_page' entry in revision
table. Such rows create ghost pages because their 'page_latest' rev is
actually missing or moved to a different page now (which possess the -
associated 'rev_page' on revision table now).

https://en.wikipedia.org/wiki/Module:Jct/city/Chinissai
(page_id=41871839) is an example of such pages. Its page_latest rev is
819371998. But this revision has been moved to another page now
(page_id= 56252475), rendering the former inaccessible.

fb58d39 will prevent this going forward (for scribunto content), but we
need to clear the extant pages for module namespace and others caused
by something else.

Bug: T263340
Change-Id: I51abc295e37030ab181d4380f62c30d7998f1b9e
2021-05-17 16:41:53 +10:00
jenkins-bot
74d0048587 Merge "Fix extra space in field definition of page.page_restrictions" 2021-05-15 02:55:59 +00:00
James D. Forrester
f2f9345e39 Replace uses of DB_MASTER with DB_PRIMARY in documentation and local variables
This is just a start.

Bug: T254646
Change-Id: I9213aad4660e27afe7ff9e5d2e730cbf03911068
2021-05-14 12:40:34 -07:00
Amir Sarabadani
6e89835f75 Fix extra space in field definition of page.page_restrictions
It's causing issues in the drift reports. Can be fixed there instead but
we shouldn't have this extra space anyway.

Change-Id: I29a8e093ae0a6d8948a61c197b017a54c6f577ea
2021-05-14 14:21:23 +02:00
jenkins-bot
bda980bad4 Merge "purgeParserCache.php: Remove carriage return printer, minor cleanup" 2021-05-14 00:27:40 +00:00
Timo Tijhof
e556a7ea99 purgeParserCache.php: Remove carriage return printer, minor cleanup
* There was a carriage return, as part of a self-overwriting progress
  bar. While nice for humans running the script by hand, this made
  the script difficult to understand in WMF production where the logs
  go to syslog/journalctl, which doesn't like \r and thus showed only
  `[2KB blob]` instead of the actual output. This can bypassed with
  `journalctl -u … --all`, but that still leaves one with a sea of
  misaligned progress bars, concatenated as one long "line".

  It seems most of our maintenance scripts nowadays just keep printing
  lines to notify of progress made, so change the script to that,
  by just printing a boring "... % done\n" line (at most) every 0.1%.

* Change hardcoded batch size of 100 to use $wgUpdateRowsPerQuery.
  This is generally a no-op as this configuration defaults to 100 in
  DefaultSettings.php, and is not overridden in WMF production.

* Add a "--dry-run" option to allow for last-minute verification of
  the age and date calculation which is rather non-trivial given that
  we don't index creation time and assume $wgParserCacheExpireTime
  is constant and unchanged, which in practice, when this script is
  considered for running, tends not to be the case, making it hard to
  be sure exactly what it will do.

Minor stuff:

* Make the ORDER BY clause explicitly use ascending order.

* Try to retroactively document why we use a --msleep parameter
  instead of waiting for replication.

* Revert some of the variable name changes of I723e6377c26750ff9
  which imho made the code harder to understand.

* Flip order of $overallRatio additions to match the order of
  $tablesDoneRatio (e.g. high level + current thing).

* Remove use of Language->timeanddate() in favour of native
  date formatting, mainly to include seconds and timezone,
  but also because its simpler not to bring in all of Language
  and LocalisationCache into the script.

* Pass unix time directly to SqlBagOStuff::deleteObjectsExpiringBefore,
  as other callers do, instead of TS_MW-formatting first. There is
  also additional casting to TS_UNIX within the method.

Before:

> Deleting objects expiring before 21:43, 7 May 2021
> [**************************************************] 100.00%
> Done

After:

> Deleting objects expiring before Fri, 07 May 2021 21:43:52 GMT
> ... 50.0% done
> ... 100.0% done
> Done

Bug: T280605
Bug: T282761
Change-Id: I563886be0b3aeb187c274c0de4549374e0ff18f0
2021-05-13 02:42:29 +00:00
Amir Sarabadani
80c309788b Make page_is_redirect and page_is_new unsigned
Mistake during the abstraction (Ibdaf332ea1d)

It doesn't need schema change since 1.36 is not released yet.

Bug: T230428
Change-Id: I071c39dfadf185b01e9109085907d6e3deb1f02f
2021-05-12 10:52:32 +02:00
jenkins-bot
b9b94021cb Merge "manageForeignResources: Use Maintenance::fatalError, not exceptions" 2021-05-10 22:12:32 +00:00
Ammarpad
be4e48e93f manageForeignResources: Use Maintenance::fatalError, not exceptions
Change-Id: Ic6a4e42793d5f2d3e874e155ccbad1467e25698f
2021-05-10 21:48:29 +00:00
jenkins-bot
234103c2e7 Merge "Rename page_timestamp revision index" 2021-05-08 08:27:51 +00:00
jenkins-bot
b6744c24fb Merge "ForkController: Throw more meaningful error for missing PHP extensions" 2021-05-07 16:54:46 +00:00
jenkins-bot
f13d26f2ec Merge "Use a constant for 'Maintenance script' username" 2021-05-07 01:36:16 +00:00
jenkins-bot
579767f513 Merge "Use rc_new_name_timestamp index name unconditionally" 2021-05-05 22:10:00 +00:00
Ammarpad
f7f5e72ba9 Use rc_new_name_timestamp index name unconditionally
Bug: T276292
Change-Id: I93f8ce51dd1c2406d88015fcf6be9b044f424880
2021-05-05 22:40:51 +01:00
Aaron Schulz
99d5d2e8cc rdbms: cleanup getServer() and connection parameter fields in Database
Make getServer() always return a string, as documented, even with new
Database::NEW_UNCONNECTED handles that have yet to call open(). If the
'host' parameter to __construct() is ''/null, getServer() now returns
'localhost' instead of null. This avoids problems like fatal errors in
calls to TransactionProfiler::recordConnection().

Use Database constants for "connectionParams" field keys for better
static analysis.

Also:
* Add Database::getServerName() method that returns "readable" server
  names in the style of LoadBalancer::getServerName(). Note that the
  "hostName" field is already passed in from LoadBalancer.
* Migrate most getServer() callers to getServerName() for easier
  debugging and more readable logging.
* Also, normalize Database/LoadBalancer SPI logging context to use
  "db_server" and reduce logging code duplication in LoadBalancer.

Bug: T277056
Change-Id: I00ed4049ebb45edab1ea07561c47e226a423ea3b
2021-05-05 19:44:02 +00:00
Ppchelko
ecf826a2ee Revert "Hard Deprecate User ::getCanonicalName, ::isUsableName, ::isCreatableName"
This reverts commit b491279268.

Reason for revert: caused CentralAuth tests to fail.

Change-Id: Icb3ed094578df427622e0da2a7462645adcc3d6f
2021-05-05 02:14:47 +00:00
vladshapik
b491279268 Hard Deprecate User ::getCanonicalName, ::isUsableName, ::isCreatableName
Bug: T275030
Change-Id: I60689ee6519c2dbd6d000afa8ac05c3e6b7895d2
2021-05-04 21:20:50 +03:00
Gergő Tisza
926cfa3b3d Use a constant for 'Maintenance script' username
The user 'Maintenance script' is often used to perform various
automated tasks. Providing it everywhere as a string literal is
error-prone, and errors can be somewhat disruptive (e.g. with
User::newSystemUser with steal=true it can erase the credentials
of a legitimate account). Provide a constant instead.
Also replace existing uses for consistency.

Change-Id: I685a5bfe56bbf1a47f35072f7f7c8be320ee27db
2021-05-03 23:34:26 +02:00
Reedy
417de8f5c4 Delete maintenance/cleanupAncientTables.php
Bug: T281635
Change-Id: Ia746f301467e62e4544e451ccc7f46f4e2c6380c
2021-05-03 01:07:39 +01:00
Kunal Mehta
ec0be22116 Update Legoktm's email address
Change-Id: Icd58c93bb0cff5b0a4e7b7f02873a271bab8964f
2021-05-02 05:39:37 +00:00
Ammarpad
d9400049cf Rename page_timestamp revision index
Rename to `rev_page_timestamp`

Bug: T270033
Depends-On: I16fc273b14e7f4b00e8c31ec1ed7712149aafe37
Change-Id: I93fcfb3caf8c6bd7f9e46921065b751c23571ae1
2021-04-30 06:58:25 +01: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
jenkins-bot
aadbffb9ae Merge "rdbms: Move setLBFactoryTriggers from doMaintenance to service wiring" 2021-04-28 00:23:38 +00:00
Timo Tijhof
e9051b2b99 rdbms: Move setLBFactoryTriggers from doMaintenance to service wiring
This logic is not needed to run on every PHP process and was making
it difficult to run offline maintenance scripts without additional
complexity based on Maintenance::getDbType and DB_NONE.

Instead of skipping this only for DB_NONE, and establishing a pattern
that may spread to other ad-hoc places throughout the codebase, instead
remove this entirely from the eager set up code for all PHP processes
and move it to the service wiring and dependency injection.

That way, it naturally doesn't happen until and unless the DB service
is actually called upon. Scripts and entry point that need to disable
the DB service, can continue to use
MediaWikiServices::disableStorageBackend.

== Impact on SiteStatsUpdate ==

With wgCommandLineMode no longer being read at run-time from a global,
but in service wiring, this means SiteStatsUpdateTest can't change
the behaviour between CLI-like and Web-like, unless it e.g. resets
the 'DBLoadBalancerFactory' service first. Unfortunately, while most
any reset is supported, a reset of the 'DBLoadBalancerFactory' would
be unsupported as that would lose the temporary db clone context and
such, bringing us to either the developer's live db, or a broken set
up altogether. If there is a strong need for toggling oppertunistic
updates off and on at run-time, this could be supported in the
DeferredUpdates class perhaps, but we already have numerous methods
there (incl db begin/commit being a good proxy already), which this
test already used, so for now I've just removed the extra assertion
for this as it wasn't essential to that test.

Bug: T228895
Bug: T238436
Change-Id: Icf29bc484c155f52b6d8f61e5902233a15ba0c6d
2021-04-27 23:35:20 +01:00
jenkins-bot
1d7e23e460 Merge "Add script for resolving class names to files" 2021-04-27 14:45:17 +00:00
vladshapik
9cc797695b Hard deprecate User ::isIP, ::getOptions
Bug: T275602
Change-Id: Id4be13751ca0a900e51214c1855a4624077a5a62
2021-04-26 16:10:24 +00:00
jenkins-bot
9ba56ccb3b Merge "resourceloader: Move most of mw.log from startup to mediawiki.base" 2021-04-26 11:28:57 +00:00
jenkins-bot
3785078ddb Merge "Migrate user table to abstract schema" 2021-04-25 10:15:28 +00:00
Ammarpad
88bfadf5ed Migrate user table to abstract schema
Postgres:
 - Rename the table from `mwuser` to `user`
 - Transition user_id from int to serial
 - Make user_token not nullable and add default
 - Make user_real_name not nullable and add default
 - Make user_email not nullable
 - Make user_newpassword not nullable
 - Make user_password not nullable
 - Drop UNIQUE contraint on user_name and add default

MySQL/SQLite:
 * No changes

Bug: T164898
Bug: T230428
Change-Id: I746714f7b3ae16f9625f97bcca84280fcd8b61a0
2021-04-24 21:44:26 +01:00
jenkins-bot
3f131cb38e Merge "Delete cached data of non-cached querypages with updateSpecialPages.php" 2021-04-22 01:23:44 +00:00
Tim Starling
419dde00f5 Stop using legacy ActorMigration field "ar_user"
Bug: T278917
Change-Id: Ib6bdb727d58a1732448a2034732269f2f125be7e
2021-04-20 12:44:29 +10:00
Tim Starling
768cb1874e Stop using legacy ActorMigration fields in reassignEdits.php
Bug: T278917
Change-Id: Iee627d1e4787d9b5a264e7b80cf1e372de3e8a9b
2021-04-20 12:44:29 +10:00
Timo Tijhof
a05fb27e90 resourceloader: Move most of mw.log from startup to mediawiki.base
As of 99d4ad5995, mw.log.deprecate is no longer used within the
startup module, and I don't expect use of it to return. The only
reason we needed it in startup was because mw.config, which was a hybrid
that is both deprecated (when accessed via window) and not deprecated
(when accessed via mw.config).

For anything else, there is no reason to ever ship deprecated code
in the startup module that isn't internally used by mw.loader.

Even if an mw.loader method were to be deprecated at some point, we'd
remove it from startup and ship it in mediawiki.base instead and
deprecate it there (like '$j' and 'importScript', for example).

For future reference, this move was made possible by preparations in
Ied4d08c554936 and I68f2021fd39b.

Change-Id: I2ef8d4e6c3c32a811d418d48bf2b0da9f3d621b1
2021-04-20 03:15:04 +01:00
Ammarpad
8270e5ef99 ForkController: Throw more meaningful error for missing PHP extensions
Currently all the signal constants emit warnings as they are undefined
in PHP 7.4 and throw fatal error in PHP 8, if pcntl is not available.

pcntl extension is not enabled by default, and is not required by
MediaWiki, so this class should throw a better error if it's not
found. The class already has comment that pcntl and posix are required
but this is meaningless since the error and a warning for each constant
would be emitted anyway.

https://www.php.net/manual/en/pcntl.installation.php

Convert RESTARTABLE_SIGNALS constant back to static property as it was,
because we can only use these constants after confirming they exist,
which happens in the constructor.

Bug: T280456
Change-Id: I66deaa9b346b936b2628ac0511492d20a42fea6c
2021-04-17 22:21:15 +01:00
Taavi Väänänen
23efcf9dbf
Add change tag for media uploaded using importImages.php
Change-Id: I74a7d6f9e5e7bada4803f7e807c7c74d237e9d47
2021-04-17 22:45:52 +03:00
daniel
6627e42284 Add script for resolving class names to files
Use case: for a list of classes used in a specific context such as
MediaWikiServices, list all files containing these classes, so they can
be processed with command line tools such as grep.

Change-Id: I88dbee72dc5a560624f8cc1da0d905460309f624
2021-04-16 11:04:39 +00:00
jenkins-bot
9c74a067c3 Merge "Factor out rollback logic from WikiPage" 2021-04-14 20:22:27 +00:00
Petr Pchelko
46db19ecdf Factor out rollback logic from WikiPage
Change-Id: I95da91875fcf2f53143c315560e35ccd5ffbf4b3
2021-04-14 11:49:07 -07:00
jenkins-bot
150601f875 Merge "Update updateSearchIndex.php to 2006+ standards" 2021-04-13 23:48:46 +00:00
jenkins-bot
0d547d95ee Merge "Remove checkLess.php" 2021-04-13 21:40:16 +00:00
jenkins-bot
b61fbb0ab5 Merge "rebuildLocalisationCache: Add --skip-message-purge and accompanying script" 2021-04-13 21:28:12 +00:00
jenkins-bot
19a4d0e785 Merge "maintenance: Support newlines in addOption() descriptions" 2021-04-13 21:26:40 +00:00
gengh
d59983739e Remove checkLess.php
Bug: T279026
Change-Id: I7b7425bd18df05edc8b2716e44fc03152613efbd
2021-04-13 21:13:04 +00:00
Tim Starling
221162b803 Update updateSearchIndex.php to 2006+ standards
* Remove LOCK TABLES. It was probably never necessary, but in any case
  we have transactions now.
* Delete updateDoubleWidthSearch.php, it was for upgrading from 1.17 or
  earlier, which is no longer supported. Revert the move of various
  updateSearchIndex.php functions to Maintenance. Nothing has ever used
  these except updateSearchIndex.php and updateDoubleWidthSearch.php.
* Convert the query to use the new Database:select() method.
* Remove migration from searchUpdate.pos to searchUpdate.wiki.pos, which
  was put there to support upgrades to 1.16.

Bug: T252853
Change-Id: I19bb44a9a46c2ebdb16a777bb462375278b05b7b
2021-04-09 07:35:07 +10:00
Umherirrender
cfcb3e4785 Use ::class for class name
This works also for non-existing classes,
because it is resolved on compile time

Change-Id: Id3132341856fb1eb20e8b494bb4acdfe3a394db6
2021-04-08 21:17:42 +02:00
Tim Starling
61c5d9d208 Actor migration cleanup for rebuildrecentchanges.php
* Revisions always have an associated actor, which will be present in
  the rev_actor alias that comes from ActorMigration, so just use that
  actor instead of doing a complicated thing involving
  User::newFromAnyId()
* Stop using ActorMigration for logging and recentchanges, no longer
  necessary.
* The code to fill rc_bot and rc_patrol used an almost identical query
  which joins recentchanges with user_groups. So I factored that out to
  findRcIdsWithGroups(). The update code for the two cases was somewhat
  different, but I preferred the rc_bot one with its array_chunk() call,
  so I used that style of update also in the rc_patrolled case.

Bug: T278917
Change-Id: I32acb5848eacd4b28c0f89e8a6ec686304744c5b
2021-04-07 16:24:55 +10:00
Timo Tijhof
0af11e2740 rebuildLocalisationCache: Add --skip-message-purge and accompanying script
== Adding --skip-message-purge

Follows-up d91c6627a9. Per CR and Phab comments, I don't think we
can (yet) promise a generic "--offline" mode. This seems too easy to
misuse. Both for users of the script, as well as for future development
to the script. It can fall out out of sync with requirements of the
overall system and leaves no natural place to discover what
responsibilities are being deferred and how the operator should fulfill
those duties.

We know LCStoreDB doesn't work offline, but there are likely other
aspects of this that don't yet work offline for some users. It would
require a much more rigorous refactor (and dropping signifant extension
hooks) to make this reliably offline. I'd welcome a standalone script
using only vendor libs, that does nothing other than scan directories
and build JSON/PHP/CDB files, but that's not what it is today.

What we can do is skip the one operation we know requires a live
DB connection, and (my main motivation for this commit) then document
that skipping it, require the user to perform the purge by other means
instead, since the purge itself is not actually optional.

Also, make this not a WMF-specific option in MW core, by committing
the accompanying script needed for this to work. This was previously
in the WikimediaMaintenance extension as "refreshMessageBlobs.php".

== Keeping --offline (as --no-database)

As far as I know, the purge is the only action we ran into that needed
a database connection, and important to note was that it's not optional.

I think for WMF we did not run into any other logic in our configuration
that uses a database, so --skip-message-purge should suffice. However,
I've kept the option for two reasons:

1. To recognise in some way the business need for WMF to use this
   script in an offline manner, and thus document that the script
   should at least have a way to work offline, even if there may be
   site configurations and extensions that make this impossible, from
   a core perspective we want to (experimentally) try to support this.

2. There is unimportant setup logic that happens in doMaintenance.php
   where the service wiring for LBFactory is activated by default.
   This seems avoidable and technical debt, but at least for now
   we do need a way to skip that, so this option will continue to
   have that effect.

However, I've renamed the option and inverted its promise. This is not
a promise from core *to* the user to offer an offline mode. Rather,
it is a promise *from* the user that they think nothing DB-needy is in
use.

Bug: T268698
Bug: T263872
Change-Id: I7878fdf4a901fb5e75da540293bb9df9fb508c20
2021-04-07 00:36:59 +01:00
Timo Tijhof
f9443def6b maintenance: Support newlines in addOption() descriptions
Change-Id: I83993ec898d1991f1e41e674339b9b241043d471
2021-04-07 00:36:59 +01:00
Ammarpad
e497482ee4 DoctrineSchemaBuilder: Do not add prefix placeholder for Postgres at all
Adding it (only to be removed later) is not useful and interferes with
the internals of the schema builder because it masks the actual table
name during the table sql building and at some stages, this actual name
is required to be known

Bug: T191231
Change-Id: I57cc9b83c81f5c2d0d50c7b9e0dc334e7251c74f
2021-04-06 00:23:14 +00:00
Timo Tijhof
79caf9cc28 maintenance: Fix "changing" typo in class doc
Follows-up f04db99039.

Change-Id: If375e0fe73b9190e91c07038f0b992b204caf7a5
2021-04-04 23:52:11 +01:00
jenkins-bot
12a4e3f7c1 Merge "Add a warning to Maintenance about its unusual setup sequence" 2021-04-04 18:35:34 +00:00
jenkins-bot
1009989495 Merge "Partially revert "Maintenance.php: Remove hardcoded terminal size"" 2021-04-04 18:34:10 +00:00
Gergő Tisza
f04db99039 Add a warning to Maintenance about its unusual setup sequence
Change-Id: I2a8f618275930e5e44754f12ea1f6f73e7c30b7e
2021-04-04 19:59:10 +02:00
Gergő Tisza
6ca79d78f0 Partially revert "Maintenance.php: Remove hardcoded terminal size"
This partially reverts commit 1d9f3542bd.

Reason for revert: cannot use methods that might trigger class
loading in Maintenance::showHelp, as it's called on parameter parsing
errors which happen before Setup.php is run.

Change-Id: I0ffb2800a007d4077d7f33bc8cdef1d895d1ab5f
2021-04-04 19:53:24 +02:00
Paladox
4569d5cb11 BackupDumper: Add -o as shortcode for --output
Change-Id: I3ff00a19b95a9089e7f710fbcc1e2823c724a324
2021-04-03 18:21:39 +00:00
jenkins-bot
e614e8653e Merge "Drop unused patch-rc_cur_id-not-null.sql" 2021-04-02 23:01:34 +00:00
jenkins-bot
fc8944012a Merge "Drop unused patch-update_sequences.sql" 2021-04-02 22:54:59 +00:00
jenkins-bot
7529354d03 Merge "Make stricter type checks on user email and real name" 2021-04-02 21:28:57 +00:00
Amir Sarabadani
ac7391c6ea Drop unused patch-rc_cur_id-not-null.sql
Unused since Iebb6855e8f6f44470bb (2012)

Change-Id: I82d16d2c0d28902a0c3aedf8fece69c02a56c95c
2021-04-02 15:57:54 +02:00
Amir Sarabadani
1980d47f7f Drop unused patch-update_sequences.sql
Unused since r71040 (2010)

Change-Id: Ib0d841a974eef95898e4627d0b93ab3dd4d64f93
2021-04-02 15:55:58 +02:00
Amir Sarabadani
18b33350d8 Drop now unused patch-kill-iwl_prefix.sql
Leftover from I0ff387e057c1fb

Bug: T272199
Change-Id: If05e8613b6c87d8267088e6d082a8324359469b1
2021-04-02 02:12:07 +02:00
jenkins-bot
6c49afb7ca Merge "Drop unused patch-watchlist.sql" 2021-04-01 23:30:14 +00:00
Amir Sarabadani
13c298fcc9 Drop unused patch-watchlist.sql
This patch was introduced in r1030 (2002) and was never
wired to update.php and any mention of it was removed from documentation
in r23242 (2007). Since then, you can't find any mention of this file.
It clearly won't run on any modern mediawiki database.

Change-Id: I49a7a0bd53d5fb1b97f9c7016bb72d29e50211f7
2021-04-02 00:09:59 +02:00
Amir Sarabadani
b4a236b9d9 Drop now unused patch-categorylinks-better-collation.sql
Leftover from I0ff387e057c1fb

Bug: T272199
Change-Id: I6a00353eeb16496ce3ed2cd5f39906fa3b35e204
2021-04-02 00:02:19 +02:00
Petr Pchelko
c44d44639b Make stricter type checks on user email and real name
Currently both email and real name are documented as
non-nullable, but it seems there's code that breaks
this contract. Try stricter type checks.

Depends-On: Ie8fa1e7881e1b016dccdc9097a1763a07cc140b9
Depends-On: Id3bf35fe56c459597ed6a602bdf6ca4860271f6e
Change-Id: I2f4b7b3500a2b25f7d5cf25147f65ad412d61955
2021-04-01 15:21:41 -06:00
Tim Starling
f66ea1b38e Actor migration cleanup for removeUnusedAccounts.php
The query does a LEFT JOIN between user and actor. Given the state of
the actor table migration, it's impossible for a user to be active
without having an actor row. So such users must be inactive.

isInactiveAccount() does a loop over tables, sending them all to
ActorMigration, but that's obsolete for all except revision. So split
out the revision case out of the loop, with roughly the same code as
before. Inside the loop, do new-style queries in the knowledge that the
*_actor fields exist.

logging still needs a special case, but like the other non-revision
tables, it no longer needs ActorMigration.

Bug: T278917
Change-Id: I37281a0c856618674160bb39506108d5fff92479
2021-04-01 14:02:27 +11:00
Amir Sarabadani
4213630c2a Drop unused patch-uploadstash_sequence.sql
This was introduced in r103367 as a follow up to r103365 while none of
the commits wire this to update.php and since then it has been unused.

And even if it was wired dynamically somehow that I missed, it's not
needed anymore as we don't support direct upgrades from these versions
(1.18 and 1.19) anymore.

Change-Id: I1e16de398bbe61adcb55787117378ea96a2b3e9f
2021-03-30 20:42:16 +02:00
Amir Sarabadani
1bcee79097 Drop now unused patch-interwiki.sql
Follow up to I0de40b8dc6

Bug: T272199
Bug: T273080
Change-Id: I639f31e2ece1c936a9013f504e545796aa636724
2021-03-30 20:04:09 +02:00
jenkins-bot
3f96a72ac9 Merge "Prepare for migrating user to abstract schema" 2021-03-28 10:31:03 +00:00
Ammarpad
c697406d3f Prepare for migrating user to abstract schema
Split off to make the migration patch smaller

Postgres:
 - Make user_touched not nullable

MySQL/SQlite
 - Change user_name from varchar to varbinary
 - Change user_name from varchar to varbinary
 - Drop empty string default from user_touched (Timestamp field)

Bug: T230428
Bug: T164898
Change-Id: I8fe0b1fb2af3149a2e2fdae7bb056ac6f863b09c
2021-03-28 09:55:07 +01:00
jenkins-bot
f4b6cf32ce Merge "resetUserEmail.php: Treat empty string as valid email" 2021-03-28 02:18:14 +00:00
jenkins-bot
48674bee1d Merge "Drop two unused Perl scripts" 2021-03-28 02:17:35 +00:00
Ammarpad
0e7bf93d48 Drop two unused Perl scripts
Probably nobody is using these.

Also hopefully after fully migrating to abstract schema, there'd
not be any more unnecessary drifts between MySQL and Postgres tables,
obsoleting the need for compare_schema.pl

For mysql2postgres.pl, dumpBackup.php/importDump.php can be used.

Bug: T258876
Change-Id: Ief36bca6f3a387f811408f2a5e4840656dfffff2
2021-03-27 11:47:48 +01:00
jenkins-bot
e2f406a6eb Merge "Drop now unused patch-page-page_lang.sql from Sqlite" 2021-03-27 10:46:36 +00:00
jenkins-bot
9324b7ecc5 Merge "Drop unused patch-random-dateindex.sql" 2021-03-27 10:40:12 +00:00
jenkins-bot
85f757fefa Merge "Remove unused schema change." 2021-03-27 09:37:16 +00:00
Amir Sarabadani
d9933fd212 Drop now unused patch-page-page_lang.sql from Sqlite
Leftover from I76b4235f13aef0, was supposed to be removed but forgotten.

Bug: T272199
Change-Id: I7bf0fa8bddac8fc567b148b6b434487fafa7eb68
2021-03-27 10:12:47 +01:00
Amir Sarabadani
f21644c8fe Drop unused patch-random-dateindex.sql
This patch was introduced in r1161 (February 2003) but it wasn't
mentioned in the patch-list.txt and checking git history since initial
version (phase3) didn't return any mention of it since then.

It clearly can't be ran on any modern mediawiki setup.

Change-Id: Ic5a8f0699dd31a181c31582be4958522ce3483b3
2021-03-27 09:53:02 +01:00
Ammarpad
eece54b831 Remove unused schema change.
There's no reason to keep schema change that's no longer useful.
History is already tracked by git.

Change-Id: Ia8aa0d21ae5f2d799d9a641ebe7b924f56e07ab1
2021-03-27 09:32:29 +01:00
Ammarpad
81ba51eb0e Postgres: Remove page_deleted trigger
Bug: T164898
Change-Id: Ie7ff5ff9fd649f27564443e17e602c4bc61669fc
2021-03-27 07:29:00 +01:00
Reedy
040317c534 maintenance: Don't create SearchUpdate in rebuildtextindex.php for page_namespace below 0
Bug: T268673
Change-Id: I18462dbc99215beb4d642a47e081af1d85a7068c
2021-03-27 02:40:04 +00:00
Martin Urbanec
82cd2ca311 resetUserEmail.php: Treat empty string as valid email
User::setEmail with an empty string removes the mail, which
is something necessary to do.

Change-Id: I0954f31e9214f05549697750ecc50c482c889047
2021-03-26 22:05:18 +01:00
Amir Sarabadani
a4379d6fc9 Drop doInterwikiUpdate
This update is not being called in basically any wiki because it skips
when interwiki exists and that table was introduced in 1.2 (we don't
support direct upgrade from 1.26 or earlier).

The .sql file is not useful but installers use interwiki.list and that
is useful.

Bug: T272199
Bug: T273080
Change-Id: I0de40b8dc60eb07b9c7ebeb620142f3cdfe5b67b
2021-03-26 21:41:59 +01:00
Amir Sarabadani
0dacf7d68d Drop two 1.13 updates
- doCategoryPopulation is not needed nor being called anymore. There's
   not much use for the maintenance script either.
 - doPopulateParentId ditto.

Bug: T272199
Change-Id: Id7fc111b71e8ee9a37a3e2e56849ac5afeea9f9d
2021-03-26 21:34:00 +01:00
jenkins-bot
1857b8244b Merge "Drop rest of unsupported upgrade paths and patches in Postgres" 2021-03-26 19:04:53 +00:00
jenkins-bot
d904a7159b Merge "Drop tsearch fixes in postgres" 2021-03-26 19:04:18 +00:00
Petr Pchelko
cf763fe116 Drop most hard-deprecated methods in Article
Bug: T239975
Change-Id: I6ca9fbaa699d0465a59e86abbf2bca6bbdb69c01
2021-03-24 19:34:41 +00:00
Amir Sarabadani
6ba7c4fa09 Drop rest of unsupported upgrade paths and patches in Postgres
These are from versions we don't support direct upgrade anymore and they
are already removed from update.php wiring.

Bug: T272199
Change-Id: I863d91d7d620943571cb8bb22f663c2efbbd0821
2021-03-22 07:43:34 +01:00
Amir Sarabadani
447db80038 Drop tsearch fixes in postgres
These changes to tsearch functions were introduced in 2010 in a version
that we definitely don't support direct upgrades from.

Bug: T272199
Change-Id: I47c4054552daad55c0e13eec36865706ee6d1903
2021-03-22 07:29:06 +01:00
Amir Sarabadani
e2c005f91f Drop unsupported 1.23 upgrade code and patches from Postgres
We don't support upgrading from 1.23 anymore.

Bug: T272199
Change-Id: Iac9652095927c86c47f45a2aa131c28efef5c73a
2021-03-22 07:26:53 +01:00
Ammarpad
53f24f2ac8 Postgres: Fix revision table indexes drifts with MySQL
Added new index: 'rev_page_timestamp' (the corresponding index
in MySQL is currently 'page_timestamp' but it will soon be
renamed to have the rev_ suffix as part of T270033).

Rename rev_timestamp_idx and revision_unique to match names
that are in use for MySQL

Bug: T230428
Bug: T164898
Change-Id: I3a79a892673b073cea57ee4e397b2963c7cef2f1
2021-03-21 18:29:12 +01:00
Ammar Abdulhamid
6a3aa5b5a2 Migrate page to abstract schema
Postgres:
 - Change page_namespace from smallint to int
 - Change page_random from numeric with arbitrary precision to float
 - Make page_touched not nullable

MySQL/SQLite:
 - Change datatype of page_title from varchar (with binary collation)
   to varbinary(255)
 - Drop default empty string from timestamp field of page_touched

Bug: T230428
Bug: T164898
Change-Id: Ibdaf332ea1da309d31d35a6ebbc1b8fefced335e
2021-03-21 12:07:12 +01:00
jenkins-bot
b0f893f4ad Merge "Abstract schema: Handle MySQL Float/Double precision types" 2021-03-21 09:00:41 +00:00
Ammarpad
ffff04b375 Abstract schema: Handle MySQL Float/Double precision types
Subclass DBAL\Platforms\MySqlPlatform so that we can override
methods cleanly. Move the current MySQL hack from the schema
generator script to this class.

If 'float' is specified in the json spec without any option, the
FLOAT data type will be used. To use DOUBLE PRECISION (aka REAL)
a 'doublePrecision' option has to be specified and set to true.
No support for specifying arbitrary precision since no current
table is using that and the feature is deprecated in MySQL 8 anyway

Due to T270740, the subclassing is not straightforward because
the base DBAL MySqlPlatform class is renamed in DBAL 3.0.0. For
now a compatibility intermediate class is used as in PG subclass

Other changes: Use switch instead of if/else and remove brackets
in instantiating a class without arguments.

Bug: T191231
Change-Id: I9a5087b1e2afc2b63e30d67ea2ca616f047a0258
2021-03-21 05:00:55 +00:00
Reedy
cbf86196d3 pageExist.php: Output trailing newlines
Change-Id: Ib4877bd084277fa574b6a9002d4f6b494b421326
2021-03-20 21:20:31 +00:00
Amir Sarabadani
11f091db7d Drop add_interwiki updater in Postgres
This function was removed in abstracting interwiki table (Id652cb544)
and it's not needed anymore.

Change-Id: Ifc956ae91f8362e9872cd449fcab5cfb4870ec7f
2021-03-20 18:25:02 +00:00