<?php // NOTE: If you need to make any significant updates to this to deal with // future changes to objects, it's probably better to just wipe the whole // migration. This feature doesn't see overwhelming amounts of use, and users // who do use it can recreate their queries fairly easily with the new // interface. By the time this needs to be updated, the vast majority of // users who it impacts will likely have migrated their data already. $table = new ManiphestTask(); $conn_w = $table->establishConnection('w'); $search_table = new PhabricatorSearchQuery(); $search_conn_w = $search_table->establishConnection('w'); // See T1812. This is an old status constant from the time of this migration. $old_open_status = 0; echo "Updating saved Maniphest queries...\n"; $rows = new LiskRawMigrationIterator($conn_w, 'maniphest_savedquery'); foreach ($rows as $row) { $id = $row['id']; echo "Updating query {$id}...\n"; $data = queryfx_one($search_conn_w, 'SELECT parameters FROM %T WHERE queryKey = %s', $search_table->getTableName(), $row['queryKey']); if (!$data) { echo "Unable to locate query data.\n"; continue; } $data = json_decode($data['parameters'], true); if (!is_array($data)) { echo "Unable to decode query data.\n"; continue; } if (idx($data, 'view') != 'custom') { echo "Query is not a custom query.\n";