Page MenuHomePhabricator

deleteArchivedRevisions.php deletes even without its --delete option
Closed, ResolvedPublic

Description

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'

TablesColumnsTotal Rows
archive152206

$ php deleteArchivedRevisions.php
Delete Archived Revisions

Deleting archived revisions...done.
$ mysqlshow --count taizhongbus|egrep 'T| archive'

TablesColumnsTotal Rows
archive150

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.


Version: 1.15.x
Severity: normal

Details

Reference
bz18121

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:34 PM
bzimport set Reference to bz18121.
bzimport added a subscriber: Unknown Object (MLST).
Jidanni created this task.Mar 24 2009, 11:16 AM
IAlex added a comment.Apr 20 2009, 7:18 PM

fixed in r49674.

brion added a comment.Apr 28 2009, 9:46 PM

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!

IAlex added a comment.Apr 29 2009, 8:35 PM

fixed in r50052.