Commit graph

71 commits

Author SHA1 Message Date
Alexandre Emsenhuber
09bb6975c5 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I1615bf268515ed7169e33173cea6ec30402451dc
2012-05-06 07:50:15 +02:00
Marcin Cieślak
556c5cf464 Rename "user" and "text" when upgrading on PostgreSQL
Follow-up to r15791.

You can lie to me, but not to your installer.

Make DatabasePostgres::tableExists to check for real table names, not
faked ones.

DatabasePostgres is currently lying to the rest of the MediaWiki that
"mwuser" table is actually called "user" and that "pagecontents" is
called "text". While MediaWiki does not care, the installer (and updater
do).

This allows us to overcome first hurdle in getting MediaWiki 1.7.3 to
update to trunk on PostgreSQL and uncover further bugs.

For this commit to actually do something, we rename those tables when
upgrading to match what we have in maintenance/postgres/tables.sql

And by the way, tell installer not to check for "user" table, since most
PostgreSQL users will have "mwuser" instead. Picking "archive" instead.

Patchset2: wrapped commit message at 72 chars

Change-Id: Ic874e92bb1adda3430d3292423d4f3617c25456c
2012-03-24 09:10:59 +01:00
Roan Kattouw
0fca9a7991 Revert r107309, r113601, r113704, r113742, r113792, r113838, r113859, r113893, r113894, r113952, r114047, r114252, r114256, r114257. This reverts the remaining 'new' revisions in core.
All of these revisions are tagged with 'gerritmigration' and will be resubmitted into Gerrit after the Gerrit switchover. See also http://lists.wikimedia.org/pipermail/wikitech-l/2012-March/059124.html
2012-03-21 00:16:50 +00:00
Marcin Cieślak
8e2da3a4a6 Follow-up to r15791: Rename "user" and "text" when upgrading on PostgreSQL
You can lie to me, but not to your installer.

Make DatabasePostgres::tableExists to check
for real table names, not faked ones.

DatabasePostgres is currently lying to the rest
of the MediaWiki that "mwuser" table is actually
called "user" and that "pagecontents" is called
"text". While MediaWiki does not care, the
installer (and updater do).

This allows us to overcome first hurdle
in getting MediaWiki 1.7.3 to update to trunk
on PostgreSQL and uncover further bugs.

For this commit to actually do something,
we rename those tables when upgrading to match
what we have in maintenance/postgres/tables.sql

And by the way, tell installer not to check
for "user" table, since most PostgreSQL users
will have "mwuser" instead. Picking "archive"
instead.
2012-03-14 20:20:53 +00:00
Alexandre Emsenhuber
61a88f8c18 Pass __METHOD__ to DatabaseBase::begin(), DatabaseBase::commit() and DatabaseBase::rollback() 2012-02-26 17:19:11 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Sam Reed
138ddc452f Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:42:35 +00:00
Max Semenik
16b811c803 Made installer not install on SQLite less than 3.3.7, would prevent stuff like bug 25746. Also, threw MSSQL out of release notes - it can't be installed through the usual means. 2012-01-04 10:41:39 +00:00
Sam Reed
9814e6b075 Add $fname to tableExists
Pass $fname/__METHOD__ in in upstream callers
2011-11-10 20:39:23 +00:00
Sam Reed
856faea6d6 Add documentation
Fix some unused variables, commented some others out
2011-10-18 17:26:09 +00:00
Robin Pepermans
056628a8a5 (bug 30679) Some installer fields should always be LTR
Patch by Amir E. Aharoni (some whitespace fixes)
2011-09-05 00:56:54 +00:00
Tim Starling
88e8af820c Fix for r72150: rename getSchema() to getSchemaPath(). This terminology creates an unfortunate and potentially confusing conflict with the PostgreSQL usage of the term. At some point in the future I'd like to have a getSchema() that gives you the PostgreSQL schema name ($wgDBmwschema). Strictly speaking, tables.sql is not a schema, it's an SQL file that creates a schema. 2011-06-20 07:16:09 +00:00
Tim Starling
b37cde66c1 PostgreSQL install fixes:
* 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.
2011-06-10 11:32:57 +00:00
Chad Horohoe
e54a7056e9 Get rid of addNewExtension()/getNewExtensions() method of adding new extensions (added in r81266). Since r85021, this isn't necessary because we run old updates like we should. Fix the 3 extensions using it. Reverts most of r81266, all of r84868, tiny part of r86741. Also ping r89653 which is what caused me to look at this again. 2011-06-07 17:33:34 +00:00
Max Semenik
f2b428c317 Fix r85021: extension tables weren't created in some cases 2011-06-07 15:52:38 +00:00
Mark A. Hershberger
9be60e5725 forward port r88929 2011-06-03 03:41:11 +00:00
Sam Reed
f675c6bf05 Documentation 2011-05-02 16:58:29 +00:00
Max Semenik
7966eae6e6 (bug 28237) Installer doesn't create extension tables 2011-03-30 17:32:20 +00:00
Brion Vibber
4ac9bc6a0a * (bug 26937) [Installer] Fix for Javascript-opened sections being incorrectly open or closed when returning to page
The sections whose visibility was being controlled by the checkbox had an initial visibility hardcoded in the page output, which had been manually set to match the expected initial default state. I've switched these to instead check what the variable is set to and base the initial style visibility on that.
Could be better to encapsulate these settings together in some way, but this'll do for now.

Note that the way these are all done now means that the sections can never be used when JS is off; if a fully-functional installer is desired in a JS-free environment, it may be necessary to change these further to default to shown, and do the initial hiding in JavaScript (could have 'flashing' issues though: the bits showing up, then quickly hiding. laaame but oh well)
2011-03-27 19:22:14 +00:00
Chad Horohoe
34dc3650b6 (bug 12070) After Installation MySQL was blocked. GRANT with IDENTIFIED BY will overwrite the password of an existing user silently, moving CREATE USER and GRANT to two separate operations so we can handle the different errors. Put in HISTORY, needs backporting with RELEASE-NOTES 2011-03-01 18:46:16 +00:00
Chad Horohoe
8fcd602c89 Don't allow the user to create DB users with no passwords, it's not good practice.
We can't stop them from using users that already have empty passwords, but we can refuse to create it ;-)
2011-02-23 16:18:51 +00:00
Sam Reed
7ebf2e5165 More function level documentation
Fixup some indenting
2011-02-19 00:44:38 +00:00
Mark A. Hershberger
b4cee86beb w/s fixups 2011-02-12 04:06:22 +00:00
Chad Horohoe
31b0483aa6 Suppress warnings on reading interwiki.list in case permissions or something else makes it not work.
Tweak message since we no longer read the .sql file.
2011-02-04 21:10:02 +00:00
Sam Reed
a15519fabc Few more return types 2011-02-03 23:09:42 +00:00
Sam Reed
4a5298e6fd Fix return type documentation 2011-02-03 20:57:56 +00:00
Chad Horohoe
3f5e23548c Fixups to r81266 2011-01-31 20:09:29 +00:00
Chad Horohoe
742ea74200 (bug 26857) Fatal error during installation enabling 'Vector' extension (or any extension, really). The reason we're including extensions during setup is so they have a chance to register with LoadExtensionSchemaUpdates. Before including extensions, we now include DefaultSettings.php, so any operations on those variables won't result in the fatals described in the bug.
More importantly, this adds support for installing extension tables *at* install time. Previously, the best we could do was to add the require()s to LocalSettings. However, without a subsequent update, wikis will probably start having errors immediately after install (this is really bad!). So I've added an interface to the DatabaseUpdater passed to LoadExtensionSchemaUpdates. An extension can now call addNewExtension() which will allow the extension to be enabled on install and not just update. Example committed in CodeReview
2011-01-31 20:00:59 +00:00
Tim Starling
e1c8e80297 * Fixed Oracle new installer support, broken by r80957. This is a minimal patch and doesn't address the architectural issues.
** Moved the responsibility for calling setupSchemaVars() on install to the DatabaseInstaller subclass. This allows it to be called after setupDatabase() has completed, as required by Oracle and PostgreSQL.
** Fixed OracleInstaller::getConnection() so that it respects $this->useSysDBA correctly.
** In OracleInstaller, added some more variables to the list of schema vars, which are needed by user.sql and tables.sql
** In SearchOracle, specify the database name when calling ctx_ddl.sync_index(). This fixes a fatal error in the createMainpage step, caused by the schema name not being equal to the current user. 

* In oracle/tables.sql, fixed a couple of indexes with missing table prefixes.
* Improved debugging output in DatabaseInstaller::getConnection() and Installer::createMainpage().
* In DatabaseBase::selectDB(), set $this->mDBname correctly, as in DatabaseMysql.
2011-01-27 08:25:48 +00:00
Tim Starling
12c87d042c Removed getConnectionOrDie(), accidentally added in r80957 2011-01-27 03:54:33 +00:00
Tim Starling
0c86b1611a * Fixed a bug causing the installer to ignore the "engine" and "charset" settings when installing a MySQL database.
* Fixed a bug causing the engine and charset settings to not be properly preserved when adding new tables on upgrade.
* Fixed total breakage of SQLite upgrade, by reusing the administrative connection to the SQLite database instead of creating a new one when wfGetDB() is called. Added LBFactory_Single to support this. 
* Introduced a "schema variable" concept to DatabaseBase to avoid the use of globals for communication between the installer and the Database. Removed a lot of old global variable names from Database::replaceVars(), most were only added on a whim and were never used.
* Introduced DatabaseInstaller::getSchemaVars(), to allow schema variables to be supplied by the DatabaseInstaller child classes.
* Removed messages config-mysql-egine-mismatch [sic] and config-mysql-charset-mismatch. In the old installer it was possible for users to request a certain character set for an upgrade, but in the new installer the question is never asked. So these warnings were shown whenever a non-default character set or engine was used in the old database.
* In MysqlInstaller::preUpgrade(), fixed the incorrect strings used to identify the MySQL character sets: mysql5 instead of utf8 and mysql5-binary instead of binary.
* On install, initialise the site_stats table, using code copied from the old installer. Unlike the old installer, use SiteStats to increment the user count when the initial user is added.
* Fixed several instances of inappropriate call-by-reference. 
* Replaced call_user_func_array() with call_user_func() where possible, it is shorter and simpler.	
* Moved the caching boilerplate for DatabaseInstaller::getConnection() to the base class, and have the derived classes override an uncached function openConnection() instead. Updates r80892.
* In MysqlInstaller::getLocalSettings(), escape PHP strings correctly with LocalSettingsGenerator::escapePhpString(). 
* Reduce timeout for checks in dirIsExecutable() to 3 seconds, so that it doesn't take 30s to run when apache is in single-threaded mode for debugging.
* MySQL and SQLite have been tested and they appear to work. PostgreSQL upgrade is totally broken, apparently it was like that before I started. The Oracle code is untested.
2011-01-25 07:37:48 +00:00
Chad Horohoe
a5053d4c5a * Cleanup massive duplication across Database constructors. Default implementation fairly sane. Now they all share the same if( $server ) logic to allow constructing the class without forcing open a connection (MySQL has done this since at least r15094)
* Get rid of intermediate installTables() callback
* Actually cache the result of DbInstaller::getConnection() like the documentation says
2011-01-24 18:36:09 +00:00
Chad Horohoe
44dd1794a1 Partially revert r69738 (splitting Installer/CoreInstaller). As discussed on CR, this probably wasn't the best route to go with this code.
We can figure that out sometime in 1.18
2011-01-21 15:27:16 +00:00
Sam Reed
cb70fd7cdb * (bug 26733) Wrap initial table creation in transaction 2011-01-14 20:43:14 +00:00
Sam Reed
b883e46c7e Parent in DatabaseInstaller is a CoreInstaller, not just an Installer 2011-01-11 02:46:55 +00:00
Jure Kajzer
f853d711ac * fixed Oracle code for installer and phpunit tests
* removed ORABlob class
2011-01-10 19:22:27 +00:00
Alexandre Emsenhuber
62e5d4ba70 Fix for r64254: undefined variable 2011-01-02 19:04:23 +00:00
Mark A. Hershberger
aa08646a71 Misc whitespace changes, mostly EOL w/s and indention fixes so TAB = 4 spaces 2010-12-19 04:31:15 +00:00
Sam Reed
984c692ec4 Removing trailing whitespace 2010-12-16 11:20:39 +00:00
Brandon Harris
4f8f4bf675 Revert r77860, which was a reversion of r75832.
Didn't see comments about escaping html and use of tipsy; will be addressed in next commit.
2010-12-06 20:04:28 +00:00
Tim Starling
41b92f3343 Reverted r75832 per my comments on CR, unanswered for 19 days. Moving all help information into tooltips is a step backwards for usability. Reverted followups r75836, r75866, r76314 and r76315. 2010-12-06 07:08:31 +00:00
Sam Reed
cadc951d15 More reversion of r77297, 1 of 2 commits to keep it readable in CR (hopefully) 2010-11-25 22:24:11 +00:00
Antoine Musso
6fe29c9c30 revert r76464
* mixed style changes and variable removing
* logic changes
* useful comments removed
2010-11-25 20:01:34 +00:00
Sam Reed
10ecfeb03b Various unused variables, add some braces
Explicitally define some variables used in hook type calls
2010-11-10 19:49:04 +00:00
Chad Horohoe
c7f9eaf626 Postgres updater stuff, needs review
* Move setup_database() from DatabasePostgres to PostgresInstaller
** Add install step after interwiki for the COMMIT
** Put the table creation test (should we abstract this?) in setupDatabase()
** The leftover stuff in initial_setup() also belongs in setupDatabase(), I think?
2010-11-10 16:06:16 +00:00
Chad Horohoe
2c965c5dc4 Followup r76055, missed a few more 2010-11-04 23:23:34 +00:00
Chad Horohoe
0bee9581b4 Replace XML->HTML methods throughout most of the installer 2010-11-04 23:21:24 +00:00
Brandon Harris
d00ddeef7f * Added tipsy library
* Added associated files for tooltip display
* Added associated css rules for tooltip display
* Updated installer's help system in (most?) places to display help as tooltips instead of show/hide system
* Beginnings of visual changes (e.g., less boxes, more color)
* Modified several of the installer's widget display methods
* Added a couple new i18n values
* Fixed small bug in installer logic:
  - Password validation on new users was being executed even if there wasn't a $user object
2010-11-01 21:17:15 +00:00
Jure Kajzer
9b9cbb4206 * moved installMainpage to CoreInstaller as requested in r75366 2010-10-25 18:57:44 +00:00
Jure Kajzer
1eede8e88b * DatabaseOracle - throw connection exception instead of debug+false
* DatabaseOracle - fixed $wgContLang local usage in update
* Installer - added Main Page insertion as a new installation step (fixes bug 22308)
2010-10-25 16:49:59 +00:00