summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-10-24 11:41:14 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-10-24 11:41:14 -0700
commit7259d8fc3068651da73c235b0c5efc9ab6912491 (patch)
treea6365004ed2fe315e3805de930dc3dd38be46f23 /modules
parentabc2183d36e2e67f4b3f49a0bed6fa8791452e07 (diff)
downloadbrdo-7259d8fc3068651da73c235b0c5efc9ab6912491.tar.gz
brdo-7259d8fc3068651da73c235b0c5efc9ab6912491.tar.bz2
Issue #1129642 follow-up by BTMash: Fixed D7 upgrade path for images.
Diffstat (limited to 'modules')
-rw-r--r--modules/image/image.install42
1 files changed, 27 insertions, 15 deletions
diff --git a/modules/image/image.install b/modules/image/image.install
index bbf44c876..fc326b4e6 100644
--- a/modules/image/image.install
+++ b/modules/image/image.install
@@ -331,16 +331,6 @@ function _image_update_7002_populate_dimensions($table, $field_name, &$last_fid)
*/
function image_update_7002(array &$sandbox) {
if (empty($sandbox)) {
- $fields = _update_7000_field_read_fields(array(
- 'module' => 'image',
- 'storage_type' => 'field_sql_storage',
- 'deleted' => 0,
- ));
-
- if (empty($fields)) {
- return;
- }
-
// Setup the sandbox.
$sandbox = array(
'tables' => array(),
@@ -349,16 +339,38 @@ function image_update_7002(array &$sandbox) {
'last_fid' => NULL,
);
- foreach ($fields as $field) {
- foreach ($field['storage']['details']['sql'] as $tables) {
- $table = reset(array_keys($tables));
- $sandbox['tables'][$table] = $field['field_name'];
- $sandbox['total'] += db_select($table)->countQuery()->execute()->fetchField();
+ $fields = _update_7000_field_read_fields(array(
+ 'module' => 'image',
+ 'storage_type' => 'field_sql_storage',
+ 'deleted' => 0,
+ ));
+ foreach ($fields as $field) {
+ $tables = array(
+ _field_sql_storage_tablename($field),
+ _field_sql_storage_revision_tablename($field),
+ );
+ foreach ($tables as $table) {
// Add the width and height columns to the table.
_image_update_7002_add_columns($table, $field['field_name']);
+
+ // How many rows need dimensions populated?
+ $count = db_select($table)->countQuery()->execute()->fetchField();
+
+ if (!$count) {
+ continue;
+ }
+
+ $sandbox['total'] += $count;
+ $sandbox['tables'][$table] = $field['field_name'];
}
}
+
+ // If no tables need rows populated with dimensions then we are done.
+ if (empty($sandbox['tables'])) {
+ $sandbox = array();
+ return;
+ }
}
// Process the table at the top of the list.