[geeklog-cvs] geeklog: Fixed upgrade issues when taking settings from an old c...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon Jan 5 05:06:55 EST 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/591bc2b8c55d
changeset: 6621:591bc2b8c55d
user: Dirk Haun <dirk at haun-online.de>
date: Thu Jan 01 11:15:21 2009 +0100
description:
Fixed upgrade issues when taking settings from an old config.php
diffstat:
3 files changed, 44 insertions(+), 60 deletions(-)
public_html/admin/install/index.php | 37 +----------------------------
public_html/admin/install/lib-install.php | 33 ++++++-------------------
public_html/admin/install/lib-upgrade.php | 34 ++++++++++++++++++++++++++
diffs (165 lines):
diff -r 1aceb360b6ea -r 591bc2b8c55d public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Wed Dec 31 19:56:03 2008 +0100
+++ b/public_html/admin/install/index.php Thu Jan 01 11:15:21 2009 +0100
@@ -551,10 +551,10 @@
} else {
$site_url = isset($_POST['site_url']) ? $_POST['site_url'] : (isset($_GET['site_url']) ? $_GET['site_url'] : '') ;
$site_admin_url = isset($_POST['site_admin_url']) ? $_POST['site_admin_url'] : (isset($_GET['site_admin_url']) ? $_GET['site_admin_url'] : '') ;
+ }
- INST_fixPathsAndUrls($_CONF['path'], $html_path,
+ INST_fixPathsAndUrls($_CONF['path'], $html_path,
urldecode($site_url), urldecode($site_admin_url));
- }
// disable plugins for which we don't have the source files
INST_checkPlugins();
@@ -832,39 +832,6 @@
}
}
-
-/**
-* Change default character set to UTF-8
-*
-* @param string $siteconfig_path complete path to siteconfig.php
-* @param string $charset default character set to use
-* @return boolean true: success; false: an error occured
-* @note Yes, this means that we need to patch siteconfig.php a second time.
-*
-*/
-function INST_setDefaultCharset($siteconfig_path, $charset)
-{
- $result = true;
-
- $siteconfig_file = fopen($siteconfig_path, 'r');
- $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
- fclose($siteconfig_file);
-
- $siteconfig_data = preg_replace
- (
- '/\$_CONF\[\'default_charset\'\] = \'[^\']*\';/',
- "\$_CONF['default_charset'] = '" . $charset . "';",
- $siteconfig_data
- );
-
- $siteconfig_file = fopen($siteconfig_path, 'w');
- if (!fwrite($siteconfig_file, $siteconfig_data)) {
- $result = false;
- }
- @fclose($siteconfig_file);
-
- return $result;
-}
/**
* Handle default install of available plugins
diff -r 1aceb360b6ea -r 591bc2b8c55d public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Wed Dec 31 19:56:03 2008 +0100
+++ b/public_html/admin/install/lib-install.php Thu Jan 01 11:15:21 2009 +0100
@@ -457,28 +457,6 @@
}
/**
- * Import a Geeklog database from a backup file
- *
- * @param string $file Path to backup file on the server
- * @return bool True if successful, false if not
- *
- */
-/*
-function INST_importDBFromBackup($file)
-{
- global $_DB, $_DB_name, $display, $_TABLES;
-
- // Make sure the database is clean
- if (!DB_query('drop database ' . $_DB_name))
- die('unable to drop database ' . $_DB_name);
- if (!DB_query('create database ' . $_DB_name))
- die('unable to create database ' . $_DB_name);
-
- return true;
-}
-*/
-
-/**
* Can the install script connect to the database?
*
* @param array $db Database information
@@ -792,7 +770,7 @@
COM_errorLog("Attempting to install the '$plugin' plugin", 1);
}
- // sanity checks in $inst_parms
+ // sanity checks for $inst_parms
if (isset($inst_parms['info'])) {
$pi_name = $inst_parms['info']['pi_name'];
$pi_version = $inst_parms['info']['pi_version'];
@@ -1019,7 +997,7 @@
*/
function INST_fixPathsAndUrls($path, $path_html, $site_url, $site_admin_url)
{
- // no global $_CONF here!
+ // no "global $_CONF" here!
require_once $path . 'system/classes/config.class.php';
@@ -1050,8 +1028,13 @@
$config->set('path_html', $path_html);
}
if (! file_exists($_CONF['path_themes'] . $_CONF['theme']
- . '/header.thtml')) {
+ . '/header.thtml')) {
$config->set('path_themes', $path_html . 'layout/');
+
+ if (! file_exists($path_html . 'layout/' . $_CONF['theme']
+ . '/header.thtml')) {
+ $config->set('theme', 'professional');
+ }
}
if (! file_exists($_CONF['path_images'] . 'articles')) {
$config->set('path_images', $path_html . 'images/');
diff -r 1aceb360b6ea -r 591bc2b8c55d public_html/admin/install/lib-upgrade.php
--- a/public_html/admin/install/lib-upgrade.php Wed Dec 31 19:56:03 2008 +0100
+++ b/public_html/admin/install/lib-upgrade.php Thu Jan 01 11:15:21 2009 +0100
@@ -579,6 +579,40 @@
/**
+* Change default character set to UTF-8
+*
+* @param string $siteconfig_path complete path to siteconfig.php
+* @param string $charset default character set to use
+* @return boolean true: success; false: an error occured
+* @note Yes, this means that we need to patch siteconfig.php a second time.
+*
+*/
+function INST_setDefaultCharset($siteconfig_path, $charset)
+{
+ $result = true;
+
+ $siteconfig_file = fopen($siteconfig_path, 'r');
+ $siteconfig_data = fread($siteconfig_file, filesize($siteconfig_path));
+ fclose($siteconfig_file);
+
+ $siteconfig_data = preg_replace
+ (
+ '/\$_CONF\[\'default_charset\'\] = \'[^\']*\';/',
+ "\$_CONF['default_charset'] = '" . $charset . "';",
+ $siteconfig_data
+ );
+
+ $siteconfig_file = fopen($siteconfig_path, 'w');
+ if (!fwrite($siteconfig_file, $siteconfig_data)) {
+ $result = false;
+ }
+ @fclose($siteconfig_file);
+
+ return $result;
+}
+
+
+/**
* Set VERSION constant in siteconfig.php after successful upgrade
*
* @param string $siteconfig_path path to siteconfig.php
More information about the geeklog-cvs
mailing list