getBools doesn't exist in Translate anymore
[lhc/web/wiklou.git] / maintenance / rollbackEdits.php
index 6a7e85a..4660bce 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
 
+/**
+ * Maintenance script to rollback all edits by a given user or IP provided
+ * they're the most recent edit.
+ *
+ * @ingroup Maintenance
+ */
 class RollbackEdits extends Maintenance {
        public function __construct() {
                parent::__construct();
@@ -62,10 +69,12 @@ class RollbackEdits extends Maintenance {
                        return;
                }
 
+               $doer = User::newFromName( 'Maintenance script' );
+
                foreach ( $titles as $t ) {
-                       $a = new Article( $t );
-                       $this->output( 'Processing ' . $t->getPrefixedText() . '...' );
-                       if ( !$a->commitRollback( $user, $summary, $bot, $results ) ) {
+                       $page = WikiPage::factory( $t );
+                       $this->output( 'Processing ' . $t->getPrefixedText() . '... ' );
+                       if ( !$page->commitRollback( $user, $summary, $bot, $results, $doer ) ) {
                                $this->output( "done\n" );
                        } else {
                                $this->output( "failed\n" );