Page MenuHomePhabricator

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


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

$ php deleteArchivedRevisions.php
Delete Archived Revisions

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

TablesColumnsTotal Rows

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
"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



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).

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!