From: Michael J. Rubinsky Date: Thu, 23 Sep 2010 17:18:06 +0000 (-0400) Subject: Further tweaks to upgrade script. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=4677fb7384087f5c8cf4c9553b03ee5ece14cf01;p=horde.git Further tweaks to upgrade script. Make sure the image generator names are mapped to the new names. --- diff --git a/ansel/scripts/upgrades/2010-09-16_migrate_styles.php b/ansel/scripts/upgrades/2010-09-16_migrate_styles.php index 4912ea641..55c950a37 100644 --- a/ansel/scripts/upgrades/2010-09-16_migrate_styles.php +++ b/ansel/scripts/upgrades/2010-09-16_migrate_styles.php @@ -7,6 +7,30 @@ * * @author Michael J. Rubinsky */ + +/** + * Translates old style array from Ansel 1.x to Ansel 2.x. + * + * @param array $properties + */ +function translate_generators($properties) +{ + $thumb_map = array( + 'thumb' => 'Thumb', + 'prettythumb' => 'RoundedThumb', + 'shadowsharpthumb' => 'ShadowThumb', + 'polaroidthumb' => 'PolaroidThumb'); + + $properties['thumbstyle'] = $thumb_map[$properties['thumbstyle']]; + unset($properties['requires_png']); + unset($properties['name']); + unset($properties['title']); + unset($properties['hide']); + unset($properties['default_galleryimage_type']); + + return $properties; +} + $debug = false; require_once dirname(__FILE__) . '/../../lib/Application.php'; Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true)); @@ -40,10 +64,10 @@ foreach ($rows as $row) { $newStyle = ''; } else { $properties = array_merge($defaults, $styles[$row[1]]); - unset($properties['requires_png']); - unset($properties['name']); - unset($properties['title']); - unset($properties['hide']); + + // Translate previous generator names: + $properties = translate_generators($properties); + $newStyle = serialize(new Ansel_Style($properties)); } if ($debug) {