Commit graph

111 commits

Author SHA1 Message Date
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
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
Aaron Schulz
d1215eb7a5 Small DB classes IDEA warning fixes and cleanups
Change-Id: I65b5f452a364b329bb671540f4115dbc4f40eebd
2016-10-23 22:03:37 -07:00
Kevin Israel
751f1d0d45 update.php: Don't check for mbstring extension
This check is redundant to the one in PHPVersionCheck.php which
was added in 41d1fa1c3a.

Change-Id: I32ab259939ca7e93ad6d08f2c04406ad8a973b5d
2016-06-15 10:23:21 +00:00
Chad Horohoe
de764f68dc Remove unused and undocumented $wgUseMasterForMaintenance
Change-Id: I32b58a869c796f5170fc61d6cedca9b07b7f5762
2016-06-13 19:24:48 -07:00
Kevin Israel
5ce39553e2 Fix mbstring check in update.php
Maintenance::error() will not cause the script to exit unless the
$die argument, when cast as an integer, is greater than 0. Since
the default value is 0, specify a different one, as in the other
calls from within the same function.

Follows-up 943563062f.

Change-Id: I3af72b1cd87c63d7f57436866633e86c272e904f
2016-04-08 00:44:33 -04:00
Max Semenik
943563062f Kill mbstring fallbacks
In the age when we require PHP 5.5, pretending that mbstring emulation
is not slow and silly is silly.

Bug: T129435
Change-Id: Ic8235c9da9a926df63ec7388900c44eab454eebe
2016-04-06 22:14:48 +00:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
Timo Tijhof
9a2e9ff1cd maintenance: Remove odd use of $wgLang
* testCompression.php: Called $wgLang, but didn't set it.
  It just assumed it was English. Use a local variable instead.

* update.php: Set $wgLang to English. Set main RequestContext as well.

* transstat.php: Rename $wgLanguages to $languages for less confusion.
  It's just a local instance of language.inc's Languages class.

Change-Id: I67865f4d8710946001f7586ab0a17e125366b184
2016-03-03 01:37:45 +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
Max Semenik
59db24e90b Use addDescription() instead of accessing mDescription directly
Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
2016-01-30 01:28:32 -08:00
Reedy
44cebea941 Update wfGetDB calls in Maintenance scripts to use getDB()
Change-Id: I9ad6745d84506b736dae94747256caac89715899
2016-01-02 16:58:23 +00:00
Reedy
fd366c908e Remove a few more PHP4-isms from update.php
Change-Id: I98f12f3b4ff11341839202311f492f1a8cca2882
2015-06-28 02:03:48 +01:00
aude
9880d5b60b Check for dependencies in entry point and Maintenance.php
This way, if someone tries to install MediaWiki via
either web installer or install.php maintenance script,
after obtaining from git, they get some useful information
on what to do.

Put the checks alongside the php version check, as
stuff installed via composer (mustache / lightncandy)
is used for NoLocalSettings.php and install.php
attempts to use logging stuff.

Also tried to make PHPVersionError look slightly nicer,
with some <h2> elements and more padding for the <p>
elements.

and centralized this code in one place, as much as possible,
for improved ease of maintenance.

Bug: T90438
Bug: T88951
Change-Id: Iae4eb42c4266dbe9213c5de8a96fccfbeaa9acb0
2015-05-23 15:05:11 +00:00
Reedy
2d234faf92 Remove PHP4 "support" from using constant in update.php
Change-Id: I4743d10a3084a7dc4806d73662b19aa6751b0c18
2015-05-11 15:34:02 +01:00
jenkins-bot
39508404aa Merge "update.php: Remove max seconds of lag from wfWaitForSlaves() call" 2015-05-06 20:37:26 +00:00
Kevin Israel
e10055bfdc update.php: Correctly report durations >= 1 hour
Bug: T67772
Change-Id: I61492a1ad8bf7f574b198af82799b030221bb58b
2015-04-07 21:24:22 -04:00
Aaron Schulz
46cf4f1e30 Clean up $wgSQLiteDataDir handling and removed standalone sqlite class
* The data directory can now be set via the construction params
* A standalone factory method now replaces the subclass
* Also made mDatabaseFile protected

Change-Id: I1791fd4f630e5c121fa7f68f473411a7c12d0c97
2015-03-09 18:35:24 +00:00
Kevin Israel
8f70ae8a94 update.php: Remove max seconds of lag from wfWaitForSlaves() call
Follows-up r97526 (a11a1edafa).

Change-Id: Ie208810f2531924f37fb1b21fe2b9637f0476782
2015-03-03 16:14:13 -05:00
Kunal Mehta
def1783b27 update.php: Add option to not check if external dependencies are up to date
Bug: T88211
Change-Id: Ie84dd6320e5e17cd30a063c61f2b8a3af0549fac
2015-01-31 13:55:13 -08:00
Kunal Mehta
c9c76be9ed update.php: Run checkComposerLockUpToDate.php
As suggested on wikitech-l

Change-Id: If9cde3aafb136c7194e74e6f7f0bae0b49e36465
2015-01-23 20:02:20 +00:00
Aaron Schulz
4bddc93561 Make sure that the temp zone has an .htaccess file
Change-Id: I357c6f6a60b4eb531636132180a717f4186b1797
2014-11-06 10:58:47 -08:00
Kunal Mehta
0e17070d40 Require PHP >= 5.3.3
Bug: T839
Change-Id: Iac827ef8505ff0653a40e45d759b0f79619351ee
2014-10-30 10:10:52 -07:00
Chad Horohoe
a4334bbef5 Use PHP_VERSION constant instead of phpversion() function call
Change-Id: Ifb3d1bd92d6abaa561e7337b311b4cb10c38a2b6
2014-07-09 16:46:35 -07:00
physikerwelt
de3a91f929 Make update.php file executable
It's simpler to run ./update.php rather than php update.php.

Change-Id: I8ea8e00ac80011d375cbec095ad32239dede7310
2014-05-09 10:24:11 +00:00
Siebrand Mazeland
a50a5d9da7 Pass phpcs-strict on maintenance/ (1/8)
Change-Id: Ib68a7cf4251e8f4c71233df869673f4c5d3cf84c
2014-04-22 21:25:22 +00:00
Chad Horohoe
518fa756f2 Remove $wgTitle from all maintenance scripts
Shouldn't be needed and aren't for any core operations. If any
extension relies on these $wgTitles being set in maintenance
environments those extensions are broken and should be fixed.

Change-Id: Ie02a5042ab96e155d783d56d5340dd0da8e3d55c
2014-03-12 18:28:47 -07:00
Kevin Israel
1d049a7451 Installer: Remove two environmental checks
* envCheckPHP531: Message is outdated ("downgrade to 5.3.0"; the
  current minimum PHP version is 5.3.2), and PHP Bug #50394 has
  not reappeared in any later version.
* envCheckZE1: zend.ze1_compatibility_mode was removed in 5.3.0.

Also updated the error message for envCheckBrokenXML to remove
the "Upgrade to PHP 5.2.9 or later" wording.

Change-Id: Ifc8754151dd23a0314c6739cb78c7ac61a306bc4
2014-01-22 19:41:19 -05:00
Kevin Israel
b215d91224 Check for very old PCRE versions in installer and updater
RE_IPV6_ADD uses (?(-n)) ("relative reference condition"), and CSSMin uses
\K ("reset start of match"), which only work in PCRE 7.2 and later -- newer
versions than the PCRE 6.6 included with Red Hat Enterprise Linux 5 and its
derivatives (e.g. CentOS 5).

Because the WMF developers, in general, do not seem to support maintaining
compatibility with such old software versions, I have opted to add a check
to the MediaWiki installer for these versions of PCRE. Affected users are
directed to a MediaWiki.org page advising the use of a different PHP package
that uses the bundled PCRE version instead of the older system version.

For now, the minimum PCRE version is set to 7.2, the oldest version not
known to break MediaWiki core. Once PHP 5.3 support is dropped, we may be
able to require PCRE 8.12 (bundled with PHP 5.4.0) or later.

The existing check for mere existence of the PCRE functions is removed;
since PHP 5.3, it is impossible to compile PHP without PCRE support.

Bug: 58213
Change-Id: Icf3732b6f84eeb25990178ae8fe3bd0fe4cc833f
2014-01-21 17:28:35 -05:00
Kevin Israel
8b074987c9 update.php: Fix PHP4 syntax error
PHP4 does not support method chaining, so I broke the line into
two so we can continue to show a more helpful error message in
that version of PHP, which reached EOL just about six years ago.

Also changed "Done. The job took [...]" to "Done in [...]"; "job"
has a specific meaning in MediaWiki that is irrelevant here.

Follows-up fae8daa658.

Change-Id: If2480aa24f18d36f33462d874b2a1dd13abb641a
2013-12-16 20:24:22 -05:00
jenkins-bot
e0d92d376b Merge "Define 'MW_UPDATER' when running update.php" 2013-12-05 21:59:32 +00:00
Bartosz Dziewoński
72c67be8c6 update.php: Add a full stop
Change-Id: I64810380cc56e0c63901062b5bd566ab98d591a1
2013-12-01 23:23:58 +01:00
Kunal Mehta
4e05dd8080 Define 'MW_UPDATER' when running update.php
So extensions can not run stuff that might depend on a table
which may not exist yet.

Bug: 57335
Change-Id: I57a47661f2069efb91340db8188be92d4efb23e9
2013-11-20 16:27:23 -08:00
umherirrender
f153998317 Fixed spacing
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line

Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
2013-11-19 19:03:54 +01:00
Siebrand Mazeland
e711503e7a Remove underscore from classes LCStore_*
iPart of program to remove underscores from class names. Checked core and
600+ extensions for occurrences. All uses are in core, and are updated in
this change.

Change-Id: I432dc249d22053728013ae7d0d56c3c398021c5e
2013-11-17 22:09:31 +01:00
mayankmadan
fae8daa658 Add ability to show the time taken by update.php
Bug: 28278

Change-Id: I42cd0da35a2ed20748374afbe1a02773cd941136
2013-11-05 09:47:39 +05:30
umherirrender
037d375e0d update.php clears caches twice
There was a bad rebase on I96b4cfd4c02e9cbf46cc6a0499b87fb3b89020a0,
because it partically reverts Ice42a31dee1e6b41da4aa0a47e8786579382aff1

Bug: 44690
Change-Id: Iff2c8d3cb1a10da7cd0ab18ee189454761d7db6f
2013-09-21 03:37:02 +00:00
Reedy
f857f0cd2e Remove duplicate runChild() call
Change-Id: Ie8479dbb05bed5ec2e99b3ee1292a15f05c53259
2013-08-25 06:46:16 +00: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
dbd0b590e9 else if -> elseif
Also fixed some spacing while at it
Added some braces for one line statements

Change-Id: Iebfa2b17091509daabc76248121c7763e2295d20
2013-04-17 16:52:47 +02:00
Platonides
32139b0ddf Make update.php and install.php use wfPHPVersionError() and reorganise it
update.php and install.php now use wfPHPVersionError()

Moved to wfPHPVersionError( cli ) the suggestion of another binary name.

Old PHP versions won't have $_SERVER superglobal, hardcode HTTP/1.0 in that case.

Store in a variable the minimum version of PHP supported by MediaWiki.

Changed PHP_VERSION to phpversion(), although it doesn't matter for the version
ranges this works.

phpversion() has been present since PHP-2.0
PHP_VERSION was added in PHP 3.0RC5

On its current form in PHP 4 it was moved from Zend/zend_constants.c
to main/main.c by Zeev in commits 71dddd7db7e768ae8145e085fcbb6b6db4a1c40a and
fb1c77bd4f8a636ba47d720f8ca65fc6baae836d (1999-12-17)
It had been commented there since the beginning of svn history (1999-04-07)

The earliest version we can target seems to be PHP 4.1.0
PHP 4.0.0 produces a parse error on a require_once not followed by a literal
path (although you can use require with an expression), plus its dirname()
is quite dumb, and wouldn't provide the right path (would require you to call
"php ./update.php" from maintenance folder, not "php update.php" or
"php maintenance/update.php" from the main dir)

Replacing pathinfo( $_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME ); into a pathinfo()
to another variable since pathinfo( "", PATHINFO_DIRNAME ); core dumps in PHP 4.1.0
(works if $path is not empty)

The value of the pragma directive is 'no-cache', not 'nocache'. See section 14.32
of rfc2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32

Change-Id: I6294e86a5f3e11b9ea0f62762815e7c71b9037ce
2013-02-26 21:55:06 +01:00
Platonides
55e8388137 Make maintenance/update.php parse again under PHP 4.1.0
The instanceof produces a parse error on old PHP versions,
which doesn't show the old-version error message.

Note that our is minimum PHP version is 5.3.2, so it won't
produce E_STRICTs (is_a() was undeprecated in 5.3.0)

Change-Id: I5904301759bd154dd87ed90a5176369e37346482
2013-02-26 21:52:23 +01: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
Antoine Musso
678e164fe0 updater now shows the SQLite file being used
On continuous integration, we run several update.php with paths coming
from environnement variables. To make sure the correct path is always
used and assist in debugging, the maintenance/update.php script now
print out the SQLite database full filename whenever we are using a
SQLite database backend.

Change-Id: I2bba919e054c1947c1d956d94998c2cf95fd9683
2012-11-06 13:59:34 +01:00
Chad Horohoe
ee01bb0d94 Move cache purging out of doUpdates()
It makes a whole lot more sense to run this at the end of the
update process after post update maintenance rather than just
at the end of schema updates.

Run update.php more than once so all the updatelog entries
are populated and you'll see why it makes sense.

Change-Id: Ice42a31dee1e6b41da4aa0a47e8786579382aff1
2012-10-25 14:21:34 -04:00
umherirrender
b887cea9d1 PostDatabaseUpdateMaintenance: childs checks updatelog already
The parent class LoggedUpdateMaintenance of each update script is
checking the updatelog self.

Checking in update.php prevents the script to be run, when using --force
on update.php and updater is not outputting a skipped message

Change-Id: I6cdad807ee4e49983cedef168d4e697a5bd8b7e7
2012-10-12 20:52:29 +02:00
Alexandre Emsenhuber
2a7478b4fb Improve documentation of maintenance scripts.
Change-Id: Id7a04ff816dc47a8cc81a4da5ab0dff26b688bd5
2012-09-03 20:10:09 +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
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