From d91e07dad1ac276fa8105dd727a8a61cfe418f9e Mon Sep 17 00:00:00 2001 From: "Cathy J. Fitzpatrick" Date: Sat, 26 Jan 2013 13:46:46 -0700 Subject: [PATCH] Revise version query system In order to avoid having a dirty working directory on the live web server, this commit moves index.php to index.php.template.txt and generates index.php in update-version-query-strings. The index.php file is not under version control. --- githooks/update-version-query-strings | 6 ++-- index.php => index.php.template.txt | 40 +++++++++++++-------------- 2 files changed, 22 insertions(+), 24 deletions(-) rename index.php => index.php.template.txt (80%) diff --git a/githooks/update-version-query-strings b/githooks/update-version-query-strings index 7a7a0818a..ab17ecabb 100755 --- a/githooks/update-version-query-strings +++ b/githooks/update-version-query-strings @@ -9,16 +9,14 @@ * post-commit, post-checkout, post-merge, post-rewrite */ -define('SOURCE_FILE', 'index.php'); - function replaceMatch($m) { $hash = md5_file($m[2]); return "${m[1]}=\"/${m[2]}?${hash}\""; } -file_put_contents(SOURCE_FILE, +file_put_contents('index.php', preg_replace_callback('/(src|href)="\/(.*?)\?[a-z0-9]*?"/', 'replaceMatch', - file_get_contents(SOURCE_FILE)) + file_get_contents('index.php.template.txt')) ); diff --git a/index.php b/index.php.template.txt similarity index 80% rename from index.php rename to index.php.template.txt index b693a8f52..d51829031 100644 --- a/index.php +++ b/index.php.template.txt @@ -84,9 +84,9 @@ $serverlibrary = $serverlibs[$serverprotocol]; Showdown! - + - + @@ -174,41 +174,41 @@ $serverlibrary = $serverlibs[$serverprotocol]; - + - - - + + + - - - + + + - + - - - - - - - - + + + + + + + + - + - +