From c1934161b08260b734354b79532a68f6fb2df42c Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 16 Sep 2010 17:45:08 -0400 Subject: [PATCH] Add update script for moving deprecated gallery categories to the tag system --- .../2010-09-16_migrate_categories_to_tags.php | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ansel/scripts/upgrades/2010-09-16_migrate_categories_to_tags.php 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'); -- 2.11.0