Commit graph

54 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
Marc A. Pelletier
7694faf68f (bug 5445) remove autoblocks when user is unblocked
Previously, whenever we blocked a user, its IP address would be
autoblocked whenever he tries to edit a page. Thus when later unblocking
the username, he would be automatically blocked again if we forgot to
clean up is IP.

This patch introduces a the ipb_parent_block_id column in ipblocks table
to track which block triggered the autoblock command. Thus, when deleting
the original block we can easily remove all subsequentautoblocks.

Schema updaters for MySQL, SQLite and postgres have been added to the
patch but not for the other database types such as ibm_db2, mssql and
Oracle.

Change-Id: I4aa820ae9bbd962a12d0b48b6c638a1b6ff4efc9
2012-05-03 12:07:30 +02:00
saper
557a05f384 bug 36087: PostgresUpdater fails on 8.3.14
PostgresUpdater fails on PostgreSQL 8.3.14:

> Changing 'image.img_metadata' default value
> A database query syntax error has occurred.
> The last attempted database query was:
> "ALTER TABLE image ALTER img_metadata SET DEFAULT '\x'::bytea"
> from within function "".
> Database returned error "22P02: ERROR:  invalid input syntax for type
> bytea"

Patchset 2:

> Database returned error "42883: ERROR:  function
> generate_subscripts(int2vector, integer) does not exist
> LINE 7:     (SELECT generate_subscripts(isub.indkey, 1) AS g
>                     ^
> HINT:  No function matches the given name and argument types. You
> might need to add explicit type casts.
> "

Change-Id: I6e1811ded0eedad9c0eb0df715698c45aaf8e3f0
2012-04-19 14:53:08 +02:00
saper
91eb34756e Fix broken merge by 0a792a1dcb
Changeset 1 of https://gerrit.wikimedia.org/r/#change,3365:
763b57f9f2af131a2d8e65f520a23c00109be0e1

got mis-merged in changeset 2:
f752cf8042

And introduced into master wth
0a792a1dcb

Also, marking all new functions as @since 1.19
since we want to have them there later.

Patchset 2: whitespace fixes
Patchset 3: Fix <?php
Patchset 4: rebase to current master

Change-Id: Ic7d940dfec8890de20197128505962375fac4f06
2012-04-13 20:55:14 +02:00
saper
f752cf8042 Fix PostgreSQL updater to produce 1.19 schema
* PostgresField now reports column default value
* DatabasePostgres::indexAttributes reports index
  details
* Perform schema update in one transaction

With this change we can sucessfully update
MediaWiki 1.7.3 schema to trunk^Wmaster

Patch set 2: Rebased against master. PLEASE check carefully
to make sure I got those conflicted files right.

Conflicts:

	includes/db/DatabasePostgres.php
	includes/installer/PostgresUpdater.php

Change-Id: Iebb6855e8f6f44470bbb1dc5ab9ac1abb513adfe
2012-04-10 12:59:21 -04:00
Demon
b2a3c87792 Postgres updater: add config table, adjust us_image_bits type
This is a followup to I18e67bcb, that I failed to notice before merging

Change-Id: Ia96f831f279b0f6a348f1db80ecf30298ecf064c
2012-04-04 09:54:53 -04:00
saper
fa6ab16686 (bug 33689) Fix incomplete query on constraints
Upgrade to 1.19 on Postgres fails due to incomplete query when trying to
defer foreign key for externallinks

* FieldInfo::conname() should return NULL not "" when constraint
  is not present
* Re-create missing constraint on schema update

Change-Id: I7ca351e07d228afdf4a5c3bef365f42a27c9ac45
2012-03-28 23:23:13 +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
Marcin Cieślak
bd7a268e4b Cosmetic improvements to PostreSQL updater output
* Don't WARN on sequences already existing
* Align dots nicely to the rest
2012-03-14 00:36:11 +00:00
Sam Reed
a8d907be93 PHP Fatal error: Call to undefined method DatabasePostgres::getCoreSchea() in /var/lib/jenkins/jobs/MediaWiki-postgres-phpunit/workspace/mw-core/includes/installer/PostgresUpdater.php on line 309
Ping r113487
2012-03-09 19:01:30 +00:00
Marcin Cieślak
cfb8e9a251 Handle PostgreSQL transaction errors and improve schema detection
* Introduce $wgDebugDBTransactions facility to help
  figure out what's going on with transactions.
  Currently PostgreSQL only.

  PostgresTransactionState can be easily be made more general 
  to trace all sorts of state machinery.

* Improve r113408: we don't need to full reconnect on error,
  rollback is enough. 
  
  Rolling back breaks search_path, as PostgreSQL
  can manage sessions settings under transaction therefore
  we need to improve schema sniffing introduced in r82674

* Introduce few schema handling functions. This could
  probably be generalized for other databases like DB2 and Oracle.

* Fix bug 15816 - Add a switch for SETting the search_path

  We try to avoid touching search_path at all unless
  really necessary. Even in this case we append MediaWiki
  core schema to the front of the list.

* No longer add $wgDBmwschema to PostgreSQL role search_path
  in the installer. This is no longer necessary as 
  setting schema on connect should ReallyWorkNow(tm).

* Get rid as much as possible of $wgDBmwschema and
  bring us one step closer to fix bug 16794 (wgSharedDB
  support). 
  
  All references to core MediaWiki schema in PostgreSQL
  specific code should now use Database::getCoreSchema() 
  unless we know what we are doing. 

Followup-To: r113408 r82674
2012-03-09 17:24:57 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
OverlordQ
351332641a Followup to r107866, add in new job_timestamp field which was likely completely breaking anything related to the job queue, should fix failing TemplateCategoriesTest.testTemplateCategories on PG 2012-01-12 22:11:12 +00:00
OverlordQ
44ce86ac01 Followup to whatever revision added us_chunk_inx 2012-01-12 17:10:48 +00:00
Max Semenik
adc04f1a62 Postgres updater didn't output a message for some updates it ran 2011-12-27 11:26:24 +00:00
Chad Horohoe
7914b2ee68 (bug 29475) Remove "trackback" feature entirely from core. This has been disabled-by-default since its inception and nobody uses it.
If someone really really wants this, they can write an extension.

Language files need rebuilding, but I took care of En and messages.inc.
2011-11-23 17:14:03 +00:00
Sam Reed
22b42abc70 * (bug 29635) update.php for Postgres creates sequences, then fails when it to rename sequences to those same names
Patch by Luigi Corsaro
2011-11-20 17:54:47 +00:00
OverlordQ
0074526857 Followup to r100640, use correct name scheme for sequence, correct references to sequence and add optional patch file for sites following trunk 2011-11-16 19:54:38 +00:00
Mark A. Hershberger
f423abb9ed Follow up r101151 — store hex representation of binary data in text 2011-11-01 19:02:13 +00:00
Mark A. Hershberger
6e98495b5d Fix Bug #30383 for Pg 2011-10-28 16:51:47 +00:00
OverlordQ
b5279861e6 Add user_former_groups table to PG updater 2011-10-24 19:55:01 +00:00
OverlordQ
8cd73f35ff Update Postgres with missing uploadstash tables 2011-10-24 19:43:16 +00:00
Mark A. Hershberger
a67094c6c1 Remove hardcoded commit statements for pg installer. 2011-10-11 21:54:10 +00:00
Tim Starling
20ba4436cc Fix for r86741 which broke PG update due to the math table disappearing 2011-06-10 08:03:35 +00:00
Mark A. Hershberger
9be60e5725 forward port r88929 2011-06-03 03:41:11 +00:00
Chad Horohoe
42242d7620 Followup r81534, use addQuotes() instead 2011-02-23 16:42:42 +00:00
Chad Horohoe
62679f963e Various Postgres fixes (bug 26612 stuff)
* Remove last of $wgDBuser-specific settings like timezone, datestyle and search_path. This is all handled by open() :D
* Only set search_path if the schema exists (rather than just set to some random string), fall back to 'public' otherwise
* Only call setupUser() if we need to _CreateDBAccount, otherwise it returns immediately and confuses you (no functional change)
* Implement selectDB() for Postgres, basically call open() with a new DB name
* Try to fix setupDatabase() for this "user must be owner of relation" error I'm getting when the $wgDBuser exists (have tried with roles granted && no roles granted). I get no errors at all when
2011-02-23 16:01:22 +00:00
Mark A. Hershberger
56a62b9c7b These table renames aren't needed for an upgrade since Pg has these as reserved names anyway. 2011-02-04 21:44:24 +00:00
Mark A. Hershberger
bc73fdc28d change from double quote to single quote to avoid double-encoding by htmlspecialchars() 2011-02-04 20:05:05 +00:00
Chad Horohoe
69d2ee1095 Followup r81132, missed some more ts2 removal 2011-01-28 15:25:15 +00:00
Greg Sabino Mullane
c4a15c727c Don't put multiple tables in the same file. 2010-12-30 18:53:48 +00:00
Chad Horohoe
a854a0efbe * Followup r78450: just use selectField() instead of pg_fetch_result() with a raw doQuery()
* Remove useless isset() check, this will always be set with some default in DefaultSettings.php
2010-12-27 13:56:20 +00:00
Aaron Schulz
281018701f Changed doQuery() -> query() 2010-12-15 20:59:29 +00:00
Chad Horohoe
793d1e9fba rm double comment 2010-12-14 12:47:37 +00:00
Mark A. Hershberger
962be1d210 * Commit changes to PG new-installer I thought I had done last week.
* Set up and use function for renaming tables
* Use $conn instead of $this when it is called for
* remove protection from commitChanges so the installer can use it
2010-12-01 20:15:45 +00:00
Max Semenik
4345c2c20e Refactoring of *Field classes:
* Made them all implement one common interface (might add more functions to it later)
* Moved MySQLField to DatabaseMysql.php
* Renamed nullable() to isNullable()
* Removed maxLength() from:
** SQLiteField: makes no sense
** MySQLField: doesn't do what people may think, useless for this class' purpose of assisting querying the DB schema
2010-11-21 19:56:51 +00:00
Sam Reed
a4cebd898a Another followup to r71426, $ni to $fieldRecord 2010-10-14 20:34:01 +00:00
Sam Reed
9b19417e6c Followup r71426, not $nc it's $fieldRecord 2010-10-14 20:31:34 +00:00
Sam Reed
a2589ff8c6 Assignment in loop conditions suck
while ( $row = $dbw->fetchObject( $res ) ) { to foreach ( $res as $row ) in includes

Add some braces
2010-10-13 23:11:40 +00:00
Chad Horohoe
ec9eddf74b wfOut() -> $this->output(). More useful in the long run. No functional changes. 2010-10-01 15:11:06 +00:00
Greg Sabino Mullane
cb1c5fd26b Add new index on pagelinkes(pl_title) per suggestion from bug 25111 2010-09-13 15:04:04 +00:00
Greg Sabino Mullane
84a28b19b7 Add the "page" table back in when upgrading from really old MW versions using Postgres 2010-09-13 14:26:38 +00:00
Greg Sabino Mullane
7fb452c2a7 Add new columns to categorylinks 2010-09-08 17:51:42 +00:00
OverlordQ
b7c0058a7e Followup to r72349, PG table def + updater for module_deps 2010-09-04 04:14:51 +00:00
OverlordQ
d97bb6f129 Followup to r72349, PG tables + updater 2010-09-04 04:10:23 +00:00
Chad Horohoe
21216bd52d Deprecate archive() in favor of DatabaseBase::patchPath() 2010-09-01 18:52:06 +00:00
Alexandre Emsenhuber
c815ad8696 Oops, forgot to change this in r71426 2010-08-22 08:32:29 +00:00
Alexandre Emsenhuber
6a98ded353 Moved PostgreSQL schema update to PostgresUpdater:
* Still not doing sequential updates, but now this should be easier to correct
* Corrected addition of page_restrictions.pr_id field to use the correct sequence name
* Had to change DatabaseUpdater::getOldGlobalUpdates() from private to protected, since PostgreSQL has its own globals for extensions
* Moved do_all_updates() and archive() to the top of updaters.inc so that they are easier to find
2010-08-22 08:07:26 +00:00