summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-11-28 03:32:03 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-11-28 03:32:03 +0000
commitf84f1d2ad2ed7b19c8eeb969c994af27046f9298 (patch)
treede253549316d68754a94a37e5ec6a4de20718df9
parentfc71e763fa2e3f50ec446f80aa21dcd0e9132f75 (diff)
downloadbrdo-f84f1d2ad2ed7b19c8eeb969c994af27046f9298.tar.gz
brdo-f84f1d2ad2ed7b19c8eeb969c994af27046f9298.tar.bz2
#99644 by neclimdul. Move a function to be more accessible by modules updating.
-rw-r--r--includes/install.inc54
-rw-r--r--modules/system/system.install54
2 files changed, 54 insertions, 54 deletions
diff --git a/includes/install.inc b/includes/install.inc
index d19a5eceb..fedd99265 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -600,6 +600,60 @@ function st($string, $args = array()) {
}
/**
+ * Converts a set of tables to UTF-8 encoding.
+ *
+ * This update is designed to be re-usable by contrib modules and is
+ * used by system_update_169().
+ */
+function _system_update_utf8($tables) {
+ // Are we starting this update for the first time?
+ if (!isset($_SESSION['update_utf8'])) {
+ switch ($GLOBALS['db_type']) {
+ // Only for MySQL 4.1+
+ case 'mysqli':
+ break;
+ case 'mysql':
+ if (version_compare(mysql_get_server_info($GLOBALS['active_db']), '4.1.0', '<')) {
+ return array();
+ }
+ break;
+ case 'pgsql':
+ return array();
+ }
+
+ // See if database uses UTF-8 already
+ global $db_url;
+ $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
+ $db_name = substr($url['path'], 1);
+ $result = db_fetch_array(db_query('SHOW CREATE DATABASE `%s`', $db_name));
+ if (preg_match('/utf8/i', array_pop($result))) {
+ return array();
+ }
+
+ // Make list of tables to convert
+ $_SESSION['update_utf8'] = $tables;
+ // Keep track of total for progress bar
+ $_SESSION['update_utf8_total'] = count($tables);
+ }
+
+ // Fetch remaining tables list and convert next table
+ $list = &$_SESSION['update_utf8'];
+
+ $ret = update_convert_table_utf8(array_shift($list));
+
+ // Are we done?
+ if (count($list) == 0) {
+ unset($_SESSION['update_utf8']);
+ unset($_SESSION['update_utf8_total']);
+ return $ret;
+ }
+
+ // Progress percentage
+ $ret['#finished'] = 1 - (count($list) / $_SESSION['update_utf8_total']);
+ return $ret;
+}
+
+/**
* Check a profile's requirements.
*
* @param profile
diff --git a/modules/system/system.install b/modules/system/system.install
index 7444b4893..a4149e6c6 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -2535,60 +2535,6 @@ function system_update_169() {
));
}
-/**
- * Converts a set of tables to UTF-8 encoding.
- *
- * This update is designed to be re-usable by contrib modules and is
- * used by system_update_169().
- */
-function _system_update_utf8($tables) {
- // Are we starting this update for the first time?
- if (!isset($_SESSION['update_utf8'])) {
- switch ($GLOBALS['db_type']) {
- // Only for MySQL 4.1+
- case 'mysqli':
- break;
- case 'mysql':
- if (version_compare(mysql_get_server_info($GLOBALS['active_db']), '4.1.0', '<')) {
- return array();
- }
- break;
- case 'pgsql':
- return array();
- }
-
- // See if database uses UTF-8 already
- global $db_url;
- $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
- $db_name = substr($url['path'], 1);
- $result = db_fetch_array(db_query('SHOW CREATE DATABASE `%s`', $db_name));
- if (preg_match('/utf8/i', array_pop($result))) {
- return array();
- }
-
- // Make list of tables to convert
- $_SESSION['update_utf8'] = $tables;
- // Keep track of total for progress bar
- $_SESSION['update_utf8_total'] = count($tables);
- }
-
- // Fetch remaining tables list and convert next table
- $list = &$_SESSION['update_utf8'];
-
- $ret = update_convert_table_utf8(array_shift($list));
-
- // Are we done?
- if (count($list) == 0) {
- unset($_SESSION['update_utf8']);
- unset($_SESSION['update_utf8_total']);
- return $ret;
- }
-
- // Progress percentage
- $ret['#finished'] = 1 - (count($list) / $_SESSION['update_utf8_total']);
- return $ret;
-}
-
function system_update_170() {
if (!variable_get('update_170_done', FALSE)) {
switch ($GLOBALS['db_type']) {