Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/schema/PhabricatorConfigSchemaQuery.php
Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | public function buildComparisonSchema( | ||||
return $comp_server; | return $comp_server; | ||||
} | } | ||||
private function compareSchemata( | private function compareSchemata( | ||||
PhabricatorConfigStorageSchema $expect = null, | PhabricatorConfigStorageSchema $expect = null, | ||||
PhabricatorConfigStorageSchema $actual = null) { | PhabricatorConfigStorageSchema $actual = null) { | ||||
$expect_is_key = ($expect instanceof PhabricatorConfigKeySchema); | |||||
$actual_is_key = ($actual instanceof PhabricatorConfigKeySchema); | |||||
if ($expect_is_key || $actual_is_key) { | |||||
$missing_issue = PhabricatorConfigStorageSchema::ISSUE_MISSINGKEY; | |||||
$surplus_issue = PhabricatorConfigStorageSchema::ISSUE_SURPLUSKEY; | |||||
} else { | |||||
$missing_issue = PhabricatorConfigStorageSchema::ISSUE_MISSING; | |||||
$surplus_issue = PhabricatorConfigStorageSchema::ISSUE_SURPLUS; | |||||
} | |||||
if (!$expect && !$actual) { | if (!$expect && !$actual) { | ||||
throw new Exception(pht('Can not compare two missing schemata!')); | throw new Exception(pht('Can not compare two missing schemata!')); | ||||
} else if ($expect && !$actual) { | } else if ($expect && !$actual) { | ||||
$issues = array(PhabricatorConfigStorageSchema::ISSUE_MISSING); | $issues = array($missing_issue); | ||||
} else if ($actual && !$expect) { | } else if ($actual && !$expect) { | ||||
$issues = array(PhabricatorConfigStorageSchema::ISSUE_SURPLUS); | $issues = array($surplus_issue); | ||||
} else { | } else { | ||||
$issues = $actual->compareTo($expect); | $issues = $actual->compareTo($expect); | ||||
} | } | ||||
return $issues; | return $issues; | ||||
} | } | ||||
} | } |