Extension:SpecialMergeableChanges

What can this extension do?
This Special Page shows all changes to the wiki since a given date. The user can also choose to save a zipped bundle of all the new uploads. The user can also get an xml file containing exports of all the new articles since the given date.

Usage
This is a special page. Go to Special:MergeableChanges, enter a date in the fields, and be amazed as all the changes to your wiki since that date are displayed before your eyes. Changes are nicely categorized as Added, Changed, or Deleted. Those categories are further broken down into Articles vs. Uploads.

This extension uses Special:Export to make an xml file of all new pages so that you can import it into another wiki.

**Note: You can use this extension with older versions of MediaWiki if you replace wfLoadExtensionMessages with something that will work on your version.

Download instructions
Copy the files in the section into files and put them into a folder called 'specialMergeableChanges' in your extensions folder.

Installation
To install this extension, add the following to LocalSettings.php:

SpecialMergeableChanges.body.php
\n";       while ($lineMain % $this->mcNUM_CELLS_PER_ROW != 0) {            $outMain .= " ";            $lineMain++;        }        $outMain .= " \n";        $out = array('Main'=>$outMain,'MainCount'=>$countMain,'Image'=>$outImage,'ImageCount'=>$countImage);        return $out;    }

/**    * deletes the specified element from the array *    * @param string $index * @param array &$array */   function deleteArrayElement ( $index, &$array ) { unset($array[$index]); }

/**    * This mimics the wiki export form, asking for an xml file of all newly * added pages so they can be imported into the recipient wiki. * @TODO: if you got the pclzip library uncomment the two lines below to use the upload zipping functionality *    * @param string $pages list of pages to export * @return string (an html form requesting export of pages) */   function export($pages) { //$this->makeImageBundle($pages); $this->xmlStream( $pages ); //$button = wfMsg('mc-imageFile')." "; $button .= wfMsg('mc-buttonInstruct', $this->dateTime->printableDate); return $button; }

/**    * This takes the list of pages to export and zips up all the uploads in     * their wiki file structure. Uses pclzip.lib.php *    * @param string $titlesText list of pages */   function makeImageBundle( $titlesText ) { global $wgTmpDirectory, $IP, $wgScriptPath; if (!file_exists($wgTmpDirectory)) { mkdir($wgTmpDirectory, 0777); }       $ziplist = array; $fileList = "The following files should be included in this zip:\n"; $titles = explode("\n",$titlesText); foreach ($titles as $title) { if ( stripos($title, /*I*/"mage") ) { //There is nothing to export if it isn't an image(upload) $image = str_replace("Image:", "", $title); $image = str_replace(" ", "_", $image); $imagePath = urldecode(Image::imageUrl($image)); $imagePath = $IP.str_replace($wgScriptPath, "", $imagePath); $fileList .= $imagePath. "\n"; $ziplist[] = $imagePath; }       }

file_put_contents($wgTmpDirectory."/fileList.txt", $fileList); $ziplist[] = $wgTmpDirectory."/fileList.txt";

$locale = $wgTmpDirectory."/"; if ( file_exists($locale.'images.zip') ) { unlink($locale.'images.zip'); //delete the previous zip file }       $bundle = new PclZip($locale.'images.zip'); //make a handle for the new zip file $bundle->create( $ziplist ); }

function xmlStream( $page ) { if( $page != '' ) { $pages = explode( "\n", $page );

$db =& wfGetDB( DB_SLAVE ); //TRUE - Means only the most current pages. $exporter = new WikiExporterToFile( $db, TRUE, 'import' ); $exporter->list_authors = FALSE ; $exporter->openStream;

foreach( $pages as $page ) { $exporter->pageByName( $page ); }

$exporter->closeStream; return; }   }

}