Differential D19768 Diff 47222 src/applications/search/engine/PhabricatorApplicationSearchEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | public function getNavigationItems() { | ||||
return $this->navigationItems; | return $this->navigationItems; | ||||
} | } | ||||
public function canUseInPanelContext() { | public function canUseInPanelContext() { | ||||
return true; | return true; | ||||
} | } | ||||
public function saveQuery(PhabricatorSavedQuery $query) { | public function saveQuery(PhabricatorSavedQuery $query) { | ||||
if ($query->getID()) { | |||||
throw new Exception( | |||||
pht( | |||||
'Query (with ID "%s") has already been saved. Queries are '. | |||||
'immutable once saved.', | |||||
$query->getID())); | |||||
} | |||||
epriestley: This should prevent this class of bug from ever occurring again. I made an effort to `grep` for… | |||||
$query->setEngineClassName(get_class($this)); | $query->setEngineClassName(get_class($this)); | ||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | ||||
try { | try { | ||||
$query->save(); | $query->save(); | ||||
} catch (AphrontDuplicateKeyQueryException $ex) { | } catch (AphrontDuplicateKeyQueryException $ex) { | ||||
// Ignore, this is just a repeated search. | // Ignore, this is just a repeated search. | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,486 Lines • Show Last 20 Lines |
This should prevent this class of bug from ever occurring again. I made an effort to grep for other misuses of clone but didn't turn any up.