From: Michael J. Rubinsky Date: Thu, 16 Sep 2010 21:45:08 +0000 (-0400) Subject: Add update script for moving deprecated gallery categories to the tag system X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c1934161b08260b734354b79532a68f6fb2df42c;p=horde.git Add update script for moving deprecated gallery categories to the tag system --- diff --git a/ansel/scripts/upgrades/2010-09-16_migrate_categories_to_tags.php b/ansel/scripts/upgrades/2010-09-16_migrate_categories_to_tags.php new file mode 100644 index 000000000..baca56bde --- /dev/null +++ b/ansel/scripts/upgrades/2010-09-16_migrate_categories_to_tags.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php + + */ +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true)); + +/* Gallery tags */ +$sql = 'SELECT share_id, attribute_category, share_owner FROM ansel_shares'; + +// Maybe iterate over results and aggregate them by user and gallery so we can +// tag all tags for a single gallery at once. Probably not worth it for a one +// time upgrade script. +$cli->message('Migrating gallery categories.', 'cli.message'); +$rows = $ansel_db->queryAll($sql); +foreach ($rows as $row) { + $GLOBALS['injector']->getInstance('Ansel_Tagger')->tag($row[0], $row[1], $row[2], 'gallery'); +} +$cli->message('Gallery categories successfully migrated.', 'cli.success');