From 5d79444852cdc12f976264c21409311a475cf54f Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 4 Jul 2012 22:58:31 +0200 Subject: [PATCH] Missing update script. --- apps/contacts/appinfo/update.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 apps/contacts/appinfo/update.php diff --git a/apps/contacts/appinfo/update.php b/apps/contacts/appinfo/update.php new file mode 100644 index 00000000000..873899f578b --- /dev/null +++ b/apps/contacts/appinfo/update.php @@ -0,0 +1,25 @@ +execute(array()); + + // Then get all the active address books. + $stmt = OCP\DB::prepare( 'SELECT userid,configvalue FROM *PREFIX*preferences WHERE appid=\'contacts\' AND configkey=\'openaddressbooks\'' ); + $result = $stmt->execute(array()); + + // Prepare statement for updating the new 'active' field. + $stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=? WHERE id=? AND userid=?' ); + while( $row = $result->fetchRow()) { + $ids = explode(';', $row['configvalue']); + foreach($ids as $id) { + $r = $stmt->execute(array(1, $id, $row['userid'])); + } + } + + // Remove the old preferences. + $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid=\'contacts\' AND configkey=\'openaddressbooks\'' ); + $result = $stmt->execute(array()); +} -- 2.39.5