diff options
author | Pablo Martin <caedes@sindominio.net> | 2012-10-06 19:22:27 +0200 |
---|---|---|
committer | root <root@delvj.org> | 2012-10-06 19:22:43 +0200 |
commit | d88344c667c996d9d25f5a1393321c675ce8f2f9 (patch) | |
tree | bc6878e041140d6c36727c49f02b9dac0c3bdc90 /upgrades/2012022501.php | |
parent | d2b3600e49bfac698042e39e6b6ac79124b1080e (diff) | |
download | elgg-d88344c667c996d9d25f5a1393321c675ce8f2f9.tar.gz elgg-d88344c667c996d9d25f5a1393321c675ce8f2f9.tar.bz2 |
fix upgrade script.
Diffstat (limited to 'upgrades/2012022501.php')
-rw-r--r-- | upgrades/2012022501.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php index 50102e875..576aaba7d 100644 --- a/upgrades/2012022501.php +++ b/upgrades/2012022501.php @@ -7,7 +7,7 @@ $items = elgg_get_entities(array( 'type' => 'object', - 'subtype' => 'videolist_item', + 'subtype' => 'videolist', 'limit' => 5, 'order_by' => 'e.time_created asc', )); @@ -32,12 +32,9 @@ foreach ($items as $item) { * @return bool */ function videolist_2012022501($item) { + require_once(elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php'); - // do not upgrade videos that have already been upgraded - if ($item->thumbnail === true) { - return true; - } - + // get thumbnail image $thumbnail = file_get_contents($item->thumbnail); if (!$thumbnail) { return false; @@ -51,14 +48,27 @@ function videolist_2012022501($item) { $filehandler->write($thumbnail); $filehandler->close(); - $item->thumbnail = true; + // update properties + if ($item->url) { + $item->video_url = $item->url; + $item->deleteMetadata('url'); + } + if ($item->desc) { + $item->description = $item->desc; + $item->deleteMetadata('desc'); + $item->save(); + } + if ($item->embedurl) { + $item->deleteMetadata('embedurl'); + } + upgrade_change_subtype($item, 'videolist_item'); return true; } $previous_access = elgg_set_ignore_access(true); $options = array( 'type' => 'object', - 'subtype' => 'videolist_item', + 'subtype' => 'videolist', 'limit' => 0, ); $batch = new ElggBatch('elgg_get_entities', $options, 'videolist_2012022501', 100); |