From 56cc3f0de4aecbd0af1055340f1f3945e07a8dc5 Mon Sep 17 00:00:00 2001 From: "Cathy J. Fitzpatrick" Date: Sat, 26 Jan 2013 00:25:01 -0700 Subject: [PATCH] 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. --- githooks/update-version-query-strings | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/githooks/update-version-query-strings b/githooks/update-version-query-strings index 71c5b430d..ab4ba07d4 100755 --- a/githooks/update-version-query-strings +++ b/githooks/update-version-query-strings @@ -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)) + );