- //skip anything that looks modified (i.e. multiple revs)
- if (($count == 1)) {
- #echo $title->getPrefixedText(), "\t", $count, "\n";
- echo "delete: ", $title->getPrefixedText(), "\n";
-
- //as much as I hate to cut & paste this, it's a little different, and
- //I already have the id & revs
-
- if( $delete ) {
- $dbw->query( "DELETE FROM $tbl_pag WHERE page_id = $id" );
- $dbw->commit();
- // Delete revisions as appropriate
- DeleteRevisions( $revs );
- PurgeRedundantText( true );
- $n_deleted ++;
- }
- } else {
- echo "skip: ", $title->getPrefixedText(), "\n";
- }
-
-
- }
- $dbw->commit();
-
- if ($n_deleted > 0) {
- #update statistics - better to decrement existing count, or just count
- #the page table?
- $pages = $dbw->selectField('site_stats', 'ss_total_pages');
- $pages -= $n_deleted;
- $dbw->update( 'site_stats',
- array('ss_total_pages' => $pages ),
- array( 'ss_row_id' => 1),
- __METHOD__ );
-
- }
-
- if (!$delete) {
- echo( "To update the database, run the script with the --delete option.\n" );
- }
-
-}
+ if ( $n_deleted > 0 ) {
+ # update statistics - better to decrement existing count, or just count
+ # the page table?
+ $pages = $dbw->selectField( 'site_stats', 'ss_total_pages' );
+ $pages -= $n_deleted;
+ $dbw->update(
+ 'site_stats',
+ array( 'ss_total_pages' => $pages ),
+ array( 'ss_row_id' => 1 ),
+ __METHOD__
+ );
+ }