Index: trunk/phase3/maintenance/deleteArchivedFiles.inc |
— | — | @@ -25,16 +25,18 @@ |
26 | 26 |
|
27 | 27 | # Get "active" revisions from the filearchive table
|
28 | 28 | echo( "Searching for and deleting archived files...\n" );
|
29 | | - $res = $dbw->query( "SELECT fa_storage_group,fa_storage_key FROM $tbl_arch" );
|
| 29 | + $res = $dbw->query( "SELECT fa_id,fa_storage_group,fa_storage_key FROM $tbl_arch" );
|
30 | 30 | while( $row = $dbw->fetchObject( $res ) ) {
|
31 | 31 | $key = $row->fa_storage_key;
|
32 | 32 | $group = $row->fa_storage_group;
|
| 33 | + $id = $row->fa_id;
|
33 | 34 |
|
34 | 35 | $store = FileStore::get( $group );
|
35 | 36 | if ( $store ) {
|
36 | 37 | $path = $store->filePath( $key );
|
37 | 38 | if ( $path && file_exists($path) ) {
|
38 | 39 | $transaction->addCommit( FSTransaction::DELETE_FILE, $path );
|
| 40 | + $dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" );
|
39 | 41 | } else {
|
40 | 42 | echo( "Notice - file '$key' not found in group '$group'\n" );
|
41 | 43 | }
|
— | — | @@ -46,12 +48,6 @@ |
47 | 49 |
|
48 | 50 | $transaction->commit();
|
49 | 51 |
|
50 | | -
|
51 | | - # Delete as appropriate
|
52 | | - echo( "Deleting filearchive rows..." );
|
53 | | - $dbw->query( "TRUNCATE TABLE $tbl_arch" );
|
54 | | - echo( "done.\n" );
|
55 | | -
|
56 | 52 | # This bit's done
|
57 | 53 | # Purge redundant text records
|
58 | 54 | $dbw->commit();
|