Path: blob/master/src/applications/config/check/PhabricatorRepositoriesSetupCheck.php
12256 views
<?php12final class PhabricatorRepositoriesSetupCheck extends PhabricatorSetupCheck {34public function getDefaultGroup() {5return self::GROUP_OTHER;6}78protected function executeChecks() {910$cluster_services = id(new AlmanacServiceQuery())11->setViewer(PhabricatorUser::getOmnipotentUser())12->withServiceTypes(13array(14AlmanacClusterRepositoryServiceType::SERVICETYPE,15))16->setLimit(1)17->execute();18if ($cluster_services) {19// If cluster repository services are defined, these checks aren't useful20// because some nodes (like web nodes) will usually not have any local21// repository information.2223// Errors with this configuration will still be detected by checks on24// individual repositories.25return;26}2728$repo_path = PhabricatorEnv::getEnvConfig('repository.default-local-path');2930if (!$repo_path) {31$summary = pht(32"The configuration option '%s' is not set.",33'repository.default-local-path');34$this->newIssue('repository.default-local-path.empty')35->setName(pht('Missing Repository Local Path'))36->setSummary($summary)37->addPhabricatorConfig('repository.default-local-path');38return;39}4041if (!Filesystem::pathExists($repo_path)) {42$summary = pht(43'The path for local repositories does not exist, or is not '.44'readable by the webserver.');45$message = pht(46"The directory for local repositories (%s) does not exist, or is not ".47"readable by the webserver. This software uses this directory to ".48"store information about repositories. If this directory does not ".49"exist, create it:\n\n".50"%s\n".51"If this directory exists, make it readable to the webserver. You ".52"can also edit the configuration below to use some other directory.",53phutil_tag('tt', array(), $repo_path),54phutil_tag('pre', array(), csprintf('$ mkdir -p %s', $repo_path)));5556$this->newIssue('repository.default-local-path.empty')57->setName(pht('Missing Repository Local Path'))58->setSummary($summary)59->setMessage($message)60->addPhabricatorConfig('repository.default-local-path');61}6263}6465}666768