Change version script for PHP 5.2

The live web server runs PHP 5.2, which apparently does not
support anonymous functions, so the anonymous funciton has
been removed from update-version-query-strings.
This commit is contained in:
Cathy J. Fitzpatrick
2013-01-26 00:25:01 -07:00
parent 7dbb3330c2
commit 56cc3f0de4

View File

@@ -11,11 +11,14 @@
define('SOURCE_FILE', 'index.php');
function replaceMatch($m) {
$hash = md5_file($m[2]);
return "${m[1]}=\"/${m[2]}?${hash}\"";
}
file_put_contents(SOURCE_FILE,
preg_replace_callback('/(src|href)="\/(.*?)\?[a-z0-9]*?"/',
function($m) {
$hash = md5_file($m[2]);
return "${m[1]}=\"/${m[2]}?${hash}\"";
},
file_get_contents(SOURCE_FILE)));
'replaceMatch',
file_get_contents(SOURCE_FILE))
);