Commit graph

88 commits

Author SHA1 Message Date
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
Sam Reed
fc7532449d Same for the getPostDatabaseUpdateMaintenance
We only need to run them once
2011-11-11 17:06:03 +00:00
Chad Horohoe
0d90d0b9ca Whoops, need a ! 2011-11-03 20:17:49 +00:00
Chad Horohoe
61ff866b4b *grumble grumble* know it alls think I'm abusing $wgMiserMode. So fine, have a SHINY NEW GLOBAL INSTEAD. bug 32072, r92109, yada-yada.
This is not a "useless" error message, regardless of what the bug claims.
2011-11-03 20:15:27 +00:00
Aaron Schulz
6447ae9f21 Renamed annoying --iknowwhatimdoing param to --force (bug 32073) 2011-10-31 17:30:47 +00:00
Sean Colombo
a11a1edafa Merged in a change which causes update.php to be gentler (tests slave-lag). Part of the many Wikia diffs: http://www.mediawiki.org/wiki/Wikia_code 2011-09-19 18:25:39 +00:00
Max Semenik
f86947bfe7 Fix r87731: update site stats only when explicitly asked to do so 2011-09-03 10:23:47 +00:00
Chad Horohoe
e5ca759a8f (bug 29558) Add config var to disable update.php. Did this by checking $wgMiserMode and bailing unless --iknowwhatimdoing 2011-07-13 22:14:19 +00:00
Tim Starling
6fec4e3fde Revert r87635, r87637, r87639, r87643 (MW_MIN_PHP_VERSION etc.): breaks HipHop support. 2011-05-15 13:21:16 +00:00
Happy-melon
cd128f4496 Follow-up r87637: the terrors of copy-and-paste. 2011-05-07 15:37:23 +00:00
Happy-melon
7055add799 Centralise the minimum-required-php-version in a MW_MIN_PHP_VERSION constant in Defines.php. This requires loading Defines.php before the PHP4 version checks, so include a big note reminding people not to include anything other than vanilla define() statements in there.
I have a sneaking suspicion that including Defines.php in the entry points might not play nicely with HipHop, but I can't test it (wrong OS).
2011-05-07 15:16:01 +00:00
OverlordQ
14ae286fb4 Followup to r85021, fix caller in updater maintenance script 2011-03-30 20:56:03 +00:00
Max Semenik
f2f298ba67 update.php: restore compatibility with PHP4 to die gracefully 2011-03-19 19:48:29 +00:00
Sam Reed
7f1c9f7b63 Fixup some more old version comparison stuff 2011-03-15 12:06:40 +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
Alexandre Emsenhuber
9f5d06527c Part of bug 26280: added license headers to PHP files in maintenance 2010-12-16 19:15:12 +00:00
Mark A. Hershberger
617a5b1e15 Whitespace fixup under tha maint directory. 2010-12-04 03:20:14 +00:00
Chad Horohoe
670602f082 Trying to kill install-utils.inc/old install crap:
* Cripple the old installer (entry point is gone, supporting code immediately exits). Keeping the latter for reference still :)
* Move posix_isatty() wrapper to Maintenance.php, all CLI scripts include this
* Clarify docs on archive() deprecation and removal - hasn't been used going back thru 1.15
* Clarify docs on dbsource() deprecation and removal - was in wide use thru 1.15. 1.16 removed all extension usages
* Move the two PHP bug tests to a file with the other installer files, moved them to more logical places in new install/update sequence
* Remove mw_have_dl/mw_get_session_save_path, zero callers
* Move readconsole() and helpers to be a static method on Maintenance, no extensions have used it since 1.15 either
2010-11-06 22:16:19 +00:00
Platonides
c7e101b7bf r75540 CR 2010-10-27 14:46:58 +00:00
Platonides
051fd41053 Make update.php obey --quiet 2010-10-27 14:38:31 +00:00
Platonides
f323cece43 Follow up r75474 2010-10-27 13:56:58 +00:00
Platonides
30d21e6d66 Keep maintenance/update.php php4 compatible up to the point where we can give a maeningful error. Check based in install_version_checks()
Follow up conversion to new maintenance format in r72539
2010-10-26 21:42:49 +00:00
Alexandre Emsenhuber
66234904b8 Use full path to Maintenance.php 2010-10-10 08:35:07 +00:00
Alexandre Emsenhuber
f8efa1a751 Fix doc: $wgExtensionFunctions, not $wgExtensionSetupFunctions 2010-10-02 21:09:23 +00:00