Commit graph

718 commits

Author SHA1 Message Date
daniel
fe8b5fa79c make rev_actor_timestamp index cover the rev_id field.
This adds the rev_id column to the end of the rev_actor_timestamp index
to make it unambiguous. With the id field added, the index matches the
pagination criterion for user contributions (filter by actor, sort by
timestamp, then disambiguate based on revision id). The index is not
marked UNIQUE since this would potentially degrade write performance.
Uniqueness is already guaranteed by the rev_id field being the primary
key.

Note that no provisions are made to change the definition of the
rev_actor_timestamp index for existing instances. This index was only
recently added in I18071a2fe45907a0cf1b0fefebd96a97a2dacb7b and has not
been part of any release. It has also not yet been created on the wikimedia
servers. For this reason, any existing instances are assumed to be for
testing only. Instances would also continue to function normally with
the previous index definition.

With this patch, the new index will be created correctly when updating
from 1.34 or earlier. It will however not be modified for installations
of some development version of 1.35.

Bug: T200259
Bug: T238966
Change-Id: I511bb21b1ca820d950818cc831f8e3fef43a1559
2020-06-03 09:14:42 +02:00
Dayllan Maza
39448a9cf6 Remove ipb_anon_only from ipb_address_unique UNIQUE INDEX
Bug: T251188
Change-Id: I4618f659be64134664ac1644de2b51d74f000e4c
2020-06-02 17:15:36 -04:00
DannyS712
c5423ce5d5 Rename patch-l10ncache-lc_lang-35.sql to patch-l10n_cache-lc_lang-35.sql
Follow-up to 141e0b0b35

Bug: T253276
Change-Id: I85f5578de5c6ee2437a1f43a4c079406650fd15e
2020-05-25 12:02:20 +00:00
Reedy
141e0b0b35 Normalise length of language fields to varbinary(35)
Update length in patch-langlinks.sql and fix PK too
Update length in patch-sites.sql and fix PK too
Update length in patch-l10n_cache.sql and fix PK too

Re-use patch-langlinks-ll_lang-20.sql and update

Bug: T253276
Change-Id: I95bef3ef279cb59d54a3127c646a03826fa0da6b
2020-05-22 20:41:15 +00:00
Brad Jorsch
c04732b987 Alter revision for actor, comment, and MCR
We're finally to the point of making the massive alter to the `revision`
table that we've been building up to for 2.5 years now.

Changes here are:
* Drop `rev_text_id`, `rev_content_model`, and `rev_content_format` that
  MCR obsoleted.
* Drop `ar_text_id`, `ar_content_model`, and `ar_content_format` that
  MCR obsoleted.
* Replace `rev_comment` with `rev_comment_id`.
* Replace `rev_user` and `rev_user_text` with `rev_actor`, plus
  associated index changes.

Future patches will make the code changes to migrate data from
`revision_actor_temp` and `revision_comment_temp` into the new
`revision` columns.

Bug: T251343
Bug: T184615
Bug: T215466
Change-Id: I18071a2fe45907a0cf1b0fefebd96a97a2dacb7b
2020-05-08 15:26:56 +00:00
Reedy
8ba1c75559 Replace wfWaitForSlaves() with LBFactory::waitForReplication()
Change-Id: I337147d61e2ec686a8672d0340dff4b6783f78cd
2020-05-02 02:00:01 +00:00
Amir Sarabadani
d779d2889a Rename ipb_address to ipb_address_unique
This is how it's named in WMF production and the Postgres. Converging
names would help us to keep everything consistent, for example if we
need to force this index in the code.

For changing this index in Sqlite, we don't need to make a temp table as
this only touches the index and not the table structure.

Bug: T250071
Change-Id: I0838753b809680af3ee06d9c4f6d21d95b8982cc
2020-04-22 13:39:02 +00:00
Máté Szabó
992da671a1 Add schema change to make page.page_restrictions column nullable
The page.page_restrictions field was used to store protection settings
for pages before MediaWiki 1.10 introduced the page_restrictions table.
update.php has since been running the updateRestrictions.php maintenance
script to migrate data from the legacy field to the new table.

In preparation for dropping this field, it is necessary to first make this
column nullable, so that we can remove code that references it during write
operations. This patch adds migrations for MySQL and SQLite to make the column
type 'tinyblob NULL'. Postgres does not seem to require a schema change, as the
field definition there is 'TEXT' rather than 'TEXT NOT NULL'.

Bug: T218446
Change-Id: I626859cdb5ab81c504a986129d21059ab088b8bd
2020-03-20 20:51:55 +01:00
MusikAnimal
865755dbe5 Create new table for watchlist expiry
This table will store expiries for watchlist items, so that pages can be
automatically unwatched at a specific time.

Bug: T240094
Change-Id: I014ffccb91969e7a222a83858c55e71067b0f2af
2020-02-07 14:59:50 -05:00
Ammar Abdulhamid
f482090d77 Replace deprecated IP class with IPUtils
Bug: T242556
Change-Id: Ieaf4e1de2d766766bdb5fdb2425e8148ddd331b4
2020-01-24 18:49:33 +01:00
Umherirrender
b4fe9c4bcc Set method visibility on maintenance scripts
Change-Id: I44c82fbe65e1d002803ce065df6563f06dd39cd4
2019-11-16 22:54:17 +00:00
jenkins-bot
c2c789cc59 Merge "Remove traling double newlines from text files" 2019-11-07 10:01:02 +00:00
Timo Tijhof
0da1ecfd89 profiler: Remove ProfilerOutputDb and profileinfo.php entry point
Bug: T231366
Change-Id: I211c8192200d9af00914f9847608a6daf2898f91
2019-11-06 15:28:00 -05:00
Fomafix
d607ef8512 Remove traling double newlines from text files
Performed using:

git ls-files \*.json \*.php \*.xml \*.xsd \*.html \*.txt \*.sql | xargs sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba'

Excluded tests/parser/preprocess.

Change-Id: I513538ff13c942acfe589f15c5128a8df2b3ace9
2019-10-23 21:17:43 +02:00
Umherirrender
7363e38ddf Set public for override of Maintenance functions
The following function are set to public in the parent class and cannot
have another visibility in subclasses
Maintenance::__construct
Maintenance::execute
Maintenance::getDbType
Maintenance::validateParamsAndArgs
Maintenance::setDB

Change-Id: I0cd6514642d479aca20f1221bf673b0713c21631
2019-10-09 20:41:33 +02:00
Reedy
e22efbce17 Split down patch-actor-table.sql
Bug: T227662
Change-Id: I024ff1d6f4c2726242138ba7e7f19480d9d2b948
2019-09-30 15:20:08 +00:00
jenkins-bot
825d66bfa4 Merge "Split down patch-comment-table.sql" 2019-09-27 15:18:11 +00:00
Brad Jorsch
5424238aa9 Remove MySQL index aliasing for user_newtalk indexes
While these have not yet caused problems, we should probably deprecate
the whole confusing "index aliasing" feature. Cleaning this up needs to
be done first.

Method MWLBFactory::setSchemaAliases() is being considered private due
to the @internal notation, and so is being removed without deprecation.

Bug: T233240
Change-Id: Ib04b7bc4af53382fde01bd8550cc7e361124255f
2019-09-27 09:30:31 +00:00
Brad Jorsch
f45441aaa7 Clean up ar_usertext_timestamp index mess
See T233221 for the sordid history. The short version is that it might
exist as `ar_usertext_timestamp`, `usertext_timestamp`, or both on
MySQL, so dropping it for the actor migration needs to drop both names
if they exist.

We can also remove the now-obsolete aliasing from MWLBFactory.

Bug: T233221
Bug: T104756
Bug: T229712
Change-Id: I429e7ade2c86a2514aafe947012f096b03aa67ce
2019-09-18 11:49:02 -04:00
Umherirrender
f74400487f phan: Disable enable_class_alias_support
It is enabled for b/c in extensions, but not needed in core

Change-Id: I51dca12be9c77049f77563d9bf0edd07928c2300
2019-09-15 08:26:52 +00:00
Brad Jorsch
c29909e59f Mostly drop old pre-actor user schemas
This removes most of the pre-actor user and user_text columns, and the
$wgActorTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_user and rev_user_text remain in the code, as on Wikimedia wikis the
revision table is too large to alter at this time. A future change will
combine that with the removal of rev_comment, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

ActorMigration's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process. Code using
ActorMigration for accessing the core fields should be updated to use
the new actor fields directly. That will be done for in a followup.

Bug: T188327
Change-Id: Id35544b879af1cd708f3efd303fce8d9a1b9eb02
2019-09-09 11:38:36 -04:00
Daimona Eaytoy
c659bc6308 Unsuppress another phan issue (part 7)
Bug: T231636
Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9
Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0
Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
2019-09-03 17:19:21 +00:00
Reedy
c00c34f288 Split down patch-comment-table.sql
Bug: T227662
Change-Id: I7617616df57f7468d06e9b52426b6851bfef0e7d
2019-08-20 19:35:57 +00:00
Niklas Laxström
144f40a4b8 Fix typo: namesapce
Change-Id: Idb4e420c87b7043baf3289556b8ef8775126bf8e
2019-05-17 15:25:21 +02:00
Erik Bernhardson
c3c22e9ae8 Change job table params from blob to mediumblob
The default blob type holds 65kB which is often enough, but some
jobs push over this limit. When using mysql these are silently
truncated to 65kB which only issues errors when the data is retrieved.

Increase from blob to mediumblob which gives a max size of 16MB. There
may be some valid use cases for jobs > 64kB, but there should be no
use case for jobs > 16MB.

Bug: T124196
Change-Id: I6df6634bd3a5b5fa27ce6f8ff20d251a9b5eba32
2019-04-01 09:07:35 -07:00
Brad Jorsch
0abb9338f8 Mostly drop old comment schemas
This removes most of the pre-CommentStore text columns, and the
$wgCommentTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_comment remains in the code, as on Wikimedia wikis the revision
table is too large to alter at this time. A future change will combine
that with the removal of rev_user_text, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

CommentStore's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process.

Bug: T166733
Change-Id: I1479c73774e01ead1490adf6128f820c09bce9d4
2019-02-07 16:59:27 +11:00
Amir Sarabadani
8640b66568 Clean ups of dropping tag_summary table
Change-Id: I92dc906d0dfd870e6b77671e5d7cfd3f56090325
2018-12-19 10:14:33 +00:00
Amir Sarabadani
2ce92e90a7 Drop tag_summary and valid_tag tables
Bug: T209525
Change-Id: I153607239145a772f5ea47eefd3340096a494b4b
2018-12-18 20:45:36 +00:00
Amir Sarabadani
1427bb1821 Drop ct_tag column from change_tag table
Bug: T194163
Change-Id: I05d43510b51a67733b0107f0a768e261fe8ddabd
2018-11-28 23:03:43 +01:00
Fomafix
1472f02b36 Phabricator: Use Tddddd instead of Bug ddddd in comments
Change-Id: Ic9fe03cab270bd6be738af346164ad5d31a0d780
2018-10-04 09:15:02 +02:00
Reedy
6ee0b58499 copyedit patch-parsercache.sql comment
Change-Id: Ie0a9d9dc11bd6944cabd30952fa836745e3f22b9
2018-09-26 22:36:24 +01:00
David Barratt
c2bd4b12c7 Make Schema changes for Partial Blocks
Update the database schema so a block can be switched between a sitewide and
partial block. Also add the restrictions table for specifiying the partial
blocks.

Bug: T197144
Change-Id: I4a725312c4b980a1b14e5ca826069fa2278a5913
2018-09-07 15:25:49 -07:00
Reedy
cf95107ffa Fix table prefixing in patch-change_tag-change_tag_rc_tag_id.sql
Change-Id: Id1963e93a43d4b183a31788b645c83e3037f3016
Follows-up: I24609c57e47308d1330a97527f4ea374d0d307ba
2018-09-06 22:41:27 +01:00
Amir Sarabadani
da9d5c2188 Schema change for reading ct_tag_id instead of ct_tag
Adding unique index on ct_tag_id and making indexes on ct_tag non unique

Bug: T193874
Change-Id: I24609c57e47308d1330a97527f4ea374d0d307ba
2018-09-04 19:29:48 +02:00
Aaron Schulz
27a2aceb25 Drop the transcache table from the schema
Bug: T189702
Change-Id: I3286a99165953392126fcff07d565738863de6a1
2018-08-31 19:50:49 -07:00
Amir Sarabadani
ddd47d2808 Add index on rc_this_oldid
Approved by TechComm

Bug: T139012
Change-Id: I0ccfd26d68a5ceef552ae3aa37a6e345b24ff84e
2018-08-02 21:46:54 +02:00
Reedy
267d99fa85 Convert numerous UNIQUE INDEX to PRIMARY KEY
MySQL, SQLite, PostgreSQL and MSSQL done with transitional patches.

One additional duplicate index removed from PostgreSQL schema.

Having a PK is essential to do maintenance, specially on large tasks.
By not having a PK it is impossible to add it in a safe way if not done
directly on the master.

Having a PK means that we can easily change the PK into another one if
needed in the future. The ones we chose might not be the best ones, but
will allow us to get them changed.

Bug: T198811
Change-Id: I6b96a427687085c6c24bcd759c9739f81288b919
2018-07-11 20:36:33 +01:00
Reedy
b2101d7202 Rename index type_action to log_type_action
Bug: T51199
Change-Id: I697fd5689e573bfa965ca75385f919c9a8403c14
2018-07-11 19:07:21 +00:00
Brad Jorsch
c84083e413 Make archive.ar_rev_id unique
To follow up I39b0825c, this change replaces the existing non-unique
index on the column with a unique index, to help avoid some of these
sort of bugs in the future.

Bug: T193180
Change-Id: I932478c9c6a13210bc9dff75286d0f08da56682c
2018-06-04 08:52:06 +00:00
Amir Sarabadani
f45314cd4f Add ct_tag_id field to change_tag table
Part of normalizing the table

Bug: T193867
Change-Id: I8c38e673aab14c5b87e5501da1a752c5bd4709c8
2018-05-18 16:37:04 +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
Amir Sarabadani
6039593649 Introduce change_tag_def table
Table defining tag names for IDs. Also stores hit counts to avoid expensive queries on change_tag
See T185355 for more information

Bug: T193867
Bug: T185355
Change-Id: I4fd943589b3ed304471304c8beda15327a8edbcf
2018-05-08 18:48:52 +02:00
jenkins-bot
2224e31507 Merge "Drop archive.ar_text and ar_flags" 2018-04-23 20:15:26 +00:00
Amir Sarabadani
f303a13a72 Change index on rc_namespace, rc_title to rc_namespace, rc_title, rc_timestamp
Bug: T190444
Change-Id: I5c59f1ee9306710505654a8db965f85ebf855873
2018-04-04 09:08:28 +02: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
jenkins-bot
1a9ba829a5 Merge "Populate ar_rev_id and make it non-nullable" 2018-04-03 15:37:05 +00:00
jenkins-bot
dd942172f8 Merge "DB: Add img_description_id column" 2018-04-03 01:18:42 +00: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
Eddie Greiner-Petter
27c76fa4ae Overhaul site_stats table
The site stats table holds a bunch of metric fields, two of which are of
data type "bigint unsigned", 3 are "bigint" (signed) and one is int
(signed).  Also the default values differ widely: It is 0 on the
"unsigned" fields and the "int" field, but -1 on the three others. This
patch makes all of this more consistent:

Set all fields (except the ss_row_id, which isn't changed) data type to
"bigint unsigned". Also set NULL as the default value for all those
fields. Obviously -1 isn't a possible default value any more. Also, 0
can easily be mistaken for a real value (e.g. ss_active_users=0 -->
"there is nobody active on this wiki"). NULL, by it's definition, is the
value of choice for a value to insert into fields of which we don't know
a correct value.

The respective patch files were tested locally against MySql, Sqlite,
Postgres and SQL Server 2016. Neither oracle nor the upgrade with
update.php was tested.

Bug: T56888
Change-Id: I7d42aae434852a56b6f8dd559d8a5f3bce416021
2018-03-26 23:51:40 +00:00
jenkins-bot
9ced9ebca2 Merge "MCR: replace slot_inherited with slot_origin" 2018-03-20 12:06:32 +00:00
daniel
b0bdfd7e9f MCR: replace slot_inherited with slot_origin
Bug: T189004
Change-Id: Ie9dbda3296a71f584c82a5f275098adc225a53d5
2018-03-19 21:51:56 +01:00
addshore
8d15ade672 Add default for revision.rev_text_id where missing
This adds a default of 0 for:
 - Mssql
 - Mysql
 - Sqlite

The field is already NULLable in:
 - Oracle
 - Postgres

Bug: T188741
Change-Id: Ibe1cc363d21fb96f38c263181bf30a429a1c7b45
2018-03-19 18:20:27 +00:00
Brad Jorsch
267af09d32 DB: Add img_description_id column
This begins the process of merging image_comment_temp into the image
table by adding the needed column. Iab5f5215 will adjust the code
to use it and to add the necessary migration script.

Note this patch puts the new schema change in the 1.30 section rather
than the 1.31 section. This allows Iab5f5215 to have migrateComments.php
migrate the comments directly to the new field instead of having to
populate and then depopulate the temporary table.

Bug: T188132
Change-Id: I2485c5a758bf03bb2b4991eea920abd9d0d30bda
2018-03-13 16:54:25 -04: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
daniel
943c724198 MCR database schema
Schema additions/updates for MySQL, SQLite, PostgreSQL, MSSQL
and Oracle to add new tables:

* content
* content_models
* slots
* slot_roles

See also https://www.mediawiki.org/wiki/Multi-Content_Revisions/Database_Schema

Bug: T174028
Change-Id: I30a3a9834d54d0e6957553d91908b2b73b2c802f
2017-12-23 17:43:09 -05:00
jenkins-bot
52ce204415 Merge "Fix patchfile used to add newtalk table on mysql" 2017-09-29 05:31:59 +00:00
Reedy
c16b1e8191 Fix patchfile used to add newtalk table on mysql
Remove orghaned patch-drop-user_newtalk.sql

Change-Id: I27ad5a628deedbab2e659200f003cdeb18ea3620
2017-09-26 21:25:51 +00:00
Reedy
e6a77bb2d4 Don't unconditionally run patch-editsummary-length.sql
Bug: T176041
Change-Id: I165ee4fa1c0cfadf5f8f400a0ea9db220ed7dbbb
2017-09-18 14:27:59 +00:00
Reedy
f4022fe876 Making numerous fields unsigned to match their target referenced column
Bug: T157227
Change-Id: Ic11822d6c893103adcc99a3e188a592f13c968b8
2017-09-06 19:34:09 +01:00
tjlsangria
93eef8d2c5 Convert INDEX into PRIMARY KEY in l10n_cache
Bug: T146591
Change-Id: I85ab18bfa30e562e76253e3ef71653dbf46db041
2017-09-05 17:58:12 +00:00
Reedy
575a886a46 Remove patch-log_search-rename-index.sql from MW 1.16 updaters
Otherwise, the PK on log_search keeps getting dropped, ls_field_val readded and
this is then repeated on every run of update.php

Change-Id: I6b00933c29b5e24ec2833001fcf45053292d190c
Follows-up: Id635297838938c7c5dfe65d45285a4d16d65152d
2017-09-01 17:44:49 +01:00
Reedy
f0f839c969 Prefix comment table when adding indexes
Change-Id: Ie87d2ef68050a402d6c81ca98cc7402f7c5f14aa
Follows-Up: Ic3a434c061ed6e443ea072bc62dda09acbeeed7f
2017-08-30 16:41:38 +00: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
Reedy
0f13fff160 Convert UNIQUE keys into PRIMARY KEY
WMF DBAs have been doing a massive effort to convert UNIQUE KEYS into
PRIMARY KEY.

Having a PK is essential to do maintenance, specially on large tasks.
By not having a PK it is impossible to add it in a safe way if not done
directly on the master.

Having a PK means that we can easily change the PK into another one if
needed in the future. The ones we chose might not be the best ones, but
will allow us to get them changed.

Bug: T172514
Change-Id: Id635297838938c7c5dfe65d45285a4d16d65152d
2017-08-29 18:25:37 +01:00
MusikAnimal
d779a09035 Create new table to be used for querying IP ranges.
When revisions by logged out users are created, they will get copied
to this table. We can then JOIN it with revision when querying for
ranges at Special:Contributions.

DBA approval for this table can be found at T156318

Bug: T163562

Change-Id: I6593eb13701128faa782691a6b25ec01869c827d
2017-08-10 21:28:16 +00:00
Mark Holmquist
a2f5d05ae8 Add 3D filetype for STL files
Other filetypes use the text/plain MIME type, so we'll have to do something
else to support them.

Bug: T157348
Change-Id: Id78a504302fa664b353a4c45bdc5d99f95a0180a
2017-04-17 17:01:52 +02:00
jenkins-bot
ecba64eee0 Merge "Use IDatabase type hints in /maintenance" 2017-04-08 02:26:47 +00:00
Aaron Schulz
21e71e0235 Use IDatabase type hints in /maintenance
Relatedly, move lockTables()/unlockTables() to IMaintainableDatabase

Change-Id: Ib53e9fa948deb2f9a70f0ce16c002613d0060bf9
2017-04-07 23:37:41 +00:00
Tim Starling
c13dd55f4e Fix incorrect index name in new 1.28.0 installations
This index name should be the same in new installations as in all other
MySQL installations. This is necessary so that
Special:DeletedContributions does not give an SQL error. Release notes
will go in the 1.28 branch.

Bug: T154872
Change-Id: I535a5513ab56203139c4cf64874ea7e7498990e3
2017-04-06 08:04:06 +10:00
Matthias Mullie
792555fcee Add image.img_user, image.img_timestamp index
This will allow searching on user id instead of just the name.
This is how ContribsPager, LogPager, ... all work already.

Bug: T160415
Change-Id: I4db7bd0f917a428f40eb315246f89d49c7ae5b6a
2017-03-14 15:37:27 +01:00
James D. Forrester
242df680ce maintenance: 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.

This includes renaming fixBug20757.php to fixT22757.php for similar consistency.

Change-Id: If81a590d658fbd82c20c54ac47dfdc8856745ca3
2017-02-21 18:32:44 -08:00
This, that and the other
ae8916eef9 Don't try to drop ug_user_group index if it doesn't exist
This is needed for MySQL only.

Bug: T156901
Change-Id: I351fa1b7ce5a9b1c7b19ecb7d26d8a1f699d88f8
2017-02-02 01:57:09 +11:00
This, that and the other
73224f4f8b User group memberships that expire
This patch adds an ug_expiry column to the user_groups table, a timestamp
giving a date when the user group expires. A new UserGroupMembership class,
based on the Block class, manages entries in this table.

When the expiry date passes, the row in user_groups is ignored, and will
eventually be purged from the DB when UserGroupMembership::insert is next
called. Old, expired user group memberships are not kept; instead, the log
entries are available to find the history of these memberships, similar
to the way it has always worked for blocks and protections.

Anyone getting user group info through the User object will get correct
information. However, code that reads the user_groups table directly will
now need to skip over rows with ug_expiry < wfTimestampNow(). See
UsersPager for an example of how to do this.

NULL is used to represent infinite (no) expiry, rather than a string
'infinity' or similar (except in the API). This allows existing user group
assignments and log entries, which are all infinite in duration, to be
treated the same as new, infinite-length memberships, without special
casing everything.

The whole thing is behind the temporary feature flag
$wgDisableUserGroupExpiry, in accordance with the WMF schema change policy.

The opportunity has been taken to refactor some static user-group-related
functions out of User into UserGroupMembership, and also to add a primary
key (ug_user, ug_group) to the user_groups table.

There are a few breaking changes:
- UserRightsProxy-like objects are now required to have a
  getGroupMemberships() function.
- $user->mGroups (on a User object) is no longer present.
- Some protected functions in UsersPager are altered or removed.
- The UsersPagerDoBatchLookups hook (unused in any Wikimedia Git-hosted
  extension) has a change of parameter.

Bug: T12493
Depends-On: Ia9616e1e35184fed9058d2d39afbe1038f56d7fa
Depends-On: I86eb1d5619347ce54a5f33a591417742ebe5d6f8
Change-Id: I93c955dc7a970f78e32aa503c01c67da30971d1a
2017-01-27 09:24:20 +00:00
Brad Jorsch
c585ec5ed6 Add externallinks.el_index_60 column and indexes
This will allow for replacing the limit-and-offset queries with queries
that page in a sensible manner.

Bug: T59176
Change-Id: If5c137f68496772f3fff3a735b7b0c388426e518
2016-11-21 16:37:49 -05: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
Paladox
b39a5f94e5 Add patch to migrate rc_ip field to varbinary(40)
This makes it match tables.sql, as it was modified previously but no
related database patch was made.

Bug: T117854
Change-Id: I239e7ee4d97fcc3cb96c98dc53d9371883aaf4fb
2016-10-12 22:15:13 +00:00
This, that and the other
d0a0e9b417 Add primary key to change_tag and tag_summary tables
Based heavily on 43e386ca16.

Bug: T123225
Change-Id: I33480f4016812259700979f1145099744bb451d4
2016-10-02 13:02:41 +11:00
Aaron Schulz
30f4b3c103 Replace DatabaseBase => Database in more places
Change-Id: If37a7909056bf2c31a8228cbc84f0fbbf5f1c517
2016-09-28 15:53:02 -07:00
James D. Forrester
960e4d09ca Documentation: Replace misuse of 'later' when we meant 'latter'
Change-Id: I01bfdb8e0bfaa132533732873f7c840cea7935eb
2016-09-07 13:13:42 -07:00
Kevin Israel
c1079140e4 Remove patch-pl-tl-il-unique.sql
In 1.24 (b8c038f678), this update from 1.15 (see T18645,
640a6d311e) was undone in tables.sql. However, it was not
removed from MysqlUpdater, so update.php would still make the
indices UNIQUE, even when run on a new MediaWiki installation.

In its place, added patch-pl-tl-il-nonunique.sql, which recreates
the indices to match the current definitions from tables.sql.

Bug: T78513
Change-Id: Ic82ca06c8e7051bcd1e0a2a3d5d251e297a9142f
2016-08-26 05:09:12 -04:00
Aaron Schulz
af58998190 Remove redundant UNIQUE from rev_page_id
The PRIMARY KEY is rev_id, so this is a waste and
makes the index slower to maintain (e.g. no change
buffering).

Bug: T142725
Change-Id: I63f817656ff5e62aa27caf607d70353cc99eb349
2016-08-25 06:30:41 +00:00
Brad Jorsch
adf9875c74 Add rc_name_type_patrolled_timestamp index
Bug: T140108
Change-Id: I382a5f0daef703a3d16fe008a5e1d1402f2c7b33
2016-07-14 12:01:04 -04:00
Brian Wolff
eec016ece6 Add new index to make updateCollation.php painless
We want to update categories in order, to minimize disruption
to users. Previous indexes required a filesort to do this, which
exploded things on large wikis. See bug for details

Bug: T58041
Change-Id: Iee6cd997ff87a313a46fda19d8ab063d0fed8ce8
2016-03-22 16:32:52 -06:00
addshore
43e386ca16 Add id field to watchlist db table
Bug: T125990
Change-Id: I3ce3a736d51bc06fe40fd773f079e694039b4f3e
2016-02-18 21:01:01 +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
Brad Jorsch
2257fe4228 Revert "Remove SessionManager, temporarily"
This reverts commit 823db5d63dd5200d04c63da50ba6bf16f928e70b.

Change-Id: Ibb3e023e4eb6715295586dea87d0725c344a8271
2016-02-03 21:44:59 +00:00
Brad Jorsch
5083e810eb Remove SessionManager, temporarily
The plan here is to take it out of 1.27.0-wmf.12 and put it back in
1.27.0-wmf.13.

Since BotPasswords depends on SessionManager, that's getting temporarily
removed too.

This reverts the following commits:
* 6acd424e0d SessionManager: Notify AuthPlugin before calling hooks
* 4d1ad32d8a Close a loophole in CookieSessionProvider
* fcdd643a46 SessionManager: Don't save non-persisted sessions to backend storage
* 058aec4c76 MessageCache: Don't get a ParserOptions for $wgUser before the end of Setup.php
* b5c0c03bb7 SessionManager: Save user name to metadata even if the user doesn't exist locally
* 13f2f09a19 SECURITY: Fix User::setToken() call on User::newSystemUser
* 305bc75b27 SessionManager: Don't generate user tokens when checking the tokens
* 7c4bd85d21 RequestContext::exportSession() should only export persisted session IDs
* 296ccfd4a9 SessionManager: Save 'persisted' flag in session metadata
* 94ba53f677 Move CSRF token handling into MediaWiki\Session\Session
* 46a565d6b0 Avoid false "added in both Session and $_SESSION" when value is null
* c00d0b5d94 Log backtrace for "User::loadFromSession called before the end of Setup.php"
* 4eeff5b559 Use $wgSecureCookie to decide whether to actually mark secure cookies as 'secure'
* 7491b52f70 Call session_cache_limiter() before starting a session
* 2c34aeea72 SessionManager: Abstract forceHTTPS cookie setting
* 9aa53627a5 Ignore auth cookies with value 'deleted'
* 43f904b51a SessionManager: Kill getPersistedSessionId()
* 50c5256352 SessionManager: Add SessionBackend::setProviderMetadata()
* f640d40315 SessionManager: Notify AuthPlugin when auto-creating accounts
* 70b05d1ac1 Add checks of $wgEnableBotPasswords in more places
* bfed32eb78 Do not raise a PHP warning when session write fails
* 722a7331ad Only check LoggedOut timestamp on the user loaded from session
* 4f5057b84b SessionManager: Change behavior of getSessionById()
* 66e82e614e Fix typo in [[MediaWiki:Botpasswords-editexisting/en]]
* f9fd9516d9 Add "bot passwords"
* d7716f1df0 Add missing argument for wfDebugLog
* a73c5b7395 Add SessionManager

Change-Id: I2389a8133e25ab929e9f27f41fa9a05df8147a50
2016-02-01 22:06:49 +00:00
Brad Jorsch
f9fd9516d9 Add "bot passwords"
Bot passwords are something like OAuth-lite, or Google's application
passwords: the bot can use API action=login to log in with the special
username and password, and will then be allowed to use the API with a
restricted set of rights.

This is intended to provide an easy migration path for legacy bots and
for bots on wikis without OAuth, since AuthManager is going to greatly
complicate non-interactive authentication. If OAuth is available, an
owner-only consumer would be a better choice.

Bug: T121113
Change-Id: Iaa4015e00edbfbfaedcc8b2d27a2d3fd25009159
Depends-On: I7e15331efb162275c4116bcae61f19d6b884cbe3
2016-01-12 22:37:44 +00:00
Reedy
44cebea941 Update wfGetDB calls in Maintenance scripts to use getDB()
Change-Id: I9ad6745d84506b736dae94747256caac89715899
2016-01-02 16:58:23 +00:00
Timo Tijhof
baf1721491 resourceloader: Remove obsolete msg_resource database table
No longer used as of 5d5b269e0e.

Change-Id: Ieb8448185cf39aa396e902e025e673f0886ac3c3
2015-12-14 01:24:27 +00:00
Timo Tijhof
cbf5bacae5 resourceloader: Remove obsolete msg_resource_links table
No longer used as of Ia9131f570.

Change-Id: If009e2620e59002e127d21b90a96bdd29e5d2a9d
2015-12-14 01:23:19 +00:00
Timo Tijhof
afcfc3290c resourceloader: Consistently refer to the framework as ResourceLoader
Change-Id: Ia59e4eac9662723e80d62f7cfcb9e4292e3ee4de
2015-10-28 03:24:40 +00:00
umherirrender
271da88127 Some bugzilla.wikimedia.org -> phabricator.wikimedia.org changes
Changed some old bugzilla links to new phabricator links in comments,
test data and error message. This reduces the need for redirects from
old bugzilla to new phabricator from our source code.

Change-Id: Id98278e26ce31656295a23f3cadb536859c4caa5
2015-09-24 17:17:25 +02:00
jenkins-bot
53a43bb651 Merge "Reorder backlinks indexes" 2015-04-10 18:04:19 +00:00
Brian Wolff
5d9b67e09e Allow edit summaries to be up to 767 bytes long
This is just the db part. The changes to UI validation code will
come in a dependent patch later.

This changes the max size of various *_comment, *_description
and *_reason fields to be 767 bytes. This size is chosen to
be consistent with the largest we can get away with while
still having covering indexes.

It also unifies the various data types of these fields to
varbinary. (Note, this was previously done and reverted in
r80547, but I don't think the reason for revert applies to
the edit summary fields)

MyISAM has a much smaller max index size, and this wouldn't
work with that storage engine. However, none of these fields
are used in default indexes (only in WMF indexes), so this
should not be an issue for anyone using MyISAM. Postgress
and sqlite already supported the larger edit summary size.

Note: This patch increases min mysql version to 5.0.3.

Bug: T6715
Change-Id: I8558e80a18e4591f07f2c3e80f792ea4435c4e71
2015-03-11 13:36:38 +00:00
umherirrender
a086557ab8 [schema] Make column user_newtalk.user_id an unsigned int
The primary key of the user table is an unsigned int, the column
user_newtalk.user_id refer the id and should have the same typ to store
the same values as the user table does.

No pre-deployment activity necessary; no need to sync deployment
and merge; can be done at any time (now or later)

Bug: T77005
Change-Id: I641dc1fad0a5bb14815f55e0357243a562fd672b
2015-02-17 17:27:54 +00:00
Sean Pringle
7843a9e533 Reorder backlinks indexes
Bug: T89630
Change-Id: I2b04268545b9a88c584f6461f67a38fe3944c17a
2015-02-16 09:24:01 +00:00
raymond
20dc3883ec Kill hitcounter remains
Followup to Ieeb558f9523c11965cbc1941cad4f316c00c85c5
No need to create the table and drop it then

Change-Id: I11409c6e5a76d65365c5652039c584e249dbf556
2015-01-28 18:26:04 +00:00
Chad Horohoe
5f8edb2c0a Drop ss_total_views and page_counter fields from MediaWiki
Follows up removal of code using hitcounters in 90d90dad6

RFC: https://www.mediawiki.org/wiki/Requests_for_comment/Removing_hit_counters_from_MediaWiki_core
Change-Id: Ieeb558f9523c11965cbc1941cad4f316c00c85c5
2015-01-09 19:01:01 +00:00
Chad Horohoe
37440dd762 Remove patch-restructure.sql
Unused. Basically reimplemented as doSchemaRestructuring(). That
method could possibly be broken up and make more use of patch
files though.

Change-Id: Idb0a3740dd1401632f2e273ff46dd856a5d4d735
2014-09-12 11:29:35 -07:00
rillke
9665a657b0 Add "chemical" major MIME type to the image tables
The American Chemical Society suggested a new major MIME type for files
containing chemical data in 1998: http://dx.doi.org/10.1021/ci9803233
This suggestion got widely adopted and is now a de-facto-standard despite
not registered with IANA.

Applying this patch will allow us to continue with extension MolHandler
and PDBHandler.
http://fab.wmflabs.org/T352

- Fixes bug 66412 by creating a logic that will prevent running unneeded
  updates.

Bug: 66412
Change-Id: Ic45dc1bce796a0406ed8a84e6274df1c4bda4967
2014-08-25 19:13:35 -03:00
umherirrender
6b4c44c2db Add missing @param to function docs
Change-Id: Ib26407bc55dff7969d8a3b1e2ae51751b202d8fb
2014-08-18 16:24:59 +00:00
withoutaname
2ed4b32450 Change "ENGINE=HEAP" to "ENGINE=MEMORY"
"Memory" is the preferred term, see
https://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html

Change-Id: I1fd05d027903af6023002dd357998ce5f2606708
2014-08-12 17:23:31 +00:00
rillke
c31fbf073e Unify the spelling of MIME in documentation
Writing MIME as written in Wikipedia and some documentation clean up.

Change-Id: I9dfc36d2bf55d72d9374c4075bd6d45eef0415a4
2014-08-07 23:38:45 +02:00
Aaron Schulz
b8c038f678 Redo WhatLinksHere query and add a *_from_namespace field to link tables
* Also tweaked the query so MySQL avoids doing a page_name
  index scan when it should start with the link table index
* Added population script (triggered by update.php)
* Also removed uniqueness from some indexes where it is redundant
* Renamed two confusing variables

Bug: 60618
Change-Id: Icca99b6ae0ef76cb77695faf82c615516191da36
2014-07-21 12:04:56 -07:00
Kunal Grover
50144cd02a First version of Page Language selector
Special page PageLanguage to set the page language of a page.
To enable the feature, set $wgPageLanguageUseDB to true
and assign the 'pagelang' user right to a user group.

Bug: 35489
Change-Id: I0f82b146fbe948f917c1c5d29f7469644d797e80
2014-06-27 23:27:07 +00:00
umherirrender
e121205cb3 Correct comment about getPropsFromPath/sha1Base36 in sql files
The function of class File are deprecated, so change comment to FSFile.

Change-Id: I2350b2d6d6b09d4d2f6d64ab04891e0911595cb0
2014-06-23 20:58:37 +02:00
Brad Jorsch
c396f11ab3 Add wl_user_notificationtimestamp index
Bug: 65246
Change-Id: If3e9e855c8a21874ca69c4976af207833dcc53f2
2014-06-04 06:05:38 +00:00
umherirrender
2b441eba40 Drop rc_cur_time from recentchanges
Field was removed in 1.23 from sql statements, but kept to allow easier
rollback on version update from 1.22 -> 1.23, when something gets wrong
with the new version.

Bug: 40667
Follow-Up: I4a9c2fa813d1f25dfb755e564f7677a212934d7b
Change-Id: I48989aceec31019f0b6c98aaeafaf60e975244df
2014-05-15 17:10:16 +00:00
jenkins-bot
bd2a78a159 Merge "Introducing pp_sortkey." 2014-04-24 21:42:07 +00:00
daniel
b1d6e78f74 Introducing pp_sortkey.
This adds the pp_sortkey column to the page_props table.

pp_sortkeys allows for top-k queries for pages, e.g.
the 100 pages with the most language links, etc. It is also
possible to query for exact values.

For now, pp_sortkey will contain pp_value's numeric value if
the value was set to a float, int or boolean.

Associated tasks:
* create a maintenance script for populating pp_sortkey. Tricky,
because when reading from the database, all values are strings.
* create an API module for querying pages by property value.

bug: 58032
Change-Id: I217c42656fb877ff35a36eb446a22bdaf119faac
2014-04-24 05:26:41 +00:00
Siebrand Mazeland
c331f11991 Update formatting in maintenance/ (1/4)
Change-Id: I0be8111b6ff1feb9f3a4096a96a9c6a6e40feb05
2014-04-23 20:08:06 +02:00
csteipp
01c8c421f8 Password Expiration
Add functionality to expire users' passwords:
 * Adds column to the user table to keep a password expiration
 * Adds $wgPasswordExpirationDays, which will force users to reset
   their passwords after a set number of days. By default, this set
   to false, so passwords never expire.
 * Adds a default grace period of 7 days, where if the user's password
   is expired, they can still login, but are encouraged to reset their
   password.
 * Adds hook 'LoginPasswordResetMessage' to update reset message, in
   case an extension wants to vary the message on a particular reset
   event.
 * Adds hook 'ResetPasswordExpiration' to allow extensions to change
   the expiration date when the user resets their password. E.g., if
   an extension wants to vary the expiration based on the user's group.

If the user is in the grace period, they get a password reset form
added to the login successful page. If an extension prevents showing
the login successful page (like CentralAuth), it should be updated to
show a password change form during the grace period. After the grace
period, the user will not be able to login without changing their
password.

Also prevents a successful reset if the user is "changing" their
password to their existing password.

No passwords will expire by default. Sites will have to call
User->expirePassword() from their own maintenance script to trigger a
password reset for a user.

Bug: 54997
Change-Id: I92a9fc63b409b182b1d7b48781d73fc7216f8061
2014-02-20 09:41:51 -08:00
Aaron Schulz
b57e457091 Added a page_links_updated column for job de-duplication
Change-Id: I74b6f507ef7371db92e0c3f058d38c0ca5dea9ef
2013-12-24 10:54:32 +00:00
Jackmcbarn
65a304c444 Add index on logging.log_user_text
Fixing bug #54404 requires querying against logging.log_user_text, which
is currently unindexed. Add an index, to prevent performance from being
adversely affected by the fix.

Bug: 54432
Change-Id: I6b2af65c75bbee57377cb1ec2e75ea41a5091f80
2013-12-19 03:13:05 +00:00
umherirrender
13aebc4e40 Remove SQL patches for old table 'validate'
The table has been unused and dropped since 1.8,
so there is no need to keep the patches for the updater.

See https://www.mediawiki.org/wiki/Manual:Validate_table

Change-Id: Iaadf1115ff6e6cba986c5402320da78ba3c2a8f4
2013-11-16 10:45:39 +00:00
Erik Bernhardson
6bbd4bca6c Revert "Revert "Add new recentchanges field rc_source to replace rc_type""
This reverts commit 113f49bb21 after the
schema change has been completed.

Change-Id: I5412466444526986e1209d0982dd62cd5b387ad1
2013-10-25 13:10:42 -07:00
Mwalker
0df93e8f76 Merge "Split change_tag sql patch" 2013-10-18 18:57:38 +00:00
tisane
9b2b027ba7 Add archive, externallinks PK
* New fields: ar_id, el_id. el_id is presently not used for
  anything, but will help with online schema changes.

Bug: 15441
Bug: 39675
Change-Id: Ib6b0fc3736d173fa4ba7b786ecfc710b2f4711bb
2013-10-17 18:43:40 +01:00
Reedy
113f49bb21 Revert "Add new recentchanges field rc_source to replace rc_type"
No feature flag, and also not deployed on WMF wikis. Asking for schema changes by the time we branch tomorrow is just unfair

This reverts commit e478c230f6.

Change-Id: I125c30e76fa04679cc04ae7b8728ae3a61f35194
2013-10-17 00:32:40 +00:00
Erik Bernhardson
e478c230f6 Add new recentchanges field rc_source to replace rc_type
The existing field to differentiate between kinds of recentchanges rows is
the rc_type field. We want to allow extensions to insert their own custom
data into recentchanges, but we have learned via the NS_* series of constants
that requiring extensions to "register" a specific number is very error prone.

The solution, which this commit implements the first phase of, is to utilize
a new 16 byte string field rc_source.  Within that field change types will be
prefixed strings such as 'mw.edit' and 'mw.new'.

This commit adds the new field and begins populating it with data.  At some
point in the future the rc_type field will be dropped.  While WMF wiki's will
simply wait out the 30 day recentchanges history, other wiki's have the option
of letting update.php populate rc_source, or manually applying the db change and
utilizing the PopulateRecentChangeSource maintenance script.

Change-Id: Iaddd6c446373a68d31586ed54346db7d04e13b2c
2013-10-16 11:35:20 -07:00
addshore
ebf3e7c58d Split change_tag sql patch
After pulling master and some extensions and
running the update script these tables are not
created when needed.

DB returned error "1146: Table 'my_wiki.valid_tag'

This is probably a broken edge case

This patch splits the patch into three seperate
patches ensuring all of the tables are created if
they dont already exist

Change-Id: I79c740dc4ec68d3c5aa0572dc77ea3ac8d305db9
2013-10-04 21:03:44 +02:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
Chad Horohoe
36cade5fe8 Remove ExternalUser authentication code
This was an experimental authentication system intoduced a couple
of years ago with a pretty narrow use-case. It's been pretty much
ignored since introduction, and makes login more complicated than
it needs to be.

I didn't drop the external_user table on the off-chance someone
out there actually has data in it, but they should use AuthPlugin
for their external authentication needs.

Change-Id: I794338dbb75961ee033d41fa44bb7aa22e54f447
2013-04-04 10:09:34 -04:00
Brad Jorsch
c013ec02b9 (bug 36400) API: Fix sorting for iwlinks, langlinks
The iwlinks and langlinks modules continue parameters imply ordering by
page then prefix then title. But in certain modes, the actual queries
use a different ordering, which may result in skipped or repeated
results.

This changeset fixes that. To do so, it needs to re-add an index
iwl_prefix_from_title which was mistakenly removed in 2010 (r69721). And
while it's doing that, it cleans up errors in the sqlite and postgresql
handling of the iwlinks indexes too.

Also, per Asher, make the iwl_prefix_from_title and
iwl_prefix_title_from indexes non-UNIQUE.

Change-Id: I607e8bf9183a2d8152a6127a81c83a0b5bba0c61
2013-04-03 13:22:20 -04:00
Jan Gerber
9c40037b00 add index to image table to query by type
this speeds up Special:MIMESearch and allows
queries for all files of one type.

Change-Id: I85715b0553a771ab88d9763ba921923551988bd0
2013-04-01 22:33:20 +00:00
jenkins-bot
ed4db4af0a Merge "Add pp_propname_page index to page_props" 2013-02-25 22:54:48 +00:00
Antoine Musso
f6b92231fd style: normalize end of files
By PSR2 PHP Standard, the files should ends with exactly one newline.
Some of our files have 2 or more and some other were missing a newline.

Fix almost all occurences of CodeSniffer sniff:
PSR2.Files.EndFileNewline.TooMany

I have not fixed the selenium files, I believe we will drop them.

Change-Id: I89fca8c1786fee94855b7b77bb0f364001ee84b6
2013-02-03 15:04:39 +01:00
Brad Jorsch
bc4c2ef32d Add pp_propname_page index to page_props
This adds an index to page_props to support looking up pages using a
particular property.

Change-Id: Iea778eb783e1d4a46fb0549dfd84915477cac5df
2013-01-21 22:08:10 +00:00
Reedy
0c5301a0d1 Bug 11057 - Increase size of ug_group in user_groups table
Change-Id: I79fd5c6e1566de3145ac39420da4fce77099745a
2013-01-02 20:32:42 +00:00
Aaron Schulz
e5d41cca90 [Upload] [Schema] Added us_props column to avoid expensive GETs.
* We already compute the props when stashing, so including that in a column
  lets us reuse it later when the stashed file is to be published.

Change-Id: I3d6adb6528f1e992d8986058806e745c4e1c0300
2012-12-03 10:23:40 -08:00
Aaron Schulz
cd000590ee [JobQueue] Added support for retrying jobs when runners die.
* This adds a new 'claimTTL' setting which recycles jobs into the queue
  if they have been claimed for longer than that duration (in seconds).
* This also purges jobs for such cases when job retries are not enabled.
* This adds a new job_attempts column and adds an index to improve the
  query and semantics for FIFO ordered queues.

Change-Id: Idb6217a694d86a4d6fc881768deed424628f015d
2012-11-14 01:25:03 +00:00
Reedy
cc18322559 Back out config table and related code
Change-Id: I4fa180d45984a4ec2b2c7b1149015c6dad14c5f0
2012-10-29 15:17:24 +00:00
umherirrender
e5f5e95137 Fix indentation whitespace errors
Change-Id: Ie268bee2098c589c050e1b5b0e93fe1b3feca86f
2012-10-26 17:42:13 +02:00
umherirrender
e256c69f9a Remove a bunch of trailing spaces and unneeded newlines
Change-Id: If9fb04f64389b9b40c13f3372ad4792c2e14def0
2012-10-20 13:35:38 +02:00
ASchulz
b567f3602e [JobQueue] Job queue refactoring and generalizing.
* Added support for different queue types and methods for storing queues.
* Treat each job type as being on its own queue, at least logically.
* Added $wgJobTypeConf to configure queue types for each job type.
* Improved the job DB table so that duplicate job checks actually work
  and are faster. Also improved the method for popping rows of the table.
* Disabled duplicate job removal for everything except refreshLinks.
  The DELETE statements just add DB overhead and are not useful for cheap
  jobs, especially ones with start/end params (which are unlikely to have
  exact duplicates).

Change-Id: I49824c7fa855fea4ddcac5c9901ece8c2c0101d0
2012-10-16 09:39:58 +11:00
umherirrender
fb2c1c645b Add separate fa_sha1 field to filearchive table
This allows sha1 searches with the api in miser mode for deleted files

Added script to populate the rows
Adding new field to selects and handle it in all places, where needed

Using a 10 byte index for the new field per
http://lists.wikimedia.org/pipermail/wikitech-l/2012-September/063429.html

Change-Id: Ie54a513fe361202e63df44be44a0fdd91926c974
2012-10-14 20:58:25 +02:00
jeroendedauw
7389d7c690 Added sites functionality, a much more generic and flexible version of the existing interwiki code
This code is meant to replace the current interwiki code, but does not do so just yet. It is however used by the Wikibase extension. This allows us to try out some more things and have the code stabilize more before we migrate over existing interwiki functionality.

Change-Id: I23c47c2c3909a1500350fb560a5f2ec654e2c37e
2012-10-12 17:47:44 +02:00
daniel
c546fae8ed merge latest master into Wikidata branch
Change-Id: Id4e0f40c03679c13d8934a6add99b5cd86d0437d
2012-10-08 13:58:54 +02:00
Aaron Schulz
11f49919c0 Merge "Truncate SHA-1 indexes" 2012-10-02 23:54:16 +00:00
umherirrender
e6a6b33567 (bug 34960) drop unused fields rc_moved_to_ns/rc_moved_to_title
Change-Id: I68e8c0bb23f185c0f996a8905f6d437db3080aa1
2012-09-29 17:19:40 +02:00
umherirrender
bd602d2083 Drop unused database field ss_admins
no longer updated since 1.5

Change-Id: Iebdce084d178b5003105b2d2b7dcc499c274ff56
2012-09-29 12:20:21 +02:00
Tim Starling
0d044e6071 Truncate SHA-1 indexes
Per Asher Feldman's suggestion on wikitech-l, truncate DB indexes which
hold SHA-1 values, so that the space usage is reduced at the expense of
a very small overhead when selecting values that have colliding
truncated hashes.

Change-Id: I059de4f7bba9a949cf0a93a57df32226c41d8ce0
2012-09-26 14:09:38 +10:00
Marius Hoch
652c4be7c2 Clean up: Declare variables with public instead of var
Variables in classes should be declared using public $foo
instead of var $foo for various reasons. As we require PHP 5.3
we don't have to take care about that PHP4 left over, but can
get rid of it in favour of the more clear and better readable
public.
See also: http://php.net/manual/en/language.oop5.visibility.php
(Divided into several commits to keep reviewable)

Change-Id: Ic723d0347ab2e3c78bc0097345c68bbee3dc035a
2012-09-14 21:00:00 +02:00
daniel
12166f46b4 merged master (2012-09-11)
Change-Id: I8e953eaa22f9d331b0af5e780fbeff6d702b23e3
2012-09-11 11:43:02 +02:00
umherirrender
0cbc85494d (bug 32552) Drop unused database field cat_hidden
For the hiddencat feature the page prop table is used

Change-Id: If01d3394617ab8aec1a9b50c20bfe923df08732c
2012-09-06 18:47:39 +02:00
daniel
b6fe213226 merge latest master.
some tests fail due to logical changes, will fix that in a follow-up

Change-Id: I8a5e4087ecf674fbcf6327c5d168cd401be12400
2012-09-05 17:50:13 +02:00
Alexandre Emsenhuber
dd6613b6bd Added missing GPLv2 headers in maintenance scripts.
- made file/class documentation more consistent
- contains a fix for Id7a04ff8 (2a7478b)

Change-Id: I5264105ce1b6ad86a9840e05be1af99f5d6e252a
2012-09-04 18:48:17 +02:00
daniel
9994968774 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 15:20:15 +02:00
Daniel Kinzler
392af46809 Revert "merged master"
This reverts commit 67bfdc7a68
2012-08-29 13:14:49 +00:00
daniel
67bfdc7a68 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 12:06:38 +02:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
daniel
29719f846b merging latest master
Change-Id: I36b7f2f63ab8c08f8412d521dc68ea45c8b67711
2012-08-20 16:55:28 +02:00
Aaron Schulz
4bdad0e395 Removed useless fj_path_sha1 field to save space.
* Searches by path are not used by any code, and small blobs
  are stored with the rest of the row in innoDB, so there is
  no gain there. The field is mostly a hangover from a use case
  that never materialized (where it would be indexed).

Change-Id: I5515f15bd35823736138a79a4942c7207e519e5c
2012-08-10 23:03:38 -07:00
daniel
906a1ba51f [bug 37746] string ids for content model and format.
The content model is stored as a varbinary(32), the format
as varbinary(64).

If the standard model resp. format is used, null is written
to the database instead of the actual id, saving space.

Change-Id: I32659b49a9ad3cb8ecae9019562cff7de42b65f9
2012-06-26 15:56:06 +02:00
daniel
250da851d1 merged master 2012-05-29 17:01:13 +02:00
Reedy
328739710a At least use /*$wgDBTableOptions*/; if passed through MW
Change-Id: I7ed0ae6223d362e24121836a290a6e159d672878
2012-05-17 23:31:35 +01:00
daniel
01f36b721f merged latest master 2012-05-14 23:24:18 +02:00
daniel
cbc2014b2d Use integers for content_model and content_format.
Representing content_model and content_format as integers in the
database was suggested by Asher mainly to save space.

This change entails some refactoring and renaming, but no big
change in logic.
2012-05-14 10:22:52 +02:00
Marc A. Pelletier
7694faf68f (bug 5445) remove autoblocks when user is unblocked
Previously, whenever we blocked a user, its IP address would be
autoblocked whenever he tries to edit a page. Thus when later unblocking
the username, he would be automatically blocked again if we forgot to
clean up is IP.

This patch introduces a the ipb_parent_block_id column in ipblocks table
to track which block triggered the autoblock command. Thus, when deleting
the original block we can easily remove all subsequentautoblocks.

Schema updaters for MySQL, SQLite and postgres have been added to the
patch but not for the other database types such as ibm_db2, mssql and
Oracle.

Change-Id: I4aa820ae9bbd962a12d0b48b6c638a1b6ff4efc9
2012-05-03 12:07:30 +02:00
daniel
a990fd78ff merged from master 2012-04-25 19:49:09 +02:00
Aaron
4e4b11a620 [FileBackend] Simplified fj_batch_id index
If we want to sort the ops for a batch ID, we can just use a tiny to small filesort.
No need to make the index bigger.

Change-Id: Ibf7592930ec633a26e675e33d42aebe7763547b1
2012-04-12 18:26:41 -04:00
Jens Ohlig
10e91851b2 Merge branch 'master' into Wikidata
Conflicts:
	.gitreview
	includes/Article.php
	includes/AutoLoader.php
	includes/EditPage.php
	includes/LinksUpdate.php
	includes/WikiPage.php
	includes/installer/Ibm_db2Updater.php
	includes/installer/MysqlUpdater.php
	includes/installer/OracleUpdater.php
	includes/installer/SqliteUpdater.php
	maintenance/refreshLinks.php
2012-04-11 14:24:29 +02:00
Daniel Kinzler
49d903ef22 installer/updater 2012-04-04 19:54:32 +02:00
Aaron Schulz
4e811c0c7f Reduced file journal index bloat by removing indexes that would only be
used in rare cases and where we'd almost always only be interested in very
recent entries only (timestamp is indexed). This should decrease insertion
time a bit.

Change-Id: Idb33ee3229315c44b764a8ed476afe8760f5595c
2012-04-03 17:26:04 -07:00
Aaron Schulz
215be530dd [FileBackend]
* Added FileJournal class to log file changes for file backends. This can be used for migrations (like moving to Swift), syncing mirror repos, consistency checks, finishing/reverting operation batches, and such. The default journal is the "null" journal, which simply does nothing.
* Added the optional schema change required for using the DBFileJournal (MySQL, SQLite).

Change-Id: I33c9f9a598ba1f164c862b9dc3c718f9172db02b
2012-03-27 15:27:14 +11:00
Roan Kattouw
0fca9a7991 Revert r107309, r113601, r113704, r113742, r113792, r113838, r113859, r113893, r113894, r113952, r114047, r114252, r114256, r114257. This reverts the remaining 'new' revisions in core.
All of these revisions are tagged with 'gerritmigration' and will be resubmitted into Gerrit after the Gerrit switchover. See also http://lists.wikimedia.org/pipermail/wikitech-l/2012-March/059124.html
2012-03-21 00:16:50 +00:00
Aaron Schulz
d19f54602f [FileBackend]
* Added FileJournal class to log file changes for file backends. This can be used for migrations (like moving to Swift), syncing mirror repos, consistency checks, finishing/reverting operation batches, and such. The default journal is the "null" journal, which simply does nothing.
* Added the optional schema change required for using the DBFileJournal (MySQL, SQLite).
2012-03-13 01:46:33 +00:00
Sam Reed
5f230a3a19 Can someone standardi[sz]e SQL already!?
Might aswell change mysql to same format as the sqlite one is becoming

Ping r113110
2012-03-06 00:26:48 +00:00
Sam Reed
64ac200ca3 Pull patch-revision-user-page-index.sql from r25267 2012-03-06 00:05:48 +00:00
Sam Reed
c55b05831f Pull 1.19wmf1 related patches/code out of trunk/REL1_19, they exist in 1.18wmf1 and 1.19wmf1 now 2012-02-13 15:53:06 +00:00
Asher Feldman
c4e632e1b8 article_feedback migration included in wmf 1.19 deployment 2012-02-09 01:18:32 +00:00
Sam Reed
790925d3ac Not much point making user_groups.ug_group 32 chars if we leave user_former_groups.ufg_group at 16
Also fix modify field to use correct table/column
2012-02-06 16:07:52 +00:00
Antoine Musso
44b06f908e reverts Concurrency works
trunk is frozen pending stabilisation so we can release MediaWiki 1.19.
Those changes introduces API changes and new SQL tables, so that sounds like
new feature we do not have time to review right now.

Please reapply changes in branches/concurrency and have code review handled
there. Once the branch has been reviewed, please hold. Once trunk is stable
enough and 1.19 got branched, you are welcome to merge the branch in trunk.

Note: we can have a Jenkins jobs setup to run the branch tests if you need.

Reverts:
r108595 r108591 r108585 r108584 108572 r108564 108560 r108559
2012-01-11 09:05:56 +00:00
Ian Baker
b3c84ce261 MERGE branches/concurrency 108301:108557 into trunk 2012-01-10 23:03:03 +00:00
Aaron Schulz
54e63c6abc Reverted r108502, r108504 per CR 2012-01-10 18:05:36 +00:00
Sam Reed
cc8a1f1106 Cleanup "text" (nee old) table, dropping old indexes and fields
Add oldwatchlist to dropAncientTables
2012-01-10 15:04:05 +00:00
Sam Reed
faca3cb2e7 * (bug 27724) Add timestamp to job queue.
Designed for administration purposes, not to be exposed to front end users

Useful for administration purposes (like WMF with job runners), we can look at the "highest" jobs, and find out whether enwiki is just busy, or the jobs have been there a while (signalling that the job runners potentially have issues)
2012-01-03 15:08:05 +00:00
Jan Gerber
0095c08ed2 Use database to track uploaded chunks and concatenate at the end.
with i18n documentation dont break phpunit

follow up r93720
2011-11-30 14:56:40 +00:00
Roan Kattouw
e83bb90997 Revert r104659 and its followup r104665: break the unit tests with a fatal error. This cripples our CI system, we can't detect new failures this way. 2011-11-30 13:54:35 +00:00
Jan Gerber
d70c169b90 Use database to track uploaded chunks and concatenate at the end.
follow up r93720
2011-11-30 08:55:16 +00:00
Chad Horohoe
7914b2ee68 (bug 29475) Remove "trackback" feature entirely from core. This has been disabled-by-default since its inception and nobody uses it.
If someone really really wants this, they can write an extension.

Language files need rebuilding, but I took care of En and messages.inc.
2011-11-23 17:14:03 +00:00
Sam Reed
c6b3c2f05b * (bug 32470) Increase the length of ug_group
Postgres doesn't need extending...
2011-11-19 16:26:28 +00:00
Jure Kajzer
12dabfbc10 * applyed the patch from bug 26393 (please comment on the bug page) 2011-11-11 14:28:44 +00:00
Aaron Schulz
c326cab516 Reinstated r94289 et all - rev_sha1/ar_sha1 field for bug 21860 2011-10-27 18:44:10 +00:00
Sam Reed
937fc3bcfd Back out r95396 and friends 2011-09-29 22:08:00 +00:00
Sam Reed
eda06e8593 * (bug 31204) Remove old user.user_options
Added run of ConvertUserOptions maintenance script into update.php before dropping the column

Removed usages of user_options in code

Marked User::decodeOptions() deprecated as of 1.19.

Made ConvertUserOptions drop out early if the user_options field doesn't exist

Made ConvertUserOptions update user_options to '' after migration of user options to mOptions
2011-09-28 18:08:48 +00:00
Sam Reed
44020e254c Merge the iwtransclusion branch back into trunk
Hexmode fixed broken unit tests in revisions after last time
2011-08-24 13:03:03 +00:00
Raimond Spekking
4b67a02c09 fu r94541: Delete empty files 2011-08-18 07:49:10 +00:00
Brion Vibber
5ce010f85c Revert r94289, r94290, r94294, r94333, r94345, r94362, r94370 -- core schema change with no discussion 2011-08-15 18:24:38 +00:00
Aaron Schulz
606872436b * Added rev_sha1 and ar_sha1 columns to revision/archive tables (useful for bug 25312)
* Created a script to populate these fields (doesn't handle archive rows without ar_rev_id set though)
2011-08-11 21:52:54 +00:00
Sam Reed
6026ca43ea Followup r93211, add log_timestamp to end of the index 2011-08-11 12:49:30 +00:00
Sam Reed
183d2dab37 Back out r93533, r93531, r93530
Breaks unit tests as below, not going to be able to fix them before I disappear for the evening, so might aswell leave trunk clean

ArticleTablesTest testbug14404

Error:
ArticleTablesTest::testbug14404
Undefined offset: 0

/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/ArticleTablesTest.php:31
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60

ParserTests testParserTest #552 - testParserTest with data set #551

Failure:
ParserTests::testParserTest with data set #551 ('RAW magic word', '{{RAW:QUERTY}}', '<p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
</p>', '', '')
RAW magic word
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-<p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
+<p><a href="/index.php?title=Template:RAW:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:RAW:QUERTY (page does not exist)">Template:RAW:QUERTY</a>
 </p>

/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/parser/NewParserTest.php:545
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60
2011-07-30 15:56:54 +00:00
Sam Reed
dc9d39887e Merge iwtransclusion branch into trunk 2011-07-30 15:30:01 +00:00
Sam Reed
53b0d17a11 * (bug 22744) Add/Update indexes for queries done by the API
Add index to logging table accross log_type and log_action
2011-07-26 17:03:14 +00:00
Aaron Schulz
c0659401d4 Follow-up r86482, r86485: removed user_name portion of user_email index per CR 2011-07-23 08:15:11 +00:00
Ian Baker
c2e2c8270e Added us_status column for future expansion re Bryan's suggestion
Implemented changes suggested in code review on r92009:
 constructor bug handling passed repo/stash
 up-to-date timestamp generation
 fetching db handle from repo
 iterating over select results according to convention
 changed uploadstash.us_media_type to enum to mirror image.img_media_type
 removed (most) new references to $wgUser, instead using ApiBase::createContext to find the user
2011-07-13 19:08:51 +00:00
Ian Baker
3d780db426 Added index for abandoned uploads maintenance script 2011-07-13 00:38:04 +00:00
Ian Baker
5763a028d9 changing smallint to int for image sizes, re bug 26179 comment 13 2011-07-13 00:21:02 +00:00