Differential D11102 Diff 26654 src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
Show First 20 Lines • Show All 677 Lines • ▼ Show 20 Lines | private function buildHostingProperties( | ||||
return $view; | return $view; | ||||
} | } | ||||
private function buildRepositoryStatus( | private function buildRepositoryStatus( | ||||
PhabricatorRepository $repository) { | PhabricatorRepository $repository) { | ||||
$viewer = $this->getRequest()->getUser(); | $viewer = $this->getRequest()->getUser(); | ||||
$is_cluster = $repository->getAlmanacServicePHID(); | |||||
$view = new PHUIStatusListView(); | $view = new PHUIStatusListView(); | ||||
$messages = id(new PhabricatorRepositoryStatusMessage()) | $messages = id(new PhabricatorRepositoryStatusMessage()) | ||||
->loadAllWhere('repositoryID = %d', $repository->getID()); | ->loadAllWhere('repositoryID = %d', $repository->getID()); | ||||
$messages = mpull($messages, null, 'getStatusType'); | $messages = mpull($messages, null, 'getStatusType'); | ||||
if ($repository->isTracked()) { | if ($repository->isTracked()) { | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | if ($repository->isHosted()) { | ||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: | case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: | ||||
$binaries[] = 'hg'; | $binaries[] = 'hg'; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$binaries = array_unique($binaries); | $binaries = array_unique($binaries); | ||||
if (!$is_cluster) { | |||||
// We're only checking for binaries if we aren't running with a cluster | |||||
// configuration. In theory, we could check for binaries on the | |||||
// repository host machine, but we'd need to make this more complicated | |||||
// to do that. | |||||
foreach ($binaries as $binary) { | foreach ($binaries as $binary) { | ||||
$where = Filesystem::resolveBinary($binary); | $where = Filesystem::resolveBinary($binary); | ||||
if (!$where) { | if (!$where) { | ||||
$view->addItem( | $view->addItem( | ||||
id(new PHUIStatusItemView()) | id(new PHUIStatusItemView()) | ||||
->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') | ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') | ||||
->setTarget( | ->setTarget( | ||||
pht('Missing Binary %s', phutil_tag('tt', array(), $binary))) | pht('Missing Binary %s', phutil_tag('tt', array(), $binary))) | ||||
->setNote(pht( | ->setNote(pht( | ||||
"Unable to find this binary in the webserver's PATH. You may ". | "Unable to find this binary in the webserver's PATH. You may ". | ||||
"need to configure %s.", | "need to configure %s.", | ||||
$this->getEnvConfigLink()))); | $this->getEnvConfigLink()))); | ||||
} else { | } else { | ||||
$view->addItem( | $view->addItem( | ||||
id(new PHUIStatusItemView()) | id(new PHUIStatusItemView()) | ||||
->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') | ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') | ||||
->setTarget( | ->setTarget( | ||||
pht('Found Binary %s', phutil_tag('tt', array(), $binary))) | pht('Found Binary %s', phutil_tag('tt', array(), $binary))) | ||||
->setNote(phutil_tag('tt', array(), $where))); | ->setNote(phutil_tag('tt', array(), $where))); | ||||
} | } | ||||
} | } | ||||
// This gets checked generically above. However, for svn commit hooks, we | // This gets checked generically above. However, for svn commit hooks, we | ||||
// need this to be in environment.append-paths because subversion strips | // need this to be in environment.append-paths because subversion strips | ||||
// PATH. | // PATH. | ||||
if ($svnlook_check) { | if ($svnlook_check) { | ||||
$where = Filesystem::resolveBinary('svnlook'); | $where = Filesystem::resolveBinary('svnlook'); | ||||
if ($where) { | if ($where) { | ||||
$path = substr($where, 0, strlen($where) - strlen('svnlook')); | $path = substr($where, 0, strlen($where) - strlen('svnlook')); | ||||
$dirs = PhabricatorEnv::getEnvConfig('environment.append-paths'); | $dirs = PhabricatorEnv::getEnvConfig('environment.append-paths'); | ||||
$in_path = false; | $in_path = false; | ||||
foreach ($dirs as $dir) { | foreach ($dirs as $dir) { | ||||
if (Filesystem::isDescendant($path, $dir)) { | if (Filesystem::isDescendant($path, $dir)) { | ||||
$in_path = true; | $in_path = true; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (!$in_path) { | if (!$in_path) { | ||||
$view->addItem( | $view->addItem( | ||||
id(new PHUIStatusItemView()) | id(new PHUIStatusItemView()) | ||||
->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') | ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') | ||||
->setTarget( | ->setTarget( | ||||
pht('Missing Binary %s', phutil_tag('tt', array(), $binary))) | pht('Missing Binary %s', phutil_tag('tt', array(), $binary))) | ||||
->setNote(pht( | ->setNote(pht( | ||||
'Unable to find this binary in `environment.append-paths`. '. | 'Unable to find this binary in `environment.append-paths`. '. | ||||
'You need to configure %s and include %s.', | 'You need to configure %s and include %s.', | ||||
$this->getEnvConfigLink(), | $this->getEnvConfigLink(), | ||||
$path))); | $path))); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
$doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd'); | $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd'); | ||||
$daemon_instructions = pht( | $daemon_instructions = pht( | ||||
'Use %s to start daemons. See %s.', | 'Use %s to start daemons. See %s.', | ||||
phutil_tag('tt', array(), 'bin/phd start'), | phutil_tag('tt', array(), 'bin/phd start'), | ||||
phutil_tag( | phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => $doc_href, | 'href' => $doc_href, | ||||
), | ), | ||||
pht('Managing Daemons with phd'))); | pht('Managing Daemons with phd'))); | ||||
$pull_daemon = id(new PhabricatorDaemonLogQuery()) | $pull_daemon = id(new PhabricatorDaemonLogQuery()) | ||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer(PhabricatorUser::getOmnipotentUser()) | ||||
->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE) | ->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE) | ||||
->withDaemonClasses(array('PhabricatorRepositoryPullLocalDaemon')) | ->withDaemonClasses(array('PhabricatorRepositoryPullLocalDaemon')) | ||||
->setLimit(1) | ->setLimit(1) | ||||
->execute(); | ->execute(); | ||||
if ($pull_daemon) { | if ($pull_daemon) { | ||||
// TODO: In a cluster environment, we need a daemon on this repository's | |||||
// host, specifically, and we aren't checking for that right now. This | |||||
// is a reasonable proxy for things being more-or-less correctly set up, | |||||
// though. | |||||
$view->addItem( | $view->addItem( | ||||
id(new PHUIStatusItemView()) | id(new PHUIStatusItemView()) | ||||
->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') | ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') | ||||
->setTarget(pht('Pull Daemon Running'))); | ->setTarget(pht('Pull Daemon Running'))); | ||||
} else { | } else { | ||||
$view->addItem( | $view->addItem( | ||||
id(new PHUIStatusItemView()) | id(new PHUIStatusItemView()) | ||||
->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') | ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') | ||||
Show All 16 Lines | private function buildRepositoryStatus( | ||||
} else { | } else { | ||||
$view->addItem( | $view->addItem( | ||||
id(new PHUIStatusItemView()) | id(new PHUIStatusItemView()) | ||||
->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') | ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') | ||||
->setTarget(pht('Task Daemon Not Running')) | ->setTarget(pht('Task Daemon Not Running')) | ||||
->setNote($daemon_instructions)); | ->setNote($daemon_instructions)); | ||||
} | } | ||||
if ($repository->usesLocalWorkingCopy()) { | |||||
if ($is_cluster) { | |||||
// Just omit this status check for now in cluster environments. We | |||||
// could make a service call and pull it from the repository host | |||||
// eventually. | |||||
} else if ($repository->usesLocalWorkingCopy()) { | |||||
$local_parent = dirname($repository->getLocalPath()); | $local_parent = dirname($repository->getLocalPath()); | ||||
if (Filesystem::pathExists($local_parent)) { | if (Filesystem::pathExists($local_parent)) { | ||||
$view->addItem( | $view->addItem( | ||||
id(new PHUIStatusItemView()) | id(new PHUIStatusItemView()) | ||||
->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') | ->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green') | ||||
->setTarget(pht('Storage Directory OK')) | ->setTarget(pht('Storage Directory OK')) | ||||
->setNote(phutil_tag('tt', array(), $local_parent))); | ->setNote(phutil_tag('tt', array(), $local_parent))); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 282 Lines • Show Last 20 Lines |