Commit graph

151 commits

Author SHA1 Message Date
Kevin Israel
b0647c30bc Maintenance: detect missing parent::__construct()
The first time I forgot to include that line in a maintenance script,
I spent a few minutes debugging "Notice: Undefined variable: IP".
Hopefully, this change will save someone else a few minutes of his
or her own time.

Change-Id: Icd26a5dc59e25d2bcc6da9bf0a2f6e95d494e5a6
2013-10-03 02:53:30 -04:00
Kevin Israel
93d0572d76 Use HPHP_VERSION constant to detect HipHop
Follows-up Ic3e769f1fbad4f7ad26dd819406796fee48c6b45.

Change-Id: I0210002c05efd79242b00592639b7be50a79020b
2013-10-03 02:33:27 -04:00
Kevin Israel
12c61d3e7f Remove remaining calls to MWInit methods
... as well as the require_once statements in includes/WebStart.php
and maintenance/doMaintenance.php, now that the autoloader lists
MWInit (since r85807 / c68957c5e3).

Also removed code paths in maintenance/userDupes.inc that seem to be
dead (class_exists( 'Revision' ) should always be true) and useless
global/require_once statements in languages/Language.php.

Follows-up Ic3e769f1fbad4f7ad26dd819406796fee48c6b45.

Change-Id: I48fd6810fdb923b3065ae98024912eb18d394415
2013-09-15 19:04:08 +00:00
Chad Horohoe
539ec5ffa3 Pass content to SearchUpdate rather than raw text
This is still less than ideal, but at least consolidates the
logic so we can later implement more content-specific handling.

Change-Id: Ic24a7ea2818f6eeb67453877dc5a31f110541ecf
2013-06-19 16:40:46 -04:00
Aaron Schulz
3c8c5a9649 Fixed doc typo
Change-Id: I1e4ab410cd02a74e667cc8611e58ad791558896a
2013-06-14 14:14:59 -07:00
Aaron Schulz
d2dcea586d Added a --profiler option to all maintenance scripts.
* This dumps profiling information in list or trace format as specified.
* Also optimized wfProfile* function like the ProfileSection class, which
  also plays better with Profiler::setInstance().
* Fixed fatals due to wfDebug() calls in Profiler::instance() due to that
  function not yet being loaded. The calls were simply removed.
* Cleaned up file performance test script a bit.

Change-Id: I6b8cd8b30fefc1904eeeeacada7a30a46f62fe2a
2013-05-23 14:20:51 -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
umherirrender
cbc4fd7a5b print is not a function
Removed parenthesis after print

Change-Id: I1343872de7aa7c64952a3d86a63aaa091e46bda3
2013-05-09 20:06:03 +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
Kevin Israel
d311beffec Web installer: fix "Upgrade existing installation"
Fixes a regression caused by Ic166066a: when updating an
existing database, the web installer uses the DatabaseUpdater
class, which requires Maintenance.php.

Bug: 45257
Change-Id: Ie2dc80ab1e0cd9a9552b51dce6681f748aa38ab7
2013-02-23 21:16:03 -05:00
jenkins-bot
a8a08fded9 Merge "properly stop output buffering" 2013-02-22 15:36:12 +00:00
Platonides
6a6e50208a Move around/add PHP_SAPI check, making find-entries happier.
Change-Id: Ic166066a543c4a5c0958351fdfe5f984e8d443d7
2013-02-21 00:50:27 +01:00
Antoine Musso
5c9d0c379e properly stop output buffering
While setting up itself, the Maintenance class attempt flush and end the
output buffering mecanism. It was done using a call to ob_end_flush()
which has two culprit:
- it throws an E_NOTICE whenever output buffering is already disabled
- does not flush all buffers

By querying ob_get_level() we can find out whether output buffering has
been enabled and can thus stop using the '@' operator.

Test plan:

 $ php -a
 # Output buffering nested level
 php > print ob_get_level();
 0
 # Start buffering
 php > ob_start();
 # Check nesting level (nothing shown since we buffer output)
 php > print ob_get_level();
 # Actually show buffer content
 php > ob_flush();
 1
 # Flush / end, no notice since we were buffering:
 php > ob_end_flush();
 # Second attempt will throw a notice
 php > ob_end_flush();

 Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to
delete or flush in php shell code on line 1

 Call Stack:
   162.3024     643656   1. {main}() php shell code:0
   162.3025     643736   2. ob_end_flush() php shell code:1

 php >

The while( ob_get_level() > 0) solves it nicely (IMO).

Change-Id: I1490cced5c17fc537ef9e6e1304a492deec3a6a9
2013-02-09 23:39:43 +01:00
Antoine Musso
7006e1df93 style: fix up commas in function arguments
Fix up spaces in our function calls, we do not want spaces before a
comma and try to avoid multiple commas whenever possible.

Errors:

* No space found after comma in function call
* Space found before comma in function call

Change-Id: I51aec02016f742422fa60b92ad35ba3f0ef59ba3
2013-02-06 19:30:39 +01:00
Ori Livneh
6c163ad265 (Bug 37957) Replace php_sapi_name() with PHP_SAPI
The PHP_SAPI constant has been available since PHP 4.2.0. It's more
concise to use the constant and has less overhead than a function call.

Furthermore, PHP_SAPI rhymes with "happy", whereas "php_sapi_name"
rhymes with "lame". QED, etc.

Change-Id: Ie8c121cb8fcef50536af8d3f66723b458f0bf9af
2013-02-04 12:50:45 -08:00
jenkins-bot
ee49f98d6b Merge "Avoid raw SQL queries in Maintenance::purgeRedundantText()" 2013-01-31 20:28:19 +00:00
Liangent
90c53d1655 Followup Id9f2fea7: Remove wall time restriction for readline.
Using such restriction breaks the interactive user interface, and it
doesn't make sense to have wall time limit when waiting for user input.

Change-Id: Id8fa8e9f0d0df58aa879e7bc83bec2a55674b4ab
2013-01-27 14:15:45 +08:00
Alexandre Emsenhuber
ac45877ed6 Avoid raw SQL queries in Maintenance::purgeRedundantText()
Instead use DatabaseBase::select() and DatabaseBase::delete().

Change-Id: I03d007e21c6be5aaa92830807de25990aef2ba03
2013-01-22 12:05:43 +01:00
Dévai Tamás
e45d154faa (Bug 40860) make purgeRedundantText not fail on pre MW1.5 records
Archive records for deleted pages do not have an ar_text_id,
if they were deleted before big schema overhaul in MW 1.5.
This script was assuming all archive records had an ar_text_id.

Patch by Dévai Tamás.

Change-Id: I4776a8a0f29b8299ec6d27949dc53a96ece81f39
2013-01-22 09:01:17 +00:00
MarkAHershberger
34c9bca6a8 (bug 38110) provide a way to separate out schema changes
Allows update.php to be run when $wgAllowSchemaUpdates = false.

This is useful for non-WMF environments where strict DB permissions
allow database updates (which update.php performs), but no schema
changes (such as adding or dropping tables or indices which update.php
also performs).

It does this by adding the --schema and --noschema flags. Without
either of these flags, update.php will perform exactly as before.

With --noschema, all changes to the table structure or table additions
are skipped. Only data changes are made.

With --schema is used, no schema changes are made to the database, but
the schema changes are saved to a separate SQL file that can be run.

Change-Id: I96b4cfd4c02e9cbf46cc6a0499b87fb3b89020a0
2012-11-21 22:53:24 -05:00
daniel
c546fae8ed merge latest master into Wikidata branch
Change-Id: Id4e0f40c03679c13d8934a6add99b5cd86d0437d
2012-10-08 13:58:54 +02:00
Chad Horohoe
cd1a039320 Remove some PHP 5.2 cruft (we already bailed for < 5.3.2)
Change-Id: I7057c2e0f389095b9d6191e6fdee0c6ff2f97bd8
2012-09-24 10:43:30 -04:00
daniel
b6b686c13b merged master
Change-Id: I0ef7c7f33a5dc5855f38b20c03ddc5306f38ec66
2012-09-19 12:34:10 +02:00
Reedy
248ff9e925 (bug 40302) Lock user table with LOCK TABLES
Change-Id: I26905c29e004a4c7df82fd38aab908287daf193e
2012-09-17 19:17:11 +01:00
daniel
ff03cf38cc get rid of Revision::getText
Change-Id: Ia0b16813fa1688b6faccbe8ca81b1099001b1f3b
2012-09-14 18:23:21 +02:00
Hoo man
d13c6fa967 Follow up to dirname( __FILE__ ) clean up
Remove a trailing whitespace added by me in dirname( __FILE__ )
clean up and add some comments to the PHP version checks (they
can't use __DIR__ as they have to run in older PHP versions.

Change-Id: I6a7e8cb7dbf384d91dda4d0ecbef7ce588bc3073
2012-08-28 23:47:56 +02:00
Hoo man
8ffbb077b3 Use __DIR__ instead of dirname( __FILE__ )
Removed left over uses of dirname( __FILE__ ) to __DIR__, even in comments.
Running the PHP version test in maintenance/Maintenance.php earlier, so that
we no longer have to stay PHP < 5.3 compatible in there.

Change-Id: I5a00bd5c6af44b7f826c4e5576a7b3de7b5026d8
2012-08-27 23:58:28 +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
Tim Starling
6a79e09d6f Merge "Various updates needed to bump min php version to 5.3.2" 2012-05-04 12:44:57 +00:00
Reedy
f1bec81eba Various updates needed to bump min php version to 5.3.2
Change-Id: I22015387e4ac5839a907059086d787f352746886
2012-04-16 15:38:22 +01:00
Christian Aistleitner
0c33345146 fwriting to STDOUT -> print in Maintenance
Change-Id: I50dec90893a5dc88a5deabcc05a8c32058aca4c8
2012-04-15 20:59:07 +02:00
Reedy
d1f9213c81 Document $mDb
Change-Id: I971820ba14d08f23c2eec570183ab851e48debfc
2012-04-07 22:07:41 +01:00
Sam Reed
c47f83a4d4 More __METHOD__ in our madness 2012-02-24 18:45:24 +00:00
Sam Reed
c8eb4467f1 Fix user related direct member variable access 2012-02-16 00:54:34 +00:00
Sam Reed
e63c1a4fb1 gearman has been nuked
Ping r110958
2012-02-15 21:06:13 +00:00
Sam Reed
f3f180850a Fixing up undefined types in maintenance documentation 2012-02-09 21:08:06 +00:00
Antoine Musso
46546f0519 Fix doc for maintenance/ 2012-02-08 16:55:54 +00:00
Sam Reed
5ef630a3b3 Braces, spaces, documentation 2011-11-20 18:02:38 +00:00
Platonides
7bf57a29b9 Follow-up r103179: $handled variable undefined 2011-11-15 16:27:16 +00:00
Chad Horohoe
bb45c5e8a3 Address fixme on r101644 (bug 32325, bug 32263), originally for bug 31822. PHP 5.2 below 5.2.7 throws a warning when you try to fopen() in append mode. Fixed by only fwrite()ing to STDIN|STDERR when in cli, use print otherwise (per Tim's suggestion).
People didn't seem to like the idea of bumping the minimum version to 5.2.7 since some distros like being behind the times.
2011-11-15 15:04:36 +00:00
Chad Horohoe
f0683c2351 (bug 31822) Error during upgrade due to output buffer reset in stdout.
In various places in Maintenance, we're overwriting our output buffer rather than appending to it. This doesn't matter too much in the CLI, but it can corrupt headers when upgrading from the web. Thanks Woozle for pointing this out.
2011-11-02 18:03:46 +00:00
Sam Reed
2f23e71490 arrray -> array
Whitespace

Other documentation improvements

Comment out some unused code (which has a fixme left with it already)
2011-11-01 23:48:09 +00:00
Aaron Schulz
d6ac929842 Added default updateSkippedMessage() message 2011-10-27 18:37:11 +00:00
Sam Reed
e336b5e951 Remove some unused getting of non existent arguments
Documentation
2011-10-18 17:31:54 +00:00
Chad Horohoe
41f7e84068 Tweaks to LoggedUpdateMaintenance:
* Reduce some duplication
* Prefix skipped steps with "..." per updater convention
* Make PopulateLogUsertext, PopulateLogSearch and PopulateParentId use LoggedUpdateMaintenance -- now they will properly log when there was "Nothing to do" and we can skip the clutter on future update runs
* Docs, etc.
2011-09-08 15:52:00 +00:00
Chad Horohoe
321de8502c Tweaks to WikimediaMaintenance:
* Rename Site to WMFSite, less likely to conflict
* Create generic inclusion point for these scripts, so they don't have to duplicate the $IP detection
* Make them all subclass WikimediaMaintenance and move some of the wmf-specific hacks out of core -- almost resolved this crap :D
* Fix rebuildInterwiki to be protocol-relative (like r96139)
* By the way: rebuildInterwiki and dumpInterwiki seem awfully alike...maybe we can merge the two :)
2011-09-08 00:35:16 +00:00
Brian Wolff
ddc1d23149 New maintenance script for refreshing image metadata (refreshImageMetadata.php)
This is very similar to rebuildImages.php, except more specific to img_metadata field,
and does the images in batches instead of all at once.

Also, while I'm here, I added a line to Maintenance.php to make sure it casted
$this->mBatchSize to an integer when gotten from command line (thought it was weird
that it didn't do that)

(I'm going to tag this revision 1.18 because I think it'd be nice to have this script
in 1.18 given new image metadata stuff added in 1.18, but not super-important
because rebuildImages.php does already work to refresh image metadata)
2011-08-25 05:33:32 +00:00
Brian Wolff
eb013851a5 Move the check for if a Maintenance script supports --batch-size away from addDefaultParams()
and to setBatchSize(), since setBatchSize is usually called in a subclass constructor after
parent:__construct() which is after addDefaultParams() is called.

Upside of this is lots of scripts supporting --batch-size now list it in their help output.
2011-08-25 05:15:45 +00:00