mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-03 07:59:15 +01:00
Summary: Ref T10449. Currently, we store classes (like "AlmanacClusterRepositoryServiceType") in the database. Instead, store types (like "cluster.repository"). This is a small change, but types are a little more flexible (they let us freely reanme classes), a little cleaner (fewer magic strings in the codebase), and a little better for API usage (they're more human readable). Make this minor usability change now, before we unprototype. Also make services searchable by type. Also remove old Almanac API endpoints. Test Plan: - Ran migration, verified all data migrated properly. - Created, edited, rebound, and changed properties of services. - Searched for services by service type. - Reviewed available Conduit methods. Reviewers: chad Reviewed By: chad Subscribers: yelirekim Maniphest Tasks: T10449 Differential Revision: https://secure.phabricator.com/D15346
66 lines
2.2 KiB
PHP
66 lines
2.2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorRepositoriesSetupCheck extends PhabricatorSetupCheck {
|
|
|
|
public function getDefaultGroup() {
|
|
return self::GROUP_OTHER;
|
|
}
|
|
|
|
protected function executeChecks() {
|
|
|
|
$cluster_services = id(new AlmanacServiceQuery())
|
|
->setViewer(PhabricatorUser::getOmnipotentUser())
|
|
->withServiceTypes(
|
|
array(
|
|
AlmanacClusterRepositoryServiceType::SERVICETYPE,
|
|
))
|
|
->setLimit(1)
|
|
->execute();
|
|
if ($cluster_services) {
|
|
// If cluster repository services are defined, these checks aren't useful
|
|
// because some nodes (like web nodes) will usually not have any local
|
|
// repository information.
|
|
|
|
// Errors with this configuration will still be detected by checks on
|
|
// individual repositories.
|
|
return;
|
|
}
|
|
|
|
$repo_path = PhabricatorEnv::getEnvConfig('repository.default-local-path');
|
|
|
|
if (!$repo_path) {
|
|
$summary = pht(
|
|
"The configuration option '%s' is not set.",
|
|
'repository.default-local-path');
|
|
$this->newIssue('repository.default-local-path.empty')
|
|
->setName(pht('Missing Repository Local Path'))
|
|
->setSummary($summary)
|
|
->addPhabricatorConfig('repository.default-local-path');
|
|
return;
|
|
}
|
|
|
|
if (!Filesystem::pathExists($repo_path)) {
|
|
$summary = pht(
|
|
'The path for local repositories does not exist, or is not '.
|
|
'readable by the webserver.');
|
|
$message = pht(
|
|
"The directory for local repositories (%s) does not exist, or is not ".
|
|
"readable by the webserver. Phabricator uses this directory to store ".
|
|
"information about repositories. If this directory does not exist, ".
|
|
"create it:\n\n".
|
|
"%s\n".
|
|
"If this directory exists, make it readable to the webserver. You ".
|
|
"can also edit the configuration below to use some other directory.",
|
|
phutil_tag('tt', array(), $repo_path),
|
|
phutil_tag('pre', array(), csprintf('$ mkdir -p %s', $repo_path)));
|
|
|
|
$this->newIssue('repository.default-local-path.empty')
|
|
->setName(pht('Missing Repository Local Path'))
|
|
->setSummary($summary)
|
|
->setMessage($message)
|
|
->addPhabricatorConfig('repository.default-local-path');
|
|
}
|
|
|
|
}
|
|
|
|
}
|