Extension:Wiki2LaTeX/Development/w2lUpdater.php

<?php // update and download the newest version of wiki2latex

$files = array('w2lCore', 'w2lParser', 'w2lTags', 'w2lDefaultConfig', 'w2lMessages', 'w2lChars', 'wiki2latex', 'w2lConfig.sample');

$url = 'http://www.mediawiki.org/w/index.php?title=Extension:Wiki2LaTeX/Development/'; $action = '.php&action=raw';

foreach ($files as $file) { $content = file_get_contents($url.$file.$action); $content = trim($content);

// Remove first and last line, as they both are required for syntaxhighlighting // when viewed by browser... $content = explode("\n", $content); array_shift($content); array_pop($content); $content = implode("\n", $content); $content = trim($content); $file .= '.php'; $proc_file = fopen($file, 'w'); $state = fwrite($proc_file, $content); if ($state === false) { echo "Error with file: ".$file." "; } else { $state = $state/1024; $state = round($state, 2); echo "Success updating file: ".$file." (".$state." Kb written) "; } }