本文整理汇总了PHP中ipull函数的典型用法代码示例。如果您正苦于以下问题:PHP ipull函数的具体用法?PHP ipull怎么用?PHP ipull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ipull函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$table = new PhabricatorTokenCount();
$conn_r = $table->establishConnection('r');
$rows = queryfx_all($conn_r, 'SELECT objectPHID, tokenCount FROM %T %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildLimitClause($conn_r));
return ipull($rows, 'tokenCount', 'objectPHID');
}
示例2: renderListPanel
private function renderListPanel()
{
if (!$this->packagePHID) {
return id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setTitle('No package seleted. Please select one from above.');
}
$package = id(new PhabricatorOwnersPackage())->loadOneWhere("phid = %s", $this->packagePHID);
if ($this->view === 'audit' && !$package->getAuditingEnabled()) {
return id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setTitle("Package doesn't have auditing enabled. " . "Please choose another one.");
}
$conn_r = id(new PhabricatorOwnersPackageCommitRelationship())->establishConnection('r');
$status_arr = $this->getStatusArr();
$offset = $this->request->getInt('offset', 0);
$pager = new AphrontPagerView();
$pager->setPageSize(50);
$pager->setOffset($offset);
$pager->setURI($this->request->getRequestURI(), 'offset');
$data = queryfx_all($conn_r, 'SELECT commitPHID, auditStatus, auditReasons FROM %T
WHERE packagePHID = %s AND auditStatus in (%Ls)
ORDER BY id DESC
LIMIT %d, %d', id(new PhabricatorOwnersPackageCommitRelationship())->getTableName(), $package->getPHID(), $status_arr, $pager->getOffset(), $pager->getPageSize() + 1);
$data = $pager->sliceResults($data);
$data = ipull($data, null, 'commitPHID');
$list_panel = $this->renderCommitTable($data, $package);
$list_panel->appendChild($pager);
return $list_panel;
}
示例3: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$limit = 500;
$offset = $request->getInt('offset', 0);
$drequest = $this->getDiffusionRequest();
$branch = $drequest->loadBranch();
$messages = $this->loadLintMessages($branch, $limit, $offset);
$is_dir = substr('/' . $drequest->getPath(), -1) == '/';
$authors = $this->loadViewerHandles(ipull($messages, 'authorPHID'));
$rows = array();
foreach ($messages as $message) {
$path = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'lint', 'path' => $message['path']))), substr($message['path'], strlen($drequest->getPath()) + 1));
$line = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'browse', 'path' => $message['path'], 'line' => $message['line'], 'commit' => $branch->getLintCommit()))), $message['line']);
$author = $message['authorPHID'];
if ($author && $authors[$author]) {
$author = $authors[$author]->renderLink();
}
$rows[] = array($path, $line, $author, ArcanistLintSeverity::getStringForSeverity($message['severity']), $message['name'], $message['description']);
}
$table = id(new AphrontTableView($rows))->setHeaders(array(pht('Path'), pht('Line'), pht('Author'), pht('Severity'), pht('Name'), pht('Description')))->setColumnClasses(array('', 'n'))->setColumnVisibility(array($is_dir));
$content = array();
$pager = id(new AphrontPagerView())->setPageSize($limit)->setOffset($offset)->setHasMorePages(count($messages) >= $limit)->setURI($request->getRequestURI(), 'offset');
$content[] = id(new PHUIObjectBoxView())->setHeaderText(pht('Lint Details'))->appendChild($table);
$crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'lint'));
return $this->buildApplicationPage(array($crumbs, $content, $pager), array('title' => array(pht('Lint'), $drequest->getRepository()->getCallsign())));
}
示例4: execute
public function execute()
{
$table = new PhabricatorFlag();
$conn_r = $table->establishConnection('r');
$where = $this->buildWhereClause($conn_r);
$limit = $this->buildLimitClause($conn_r);
$order = $this->buildOrderClause($conn_r);
$data = queryfx_all($conn_r, 'SELECT * FROM %T flag %Q %Q %Q', $table->getTableName(), $where, $order, $limit);
$flags = $table->loadAllFromArray($data);
if ($this->needHandles || $this->needObjects) {
$phids = ipull($data, 'objectPHID');
$query = new PhabricatorObjectHandleData($phids);
if ($this->needHandles) {
$handles = $query->loadHandles();
foreach ($flags as $flag) {
$handle = idx($handles, $flag->getObjectPHID());
if ($handle) {
$flag->attachHandle($handle);
}
}
}
if ($this->needObjects) {
$objects = $query->loadObjects();
foreach ($flags as $flag) {
$object = idx($objects, $flag->getObjectPHID());
if ($object) {
$flag->attachObject($object);
}
}
}
}
return $flags;
}
示例5: buildChartForm
private function buildChartForm()
{
$request = $this->getRequest();
$user = $request->getUser();
$table = new PhabricatorFactRaw();
$conn_r = $table->establishConnection('r');
$table_name = $table->getTableName();
$facts = queryfx_all($conn_r, 'SELECT DISTINCT factType from %T', $table_name);
$specs = PhabricatorFactSpec::newSpecsForFactTypes(PhabricatorFactEngine::loadAllEngines(), ipull($facts, 'factType'));
$options = array();
foreach ($specs as $spec) {
if ($spec->getUnit() == PhabricatorFactSpec::UNIT_COUNT) {
$options[$spec->getType()] = $spec->getName();
}
}
if (!$options) {
return id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setTitle(pht('No Chartable Facts'))->appendChild('<p>' . pht('There are no facts that can be plotted yet.') . '</p>');
}
$form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormSelectControl())->setLabel('Y-Axis')->setName('y1')->setOptions($options))->appendChild(id(new AphrontFormSubmitControl())->setValue('Plot Chart'));
$panel = new AphrontPanelView();
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->setHeader('Plot Chart');
return $panel;
}
示例6: getKeys
public function getKeys(array $keys)
{
$results = array();
if ($keys) {
$map = $this->digestKeys($keys);
$rows = queryfx_all($this->establishConnection('r'), 'SELECT * FROM %T WHERE cacheKeyHash IN (%Ls)', $this->getTableName(), $map);
$rows = ipull($rows, null, 'cacheKey');
foreach ($keys as $key) {
if (empty($rows[$key])) {
continue;
}
$row = $rows[$key];
if ($row['cacheExpires'] && $row['cacheExpires'] < time()) {
continue;
}
try {
$results[$key] = $this->didReadValue($row['cacheFormat'], $row['cacheData']);
} catch (Exception $ex) {
// Treat this as a cache miss.
phlog($ex);
}
}
}
return $results;
}
示例7: execute
public function execute()
{
$conn_r = id(new PhabricatorRepository())->establishConnection('r');
$where = $this->buildWhereClause($conn_r);
$results = queryfx_all($conn_r, 'SELECT * FROM %T %Q', PhabricatorRepository::TABLE_PATH, $where);
return ipull($results, null, 'id');
}
示例8: processRequest
public function processRequest()
{
$classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->setConcreteOnly(true)->selectAndLoadSymbols();
$classes = ipull($classes, 'name', 'name');
foreach ($classes as $class => $ignored) {
$classes[$class] = newv($class, array());
}
$classes = msort($classes, 'getName');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
foreach ($classes as $class => $obj) {
$name = $obj->getName();
$nav->addFilter($class, $name);
}
$selected = $nav->selectFilter($this->class, head_key($classes));
require_celerity_resource('phabricator-ui-example-css');
$example = $classes[$selected];
$example->setRequest($this->getRequest());
$result = $example->renderExample();
if ($result instanceof AphrontResponse) {
// This allows examples to generate dialogs, etc., for demonstration.
return $result;
}
$nav->appendChild('<div class="phabricator-ui-example-header">' . '<h1 class="phabricator-ui-example-name">' . phutil_escape_html($example->getName()) . ' (' . get_class($example) . ')' . '</h1>' . '<p class="phabricator-ui-example-description">' . $example->getDescription() . '</p>' . '</div>');
$nav->appendChild($result);
return $this->buildApplicationPage($nav, array('title' => 'UI Example', 'device' => true));
}
示例9: processRequest
public function processRequest()
{
$classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->selectAndLoadSymbols();
$classes = ipull($classes, 'name', 'name');
$selected = null;
foreach ($classes as $class => $ignored) {
$classes[$class] = newv($class, array());
if ($this->class == $classes[$class]->getName()) {
$selected = $class;
}
}
if (!$selected) {
reset($classes);
$selected = key($classes);
}
$nav = new AphrontSideNavView();
foreach ($classes as $class => $obj) {
$name = $obj->getName();
$nav->addNavItem(phutil_render_tag('a', array('href' => '/uiexample/view/' . $name . '/', 'class' => $selected == $class ? 'aphront-side-nav-selected' : null), phutil_escape_html($obj->getName())));
}
require_celerity_resource('phabricator-ui-example-css');
$example = $classes[$selected];
$example->setRequest($this->getRequest());
$nav->appendChild('<div class="phabricator-ui-example-header">' . '<h1 class="phabricator-ui-example-name">' . phutil_escape_html($example->getName()) . ' (' . get_class($example) . ')' . '</h1>' . '<p class="phabricator-ui-example-description">' . $example->getDescription() . '</p>' . '</div>');
$nav->appendChild($example->renderExample());
return $this->buildStandardPageResponse($nav, array('title' => 'UI Example'));
}
示例10: testTimelineSort
public function testTimelineSort()
{
$e1 = $this->newEvent('X1', 1, 1)->setID(1);
$in = array(array('event' => $e1, 'at' => 1, 'type' => 'start'), array('event' => $e1, 'at' => 1, 'type' => 'end'));
usort($in, array('PhrequentTimeBlock', 'sortTimeline'));
$this->assertEqual(array('start', 'end'), ipull($in, 'type'));
}
示例11: getExpectedSchemaVersion
public static function getExpectedSchemaVersion()
{
$patches = self::getPatchList();
$versions = ipull($patches, 'version');
$max_version = max($versions);
return $max_version;
}
示例12: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$query = new PhabricatorSearchQuery();
$query_str = $request->getStr('query');
$matches = array();
$query->setQuery($query_str);
$query->setParameter('type', $this->type);
switch ($request->getStr('filter')) {
case 'assigned':
$query->setParameter('owner', array($user->getPHID()));
$query->setParameter('open', 1);
break;
case 'created':
$query->setParameter('author', array($user->getPHID()));
$query->setParameter('open', 1);
break;
case 'open':
$query->setParameter('open', 1);
break;
}
$engine = PhabricatorSearchEngineSelector::newSelector()->newEngine();
$results = $engine->executeSearch($query);
$phids = array_fill_keys(ipull($results, 'phid'), true);
$phids += $this->queryObjectNames($query_str);
$phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$data = array();
foreach ($handles as $handle) {
$view = new PhabricatorHandleObjectSelectorDataView($handle);
$data[] = $view->renderData();
}
return id(new AphrontAjaxResponse())->setContent($data);
}
示例13: parseCommit
protected function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
{
// Reload the commit to pull commit data and audit requests.
$commit = id(new DiffusionCommitQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withIDs(array($commit->getID()))->needCommitData(true)->needAuditRequests(true)->executeOne();
$data = $commit->getCommitData();
if (!$data) {
throw new PhabricatorWorkerPermanentFailureException(pht('Unable to load commit data. The data for this task is invalid ' . 'or no longer exists.'));
}
$commit->attachRepository($repository);
$content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_DAEMON, array());
$committer_phid = $data->getCommitDetail('committerPHID');
$author_phid = $data->getCommitDetail('authorPHID');
$acting_as_phid = nonempty($committer_phid, $author_phid, id(new PhabricatorDiffusionApplication())->getPHID());
$editor = id(new PhabricatorAuditEditor())->setActor(PhabricatorUser::getOmnipotentUser())->setActingAsPHID($acting_as_phid)->setContinueOnMissingFields(true)->setContinueOnNoEffect(true)->setContentSource($content_source);
$xactions = array();
$xactions[] = id(new PhabricatorAuditTransaction())->setTransactionType(PhabricatorAuditTransaction::TYPE_COMMIT)->setDateCreated($commit->getEpoch())->setNewValue(array('description' => $data->getCommitMessage(), 'summary' => $data->getSummary(), 'authorName' => $data->getAuthorName(), 'authorPHID' => $commit->getAuthorPHID(), 'committerName' => $data->getCommitDetail('committer'), 'committerPHID' => $data->getCommitDetail('committerPHID')));
$reverts_refs = id(new DifferentialCustomFieldRevertsParser())->parseCorpus($data->getCommitMessage());
$reverts = array_mergev(ipull($reverts_refs, 'monograms'));
if ($reverts) {
$reverted_commits = id(new DiffusionCommitQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withRepository($repository)->withIdentifiers($reverts)->execute();
$reverted_commit_phids = mpull($reverted_commits, 'getPHID', 'getPHID');
// NOTE: Skip any write attempts if a user cleverly implies a commit
// reverts itself.
unset($reverted_commit_phids[$commit->getPHID()]);
$reverts_edge = DiffusionCommitRevertsCommitEdgeType::EDGECONST;
$xactions[] = id(new PhabricatorAuditTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $reverts_edge)->setNewValue(array('+' => array_fuse($reverted_commit_phids)));
}
try {
$raw_patch = $this->loadRawPatchText($repository, $commit);
} catch (Exception $ex) {
$raw_patch = pht('Unable to generate patch: %s', $ex->getMessage());
}
$editor->setRawPatch($raw_patch);
return $editor->applyTransactions($commit, $xactions);
}
示例14: sortAndGroupInlines
public static function sortAndGroupInlines(array $inlines, array $changesets)
{
assert_instances_of($inlines, 'DifferentialTransaction');
assert_instances_of($changesets, 'DifferentialChangeset');
$changesets = mpull($changesets, null, 'getID');
$changesets = msort($changesets, 'getFilename');
// Group the changesets by file and reorder them by display order.
$inline_groups = array();
foreach ($inlines as $inline) {
$changeset_id = $inline->getComment()->getChangesetID();
$inline_groups[$changeset_id][] = $inline;
}
$inline_groups = array_select_keys($inline_groups, array_keys($changesets));
foreach ($inline_groups as $changeset_id => $group) {
// Sort the group of inlines by line number.
$items = array();
foreach ($group as $inline) {
$comment = $inline->getComment();
$num = $comment->getLineNumber();
$len = $comment->getLineLength();
$id = $comment->getID();
$items[] = array('inline' => $inline, 'sort' => sprintf('~%010d%010d%010d', $num, $len, $id));
}
$items = isort($items, 'sort');
$items = ipull($items, 'inline');
$inline_groups[$changeset_id] = $items;
}
return $inline_groups;
}
示例15: newFromDictionary
public static function newFromDictionary(HarbormasterBuildTarget $build_target, array $dict)
{
$obj = self::initializeNewUnitMessage($build_target);
$spec = self::getParameterSpec();
$spec = ipull($spec, 'type');
// We're just going to ignore extra keys for now, to make it easier to
// add stuff here later on.
$dict = array_select_keys($dict, array_keys($spec));
PhutilTypeSpec::checkMap($dict, $spec);
$obj->setEngine(idx($dict, 'engine', ''));
$obj->setNamespace(idx($dict, 'namespace', ''));
$obj->setName($dict['name']);
$obj->setResult($dict['result']);
$obj->setDuration((double) idx($dict, 'duration'));
$path = idx($dict, 'path');
if (strlen($path)) {
$obj->setProperty('path', $path);
}
$coverage = idx($dict, 'coverage');
if ($coverage) {
$obj->setProperty('coverage', $coverage);
}
$details = idx($dict, 'details');
if ($details) {
$obj->setProperty('details', $details);
}
return $obj;
}