|
| 1 | +#!/usr/bin/env php |
| 2 | +<?php |
| 3 | + |
| 4 | +/* |
| 5 | + * Copyright 2012 Facebook, Inc. |
| 6 | + * |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | + * you may not use this file except in compliance with the License. |
| 9 | + * You may obtain a copy of the License at |
| 10 | + * |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * |
| 13 | + * Unless required by applicable law or agreed to in writing, software |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | + * See the License for the specific language governing permissions and |
| 17 | + * limitations under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +$root = dirname(dirname(dirname(__FILE__))); |
| 21 | +require_once $root.'/scripts/__init_script__.php'; |
| 22 | + |
| 23 | +$project = id(new PhabricatorRepositoryArcanistProject())->loadOneWhere( |
| 24 | + 'name = %s', $argv[1]); |
| 25 | +if (!$project) { |
| 26 | + throw new Exception('No such arcanist project.'); |
| 27 | +} |
| 28 | + |
| 29 | +$input = file_get_contents('php://stdin'); |
| 30 | +$normalized = array(); |
| 31 | +foreach (explode("\n", trim($input)) as $path) { |
| 32 | + // emulate the behavior of the symbol generation scripts |
| 33 | + $normalized[] = '/'.ltrim($path, './'); |
| 34 | +} |
| 35 | +$paths = PhabricatorRepositoryCommitChangeParserWorker::lookupOrCreatePaths( |
| 36 | + $normalized); |
| 37 | + |
| 38 | +$symbol = new PhabricatorRepositorySymbol(); |
| 39 | +$conn_w = $symbol->establishConnection('w'); |
| 40 | + |
| 41 | +foreach (array_chunk(array_values($paths), 128) as $chunk) { |
| 42 | + queryfx( |
| 43 | + $conn_w, |
| 44 | + 'DELETE FROM %T WHERE arcanistProjectID = %d AND pathID IN (%Ld)', |
| 45 | + $symbol->getTableName(), |
| 46 | + $project->getID(), |
| 47 | + $chunk); |
| 48 | +} |
0 commit comments