Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3174996
Commits
f84f1d2a
Commit
f84f1d2a
authored
18 years ago
by
Neil Drumm
Browse files
Options
Downloads
Patches
Plain Diff
#99644
by neclimdul. Move a function to be more accessible by modules updating.
parent
fc71e763
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/install.inc
+54
-0
54 additions, 0 deletions
includes/install.inc
modules/system/system.install
+0
-54
0 additions, 54 deletions
modules/system/system.install
with
54 additions
and
54 deletions
includes/install.inc
+
54
−
0
View file @
f84f1d2a
...
...
@@ -599,6 +599,60 @@ function st($string, $args = array()) {
return
strtr
((
!
empty
(
$locale_strings
[
$string
])
?
$locale_strings
[
$string
]
:
$string
),
$args
);
}
/**
* 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.
*
...
...
This diff is collapsed.
Click to expand it.
modules/system/system.install
+
0
−
54
View file @
f84f1d2a
...
...
@@ -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'
])
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment