public function execute()
 {
     $this->output("Delete archived revisions\n\n");
     # Data should come off the master, wrapped in a transaction
     if ($this->hasOption('delete')) {
         DeleteArchivedRevisionsImplementation::doDelete($this);
     } else {
         $dbw = wfGetDB(DB_MASTER);
         $res = $dbw->selectRow('archive', 'COUNT(*) as count', array(), __FUNCTION__);
         $this->output("Found {$res->count} revisions to delete.\n");
         $this->output("Please run the script again with the --delete option to really delete the revisions.\n");
     }
 }
	/**
	 * @depends testLogin
	 */
	function testUploadChunkDoneGood( $data ) {
		global $wgUser, $wgVerifyMimeType;
		$wgVerifyMimeType = false;

		$this->markTestIncomplete("Not working yet ... fails every other time b/c we're not dealing with a temporary db");

		DeleteArchivedFilesImplementation::doDelete(new nullClass, true);
		DeleteArchivedRevisionsImplementation::doDelete(new nullClass);

		$id = Title::newFromText( "Twar.png", NS_FILE )->getArticleID();
		$oldFile = Article::newFromID( $id );
		if ( $oldFile ) {
			$oldFile->doDeleteArticle();
			$oldFile->doPurge();
		}

		$oldFile = wfFindFile( "Twar.png" );
		if ( $oldFile ) {
			$oldFile->delete();
		}
		$id = Title::newFromText( "Twar.png", NS_FILE )->getArticleID();
		$this->assertEquals(0, $id);

		$oldFile = Article::newFromID( $id );
		$this->assertEquals(null, $oldFile);

		$wgUser = User::newFromName( self::$userName );
		$data[2]['wsEditToken'] = $data[2]['wsToken'];
		$token = md5( $data[2]['wsToken'] ) . EDIT_TOKEN_SUFFIX;
		$data = $this->doApiRequest( array(
			'action' => 'resumableupload',
			'comment' => 'test',
			'watchlist' => 'watch',
			'filename' => 'twar.png',
			'token' => $token ), $data );

		$url = $data[0]['uploadUrl'];
		$params = wfCgiToArray( substr( $url, strpos( $url, "?" ) ) );
		$size = 0;
		for ( $i = 0; $i < 5; $i++ ) {
			$this->makeChunk( "123" );
			$size += $_FILES['chunk']['size'];

			$data = $this->doApiRequest( $params, $data );
			$this->assertArrayHasKey( "result", $data[0] );
			$this->assertTrue( (bool)$data[0]["result"] );

			$this->assertArrayHasKey( "filesize", $data[0] );
			$this->assertEquals( $size, $data[0]['filesize'] );

			$this->cleanChunk();
		}

		$params['done'] = true;

		$this->makeChunk( "456" );
		$data = $this->doApiRequest( $params, $data );

		$this->cleanChunk();
		$this->assertArrayHasKey( 'result', $data[0] );

		$this->assertEquals( 1, $data[0]['result'] );

		$this->assertArrayHasKey( 'done', $data[0] );
		$this->assertEquals( 1, $data[0]['done'] );

		$this->assertArrayHasKey( 'resultUrl', $data[0] );
		$this->assertRegExp( '/File:Twar.png/', $data[0]['resultUrl'] );
	}