[geeklog-cvs] geeklog: The Migrate option in the install script now also works...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Sep 6 05:01:44 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/0021451d31d4
changeset: 7285:0021451d31d4
user: Dirk Haun <dirk at haun-online.de>
date: Sun Sep 06 10:23:14 2009 +0200
description:
The Migrate option in the install script now also works on an existing database (feature request #0000945)
diffstat:
public_html/admin/install/language/chinese_simplified_utf-8.php | 5 +-
public_html/admin/install/language/chinese_traditional_utf-8.php | 5 +-
public_html/admin/install/language/english.php | 3 +-
public_html/admin/install/language/german.php | 3 +-
public_html/admin/install/language/hebrew_utf-8.php | 3 +-
public_html/admin/install/language/japanese_utf-8.php | 5 +-
public_html/admin/install/language/polish.php | 5 +-
public_html/admin/install/lib-install.php | 5 +
public_html/admin/install/migrate.php | 64 ++++++++++++-
public_html/docs/history | 2 +
10 files changed, 87 insertions(+), 13 deletions(-)
diffs (245 lines):
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/language/chinese_simplified_utf-8.php
--- a/public_html/admin/install/language/chinese_simplified_utf-8.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/language/chinese_simplified_utf-8.php Sun Sep 06 10:23:14 2009 +0200
@@ -239,7 +239,8 @@
45 => 'Could not identify database version. Please perform a manual update.',
46 => '',
47 => 'Database upgrade from version %s to version %s failed.',
- 48 => 'One or more plugins could not be updated and had to be disabled.'
+ 48 => 'One or more plugins could not be updated and had to be disabled.',
+ 49 => 'Use current database content'
);
// +---------------------------------------------------------------------------+
@@ -364,4 +365,4 @@
'plugin_upload' => $LANG_PLUGINS[10]
);
-?>
\ No newline at end of file
+?>
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/language/chinese_traditional_utf-8.php
--- a/public_html/admin/install/language/chinese_traditional_utf-8.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/language/chinese_traditional_utf-8.php Sun Sep 06 10:23:14 2009 +0200
@@ -239,7 +239,8 @@
45 => 'Could not identify database version. Please perform a manual update.',
46 => '',
47 => 'Database upgrade from version %s to version %s failed.',
- 48 => 'One or more plugins could not be updated and had to be disabled.'
+ 48 => 'One or more plugins could not be updated and had to be disabled.',
+ 49 => 'Use current database content'
);
// +---------------------------------------------------------------------------+
@@ -364,4 +365,4 @@
'plugin_upload' => $LANG_PLUGINS[10]
);
-?>
\ No newline at end of file
+?>
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/language/english.php Sun Sep 06 10:23:14 2009 +0200
@@ -238,7 +238,8 @@
45 => "Could not identify database version. Please perform a manual update.",
46 => '', // TBD
47 => 'Database upgrade from version %s to version %s failed.',
- 48 => 'One or more plugins could not be updated and had to be disabled.'
+ 48 => 'One or more plugins could not be updated and had to be disabled.',
+ 49 => 'Use current database content'
);
// +---------------------------------------------------------------------------+
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/language/german.php
--- a/public_html/admin/install/language/german.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/language/german.php Sun Sep 06 10:23:14 2009 +0200
@@ -238,7 +238,8 @@
45 => 'Version des Datenbank-Backups konnte nicht ermittelt werden. Bitte ein manuelles Update durchführen.',
46 => '',
47 => 'Update von Version %s auf Version %s fehlgeschlagen.',
- 48 => 'Ein oder mehrere Plugins konnten nicht aktualisiert werden und wurden deaktiviert.'
+ 48 => 'Ein oder mehrere Plugins konnten nicht aktualisiert werden und wurden deaktiviert.',
+ 49 => 'Aktuellen Datenbank-Inhalt verwenden'
);
// +---------------------------------------------------------------------------+
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/language/hebrew_utf-8.php
--- a/public_html/admin/install/language/hebrew_utf-8.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/language/hebrew_utf-8.php Sun Sep 06 10:23:14 2009 +0200
@@ -234,7 +234,8 @@
45 => '×× ××× ×פשר ××××ת ×ת ×רסת ×××ר ×××××¢. ×× × ××¦×¢× ×¢×××× ××× ×.',
46 => '',
47 => 'ש×ר×× ×××ר ×××××¢ ××××¨×¡× %s ××××¨×¡× %s × ×ש×.',
- 48 => '××× ×× ××תר ××-plugins ×× ×צ××× ××תע××× ×××× ×××××¥ ×× ×ר××.'
+ 48 => '××× ×× ××תר ××-plugins ×× ×צ××× ××תע××× ×××× ×××××¥ ×× ×ר××.',
+ 49 => 'Use current database content'
);
// +---------------------------------------------------------------------------+
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/language/japanese_utf-8.php
--- a/public_html/admin/install/language/japanese_utf-8.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/language/japanese_utf-8.php Sun Sep 06 10:23:14 2009 +0200
@@ -240,7 +240,8 @@
45 => 'ãã¼ã¿ãã¼ã¹ã®ãã¼ã¸ã§ã³ããããã¾ãããæåã§ã¢ãããã¼ããã¦ãã ããã',
46 => '', // TBD
47 => 'ãã¼ã¿ãã¼ã¹ã«å¯¾ã㦠%s ãã %s ã¸ã®ã¢ããã°ã¬ã¼ãã«å¤±æãã¾ããã',
- 48 => 'ãã©ã°ã¤ã³ãæ´æ°ã§ããªãã£ããã®ãããã¾ãããããã®ãã©ã°ã¤ã³ã¯ç¡å¹ã«ãã¦ãã ããã'
+ 48 => 'ãã©ã°ã¤ã³ãæ´æ°ã§ããªãã£ããã®ãããã¾ãããããã®ãã©ã°ã¤ã³ã¯ç¡å¹ã«ãã¦ãã ããã',
+ 49 => 'Use current database content'
);
// +---------------------------------------------------------------------------+
@@ -365,4 +366,4 @@
'plugin_upload' => $LANG_PLUGINS[10]
);
-?>
\ No newline at end of file
+?>
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/language/polish.php
--- a/public_html/admin/install/language/polish.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/language/polish.php Sun Sep 06 10:23:14 2009 +0200
@@ -238,7 +238,8 @@
45 => 'Could not identify database version. Please perform a manual update.',
46 => '',
47 => 'Database upgrade from version %s to version %s failed.',
- 48 => 'One or more plugins could not be updated and had to be disabled.'
+ 48 => 'One or more plugins could not be updated and had to be disabled.',
+ 49 => 'Use current database content'
);
// +---------------------------------------------------------------------------+
@@ -363,4 +364,4 @@
'plugin_upload' => $LANG_PLUGINS[10]
);
-?>
\ No newline at end of file
+?>
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/lib-install.php Sun Sep 06 10:23:14 2009 +0200
@@ -362,6 +362,11 @@
*/
function INST_writeConfig($config_file, $db)
{
+ // we may have included db-config.php elsewhere already, in which case
+ // all of these variables need to be imported from the global namespace
+ global $_DB_host, $_DB_name, $_DB_user, $_DB_pass, $_DB_table_prefix,
+ $_DB_dbms;
+
require_once $config_file; // Grab the current DB values
$db = array('host' => (isset($db['host']) ? $db['host'] : $_DB_host),
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/admin/install/migrate.php Sun Sep 06 10:23:14 2009 +0200
@@ -335,11 +335,14 @@
}
rsort($backup_files);
- $display .= '<p><label class="' . $form_label_dir . '">' . $LANG_MIGRATE[6] . ' ' . INST_helpLink('migrate_file') . '</label>' . LB
+ $display .= '<p><label class="' . $form_label_dir . '">'
+ . $LANG_MIGRATE[6] . ' ' . INST_helpLink('migrate_file')
+ . '</label>' . LB
. '<select name="migration_type" onchange="INST_selectMigrationType()">' . LB
. '<option value="">' . $LANG_MIGRATE[7] . '</option>' . LB
. '<option value="select">' . $LANG_MIGRATE[8] . '</option>' . LB
. '<option value="upload">' . $LANG_MIGRATE[9] . '</option>' . LB
+ . '<option value="dbcontent">' . $LANG_MIGRATE[49] . '</option>' . LB
. '</select> ' . LB
. '<span id="migration-select">' . LB;
@@ -356,7 +359,9 @@
$filename = str_replace($backup_dir, '', $file_path);
$backup_file = str_replace($backup_dir, '', $file_path);
- $display .= '<option value="' . $filename .'">' . $backup_file . ' (' . INST_formatSize(filesize($file_path)) . ')</option>' . LB;
+ $display .= '<option value="' . $filename .'">' . $backup_file
+ . ' (' . INST_formatSize(filesize($file_path))
+ . ')</option>' . LB;
}
@@ -453,6 +458,11 @@
}
break;
+ case 'dbcontent': // No upload / import required - use db as is
+ $backup_file = false;
+ $import_errors = 0;
+ break;
+
default:
$display .= INST_getAlertMsg($LANG_MIGRATE[18]);
$backup_file = false;
@@ -563,6 +573,56 @@
break;
+ case 'dbcontent':
+
+ require_once $_CONF['path_system'] . 'lib-database.php';
+ require_once 'lib-upgrade.php';
+
+ // we need the following information
+ $has_config = false;
+ $db_connection_charset = '';
+ $DB['table_prefix'] = '';
+
+ // get table prefix and check for conf_values table
+ $result = DB_query("SHOW TABLES");
+ $num_tables = DB_numRows($result);
+ for ($i = 0; $i < $num_tables; $i++) {
+ list($table) = DB_fetchArray($result);
+ if (substr($table, -6) == 'access') {
+ $DB['table_prefix'] = substr($table, 0, -6);
+ } elseif (strpos($table, 'conf_values') !== false) {
+ $has_config = true;
+ break;
+ }
+ }
+
+ // try to figure out the charset
+ $result = DB_query("SHOW CREATE TABLE " . $DB['table_prefix']
+ . "access");
+ list($table, $create) = DB_fetchArray($result);
+ if (strpos($create, 'DEFAULT CHARSET=utf8') !== false) {
+ $db_connection_charset = 'utf8';
+ }
+
+ // Update db-config.php with the table prefix from the db
+ if (!INST_writeConfig($dbconfig_path, $DB)) {
+ exit($LANG_INSTALL[26] . ' ' . $dbconfig_path
+ . $LANG_INSTALL[58]);
+ }
+
+ if (!INST_setDefaultCharset($siteconfig_path,
+ ($db_connection_charset == 'utf8'
+ ? 'utf-8' : $LANG_CHARSET))) {
+ exit($LANG_INSTALL[26] . ' ' . $siteconfig_path
+ . $LANG_INSTALL[58]);
+ }
+
+ // skip step 3 since we don't need to import anything
+ header('Location: migrate.php?step=4&language=' . $language
+ . '&site_url=' . urlencode($_REQUEST['site_url'])
+ . '&site_admin_url=' . urlencode($_REQUEST['site_admin_url']));
+ break;
+
} // End switch ($_REQUEST['migration_type']
}
diff -r 1d689f9b83d0 -r 0021451d31d4 public_html/docs/history
--- a/public_html/docs/history Sat Sep 05 23:40:24 2009 +0200
+++ b/public_html/docs/history Sun Sep 06 10:23:14 2009 +0200
@@ -3,6 +3,8 @@
Oct ??, 2009 (1.6.1)
------------
+- The Migrate option in the install script now also works on an existing
+ database (feature request #0000945) [Dirk]
- Comment notifications used the phrase "Read the full article" when pointing
to the new comment post (bug #0000940) [Dirk]
- Send correct content type and character set header in the install script
More information about the geeklog-cvs
mailing list