Last modified: 2012-08-04 20:48:38 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T14520, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12520 - Can't delete images have oldimage, w/PostgreSQL.
Can't delete images have oldimage, w/PostgreSQL.
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.11.x
All All
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, testme
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2008-01-05 18:48 UTC by ISAKA Yoji
Modified: 2012-08-04 20:48 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch for includes/filerepo/LocalFile.php. (755 bytes, patch)
2008-01-05 18:48 UTC, ISAKA Yoji
Details

Description ISAKA Yoji 2008-01-05 18:48:48 UTC
Created attachment 4513 [details]
Patch for includes/filerepo/LocalFile.php.

System: --------------------------------------------------------------
*MediaWiki 1.11.0 + bug 12365 fixed.
*PostgreSQL 8.2.5
*FreeBSD/pc98 4.7R

Appears: -------------------------------------------------------------
In some pattern I can't delete images.

OK: Upload new image -> Delete it.
OK: Upload new image -> Replace image -> Delete old image -> Delete image.
NG: Upload new image -> Replace image -> Delete ALL images (with oldimage).

Backtrace: -----------------------------------------------------------
内部処理エラー
 
A database error has occurred Query: DELETE FROM image WHERE img_name = 'En_ban.png' Function: LocalFileDeleteBatch::doDBDeletes Error: 1 ERROR: update or delete on table "image" violates foreign key constraint "oldimage_oi_name_fkey" on table "oldimage" DETAIL: Key (img_name)=(En_ban.png) is still referenced from table "oldimage".
 
Backtrace:
 
#0 /home/cory/mediawiki-1.11.0/includes/Database.php(795): DatabasePostgres->reportQueryError('ERROR: update ...', 1, 'DELETE FROM ima...', 'LocalFileDelete...', false)
#1 /home/cory/mediawiki-1.11.0/includes/Database.php(1828): Database->query('DELETE FROM ima...', 'LocalFileDelete...')
#2 /home/cory/mediawiki-1.11.0/includes/filerepo/LocalFile.php(1257): Database->delete('image', Array, 'LocalFileDelete...')
#3 /home/cory/mediawiki-1.11.0/includes/filerepo/LocalFile.php(1325): LocalFileDeleteBatch->doDBDeletes()
#4 /home/cory/mediawiki-1.11.0/includes/filerepo/LocalFile.php(874): LocalFileDeleteBatch->execute()
#5 /home/cory/mediawiki-1.11.0/includes/FileDeleteForm.php(75): LocalFile->delete('for test.')
#6 /home/cory/mediawiki-1.11.0/includes/ImagePage.php(491): FileDeleteForm->execute()
#7 /home/cory/mediawiki-1.11.0/includes/Wiki.php(397): ImagePage->delete()
#8 /home/cory/mediawiki-1.11.0/includes/Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(ImagePage), Object(Title), Object(User), Object(WebRequest))
#9 /home/cory/mediawiki-1.11.0/index.php(89): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
#10 {main}

Cause: ---------------------------------------------------------------
In MySQL, oldimage table is NOT related to image table.
But in PostgreSQL, oldimage table is related to image table.

maintenance/tables.sql (MySQL)
    CREATE TABLE /*$wgDBprefix*/oldimage (
      oi_name varchar(255) binary NOT NULL default '',

maintenance/postgres/tables.sql (PostgreSQL)
    CREATE TABLE oldimage (
      oi_name          TEXT         NOT NULL  REFERENCES image(img_name),

And deleting process written in includes/filerepo/LocalFile.php,
tring to delete image table at first, but on PostgreSQL systems
can't delete it because related data is still active.

Solution: ------------------------------------------------------------
Please patch for includes/filerepo/LocalFile.php, and try it.


# This document written in Japanese, please see:
  日本語の解説をこちらに書いておきます→http://www.cory.to/kn/kn080106
Comment 1 Greg Sabino Mullane 2008-02-10 16:59:59 UTC
Thanks for the patch, applied in r30801.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links