Page MenuHomePhabricator

cleanupBlacklistedDomains.php: support --delete
Open, Needs TriagePublic

Description

Currently the script is set to blank the page instead of delete it when it cannot find any non-spammed revision. The code to delete is there, but has been hard-disabled:

  if ( !$rev ) {
    // Didn't find a non-spammy revision, delete the page
    /*
    print "All revisions are spam, deleting...\n";
    $article = new Article( $title );
    $article->doDeleteArticle( "All revisions matched the spam blacklist" );
    */
    // Too scary, blank instead
    print "All revisions are spam, blanking...\n";
    $text = '';
    $comment = "All revisions matched the spam blacklist ($match), blanking";
  } else {
    // Revert to this revision
    $text = ContentHandler::getContentText( $rev->getContent() );
    $comment = "Cleaning up links to $match";
  }
  $wikiPage = new WikiPage( $title );
  $wikiPage->doEditContent( ContentHandler::makeContent( $text, $title ), $comment );
}

We should support --delete option to actually delete the page. If not, just blank the page.