User:Steinsplitter/Massundelete

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Very simple script for mass undeleting pages/files.

<?php
// Dependency: Peachy

require( '/wikisystem/Peachy/Init.php' );
$site = Peachy::newWiki( "commons" );
// the txt file should contain a list with files to undelete
$file = fopen("undelete.txt", "r") or exit("Unable to open list of pages to undelete!");

while(!feof($file))
  {
  $pfile = fgets($file);
  echo "\n\nWorking on " . $pfile . "\n";
  $reason = "put in reason here";
  $site->initPage( $pfile )->undelete( $reason );
  }
fclose($file);

?>