Differential D15685 Diff 37802 src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
Show First 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | if ($device) { | ||||
if ($service_phids) { | if ($service_phids) { | ||||
// We could include `withDevicePHIDs()` here to pull a smaller result | // We could include `withDevicePHIDs()` here to pull a smaller result | ||||
// set, but we can provide more helpful diagnostic messages below if | // set, but we can provide more helpful diagnostic messages below if | ||||
// we fetch a little more data. | // we fetch a little more data. | ||||
$services = id(new AlmanacServiceQuery()) | $services = id(new AlmanacServiceQuery()) | ||||
->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
->withPHIDs($service_phids) | ->withPHIDs($service_phids) | ||||
->withServiceTypes( | |||||
array( | |||||
AlmanacClusterRepositoryServiceType::SERVICETYPE, | |||||
)) | |||||
->needBindings(true) | ->needBindings(true) | ||||
->execute(); | ->execute(); | ||||
$services = mpull($services, null, 'getPHID'); | $services = mpull($services, null, 'getPHID'); | ||||
} else { | } else { | ||||
$services = array(); | $services = array(); | ||||
} | } | ||||
foreach ($repositories as $key => $repository) { | foreach ($repositories as $key => $repository) { | ||||
$service_phid = $repository->getAlmanacServicePHID(); | $service_phid = $repository->getAlmanacServicePHID(); | ||||
$service = idx($services, $service_phid); | $service = idx($services, $service_phid); | ||||
if (!$service) { | if (!$service) { | ||||
$this->log( | $this->log( | ||||
pht( | pht( | ||||
'Repository "%s" is on cluster service "%s", but that service '. | 'Repository "%s" is on cluster service "%s", but that service '. | ||||
'could not be loaded, so the repository will not be updated '. | 'could not be loaded, so the repository will not be updated '. | ||||
'on this host.', | 'on this host.', | ||||
$repository->getDisplayName(), | $repository->getDisplayName(), | ||||
$service_phid)); | $service_phid)); | ||||
unset($repositories[$key]); | unset($repositories[$key]); | ||||
continue; | continue; | ||||
} | } | ||||
$bindings = $service->getBindings(); | $bindings = $service->getBindings(); | ||||
$bindings = mpull($bindings, null, 'getDevicePHID'); | $bindings = mgroup($bindings, 'getDevicePHID'); | ||||
$binding = idx($bindings, $device_phid); | $bindings = idx($bindings, $device_phid); | ||||
if (!$binding) { | if (!$bindings) { | ||||
$this->log( | $this->log( | ||||
pht( | pht( | ||||
'Repository "%s" is on cluster service "%s", but that service '. | 'Repository "%s" is on cluster service "%s", but that service '. | ||||
'is not bound to this device ("%s"), so the repository will '. | 'is not bound to this device ("%s"), so the repository will '. | ||||
'not be updated on this host.', | 'not be updated on this host.', | ||||
$repository->getDisplayName(), | $repository->getDisplayName(), | ||||
$service->getName(), | $service->getName(), | ||||
$device->getName())); | $device->getName())); | ||||
unset($repositories[$key]); | unset($repositories[$key]); | ||||
continue; | continue; | ||||
} | } | ||||
if ($binding->getIsDisabled()) { | $all_disabled = true; | ||||
foreach ($bindings as $binding) { | |||||
if (!$binding->getIsDisabled()) { | |||||
$all_disabled = false; | |||||
break; | |||||
} | |||||
} | |||||
if ($all_disabled) { | |||||
$this->log( | $this->log( | ||||
pht( | pht( | ||||
'Repository "%s" is on cluster service "%s", but the binding '. | 'Repository "%s" is on cluster service "%s", but the binding '. | ||||
'between that service and this device ("%s") is disabled, so '. | 'between that service and this device ("%s") is disabled, so '. | ||||
'the not be updated on this host.', | 'the not be updated on this host.', | ||||
$repository->getDisplayName(), | $repository->getDisplayName(), | ||||
$service->getName(), | $service->getName(), | ||||
$device->getName())); | $device->getName())); | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |