Also improve the description a bit and explain at a high level
how this code is used, and which classes back those entry points.
Change-Id: Ia69531858e714d0b43a29a7d5b6dcc5c7edd8240
Make createTables() work for Postgres. Also add and use new
initSqliteDatabase() method for SQLite.
Also use ConvertibleTimestamp instead of wfTimestamp
Change-Id: I8e4505775e57fc6cd7380afa015fc0901a1bfc1b
1. Make sure `wgSQLiteDataDir` is not empty.
2. Fix a logic bug
In the current logic, in web environment, SqliteInstaller::dataDirOKmaybeCreate()
will be executed twice, first in the DBConnect page [1] (with $create=true),
and the second time in Installer::performInstallation() [2] (with $create=false),
this is a sanity check.
But in cli environment, SqliteInstaller::dataDirOKmaybeCreate() will
be only executed once, called by Installer::performInstallation() (with $create=false).
So the Cli installer will abort because the data directory is checked
without the behavior of creating the directory.
In this case, I split dataDirOKmaybeCreate() into checkDataDir() and
createDataDir() according to its responsibility. And for web installation,
we just check the directory on DBConnect page instead of creating it and
then actually creating it in setupDatabase().
3. Add a unit test for SqliteInstaller::dataDirOKmaybeCreate
[1] DBConnect page call SqliteInstaller::submitConnectForm(),
::submitConnectForm() call ::dataDirOKmaybeCreate()
[2] Installer::performInstallation() call SqliteInstaller::setupDatabase(),
::setupDatabase() call ::dataDirOKmaybeCreate()
Bug: T217855
Change-Id: I139036b265716e9898fb76ba907c194f005ea318
3.3.7 is 12 years old, no chance in hell you will find it somewhere
that supports modern MediaWiki. Since Ubuntu 14.04 LTS has 3.8.2, this
seems like a reasonable conservative version.
Change-Id: I5fbb35bd2d4c0993889b79f463a3c35ce6765d3b
This does not set 'db' as the cache type so that admins can still
easily set the cache directory to use the file-based cdb system.
If they do not, then at least the second DB file will be used to
avoid heavy contention.
Bug: T93097
Change-Id: Ib3912f00cf12de99801ebda4f06135b2987ce71a
If MediaWiki has increased the minimum database server version that is
required, check it when running update.php to ensure it is still
compatible. Previously this was only checked during the installer.
Bug: T162044
Change-Id: I47092c9557f4706a4dcb3a23150647e68af4317f
I was bored. What? Don't look at me that way.
I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.
Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.
Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.
Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.
Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
* 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
* This avoids severe lock contention if CACHE_DB is used and also makes
cache sharing between wikis simple (keys are always prefixed as needed).
Bug: T89180
Change-Id: I864272af099a9ebe2b3648e2714d2ccdee20305d
* The array based format is now required
* Pass any additional parameters through factory() to __construct() even
if the base clase does not recognize them. This makes DB specific
options simpler.
* Also added missing bits to Sqlite constructors
Bug: T90288
Change-Id: I29b79a3c1bb2b5e51c1c8f5e04cd08c71e0662a3
Since Id364306d883e0d494b948854e05f3f79ba7dd6d2 the text boxes on the
gui installer were not preloaded with the default values from
DefaultSettings.php.
Changed this by return all needed globals (defined by getGlobalNames)
from DatabaseInstaller::getGlobalDefaults(). This injects the as default
value in function getVar and than gets used, when no value is set.
Bug: T71281
Change-Id: I8217b25e903e40ec82be3d700381ff7aea3b481f
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa
One class of errors left unaddressed: Class name "WebInstaller_Language"
is not in camel caps format. I think this can be changed, too, but I
wasn't able to quickly find out where class names are being created.
Change-Id: I920b0231db1b70b68c6c8907257c288a0e112668
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments
Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
Otherwise, when user selects MySQL, sets the prefix,
then switches to SQLite, the tables will created with prefix
however the prefix will be absent from LocalSettings, making the
wiki dead on arrival.
Change-Id: I6360af819f87b03c2e9967207c43bca95f931a00
* Made PG throw a DBQueryError when it gets a query error, instead of DBUnexpectedError. Apparently this mistake goes back to r14625, when exceptions were first introduced. Did it by removing reportQueryError(), the DatabaseBase version works fine.
* Fixed several places where there was an attempt to check for a query error by checking if the result of query() was false. This never worked. Used try/catch instead.
* Made the DBConnectionError messages go on one line so that they don't mess up the formatting in the installer.
* In DatabasePostgres::selectDB(), only disconnect and reconnect if the DB name is actually changing.
* Made DatabasePostgres::schemaExists() less weird and scary.
* Added DatabasePostgres::roleExists() for use by the installer.
* Removed the PostgreSQL-specific hack to make _InstallUser have a default other than "root". Made _InstallUser into a proper DBMS-specific internal variable instead, since every DBMS we support so far needs a different default.
* Removed the $dbName parameters from openConnection/getConnection, and got rid of $this->useAdmin. Implemented a more sophisticated caching scheme instead. Partial revert of r89389 and r81440.
* When connecting as the install user before DB creation, and when testing the web user's credentials, try a few different database names and use whichever one works.
* Instead of connecting as the web user to create tables, I used SET ROLE. It seems cleaner and more like what the other DBMSes do during installation. "SET ROLE wikiuser" requires the same privileges as "CREATE SCHEMA ... AUTHORIZATION wikiuser", so it's unlikely to break anything.
* In the area of web account creation, fixed various minor logic errors and introduced more informative error messages at the submit stage, pre-install. Show a helpful error message if the web user exists already and the install user can't do the relevant SET ROLE.
* Split schema creation out to a separate install step.
* When creating an account as a non-superuser, add the administrative account to the new account's group. This is necessary to avoid a fatal error during installation (bug 28845).
* Removed code which alters an existing web user to have appropriate search paths and permissions. This may break other apps and is not necessary. As in other DBMSes, If the web user exists, it is the responsibility of the sysadmin to ensure that it has appropriate permissions.
* Rewrote setupPLpgSQL() to use the query builder functions.