From 314a7c5ed82a60183e1cb07a9b8d47a306740ab9 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 17 Aug 2012 20:24:39 +0200 Subject: [PATCH] copy www files over when they do not exist --- .gitignore | 2 ++ data/surrogator.config.php.dist | 1 + res/www/favicon.ico | Bin 0 -> 318 bytes www/index.surrogator.html => res/www/index.html | 0 res/www/robots.txt | 2 ++ surrogator.php | 11 ++++++----- 6 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 res/www/favicon.ico rename www/index.surrogator.html => res/www/index.html (100%) create mode 100644 res/www/robots.txt diff --git a/.gitignore b/.gitignore index ee21d94..e2e47de 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ raw/* data/surrogator.config.php README.html www/index.html +www/favicon.ico +www/robots.txt diff --git a/data/surrogator.config.php.dist b/data/surrogator.config.php.dist index 947a96a..c7eef0b 100644 --- a/data/surrogator.config.php.dist +++ b/data/surrogator.config.php.dist @@ -1,5 +1,6 @@ x01$Nn*FJNJj-=#762=kNSyc=7HZ*hr8aV2i*! zpydnd7g4;UEa7-Ft60BNp5o2%>_fQ~#C qdo>$q8fQT4R+a?}4AKS_?aV-N=B+EMqXHNh8HEG{6@i|lG5`Pw6*m_E literal 0 HcmV?d00001 diff --git a/www/index.surrogator.html b/res/www/index.html similarity index 100% rename from www/index.surrogator.html rename to res/www/index.html diff --git a/res/www/robots.txt b/res/www/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/res/www/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/surrogator.php b/surrogator.php index c7c9d54..fdbd384 100755 --- a/surrogator.php +++ b/surrogator.php @@ -118,13 +118,14 @@ foreach ($sizes as $size) { foreach (array('mm.png', 'default.png') as $resFile) { if (!file_exists($rawDir . '/' . $resFile)) { log($resFile . ' missing, copying it from res/', 2); - copy(__DIR__ . '/res/' . $resFile, $rawDir . '/' . $resFile); + copy($resDir . '/' . $resFile, $rawDir . '/' . $resFile); } } - -if (!file_exists($wwwDir . '/index.html') && is_writable($wwwDir)) { - log('no index.html found, copying default over', 1); - copy($wwwDir . '/index.surrogator.html', $wwwDir . '/index.html'); +foreach (array('index.html', 'robots.txt', 'favicon.ico') as $resFile) { + if (!file_exists($wwwDir . '/' . $resFile) && is_writable($wwwDir)) { + log('no www/' . $resFile . ' found, copying default over', 1); + copy($resDir . '/www/' . $resFile, $wwwDir . '/' . $resFile); + } } if (count($files)) { -- 2.30.2