Extension:Wiki2LaTeX/Development/w2lUpdater.php

\n"; $after = "<"."/pre>"; } $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';

$state = file_put_contents($file, $content); if ($state === false) { echo "Error with file: ".$file.$nl; } else { $state = $state/1024; $state = round($state, 2); @chmod($file, 0666); echo "Success updating file: ".$file." (".$state." Kb written)".$nl; } } echo $after;