getAdapter(); $packages = $adapter->loadAffectedPackages(); $package_phids = mpull($packages, 'getPHID'); $this->logEffect(self::DO_BUILD, $package_phids); $all = array(); foreach ($packages as $package) { $field_list = PhabricatorCustomField::getObjectFields( $package, PhabricatorCustomField::ROLE_VIEW); $field_list ->setViewer($viewer) ->readFieldsFromStorage($package); foreach ($field_list->getFields() as $field) { $key = $field->getFieldKey(); if ($key == $field_key) { $all[] = $field->getValueForStorage(); } } } $all = implode("\n", $all); $all = phutil_split_lines($all, false); $all = array_filter($all); $all = array_unique($all); if (!$all) { return; } foreach ($all as $parameter) { $request = id(new HarbormasterBuildRequest()) ->setBuildPlanPHID($buildplan_phid) ->setBuildParameters( array( 'build-name-from-owners' => $parameter, )); $adapter->queueHarbormasterBuildRequest($request); } } public function getHeraldActionStandardType() { return self::STANDARD_NONE; } public function renderActionDescription($value) { return pht('Run builds for affected pakages.'); } protected function getActionEffectMap() { return array( self::DO_BUILD => array( 'icon' => 'fa-play', 'color' => 'green', 'name' => pht('Ran Builds'), ), ); } protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_BUILD: if (!$data) { return pht('No affected packages.'); } else { return pht( 'Ran builds for affected packages: %s.', $this->renderHandleList($data)); } } } }