Last modified: 2009-04-29 20:35:44 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 T20121, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18121 - deleteArchivedRevisions.php deletes even without its --delete option
deleteArchivedRevisions.php deletes even without its --delete option
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
1.15.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-24 11:16 UTC by Dan Jacobson
Modified: 2009-04-29 20:35 UTC (History)
2 users (show)

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


Attachments

Description Dan Jacobson 2009-03-24 11:16:27 UTC
Here --help makes it seems that --delete is needed to actually delete.
But surprise surprise, it deletes even without --delete.

$ php deleteArchivedRevisions.php --help
Delete Archived Revisions

Deletes all archived revisions.

These revisions will no longer be restorable.

Usage: php deleteArchivedRevisions.php [--delete|--help]

delete : Performs the deletion
  help : Show this usage information
$ mysqlshow --count taizhongbus|egrep 'T| archive'
|      Tables       | Columns  | Total Rows |
| archive           |       15 |       2206 |
$ php deleteArchivedRevisions.php
Delete Archived Revisions

Deleting archived revisions...done.
$ mysqlshow --count taizhongbus|egrep 'T| archive'
|      Tables       | Columns  | Total Rows |
| archive           |       15 |          0 |

The same thing happens if one does used --delete or not.

It seems --delete is ignored completely, and instead used here:

$delete = $dbw->affectedRows() != 0;

But looking at
/usr/share/doc/php-doc/html/function.mysql-affected-rows.html:
"Get the number of affected rows by the last INSERT, UPDATE, REPLACE or
DELETE query..."

Which does not include TRUNCATE.

So it seems that
	if( $delete ) {
		PurgeRedundantText( true );
	}
will never fire at all.

So the archive table will get truncated every time, --delete or not.
But PurgeRedundantText() will never get run, --delete or not.
So the only table ever affected is the archive table.
The text table is never touched.

So it does damage even with the safety pin still in place, and even without, it never hits its real target.
Comment 1 Alexandre Emsenhuber [IAlex] 2009-04-20 19:18:36 UTC
fixed in r49674.
Comment 2 Brion Vibber 2009-04-28 21:46:06 UTC
It still *says* that it's deleting, so this is really just introducing a bug that makes it not work for no user-visible reason. :)

Needs UI fix -- indicate to the user that nothing will be deleted unless they pass the extra parameter, and tell them what it is! 
Comment 3 Alexandre Emsenhuber [IAlex] 2009-04-29 20:35:44 UTC
fixed in r50052.

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


Navigation
Links