[geeklog-cvs] geeklog: In the install script, always open db-config.php and si...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Sep 6 10:18:01 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/15be5bd03553
changeset: 7290:15be5bd03553
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Sep 06 15:12:47 2009 +0200
description:
In the install script, always open db-config.php and siteconfig.php in binary mode to avoid EOL character mixup on Windows (bug #0000730)

diffstat:

 public_html/admin/install/index.php       |  4 ++--
 public_html/admin/install/lib-install.php |  8 ++++----
 public_html/admin/install/lib-upgrade.php |  4 ++--
 public_html/docs/history                  |  2 ++
 4 files changed, 10 insertions(+), 8 deletions(-)

diffs (93 lines):

diff -r 6bf0c8bab156 -r 15be5bd03553 public_html/admin/install/index.php
--- a/public_html/admin/install/index.php	Sun Sep 06 13:18:55 2009 +0200
+++ b/public_html/admin/install/index.php	Sun Sep 06 15:12:47 2009 +0200
@@ -1177,7 +1177,7 @@
 
         // Edit siteconfig.php and enter the correct GL path and system directory path
         $siteconfig_path = $_PATH['public_html/'] . 'siteconfig.php';
-        $siteconfig_file = fopen($siteconfig_path, 'r');
+        $siteconfig_file = fopen($siteconfig_path, 'rb');
         $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
         fclose($siteconfig_file);
 
@@ -1187,7 +1187,7 @@
                             "\$_CONF['path'] = '" . str_replace('db-config.php', '', $_PATH['db-config.php']) . "';",
                             $siteconfig_data);
 
-        $siteconfig_file = fopen($siteconfig_path, 'w');
+        $siteconfig_file = fopen($siteconfig_path, 'wb');
         if (!fwrite($siteconfig_file, $siteconfig_data)) {
             exit ($LANG_INSTALL[26] . ' ' . $_PATH['public_html/'] . $LANG_INSTALL[28]);
         }
diff -r 6bf0c8bab156 -r 15be5bd03553 public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php	Sun Sep 06 13:18:55 2009 +0200
+++ b/public_html/admin/install/lib-install.php	Sun Sep 06 15:12:47 2009 +0200
@@ -389,7 +389,7 @@
     }
 
     // Read in db-config.php so we can insert the DB information
-    $dbconfig_file = fopen($config_file, 'r');
+    $dbconfig_file = fopen($config_file, 'rb');
     $dbconfig_data = fread($dbconfig_file, filesize($config_file));
     fclose($dbconfig_file);
 
@@ -402,7 +402,7 @@
     $dbconfig_data = str_replace("\$_DB_dbms = '" . $_DB_dbms . "';", "\$_DB_dbms = '" . $db['type'] . "';", $dbconfig_data); // Database type ('mysql' or 'mssql')
 
     // Write our changes to db-config.php
-    $dbconfig_file = fopen($config_file, 'w');
+    $dbconfig_file = fopen($config_file, 'wb');
     if (!fwrite($dbconfig_file, $dbconfig_data)) {
         return false;
     }
@@ -1145,7 +1145,7 @@
 {
     global $_TABLES, $LANG_INSTALL;
 
-    $siteconfig_file = fopen($siteconfig_path, 'r');
+    $siteconfig_file = fopen($siteconfig_path, 'rb');
     $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
     fclose($siteconfig_file);
 
@@ -1156,7 +1156,7 @@
              $siteconfig_data
             );
 
-    $siteconfig_file = @fopen($siteconfig_path, 'w');
+    $siteconfig_file = @fopen($siteconfig_path, 'wb');
     if (! fwrite($siteconfig_file, $siteconfig_data)) {
         exit($LANG_INSTALL[26] . ' ' . $LANG_INSTALL[28]);
     }
diff -r 6bf0c8bab156 -r 15be5bd03553 public_html/admin/install/lib-upgrade.php
--- a/public_html/admin/install/lib-upgrade.php	Sun Sep 06 13:18:55 2009 +0200
+++ b/public_html/admin/install/lib-upgrade.php	Sun Sep 06 15:12:47 2009 +0200
@@ -629,7 +629,7 @@
 {
     $result = true;
 
-    $siteconfig_file = fopen($siteconfig_path, 'r');
+    $siteconfig_file = fopen($siteconfig_path, 'rb');
     $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
     fclose($siteconfig_file);
 
@@ -640,7 +640,7 @@
              $siteconfig_data
             );
 
-    $siteconfig_file = fopen($siteconfig_path, 'w');
+    $siteconfig_file = fopen($siteconfig_path, 'wb');
     if (!fwrite($siteconfig_file, $siteconfig_data)) {
         $result = false;
     }
diff -r 6bf0c8bab156 -r 15be5bd03553 public_html/docs/history
--- a/public_html/docs/history	Sun Sep 06 13:18:55 2009 +0200
+++ b/public_html/docs/history	Sun Sep 06 15:12:47 2009 +0200
@@ -3,6 +3,8 @@
 Oct ??, 2009 (1.6.1)
 ------------
 
+- In the install script, always open db-config.php and siteconfig.php in
+  binary mode to avoid EOL character mixup on Windows (bug #0000730) [Dirk]
 - Avoid SQL error with certain db dumps during migration (bug #0000955) [Dirk]
 - Plugin migration was only called when the plugin also needed an upgrade
   (bug #0000947) [Dirk]



More information about the geeklog-cvs mailing list