当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorOwnersPackage::getTableName方法代码示例

本文整理汇总了PHP中PhabricatorOwnersPackage::getTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorOwnersPackage::getTableName方法的具体用法?PHP PhabricatorOwnersPackage::getTableName怎么用?PHP PhabricatorOwnersPackage::getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorOwnersPackage的用法示例。


在下文中一共展示了PhabricatorOwnersPackage::getTableName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadPage

 protected function loadPage()
 {
     $table = new PhabricatorOwnersPackage();
     $conn_r = $table->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT p.* FROM %T p %Q %Q %Q %Q', $table->getTableName(), $this->buildJoinClause($conn_r), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     return $table->loadAllFromArray($data);
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:7,代码来源:PhabricatorOwnersPackageQuery.php

示例2: loadPackagesForPaths

 private static function loadPackagesForPaths(PhabricatorRepository $repository, array $paths, $limit = 0)
 {
     $fragments = array();
     foreach ($paths as $path) {
         foreach (self::splitPath($path) as $fragment) {
             $fragments[$fragment][$path] = true;
         }
     }
     $package = new PhabricatorOwnersPackage();
     $path = new PhabricatorOwnersPath();
     $conn = $package->establishConnection('r');
     $repository_clause = qsprintf($conn, 'AND p.repositoryPHID = %s', $repository->getPHID());
     // NOTE: The list of $paths may be very large if we're coming from
     // the OwnersWorker and processing, e.g., an SVN commit which created a new
     // branch. Break it apart so that it will fit within 'max_allowed_packet',
     // and then merge results in PHP.
     $rows = array();
     foreach (array_chunk(array_keys($fragments), 128) as $chunk) {
         $rows[] = queryfx_all($conn, 'SELECT pkg.id, p.excluded, p.path
       FROM %T pkg JOIN %T p ON p.packageID = pkg.id
       WHERE p.path IN (%Ls) %Q', $package->getTableName(), $path->getTableName(), $chunk, $repository_clause);
     }
     $rows = array_mergev($rows);
     $ids = self::findLongestPathsPerPackage($rows, $fragments);
     if (!$ids) {
         return array();
     }
     arsort($ids);
     if ($limit) {
         $ids = array_slice($ids, 0, $limit, $preserve_keys = true);
     }
     $ids = array_keys($ids);
     $packages = $package->loadAllWhere('id in (%Ld)', $ids);
     $packages = array_select_keys($packages, $ids);
     return $packages;
 }
开发者ID:Houzz,项目名称:phabricator,代码行数:36,代码来源:PhabricatorOwnersPackage.php

示例3: loadPackagesForPaths

 private static function loadPackagesForPaths(PhabricatorRepository $repository, array $paths, $limit = 0)
 {
     $package = new PhabricatorOwnersPackage();
     $path = new PhabricatorOwnersPath();
     $conn = $package->establishConnection('r');
     $repository_clause = qsprintf($conn, 'AND p.repositoryPHID = %s', $repository->getPHID());
     $limit_clause = '';
     if (!empty($limit)) {
         $limit_clause = qsprintf($conn, 'LIMIT %d', $limit);
     }
     $data = queryfx_all($conn, 'SELECT pkg.id FROM %T pkg JOIN %T p ON p.packageID = pkg.id
     WHERE p.path IN (%Ls) %Q ORDER BY LENGTH(p.path) DESC %Q', $package->getTableName(), $path->getTableName(), $paths, $repository_clause, $limit_clause);
     $ids = ipull($data, 'id');
     if (empty($ids)) {
         return array();
     }
     $order = array();
     foreach ($ids as $id) {
         if (empty($order[$id])) {
             $order[$id] = true;
         }
     }
     $packages = $package->loadAllWhere('id in (%Ld)', array_keys($order));
     $packages = array_select_keys($packages, array_keys($order));
     return $packages;
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:26,代码来源:PhabricatorOwnersPackage.php

示例4: loadPackagesForPaths

 private static function loadPackagesForPaths(PhabricatorRepository $repository, array $paths, $limit = 0)
 {
     $package = new PhabricatorOwnersPackage();
     $path = new PhabricatorOwnersPath();
     $conn = $package->establishConnection('r');
     $repository_clause = qsprintf($conn, 'AND p.repositoryPHID = %s', $repository->getPHID());
     // NOTE: The list of $paths may be very large if we're coming from
     // the OwnersWorker and processing, e.g., an SVN commit which created a new
     // branch. Break it apart so that it will fit within 'max_allowed_packet',
     // and then merge results in PHP.
     $ids = array();
     foreach (array_chunk($paths, 128) as $chunk) {
         $rows = queryfx_all($conn, 'SELECT pkg.id id, LENGTH(p.path) len
       FROM %T pkg JOIN %T p ON p.packageID = pkg.id
       WHERE p.path IN (%Ls) %Q', $package->getTableName(), $path->getTableName(), $chunk, $repository_clause);
         foreach ($rows as $row) {
             $id = (int) $row['id'];
             $len = (int) $row['len'];
             if (isset($ids[$id])) {
                 $ids[$id] = max($len, $ids[$id]);
             } else {
                 $ids[$id] = $len;
             }
         }
     }
     if (!$ids) {
         return array();
     }
     arsort($ids);
     if ($limit) {
         $ids = array_slice($ids, 0, $limit, $preserve_keys = true);
     }
     $ids = array_keys($ids);
     $packages = $package->loadAllWhere('id in (%Ld)', $ids);
     $packages = array_select_keys($packages, $ids);
     return $packages;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:37,代码来源:PhabricatorOwnersPackage.php

示例5: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $views = array('owned' => 'Owned Packages', 'all' => 'All Packages', 'search' => 'Search Results');
     if (empty($views[$this->view])) {
         reset($views);
         $this->view = key($views);
     }
     if ($this->view != 'search') {
         unset($views['search']);
     }
     $nav = new AphrontSideNavView();
     foreach ($views as $key => $name) {
         $nav->addNavItem(phutil_render_tag('a', array('href' => '/owners/view/' . $key . '/', 'class' => $this->view == $key ? 'aphront-side-nav-selected' : null), phutil_escape_html($name)));
     }
     $package = new PhabricatorOwnersPackage();
     $owner = new PhabricatorOwnersOwner();
     $path = new PhabricatorOwnersPath();
     switch ($this->view) {
         case 'search':
             $packages = array();
             $conn_r = $package->establishConnection('r');
             $where = array('1 = 1');
             $join = array();
             if ($request->getStr('name')) {
                 $where[] = qsprintf($conn_r, 'p.name LIKE %~', $request->getStr('name'));
             }
             if ($request->getStr('path')) {
                 $join[] = qsprintf($conn_r, 'JOIN %T path ON path.packageID = p.id', $path->getTableName());
                 $where[] = qsprintf($conn_r, 'path.path LIKE %~', $request->getStr('path'));
             }
             if ($request->getArr('owner')) {
                 $join[] = qsprintf($conn_r, 'JOIN %T o ON o.packageID = p.id', $owner->getTableName());
                 $where[] = qsprintf($conn_r, 'o.userPHID IN (%Ls)', $request->getArr('owner'));
             }
             $data = queryfx_all($conn_r, 'SELECT p.* FROM %T p %Q WHERE %Q GROUP BY p.id', $package->getTableName(), implode(' ', $join), '(' . implode(') AND (', $where) . ')');
             $packages = $package->loadAllFromArray($data);
             $header = 'Search Results';
             $nodata = 'No packages match your query.';
             break;
         case 'owned':
             $data = queryfx_all($package->establishConnection('r'), 'SELECT p.* FROM %T p JOIN %T o ON p.id = o.packageID
         WHERE o.userPHID = %s GROUP BY p.id', $package->getTableName(), $owner->getTableName(), $user->getPHID());
             $packages = $package->loadAllFromArray($data);
             $header = 'Owned Packages';
             $nodata = 'No owned packages';
             break;
         case 'all':
             $packages = $package->loadAll();
             $header = 'All Packages';
             $nodata = 'There are no defined packages.';
             break;
     }
     $content = $this->renderPackageTable($packages, $header, $nodata);
     $filter = new AphrontListFilterView();
     $filter->addButton(phutil_render_tag('a', array('href' => '/owners/new/', 'class' => 'green button'), 'Create New Package'));
     $owners_search_value = array();
     if ($request->getArr('owner')) {
         $phids = $request->getArr('owner');
         $phid = reset($phids);
         $handles = id(new PhabricatorObjectHandleData(array($phid)))->loadHandles();
         $owners_search_value = array($phid => $handles[$phid]->getFullName());
     }
     $form = id(new AphrontFormView())->setUser($user)->setAction('/owners/view/search/')->appendChild(id(new AphrontFormTextControl())->setName('name')->setLabel('Name')->setValue($request->getStr('name')))->appendChild(id(new AphrontFormTokenizerControl())->setDatasource('/typeahead/common/users/')->setLimit(1)->setName('owner')->setLabel('Owner')->setValue($owners_search_value))->appendChild(id(new AphrontFormTextControl())->setName('path')->setLabel('Path')->setValue($request->getStr('path')))->appendChild(id(new AphrontFormSubmitControl())->setValue('Search for Packages'));
     $filter->appendChild($form);
     $nav->appendChild($filter);
     $nav->appendChild($content);
     return $this->buildStandardPageResponse($nav, array('title' => 'Package Index', 'tab' => 'index'));
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:70,代码来源:PhabricatorOwnersListController.php

示例6: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $package = new PhabricatorOwnersPackage();
     $owner = new PhabricatorOwnersOwner();
     $path = new PhabricatorOwnersPath();
     $repository_phid = '';
     if ($request->getStr('repository') != '') {
         $repository_phid = id(new PhabricatorRepositoryQuery())->setViewer($user)->withCallsigns(array($request->getStr('repository')))->executeOne()->getPHID();
     }
     switch ($this->view) {
         case 'search':
             $packages = array();
             $conn_r = $package->establishConnection('r');
             $where = array('1 = 1');
             $join = array();
             $having = '';
             if ($request->getStr('name')) {
                 $where[] = qsprintf($conn_r, 'p.name LIKE %~', $request->getStr('name'));
             }
             if ($repository_phid || $request->getStr('path')) {
                 $join[] = qsprintf($conn_r, 'JOIN %T path ON path.packageID = p.id', $path->getTableName());
                 if ($repository_phid) {
                     $where[] = qsprintf($conn_r, 'path.repositoryPHID = %s', $repository_phid);
                 }
                 if ($request->getStr('path')) {
                     $where[] = qsprintf($conn_r, '(path.path LIKE %~ AND NOT path.excluded) OR
             %s LIKE CONCAT(REPLACE(path.path, %s, %s), %s)', $request->getStr('path'), $request->getStr('path'), '_', '\\_', '%');
                     $having = 'HAVING MAX(path.excluded) = 0';
                 }
             }
             if ($request->getArr('owner')) {
                 $join[] = qsprintf($conn_r, 'JOIN %T o ON o.packageID = p.id', $owner->getTableName());
                 $where[] = qsprintf($conn_r, 'o.userPHID IN (%Ls)', $request->getArr('owner'));
             }
             $data = queryfx_all($conn_r, 'SELECT p.* FROM %T p %Q WHERE %Q GROUP BY p.id %Q', $package->getTableName(), implode(' ', $join), '(' . implode(') AND (', $where) . ')', $having);
             $packages = $package->loadAllFromArray($data);
             $header = pht('Search Results');
             $nodata = pht('No packages match your query.');
             break;
         case 'owned':
             $data = queryfx_all($package->establishConnection('r'), 'SELECT p.* FROM %T p JOIN %T o ON p.id = o.packageID
         WHERE o.userPHID = %s GROUP BY p.id', $package->getTableName(), $owner->getTableName(), $user->getPHID());
             $packages = $package->loadAllFromArray($data);
             $header = pht('Owned Packages');
             $nodata = pht('No owned packages');
             break;
         case 'projects':
             $projects = id(new PhabricatorProjectQuery())->setViewer($user)->withMemberPHIDs(array($user->getPHID()))->withStatus(PhabricatorProjectQuery::STATUS_ANY)->execute();
             $owner_phids = mpull($projects, 'getPHID');
             if ($owner_phids) {
                 $data = queryfx_all($package->establishConnection('r'), 'SELECT p.* FROM %T p JOIN %T o ON p.id = o.packageID
           WHERE o.userPHID IN (%Ls) GROUP BY p.id', $package->getTableName(), $owner->getTableName(), $owner_phids);
             } else {
                 $data = array();
             }
             $packages = $package->loadAllFromArray($data);
             $header = pht('Owned Packages');
             $nodata = pht('No owned packages');
             break;
         case 'all':
             $packages = $package->loadAll();
             $header = pht('All Packages');
             $nodata = pht('There are no defined packages.');
             break;
     }
     $content = $this->renderPackageTable($packages, $header, $nodata);
     $filter = new AphrontListFilterView();
     $owners_search_value = array();
     if ($request->getArr('owner')) {
         $phids = $request->getArr('owner');
         $phid = reset($phids);
         $handles = $this->loadViewerHandles(array($phid));
         $owners_search_value = array($handles[$phid]);
     }
     $callsigns = array('' => pht('(Any Repository)'));
     $repositories = id(new PhabricatorRepositoryQuery())->setViewer($user)->setOrder(PhabricatorRepositoryQuery::ORDER_CALLSIGN)->execute();
     foreach ($repositories as $repository) {
         $callsigns[$repository->getCallsign()] = $repository->getCallsign() . ': ' . $repository->getName();
     }
     $form = id(new AphrontFormView())->setUser($user)->setAction('/owners/view/search/')->setMethod('GET')->appendChild(id(new AphrontFormTextControl())->setName('name')->setLabel(pht('Name'))->setValue($request->getStr('name')))->appendChild(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorProjectOrUserDatasource())->setLimit(1)->setName('owner')->setLabel(pht('Owner'))->setValue($owners_search_value))->appendChild(id(new AphrontFormSelectControl())->setName('repository')->setLabel(pht('Repository'))->setOptions($callsigns)->setValue($request->getStr('repository')))->appendChild(id(new AphrontFormTextControl())->setName('path')->setLabel(pht('Path'))->setValue($request->getStr('path')))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Search for Packages')));
     $filter->appendChild($form);
     $nav = $this->buildSideNavView();
     $nav->appendChild($filter);
     $nav->appendChild($content);
     return $this->buildApplicationPage(array($nav), array('title' => pht('Package Index')));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:88,代码来源:PhabricatorOwnersListController.php

示例7: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $package = new PhabricatorOwnersPackage();
     $owner = new PhabricatorOwnersOwner();
     $path = new PhabricatorOwnersPath();
     $repository_phid = '';
     if ($request->getStr('repository') != '') {
         $repository_phid = id(new PhabricatorRepository())->loadOneWhere('callsign = %s', $request->getStr('repository'))->getPHID();
     }
     switch ($this->view) {
         case 'search':
             $packages = array();
             $conn_r = $package->establishConnection('r');
             $where = array('1 = 1');
             $join = array();
             if ($request->getStr('name')) {
                 $where[] = qsprintf($conn_r, 'p.name LIKE %~', $request->getStr('name'));
             }
             if ($repository_phid || $request->getStr('path')) {
                 $join[] = qsprintf($conn_r, 'JOIN %T path ON path.packageID = p.id', $path->getTableName());
                 if ($repository_phid) {
                     $where[] = qsprintf($conn_r, 'path.repositoryPHID = %s', $repository_phid);
                 }
                 if ($request->getStr('path')) {
                     $where[] = qsprintf($conn_r, 'path.path LIKE %~ OR %s LIKE CONCAT(path.path, %s)', $request->getStr('path'), $request->getStr('path'), '%');
                 }
             }
             if ($request->getArr('owner')) {
                 $join[] = qsprintf($conn_r, 'JOIN %T o ON o.packageID = p.id', $owner->getTableName());
                 $where[] = qsprintf($conn_r, 'o.userPHID IN (%Ls)', $request->getArr('owner'));
             }
             $data = queryfx_all($conn_r, 'SELECT p.* FROM %T p %Q WHERE %Q GROUP BY p.id', $package->getTableName(), implode(' ', $join), '(' . implode(') AND (', $where) . ')');
             $packages = $package->loadAllFromArray($data);
             $header = 'Search Results';
             $nodata = 'No packages match your query.';
             break;
         case 'owned':
             $data = queryfx_all($package->establishConnection('r'), 'SELECT p.* FROM %T p JOIN %T o ON p.id = o.packageID
         WHERE o.userPHID = %s GROUP BY p.id', $package->getTableName(), $owner->getTableName(), $user->getPHID());
             $packages = $package->loadAllFromArray($data);
             $header = 'Owned Packages';
             $nodata = 'No owned packages';
             break;
         case 'all':
             $packages = $package->loadAll();
             $header = 'All Packages';
             $nodata = 'There are no defined packages.';
             break;
     }
     $content = $this->renderPackageTable($packages, $header, $nodata);
     $filter = new AphrontListFilterView();
     $filter->addButton(phutil_render_tag('a', array('href' => '/owners/new/', 'class' => 'green button'), 'Create New Package'));
     $owners_search_value = array();
     if ($request->getArr('owner')) {
         $phids = $request->getArr('owner');
         $phid = reset($phids);
         $handles = id(new PhabricatorObjectHandleData(array($phid)))->loadHandles();
         $owners_search_value = array($phid => $handles[$phid]->getFullName());
     }
     $callsigns = array('' => '(Any Repository)');
     $repositories = id(new PhabricatorRepository())->loadAllWhere('1 = 1 ORDER BY callsign');
     foreach ($repositories as $repository) {
         $callsigns[$repository->getCallsign()] = $repository->getCallsign() . ': ' . $repository->getName();
     }
     $form = id(new AphrontFormView())->setUser($user)->setAction('/owners/view/search/')->setMethod('GET')->appendChild(id(new AphrontFormTextControl())->setName('name')->setLabel('Name')->setValue($request->getStr('name')))->appendChild(id(new AphrontFormTokenizerControl())->setDatasource('/typeahead/common/usersorprojects/')->setLimit(1)->setName('owner')->setLabel('Owner')->setValue($owners_search_value))->appendChild(id(new AphrontFormSelectControl())->setName('repository')->setLabel('Repository')->setOptions($callsigns)->setValue($request->getStr('repository')))->appendChild(id(new AphrontFormTextControl())->setName('path')->setLabel('Path')->setValue($request->getStr('path')))->appendChild(id(new AphrontFormSubmitControl())->setValue('Search for Packages'));
     $filter->appendChild($form);
     return $this->buildStandardPageResponse(array($filter, $content), array('title' => 'Package Index'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:70,代码来源:PhabricatorOwnersListController.php

示例8: PhabricatorOwnersPackage

<?php

$table = new PhabricatorOwnersPackage();
$conn_w = $table->establishConnection('w');
$iterator = new LiskMigrationIterator($table);
foreach ($iterator as $package) {
    $id = $package->getID();
    echo pht('Adding mail key for package %d...', $id);
    echo "\n";
    queryfx($conn_w, 'UPDATE %T SET mailKey = %s WHERE id = %d', $table->getTableName(), Filesystem::readRandomCharacters(20), $id);
}
开发者ID:truSense,项目名称:phabricator,代码行数:11,代码来源:20150526.owners.mailkey.2.php


注:本文中的PhabricatorOwnersPackage::getTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。