Commit graph

65 commits

Author SHA1 Message Date
Max Semenik
55a9b2f8b6 Finish migration to Maintenance::getBatchSize()
Change-Id: I02d89f71d820e4d00a39e86a30397b614bbdb432
2017-11-07 19:35:11 -08:00
Max Semenik
dac20d0ffa Introduce Maintenance::getBatchSize()
Just to isolate the internals. Fix most of usages in the core.

Change-Id: I8b3e9ca1f42b7c49ee57f17b88ca2fc7b404f342
2017-11-05 13:26:12 -08:00
Brad Jorsch
11cf01dd9a Add comment table and code to start using it
A subsequent patch will remove the old columns.

Bug: T166732
Change-Id: Ic3a434c061ed6e443ea072bc62dda09acbeeed7f
2017-08-30 15:05:00 +10:00
Umherirrender
3f1a52805e Use short type bool/int in param documentation
Enable the phpcs sniffs for this and used phpcbf

Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
2017-08-20 13:20:59 +02:00
Jesús Martínez Novo
c9cc6a299b Fix overzealous addQuotes for rc_source field in rebuildrecentchanges.php
Those quotes aren't needed since those constants are being used as an array
value and the database methods already quotes them. It caused the field to
be double-quoted and being inserted with quotes on the database.

Bug: T172205
Change-Id: I050f8d477600ee44794b7525a119b3d4451e5a28
2017-08-03 09:09:36 +00:00
mdew192837
09a5d5edd8 rebuildrecentchanges.php: Make purgeFeeds() use the correct cache
ChangesFeed was updated in 3517be1cf0, to use the WAN cache,
so this change updates the purgeFeeds() function to use that cache
too.

Avoid the deprected wfMemcKey() too.

Bug: T166195
Change-Id: I28a8d729737f03ccaf069495a59e80401c59e778
2017-05-25 12:29:34 -07:00
Aaron Schulz
4c08bf8d96 Avoid using cascadingDeletes()/cleanupTriggers()
Simplify DB callers by just having one code path.
All but some very old code paths bothered with these.

Change-Id: Iaf7a2f83146a0ed15995f9cfc74edcf16ae5a448
2016-09-18 02:05:07 +00:00
Aaron Schulz
b09a23f284 RebuildRecentchanges improvements
* Always delete entries in the time range
* Batch queries and wait for slaves
* Optimized size-fetching query (pass 2)
* Set with rc_type with the actual constants (pass 2)
* Avoid flagging non-bot accounts as 'bot edits
* Use more modern DB layer coding style

Bug: T133053
Change-Id: I55cc099bf40977fa9e0a365da104c208441eec00
2016-04-19 13:52:40 -07:00
Bartosz Dziewoński
50f54d99c9 rebuildrecentchanges: Allow rebuilding specified time range only
Bug: T133053
Change-Id: I8eef6e72f1105352116248548ab077fef818a8f9
2016-04-19 20:20:48 +02: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
Max Semenik
59db24e90b Use addDescription() instead of accessing mDescription directly
Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
2016-01-30 01:28:32 -08:00
Bartosz Dziewoński
59f5c5fdd7 rebuildrecentchanges.php: Don't create duplicate entries for upload logs
There are a few cases where we generate both a page revision and a log
entry for a single action (upload; in the future, maybe also move,
protect), but only one recent changes entry (matching the log entry).

Bug: T116809
Change-Id: Ib95a6cb57a942a0758091ff2db9d29f3c0048598
2016-01-21 23:02:54 +01:00
Reedy
44cebea941 Update wfGetDB calls in Maintenance scripts to use getDB()
Change-Id: I9ad6745d84506b736dae94747256caac89715899
2016-01-02 16:58:23 +00:00
Bartosz Dziewoński
17be4be421 rebuildrecentchanges.php: Document a little bit
Change-Id: I44db7a5322566aa0fb47ee07df50ebabcda9cc2d
2015-12-29 12:29:24 +00:00
Kevin Israel
b43ac16fcc Remove use of strencode() outside Database classes
Change-Id: Idbc38d8089541e5154b2601297b429f7433fd59e
2014-06-02 13:45:26 -04:00
Siebrand Mazeland
606c680b21 Update formatting in maintenance/ (4/4)
Change-Id: I6b58d014a4bfd6600e4e6f80188fdcfce18482ca
2014-04-23 20:09:26 +02:00
Siebrand Mazeland
89d8c583d7 Pass phpcs-strict on maintenance/ (2/8)
Change-Id: I69e2bca3c98fe9d3713c852699f49b7b4c868338
2014-04-22 21:25:47 +00:00
umherirrender
53ba5b276a rebuildrecentchanges.php leaves some rc_source empty
Adding the missing field to some queries.

Change-Id: I04b228b06d94b79fd488b370694cdf698d1901a6
2014-01-12 13:43:45 +01:00
umherirrender
974562aee9 Remove recentchanges.rc_cur_time from sql statements
Field is unused since many versions, so remove the use in sql
statements, to allow dropping in a later version.

The field must not be reference from INSERT because it has a default
value, which is used, when no value is specified in the statement.

Keeping the field allows easier rollback on version update, when
something gets wrong with the new version.

Existing Comment in tables.sql was added with r101293, was already
disused in r11088

Bug: 40667
Change-Id: I4a9c2fa813d1f25dfb755e564f7677a212934d7b
2013-11-09 18:20:54 +01: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
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
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
Timo Tijhof
50e7985d4d phpcs: Fix WhiteSpace.LanguageConstructSpacing warnings
Squiz.WhiteSpace.LanguageConstructSpacing:
   Language constructs must be followed by a single space;
   expected "require_once expression" but found
   "require_once(expression)"

It is a keyword (e.g. like `new`, `return` and `print`). As
such the parentheses don't make sense.

Per our code conventions, we use a space after keywords like
these. We appeared to have an unwritten exception for `require`
that doesn't make sense. About 60% of require/include usage
was missing the space and/or had superfluous parentheses.

It is as silly as print("foo") or return("foo"), it works
because keywords have no significance for whitespace between
it and the expression that follows, and since experessions can
be wrapped in parentheses for clarity (e.g. when doing string
concatenation or mathematical operations) the parenthesis
before and after basiclaly just ignored.

Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
2013-05-09 05:56:26 +02:00
umherirrender
bfb75bc8e2 Fixed spacing around parenthesis in languages/tests/maintenance
Change-Id: Idd4299d17f1fcf98ab1d635484cb4e880f35ee24
2013-04-28 15:57:34 +00:00
umherirrender
b114f5e1c1 Fixed some spacing in maintenance folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I9657f72996358f8c1c154cea1ea97970d973723c
2013-04-18 20:48:44 +02:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
umherirrender
9c7a84550b Use User::getGroupsWithPermission
Change-Id: Iba44440600484b9f2525805a1c80df50d5335c1a
2012-10-02 23:51:48 +00: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
Alexandre Emsenhuber
6015071beb Improve documentation of maintenance scripts.
Change-Id: I21b4fb873e88026108754eb7206e62c82648df0e
2012-08-09 19:28:14 +02:00
Mark A. Hershberger
00e3f4d8c3 re Bug 31007 - rebuildrecentchanges.php fails for Postgresql with strings for integers
Authors: "Max" and Tim Landscheidt

Unquote 'null'
2012-01-03 23:42:15 +00:00
Brion Vibber
ac49ca09b6 * (bug 31007) Fix regression in rebuildrecentchanges maintenance script
Was trying to save literal string 'NULL' into rc_old_len / rc_new_len fields due to a bug switching to database query builder methods in r77778.
2011-09-19 20:00:49 +00:00
Chad Horohoe
26505b170a Fix concern raised by Brion in r74108 (but has really existed since the maintenance rewrite). Right now, including a maintenance script causes it to execute. This is bad when you want to reuse the particular class but not have it start executing all by itself.
Until now, we relied on setting MW_NO_SETUP which was a) hacky, b) irreversable, and c) likely to be forgotten if you didn't use one of the wrappers like runChild().

Instead, move the freaky magic to doMaintenance and have *it* check if it's in a specific call stack that indicates this is being run from the file scope and should be executed. Rename DO_MAINTENANCE to RUN_MAINTENANCE_IF_MAIN so it's nice and clear what magic happens behind the require_once().
2011-01-13 22:58:55 +00:00
Chad Horohoe
47c46b454a This can be private too 2010-12-05 19:35:46 +00:00
Chad Horohoe
c169c8584e Fix copy+paste error from r77778 2010-12-05 19:34:40 +00:00
Chad Horohoe
4809fd929e One less $wgTitle, and use dbw->update() instead of raw sql 2010-12-05 05:59:02 +00:00
Mark A. Hershberger
617a5b1e15 Whitespace fixup under tha maint directory. 2010-12-04 03:20:14 +00:00
OverlordQ
b46e99b788 Partial 'reverts' of of r70608, r76539, that doesn't do what you want, you're specifying the same rc_id for every row which is wrong 2010-11-11 20:03:46 +00:00
OverlordQ
a4bb12ec9f sequence was renamed a while back but this was missed 2010-11-11 19:53:49 +00:00
Sam Reed
39c005ca79 bug 25517 Assignment in conditions should be avoided/ http://www.mediawiki.org/wiki/Manual:Coding_conventions#Assignment_expressions 2010-11-01 00:07:17 +00:00
Chad Horohoe
4c74490bb8 Big commit: kill almost every freeResult() call as useless 2010-08-08 12:27:48 +00:00
Ryan Bies
070122e8b9 DatabaseMssql class and related changes 2010-08-06 23:44:00 +00:00
Chad Horohoe
44229b50e6 Fixed a bunch of silly instances of [^!=]==\s*(true|false) 2010-06-09 11:44:05 +00:00
Sam Reed
659778619c Stylize maintenance folder.. 2010-05-22 16:50:39 +00:00
Jure Kajzer
446fd503d0 * Replaced LIMIT with limitResult call in rebuildrecentchanges.php
* Added a wrapper-function for sequence number generation and modified insertSelect in DatabaseOracle to fill missing ID-field references
2009-10-28 19:15:19 +00:00
OverlordQ
adbb5e80d6 (bug 13453) Fix rebuildrecentchanges for DB's with FK constraints 2009-10-28 18:24:04 +00:00
Alexandre Emsenhuber
6649743e0b * (bug 19055) maintenance/rebuildrecentchanges.php now purges Special:Recentchanges's RSS and Atom feed cache
Purging cache timestamps should be sufficient since it won't allow cached versions to be used.
Also fix some errors in docs/memcached.txt.
Based on a patch by Jidanni - http://bug-attachment.wikimedia.org/attachment.cgi?id=6187
2009-08-28 18:04:40 +00:00
Alexandre Emsenhuber
44729064cd * batch change for "while ( $row = $db->fetchObject( $res ) )" and similar to "foreach ( $res as $row )"
* identation fix in nukeNS.php
2009-08-17 21:15:31 +00:00
Chad Horohoe
567f244e36 Revert r54244 which was stupid and fix this properly. Require commandLine.inc/Maintenance.php using the full path every time. 2009-08-03 21:56:41 +00:00
Chad Horohoe
a1c51e18af Merge maintenance-work branch (now with less errors!):
* Docs have been updated to indicate the standard on how to write maintenance scripts (MW.org docs will follow) Have ported vast majority of maintenance scripts to new format. Remaining ones (mostly FiveUpgrade-related) are a bit more tricky. commandLine.inc is untouched for now. Many have gotten code-style updates as well. Deleted .inc files were only used by their .php counterparts, and have been merged into single files.
* (bug 11867) Lock error on redirect table when running orphans.php
* (bug 16322) Allow maintenance scripts to accept DB user/pass over input or params
* (bug 18566) Maintenance script to un/protect pages
* initStats overhaul, now uses class SiteStatsInit. Also fixes bug 18930
2009-08-02 19:35:17 +00:00