From df24129839f4e1efa9daf90639f4402405ca7b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 26 Nov 2014 12:20:33 +0100 Subject: [PATCH] Delete migrate.php Migrations are no longer supported in core --- appinfo/migrate.php | 73 --------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 appinfo/migrate.php diff --git a/appinfo/migrate.php b/appinfo/migrate.php deleted file mode 100644 index 46b7b9d0..00000000 --- a/appinfo/migrate.php +++ /dev/null @@ -1,73 +0,0 @@ -'bookmarks', - 'matchcol'=>'user_id', - 'matchval'=>$this->uid, - 'idcol'=>'id' - ); - $ids = $this->content->copyRows( $options ); - - $options = array( - 'table'=>'bookmarks_tags', - 'matchcol'=>'bookmark_id', - 'matchval'=>$ids - ); - - // Export tags - $ids2 = $this->content->copyRows( $options ); - - // If both returned some ids then they worked - if( is_array( $ids ) && is_array( $ids2 ) ) { - return true; - } else { - return false; - } - - } - - // Import function for bookmarks - function import( ) { - switch( $this->appinfo->version ) { - default: - // All versions of the app have had the same db structure, so all can use the same import function - $query = $this->content->prepare( "SELECT * FROM bookmarks WHERE user_id = ?" ); - $results = $query->execute( array( $this->olduid ) ); - $idmap = array(); - while( $row = $results->fetchRow() ) { - // Import each bookmark, saving its id into the map - $sql = "INSERT INTO `*PREFIX*bookmarks` - (`url`, `title`, `user_id`, `public`, `added`, `lastmodified`) VALUES (?, ?, ?, ?, ?, ?)" ; - $query = OCP\DB::prepare($sql); - $query->execute(array( - $row['url'], $row['title'], $this->uid, $row['public'], - $row['added'], $row['lastmodified'] - ) ); - // Map the id - $idmap[$row['id']] = OCP\DB::insertid(); - } - // Now tags - foreach($idmap as $oldid => $newid) { - $query = $this->content->prepare( "SELECT * FROM bookmarks_tags WHERE bookmark_id = ?" ); - $results = $query->execute( array( $oldid ) ); - while( $row = $results->fetchRow() ) { - // Import the tags for this bookmark, using the new bookmark id - $sql = "INSERT INTO `*PREFIX*bookmarks_tags`(`bookmark_id`, `tag`) VALUES (?, ?)"; - $query = OCP\DB::prepare($sql); - $query->execute( array( $newid, $row['tag'] ) ); - } - } - // All done! - break; - } - - return true; - } - -} - -// Load the provider -new OC_Migration_Provider_Bookmarks( 'bookmarks' ); \ No newline at end of file