Commit graph

350 commits

Author SHA1 Message Date
Chad Horohoe
8b1c53a769 Warn users when installing on a 32-bit system
Don't fail to install, because we don't explicitly need to break
32-bit support. But in this day and age it's becoming increasingly
likely to break things on a 32-bit system. So let's at least let
a system admin know that YMMV.

Change-Id: Ifb3bfa049532d82f67fe4375944af1516400513c
2017-08-12 20:59:45 +00:00
WMDE-Fisch
6df9ed1ad6 update mediawiki-codesniffer to 0.11.0 and fix issues
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
2017-08-11 22:27:51 +02:00
Kunal Mehta
fd8d75c1fd installer: Link to skin screenshots
Skins can now place *.png files in a "screenshots/" directory and the
installer will link to them. It assumes that the skin directory is in a
web accessible directory.

Bug: T70331
Co-Authored-By: Isarra <zhorishna@gmail.com>
Change-Id: I30a4374619ac2cb6afe6d8c0d9181dd6b14aae79
2017-08-10 13:15:09 -04:00
Kunal Mehta
e124721c4c installer: Disable <div> wrapping of parsed content
The mw-parser-output wrapper breaks the visual layout of the installer,
causing the radio button or checkbox to be one line above the text that
describes it.

Change-Id: I0a7ec34d80d6372927fd89b7752bc08ab0395308
2017-08-10 13:05:00 -04:00
Umherirrender
be42e09aa8 build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168

Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||

Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
2017-06-26 17:14:31 +00:00
Brad Jorsch
3b84e7f31c Change default $wgShellLocale to C.UTF-8, and use it to set LC_ALL
It's less likely to cause surprises than language-specific defaults.

Bug: T107128
Change-Id: Ife7673255798f3a3d72028a26607c56b9b7fb224
2017-05-04 05:53:47 +00:00
Eddie Greiner-Petter
b140b73b54 Revert, Follow-up: -1 recent contributors
This reverts commit b67f40e5b0.

There was an issue that the web installer, when inserting initial
values into the db table site_stats, would not insert any value for
ss_active_users. That lead to some places, most notably
Special:CreateAccount, to show off -1 recent contributors.

The commit to revert solved this by setting a default value of 1 for
the ss_active_users field in the database schema. However, while the
default schema has been changed, there hasn't been any schema update
procedure implemented. Also, the default of 1 is inconsistent with
other defaults in that table.

Revert that schema change completely. Instead, make the web installer
insert 0 to the field ss_active_users (just like it does with all other
fields in that table).

Bug: T56888
Change-Id: I4298754c2238f6e5447a5df77a4ada722ba302b2
2017-04-27 01:51:21 +00:00
Tim Starling
13c311bb0c Fix two bugs in installer session error display
If Installer::startSession() returns false, then showError() is called
before setParserLanguage(), which causes DB access via
Title::getContentModel(). The code which was meant to handle DB access
from the parser did not do so, since the exception class which is thrown
on attempted DB access has changed.

Change-Id: I1478ec06a441851c5336bdde15734642615d45e9
2017-04-03 13:55:48 +10:00
James D. Forrester
9635dda73a includes: 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.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +00:00
Max Semenik
9d6ae3dc50 Installer: don't treat the existance of main page as an error
It results in CLI installer returning status code 1, messing various
automation such as our own Vagrant.

Change-Id: I7c14596db4ddd91339b2d2af463d851123a00ae7
2017-01-23 16:52:37 -08:00
Erik Bernhardson
e5b8bf4942 Un-blacklist PhanUndeclaredVariable
Undeclared variables are a very common error type that we want to catch
as often as possible. To avoid needing to refactor a variety of global
level code (mostly in old-style maintenance scripts) this ignores
undeclared variables in global scope. This is still a good improvement
over what was happening previously.

Change-Id: I50b41d571724244552074b9408abbdf6160aca59
2017-01-18 13:07:39 -08:00
Erik Bernhardson
d67197fa11 Cleanup some incorrect return annotations
Most of these are simply changing annotations to reflect
reality. If a function can return false to indicate failure
the @return should indicate it.

Some are fixing preg_match calls, preg match returns 1, 0 or false,
but the functions all claim to return booleans.

This is far from all the incorrect return types in mediawiki, there
are around 250 detected by phan, but have to start somewhere.

Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
2016-12-12 10:15:05 -08:00
Reedy
c214c9a952 Detect/use APCu properly
In PHP 5.5 and above, userland APC caching moved to an extension

Bug: T140587
Change-Id: Ie0871776cd7e67838471a4fe95451cf4164079b7
2016-10-01 23:07:47 +01:00
Amir Sarabadani
6b221fa96a Clean up array() syntax in docs, part IV
Change-Id: If626409a93d31bf90c054c9bf7ba44a78ea9a621
2016-08-26 16:06:58 +04:30
Kunal Mehta
be0b28d475 installer: Remove "public domain" option in favor of CC-0
Some people don't consider "public domain" to be a valid license
statement, so for new wikis it's better to avoid it entirely. CC-0 works
around all of those issues, so we should be encouraging that instead.

Also it's confusing to have two "public domain" options right next to
each other.

The asset needs to stay so existing wikis that picked "public domain"
don't break.

Bug: T122916
Change-Id: I3c380f79a4f27d4793b84602002f3db5c399ac32
2016-08-17 13:31:31 +10:00
Ori Livneh
f181cdec56 Add option for sharing info about this MediaWiki install via pingback
When $wgPingback is true, MediaWiki will periodically ping
https://www.mediawiki.org/beacon with basic information about the local
MediaWiki installation.  This data includes, for example, the type of system,
PHP version, and chosen database backend.

The pingback is sent via a deferred (post-send) update whenever $wgVersion
changes, using the updatelog table to ensure we don't send duplicate pingbacks.
A database lock ensures only one thread attempts to send the pingback, and a
cache key throttles attempts to no more than once per hour.

$wgPingback is false by default. The web installer has a checkbox for
controlling this option, and it is checked by default. This nudges new installs
to turn on pingbacks, but does not sneak this decision past sysops of existing
installs.

Change-Id: Ie43a6b46a07ebd9ccc1b9c3001f2ea02435d826b
2016-07-21 21:00:28 +00:00
Chad Horohoe
41d1fa1c3a Move fatal PHP functions checks to initialization
The installer is far too late of a place to be checking if
a function does or doesn't exist if we require it for operation.
Functions can very easily (T137509) be called prior to ever
getting to the installer check page.

Also, an old installation could've gotten past the checks if
they ran update.php --skip-compat-checks. What a scary setting!

Instead, fail hard, fast and early along with PHP version checks.
All entry points are required to go through this.

While we're here, also remove the check for mbstring.func_overload
since we already would've failed at WebStart.php

Change-Id: Ib9727979af2a4741f3cd952d13a3bb350fad43e4
2016-06-14 12:50:39 -07:00
Max Semenik
d1effacdb1 Change the way installer overrides work
Instead of "don't edit this file, edit that file", do it settings.d
style where packagers can drop their stuff in mw-config/overrides.

I propose to backport it to 1.27 because LTS.

Bug: T135695
Change-Id: I2661ba2036b2887d31ab356751d731cc8b499f26
2016-06-09 17:05:35 +00:00
Ori Livneh
873def9a99 Check that file is executable in Installer::locateExecutable
Just because the file exists doesn't mean that we can run.
Use is_executable(), a one-shot check for both existence and executability.

Change-Id: I705010b01cd3a17c3950eebae3066d7b007f706e
2016-06-01 10:44:22 -07:00
daniel
fc1d4d7960 Fix installer issues introduces by MediaWikiServices
This fixes three issues with the installer:

1) Make sure LocalizationCache can find the installer's i18n files.
2) Make sure we don't try to use an SqlBagOStuff for caching before we have
   a functioning database.
3) Don't try to output HTML when redirecting (this is unrelated to
   MediaWikiServices, but came up during testing)

Bug: T135169
Change-Id: I7caa932024cd771d6fa226a3ac6001c3148ecc9c
2016-05-17 15:24:31 +00:00
jenkins-bot
f7dad57c64 Merge "Allow reset of global services (redux)." 2016-05-04 22:07:44 +00:00
daniel
d7410db0fd Allow reset of global services (redux).
(This is part of I6ec374ac9 wich was a re-submit of Ie98bf5af5
which got reverted by Ide7ab563)

This change provides a mechanism to reset global service instances
in an orderly manner. There are three use cases for this:

* the installation process
* integration tests (which most of the existing phpunit tests are)

In contrast to I6ec374ac9, this change does not cause singeltons
of legacy services to be reset. It is assumed that legacy services
use global state to access services and configuration, so any
change in confuguration would affect them immediately.

NOTE: the original I6ec374ac9 would cause session information to
get lost if the user session was creatsed before initialization
was complete. This was apparently triggered by the MobileFrontend
extension under some circumstances. Check with Addshore and Catrope.

Change-Id: Ie06782ffb96e675c0aa55dc26fb8f22037e8517d
2016-05-04 19:18:29 +02:00
Ryan Schmidt
ccdd94dc84 Pass through errors creating the main page to the installer.
Right now, any errors from inserting the main page are silently ignored by
the installer, causing it to report success even in case of failure. Let's
fix that.

Change-Id: I1da3aa076eefa212b5cc0f796a48f944e8c06fd2
2016-04-24 19:19:04 -07:00
Catrope
1162ed5f88 Revert "Allow reset of global services."
Completely breaks login.

This reverts commit 8e7a0a0912.

Change-Id: Ide7ab5632e987e81374c21173df6ab3998649df7
2016-04-11 13:40:28 -07:00
daniel
8e7a0a0912 Allow reset of global services.
This change provides a mechanism to reset global service instances
in an orderly manner. There are three use cases for this:

* the installation process
* forking processes
* integration tests (which must of the existing phpunit tests are)

Depends-On: I5d638ad415fc3840186a0beaa09ac02ea688539b
Change-Id: Ie98bf5af59208f186dba59a9e971c72ea0b63e69
2016-04-11 16:22:40 +02: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
Bartosz Dziewoński
c161c46d26 Improve code suffering from PHP 5.3's lack of support for foo()[]
I searched for /\$(\S+) = (.+?\(.*?\);)\n.*?\$\1\[/, ignored
everything involving isset(), unset() or array assigments, then
skimmed through the remaining results and changed things where they
made sense. These changes were not automated, so please review them.

Change-Id: Ib37b4c66fc57648470f151ad412210b3629c2538
2016-02-28 22:49:20 +01:00
Timo Tijhof
35b7921030 installer: Remove obsolete config-no-cache message
Follows-up 02c3f68048.

The older message is obsolete now that we require PHP 5.5.9+.

Change-Id: I68199c2ec91c8447fe7e556a6c77f1da39eb5163
2016-02-25 21:31:52 +00:00
Brad Jorsch
f61cb18b71 Enforce MW_NO_SESSION, add MW_NO_SESSION_HANDLER
When an entry point specifies MW_NO_SESSION, actually enforce that by
having both SessionManager and PHP's session handling (session_start()
and friends) throw exceptions.

If an entry point needs the old behavior of using PHP's default session
handling (as defined in php.ini), it should define
MW_NO_SESSION_HANDLER instead of or in addition to MW_NO_SESSION.

This also makes PHPSessionHandler be installed in CLI mode, where it
wasn't installed before.

Bug: T127233
Change-Id: I2a3db06ee8e44a044096c57a819b5fd5e51c5c5c
2016-02-22 12:17:31 -05: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
Kevin Israel
94e5b80fee Remove references to safe_mode INI setting
The feature no longer exists starting in PHP 5.4.0, and MediaWiki
now only supports PHP 5.5.9 or newer.

Change-Id: I3f2d1b564c50f0a28ec1ec0abd7d1b242e26953b
2016-02-12 19:18:26 -05:00
jenkins-bot
f38e4d61ec Merge "Remove register_globals and magic_quotes_* checks" 2016-02-11 22:42:55 +00:00
Max Semenik
231d152d63 Remove register_globals and magic_quotes_* checks
Yay, this crap is finally gone as of PHP 5.4!

Change-Id: I2cb01b5bf0fdde4c8cf5286ef6aff93ac45e99fd
2016-02-11 11:11:49 -08:00
Tim Starling
6a269d4d8d Suppress SessionManager sessions in the installer
SessionManager cannot work in the installer since it depends on
ObjectCache which is just an EmptyBagOStuff and so doesn't store
anything. So, introduce a custom SessionProvider which pretends to
persist sessions but actually doesn't.

Bug: T126177
Change-Id: I13d8aa1453c519df7c19ca2f1fb052c99ade043c
2016-02-11 10:48:28 +11:00
jenkins-bot
0a20c6eae1 Merge "In Installer, set the context language early to avoid loading from User" 2016-02-10 15:22:42 +00:00
Tim Starling
1714299f7a In Installer, set the context language early to avoid loading from User
Set the context language early, even before the session is loaded, to
avoid attempting to call User::loadFromSession(). Also update the things
that set $wgLang to also set it in RequestContext.

Passing $wgUser through to the ParserOptions constructor isn't strictly
necessary right now, but it does at least show the intended data flow
and is more robust to future changes in the way the language is passed
through to ParserOptions.

Fixes bug T126177 independently of my other two patches.

Bug: T126177
Change-Id: I15eb9cdce7805382d96b6fc6ffb9b25855876417
2016-02-10 21:44:09 +11:00
Tim Starling
2676e7fc3b In Installer, set the user to an anon in RequestContext, not just wgUser
This hack to prevent $wgUser being loaded was apparently not updated
when RequestContext was introduced.

Fixes T126177 independently of I13d8aa1453c

Bug: T126177
Change-Id: Iedceec3044352e433710d97d5c7c81fff1a6a3e5
2016-02-10 21:19:25 +11:00
Brad Jorsch
854406883e Add release notes and installer support for $wgAuthenticationTokenVersion
Change-Id: I092a0052b2ab50310cd8ca403d6b2f201b482d5b
2016-02-08 18:20:33 -07:00
jenkins-bot
23299ca879 Merge "Fix CLI installer when --dbname is not specified on command line." 2016-01-15 14:02:17 +00:00
Kunal Mehta
02c3f68048 installer: Say "APCu" for PHP >= 5.5
Pre-PHP 5.5 the extension was called "APC", and provided opcode caching
and userland object caching. In 5.5, the opcode caching was built-in to
PHP, and the userland object caching was moved into an extension named
"APCu".

Bug: T61998
Change-Id: Id6f4a87bfdb59b2592a56aea9450611238e313ad
2016-01-07 14:24:20 -08:00
jenkins-bot
abb7c6792f Merge "Installer: Link 4.0 family of CC licenses" 2015-12-16 19:41:49 +00:00
saper
a9de6fc779 Installer: Link 4.0 family of CC licenses
Bug: T96077
Change-Id: I86efa1dae64967d36f3a1afa79bf3637f43297dd
2015-12-16 19:34:34 +00:00
C. Scott Ananian
777c6dad44 Fix CLI installer when --dbname is not specified on command line.
When installing without an explicit `--dbname` argument on the command
line, the database is installed with the default value of $wgDBname
from DefaultSettings.php (which is `my_wiki`), but then the
LocalSettings.php file is written with the line:
    $wgDBname = "";
which overrides the default value and makes the wiki unable to
connect to the database created by the installer.

Adding `wgDBname` to the `$defaultVarNames` list fixes this problem.

Change-Id: I3792be9675aabe00b5497ed4203b12b89da8dc3a
2015-10-27 22:01:54 -04:00
jenkins-bot
f4a5507a96 Merge "Installer: use _MainCacheType form variable" 2015-10-26 17:32:52 +00:00
saper
1730a17929 Installer: use _MainCacheType form variable
Do not use "wgMainCacheType" form variable
name that contains values that cannot be
assigned to $wgMainCacheType

Bug: T116375
Change-Id: I83459c8006cc4c1bcdeaa0d78a1230687c95db46
2015-10-26 17:10:13 +00:00
saper
a93aa28711 Web installer should not pollute global namespace with session variables
There is no need to store session variables
(that also include user-supplied arguments)
as $wgXXX global variables.

Bug: T116375
Change-Id: I880d4299566beaf99ed1fc21c690cdda64149b0e
2015-10-24 02:00:02 +02:00
Florian
caa637dd83 Don't overwrite all available object caches
Just because some defined object caches are problematic in the installer, it
doesn't mean, that all others are problematic, too. Disable only the object
caches, which are known problematic ones by preserving the others.

Follow up: I1c1938b3fac395d

Bug: T113843
Change-Id: I951ef22d97b4c66d3b781a9bc4a30e7e2fca1395
2015-09-28 17:01:42 +00:00
jenkins-bot
19d5f55c01 Merge "Fix issues identified by SpaceBeforeSingleLineComment sniff" 2015-09-26 23:18:06 +00:00
Vivek Ghaisas
c54766586a Fix issues identified by SpaceBeforeSingleLineComment sniff
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
2015-09-26 23:06:52 +00:00
Florian
ded1a61e20 Add 'hash' object cache for installer
It's used to e.g. cache less files in ResourceLoader, which would throw
an exception if the installer is used (while it requests the installer
styles), if the object cache isn't defined.

Follow up: I1ff61153ddb9

Bug: T113843
Change-Id: I1c1938b3fac395dda5b42dd68b675a67bdd30261
2015-09-27 00:54:39 +02:00