本文整理汇总了PHP中DifferentialRevision::getTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP DifferentialRevision::getTableName方法的具体用法?PHP DifferentialRevision::getTableName怎么用?PHP DifferentialRevision::getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DifferentialRevision
的用法示例。
在下文中一共展示了DifferentialRevision::getTableName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadRevisions
private function loadRevisions($phid)
{
$table = new DifferentialRevision();
$conn_r = $table->establishConnection('r');
$rows = queryfx_all($conn_r, 'SELECT revisions.* FROM %T revisions ' . 'JOIN %T comments ON comments.revisionID = revisions.id ' . 'JOIN (' . ' SELECT revisionID FROM %T WHERE objectPHID = %s ' . ' UNION ALL ' . ' SELECT id from differential_revision WHERE authorPHID = %s) rel ' . 'ON (comments.revisionID = rel.revisionID)' . 'WHERE comments.action = %s' . 'AND comments.authorPHID = %s', $table->getTableName(), id(new DifferentialComment())->getTableName(), DifferentialRevision::RELATIONSHIP_TABLE, $phid, $phid, $this->filter, $phid);
return $table->loadAllFromArray($rows);
}
示例2: loadData
private function loadData()
{
$table = new DifferentialRevision();
$conn_r = $table->establishConnection('r');
if ($this->draftAuthors) {
$draft_key = 'differential-comment-';
$drafts = id(new PhabricatorDraft())->loadAllWhere('authorPHID IN (%Ls) AND draftKey LIKE %> AND draft != %s', $this->draftAuthors, $draft_key, '');
$this->draftRevisions = array();
$len = strlen($draft_key);
foreach ($drafts as $draft) {
$this->draftRevisions[] = substr($draft->getDraftKey(), $len);
}
}
$select = qsprintf($conn_r, 'SELECT r.* FROM %T r', $table->getTableName());
$joins = $this->buildJoinsClause($conn_r);
$where = $this->buildWhereClause($conn_r);
$group_by = $this->buildGroupByClause($conn_r);
$order_by = $this->buildOrderByClause($conn_r);
$limit = '';
if ($this->offset || $this->limit) {
$limit = qsprintf($conn_r, 'LIMIT %d, %d', (int) $this->offset, $this->limit);
}
return queryfx_all($conn_r, '%Q %Q %Q %Q %Q %Q', $select, $joins, $where, $group_by, $order_by, $limit);
}
示例3: buildSelectStatement
private function buildSelectStatement(AphrontDatabaseConnection $conn_r)
{
$table = new DifferentialRevision();
$select = qsprintf($conn_r, 'SELECT r.* FROM %T r', $table->getTableName());
$joins = $this->buildJoinsClause($conn_r);
$where = $this->buildWhereClause($conn_r);
$group_by = $this->buildGroupByClause($conn_r);
$this->buildingGlobalOrder = false;
$order_by = $this->buildOrderClause($conn_r);
$limit = $this->buildLimitClause($conn_r);
return qsprintf($conn_r, '(%Q %Q %Q %Q %Q %Q)', $select, $joins, $where, $group_by, $order_by, $limit);
}
示例4: loadAllOpenWithCCs
private function loadAllOpenWithCCs(array $ccphids)
{
$rev = new DifferentialRevision();
$revision = new DifferentialRevision();
$data = queryfx_all($rev->establishConnection('r'), 'SELECT revision.* FROM %T revision
JOIN %T relationship ON relationship.revisionID = revision.id
AND relationship.relation = %s
AND relationship.objectPHID in (%Ls)
WHERE revision.status in (%Ld) %Q', $revision->getTableName(), DifferentialRevision::RELATIONSHIP_TABLE, DifferentialRevision::RELATION_SUBSCRIBED, $ccphids, $this->getOpenStatuses(), $this->getOrderClause());
return $revision->loadAllFromArray($data);
}
示例5: pht
<?php
$revision_table = new DifferentialRevision();
$conn_w = $revision_table->establishConnection('w');
$conn_w->openTransaction();
$src_table = 'differential_inlinecomment';
$dst_table = 'differential_transaction_comment';
echo pht('Migrating Differential inline comments to new format...') . "\n";
$content_source = PhabricatorContentSource::newForSource(PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
$rows = new LiskRawMigrationIterator($conn_w, $src_table);
foreach ($rows as $row) {
$id = $row['id'];
$revision_id = $row['revisionID'];
echo pht('Migrating inline #%d (%s)...', $id, "D{$revision_id}") . "\n";
$revision_row = queryfx_one($conn_w, 'SELECT phid FROM %T WHERE id = %d', $revision_table->getTableName(), $revision_id);
if (!$revision_row) {
continue;
}
$revision_phid = $revision_row['phid'];
if ($row['commentID']) {
$xaction_phid = PhabricatorPHID::generateNewPHID(PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, DifferentialRevisionPHIDType::TYPECONST);
} else {
$xaction_phid = null;
}
$comment_phid = PhabricatorPHID::generateNewPHID(PhabricatorPHIDConstants::PHID_TYPE_XCMT, DifferentialRevisionPHIDType::TYPECONST);
queryfx($conn_w, 'INSERT IGNORE INTO %T
(id, phid, transactionPHID, authorPHID, viewPolicy, editPolicy,
commentVersion, content, contentSource, isDeleted,
dateCreated, dateModified, revisionPHID, changesetID,
isNewFile, lineNumber, lineLength, hasReplies, legacyCommentID)
VALUES (%d, %s, %ns, %s, %s, %s,
示例6: DifferentialRevision
<?php
$table = new DifferentialRevision();
$table->openTransaction();
$table->beginReadLocking();
$conn_w = $table->establishConnection('w');
echo 'Migrating revisions';
do {
$revisions = $table->loadAllWhere('branchName IS NULL LIMIT 1000');
foreach ($revisions as $revision) {
echo '.';
$diff = $revision->loadActiveDiff();
if (!$diff) {
continue;
}
$branch_name = $diff->getBranch();
$arc_project_phid = $diff->getArcanistProjectPHID();
queryfx($conn_w, 'UPDATE %T SET branchName = %s, arcanistProjectPHID = %s WHERE id = %d', $table->getTableName(), $branch_name, $arc_project_phid, $revision->getID());
}
} while (count($revisions) == 1000);
$table->endReadLocking();
$table->saveTransaction();
echo "\nDone.\n";
示例7: loadData
private function loadData()
{
$table = new DifferentialRevision();
$conn_r = $table->establishConnection('r');
$select = qsprintf($conn_r, 'SELECT r.* FROM %T r', $table->getTableName());
$joins = $this->buildJoinsClause($conn_r);
$where = $this->buildWhereClause($conn_r);
$group_by = $this->buildGroupByClause($conn_r);
$order_by = $this->buildOrderByClause($conn_r);
$limit = '';
if ($this->offset || $this->limit) {
$limit = qsprintf($conn_r, 'LIMIT %d, %d', (int) $this->offset, $this->limit);
}
return queryfx_all($conn_r, '%Q %Q %Q %Q %Q %Q', $select, $joins, $where, $group_by, $order_by, $limit);
}
示例8: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
if ($request->isFormPost()) {
$phid_arr = $request->getArr('view_user');
$view_target = head($phid_arr);
return id(new AphrontRedirectResponse())->setURI($request->getRequestURI()->alter('phid', $view_target));
}
$filters = array('User Revisions', 'active' => array('name' => 'Active Revisions', 'queries' => array(array('query' => DifferentialRevisionListData::QUERY_NEED_ACTION_FROM_SELF, 'header' => 'Action Required', 'nodata' => 'You have no revisions requiring action.'), array('query' => DifferentialRevisionListData::QUERY_NEED_ACTION_FROM_OTHERS, 'header' => 'Waiting on Others', 'nodata' => 'You have no revisions waiting on others'))), 'open' => array('name' => 'Open Revisions', 'queries' => array(array('query' => DifferentialRevisionListData::QUERY_OPEN_OWNED, 'header' => 'Your Open Revisions'))), 'reviews' => array('name' => 'Open Reviews', 'queries' => array(array('query' => DifferentialRevisionListData::QUERY_OPEN_REVIEWER, 'header' => 'Your Open Reviews'))), 'all' => array('name' => 'All Revisions', 'queries' => array(array('query' => DifferentialRevisionListData::QUERY_OWNED, 'header' => 'Your Revisions'))), 'related' => array('name' => 'All Revisions and Reviews', 'queries' => array(array('query' => DifferentialRevisionListData::QUERY_OWNED_OR_REVIEWER, 'header' => 'Your Revisions and Reviews'))), 'updates' => array('name' => 'Updates', 'queries' => array(array('query' => DifferentialRevisionListData::QUERY_UPDATED_SINCE, 'header' => 'Diffs that have been updated since you\'ve last viewed them'))), '<hr />', 'All Revisions', 'allopen' => array('name' => 'Open', 'nofilter' => true, 'queries' => array(array('query' => DifferentialRevisionListData::QUERY_ALL_OPEN, 'header' => 'All Open Revisions'))));
if (empty($filters[$this->filter])) {
$this->filter = 'active';
}
$view_phid = nonempty($request->getStr('phid'), $user->getPHID());
$queries = array();
$filter = $filters[$this->filter];
foreach ($filter['queries'] as $query) {
$query_object = new DifferentialRevisionListData($query['query'], array($view_phid));
$queries[] = array('object' => $query_object) + $query;
}
$side_nav = new AphrontSideNavView();
$query = null;
if ($view_phid) {
$query = '?phid=' . $view_phid;
}
foreach ($filters as $filter_name => $filter_desc) {
if (is_int($filter_name)) {
$side_nav->addNavItem(phutil_render_tag('span', array(), $filter_desc));
continue;
}
$selected = $filter_name == $this->filter;
$side_nav->addNavItem(phutil_render_tag('a', array('href' => '/differential/filter/' . $filter_name . '/' . $query, 'class' => $selected ? 'aphront-side-nav-selected' : null), phutil_escape_html($filter_desc['name'])));
}
$phids = array();
$phids[$view_phid] = true;
$rev_ids = array();
foreach ($queries as $key => $query) {
$revisions = $query['object']->loadRevisions();
foreach ($revisions as $revision) {
$phids[$revision->getAuthorPHID()] = true;
$rev_ids[$revision->getID()] = true;
}
$queries[$key]['revisions'] = $revisions;
}
$rev = new DifferentialRevision();
if ($rev_ids) {
$rev_ids = array_keys($rev_ids);
$reviewers = queryfx_all($rev->establishConnection('r'), 'SELECT revisionID, objectPHID FROM %T revision JOIN %T relationship
ON revision.id = relationship.revisionID
WHERE revision.id IN (%Ld)
AND relationship.relation = %s
ORDER BY sequence', $rev->getTableName(), DifferentialRevision::RELATIONSHIP_TABLE, $rev_ids, DifferentialRevision::RELATION_REVIEWER);
$reviewer_map = array();
foreach ($reviewers as $reviewer) {
$reviewer_map[$reviewer['revisionID']][] = $reviewer['objectPHID'];
}
foreach ($reviewer_map as $revision_id => $reviewer_ids) {
$phids[reset($reviewer_ids)] = true;
}
} else {
$reviewer_map = array();
}
if ($phids) {
$phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
} else {
$handles = array();
}
if (empty($filters[$this->filter]['nofilter'])) {
$filter_form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormTokenizerControl())->setDatasource('/typeahead/common/users/')->setLabel('View User')->setName('view_user')->setValue(array($view_phid => $handles[$view_phid]->getFullName()))->setLimit(1));
$filter_view = new AphrontListFilterView();
$filter_view->appendChild($filter_form);
$side_nav->appendChild($filter_view);
}
foreach ($queries as $query) {
$table = $this->renderRevisionTable($query['revisions'], $query['header'], idx($query, 'nodata'), $handles, $reviewer_map);
$side_nav->appendChild($table);
}
return $this->buildStandardPageResponse($side_nav, array('title' => 'Differential Home', 'tab' => 'revisions'));
}