From b000c6d4d26cd8f0e24a02811dac7080f3288cb4 Mon Sep 17 00:00:00 2001
From: andi <andi@splitbrain.org>
Date: Fri, 13 May 2005 17:12:55 +0200
Subject: [PATCH] let scriptify move the old file away after copy

darcs-hash:20050513151255-9977f-ff7a5e5984c8e419654950bfb56b1d42b31937d5.gz
---
 inc/init.php | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/inc/init.php b/inc/init.php
index c6a97e8f9..150e07d83 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -139,6 +139,15 @@ function getBaseURL($abs=false){
   return $proto.$host.$port.$dir;
 }
 
+/**
+ * Append a PHP extension to a given file and adds an exit call
+ *
+ * This is used to migrate some old configfiles. An added PHP extension
+ * ensures the contents are not shown to webusers even if .htaccess files
+ * do not work
+ *
+ * @author Jan Decaluwe <jan@jandecaluwe.com>
+ */
 function scriptify($file) {
   // checks
   if (!is_readable($file)) {
@@ -163,8 +172,9 @@ function scriptify($file) {
     fwrite($fh, $line);
   }
   fclose($fh);
+  //try to rename the old file
+  @rename($file,"$file.old");
 }
 
 
-
 //Setup VIM: ex: et ts=2 enc=utf-8 :
-- 
GitLab