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
... 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
This is still less than ideal, but at least consolidates the
logic so we can later implement more content-specific handling.
Change-Id: Ic24a7ea2818f6eeb67453877dc5a31f110541ecf
* 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
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
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !
Fixed windows newline style
Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
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
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
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
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
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
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
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
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
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
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
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.
* 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.
* 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 :)
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)
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.