Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/schema/PhabricatorConfigStorageSchema.php
<?php | <?php | ||||
abstract class PhabricatorConfigStorageSchema extends Phobject { | abstract class PhabricatorConfigStorageSchema extends Phobject { | ||||
const ISSUE_MISSING = 'missing'; | const ISSUE_MISSING = 'missing'; | ||||
const ISSUE_SURPLUS = 'surplus'; | const ISSUE_SURPLUS = 'surplus'; | ||||
const ISSUE_CHARSET = 'charset'; | const ISSUE_CHARSET = 'charset'; | ||||
const ISSUE_COLLATION = 'collation'; | const ISSUE_COLLATION = 'collation'; | ||||
const ISSUE_COLUMNTYPE = 'columntype'; | const ISSUE_COLUMNTYPE = 'columntype'; | ||||
const ISSUE_NULLABLE = 'nullable'; | const ISSUE_NULLABLE = 'nullable'; | ||||
const ISSUE_KEYCOLUMNS = 'keycolumns'; | const ISSUE_KEYCOLUMNS = 'keycolumns'; | ||||
const ISSUE_UNIQUE = 'unique'; | |||||
const ISSUE_SUBNOTE = 'subnote'; | const ISSUE_SUBNOTE = 'subnote'; | ||||
const ISSUE_SUBWARN = 'subwarn'; | const ISSUE_SUBWARN = 'subwarn'; | ||||
const ISSUE_SUBFAIL = 'subfail'; | const ISSUE_SUBFAIL = 'subfail'; | ||||
const STATUS_OKAY = 'okay'; | const STATUS_OKAY = 'okay'; | ||||
const STATUS_NOTE = 'note'; | const STATUS_NOTE = 'note'; | ||||
const STATUS_WARN = 'warn'; | const STATUS_WARN = 'warn'; | ||||
const STATUS_FAIL = 'fail'; | const STATUS_FAIL = 'fail'; | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | foreach ($this->getSubschemata() as $sub) { | ||||
$issues[self::ISSUE_SUBFAIL] = self::ISSUE_SUBFAIL; | $issues[self::ISSUE_SUBFAIL] = self::ISSUE_SUBFAIL; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
return $issues; | return $issues; | ||||
} | } | ||||
public function getLocalIssues() { | |||||
return $this->issues; | |||||
} | |||||
public function hasIssue($issue) { | public function hasIssue($issue) { | ||||
return (bool)idx($this->getIssues(), $issue); | return (bool)idx($this->getIssues(), $issue); | ||||
} | } | ||||
public function getAllIssues() { | public function getAllIssues() { | ||||
$issues = $this->getIssues(); | $issues = $this->getIssues(); | ||||
foreach ($this->getSubschemata() as $sub) { | foreach ($this->getSubschemata() as $sub) { | ||||
$issues += $sub->getAllIssues(); | $issues += $sub->getAllIssues(); | ||||
Show All 21 Lines | switch ($issue) { | ||||
case self::ISSUE_COLLATION: | case self::ISSUE_COLLATION: | ||||
return pht('Better Collation Available'); | return pht('Better Collation Available'); | ||||
case self::ISSUE_COLUMNTYPE: | case self::ISSUE_COLUMNTYPE: | ||||
return pht('Wrong Column Type'); | return pht('Wrong Column Type'); | ||||
case self::ISSUE_NULLABLE: | case self::ISSUE_NULLABLE: | ||||
return pht('Wrong Nullable Setting'); | return pht('Wrong Nullable Setting'); | ||||
case self::ISSUE_KEYCOLUMNS: | case self::ISSUE_KEYCOLUMNS: | ||||
return pht('Key on Wrong Columns'); | return pht('Key on Wrong Columns'); | ||||
case self::ISSUE_UNIQUE: | |||||
return pht('Key has Wrong Uniqueness'); | |||||
case self::ISSUE_SUBNOTE: | case self::ISSUE_SUBNOTE: | ||||
return pht('Subschemata Have Notices'); | return pht('Subschemata Have Notices'); | ||||
case self::ISSUE_SUBWARN: | case self::ISSUE_SUBWARN: | ||||
return pht('Subschemata Have Warnings'); | return pht('Subschemata Have Warnings'); | ||||
case self::ISSUE_SUBFAIL: | case self::ISSUE_SUBFAIL: | ||||
return pht('Subschemata Have Failures'); | return pht('Subschemata Have Failures'); | ||||
default: | default: | ||||
throw new Exception(pht('Unknown schema issue "%s"!', $issue)); | throw new Exception(pht('Unknown schema issue "%s"!', $issue)); | ||||
Show All 11 Lines | switch ($issue) { | ||||
case self::ISSUE_COLLATION: | case self::ISSUE_COLLATION: | ||||
return pht('This schema can use a better collation.'); | return pht('This schema can use a better collation.'); | ||||
case self::ISSUE_COLUMNTYPE: | case self::ISSUE_COLUMNTYPE: | ||||
return pht('This schema can use a better column type.'); | return pht('This schema can use a better column type.'); | ||||
case self::ISSUE_NULLABLE: | case self::ISSUE_NULLABLE: | ||||
return pht('This schema has the wrong nullable setting.'); | return pht('This schema has the wrong nullable setting.'); | ||||
case self::ISSUE_KEYCOLUMNS: | case self::ISSUE_KEYCOLUMNS: | ||||
return pht('This schema is on the wrong columns.'); | return pht('This schema is on the wrong columns.'); | ||||
case self::ISSUE_UNIQUE: | |||||
return pht('This key has the wrong uniqueness setting.'); | |||||
case self::ISSUE_SUBNOTE: | case self::ISSUE_SUBNOTE: | ||||
return pht('Subschemata have setup notices.'); | return pht('Subschemata have setup notices.'); | ||||
case self::ISSUE_SUBWARN: | case self::ISSUE_SUBWARN: | ||||
return pht('Subschemata have setup warnings.'); | return pht('Subschemata have setup warnings.'); | ||||
case self::ISSUE_SUBFAIL: | case self::ISSUE_SUBFAIL: | ||||
return pht('Subschemata have setup failures.'); | return pht('Subschemata have setup failures.'); | ||||
default: | default: | ||||
throw new Exception(pht('Unknown schema issue "%s"!', $issue)); | throw new Exception(pht('Unknown schema issue "%s"!', $issue)); | ||||
} | } | ||||
} | } | ||||
public static function getIssueStatus($issue) { | public static function getIssueStatus($issue) { | ||||
switch ($issue) { | switch ($issue) { | ||||
case self::ISSUE_MISSING: | case self::ISSUE_MISSING: | ||||
case self::ISSUE_SUBFAIL: | case self::ISSUE_SUBFAIL: | ||||
return self::STATUS_FAIL; | return self::STATUS_FAIL; | ||||
case self::ISSUE_SURPLUS: | case self::ISSUE_SURPLUS: | ||||
case self::ISSUE_COLUMNTYPE: | case self::ISSUE_COLUMNTYPE: | ||||
case self::ISSUE_SUBWARN: | case self::ISSUE_SUBWARN: | ||||
case self::ISSUE_KEYCOLUMNS: | case self::ISSUE_KEYCOLUMNS: | ||||
case self::ISSUE_NULLABLE: | case self::ISSUE_NULLABLE: | ||||
case self::ISSUE_UNIQUE: | |||||
return self::STATUS_WARN; | return self::STATUS_WARN; | ||||
case self::ISSUE_SUBNOTE: | case self::ISSUE_SUBNOTE: | ||||
case self::ISSUE_CHARSET: | case self::ISSUE_CHARSET: | ||||
case self::ISSUE_COLLATION: | case self::ISSUE_COLLATION: | ||||
return self::STATUS_NOTE; | return self::STATUS_NOTE; | ||||
default: | default: | ||||
throw new Exception(pht('Unknown schema issue "%s"!', $issue)); | throw new Exception(pht('Unknown schema issue "%s"!', $issue)); | ||||
} | } | ||||
Show All 30 Lines |