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


PHP PhabricatorProject::getTableName方法代码示例

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


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

示例1: materializeProject

 private function materializeProject(PhabricatorProject $project)
 {
     if ($project->isMilestone()) {
         return;
     }
     $material_type = PhabricatorProjectMaterializedMemberEdgeType::EDGECONST;
     $member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
     $project_phid = $project->getPHID();
     $descendants = id(new PhabricatorProjectQuery())->setViewer($this->getViewer())->withAncestorProjectPHIDs(array($project->getPHID()))->withIsMilestone(false)->withHasSubprojects(false)->execute();
     $descendant_phids = mpull($descendants, 'getPHID');
     if ($descendant_phids) {
         $source_phids = $descendant_phids;
         $has_subprojects = true;
     } else {
         $source_phids = array($project->getPHID());
         $has_subprojects = false;
     }
     $conn_w = $project->establishConnection('w');
     $any_milestone = queryfx_one($conn_w, 'SELECT id FROM %T
     WHERE parentProjectPHID = %s AND milestoneNumber IS NOT NULL
     LIMIT 1', $project->getTableName(), $project_phid);
     $has_milestones = (bool) $any_milestone;
     $project->openTransaction();
     // Delete any existing materialized member edges.
     queryfx($conn_w, 'DELETE FROM %T WHERE src = %s AND type = %s', PhabricatorEdgeConfig::TABLE_NAME_EDGE, $project_phid, $material_type);
     // Copy current member edges to create new materialized edges.
     queryfx($conn_w, 'INSERT IGNORE INTO %T (src, type, dst, dateCreated, seq)
       SELECT %s, %d, dst, dateCreated, seq FROM %T
       WHERE src IN (%Ls) AND type = %d', PhabricatorEdgeConfig::TABLE_NAME_EDGE, $project_phid, $material_type, PhabricatorEdgeConfig::TABLE_NAME_EDGE, $source_phids, $member_type);
     // Update the hasSubprojects flag.
     queryfx($conn_w, 'UPDATE %T SET hasSubprojects = %d WHERE id = %d', $project->getTableName(), (int) $has_subprojects, $project->getID());
     // Update the hasMilestones flag.
     queryfx($conn_w, 'UPDATE %T SET hasMilestones = %d WHERE id = %d', $project->getTableName(), (int) $has_milestones, $project->getID());
     $project->saveTransaction();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:35,代码来源:PhabricatorProjectsMembershipIndexEngineExtension.php

示例2: loadPage

 public function loadPage()
 {
     $table = new PhabricatorProject();
     $conn_r = $table->establishConnection('r');
     // NOTE: Because visibility checks for projects depend on whether or not
     // the user is a project member, we always load their membership. If we're
     // loading all members anyway we can piggyback on that; otherwise we
     // do an explicit join.
     $select_clause = '';
     if (!$this->needMembers) {
         $select_clause = ', vm.dst viewerIsMember';
     }
     $data = queryfx_all($conn_r, 'SELECT p.* %Q FROM %T p %Q %Q %Q %Q %Q', $select_clause, $table->getTableName(), $this->buildJoinClause($conn_r), $this->buildWhereClause($conn_r), $this->buildGroupClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     $projects = $table->loadAllFromArray($data);
     if ($projects) {
         $viewer_phid = $this->getViewer()->getPHID();
         if ($this->needMembers) {
             $etype = PhabricatorEdgeConfig::TYPE_PROJ_MEMBER;
             $members = id(new PhabricatorEdgeQuery())->withSourcePHIDs(mpull($projects, 'getPHID'))->withEdgeTypes(array($etype))->execute();
             foreach ($projects as $project) {
                 $phid = $project->getPHID();
                 $project->attachMemberPHIDs(array_keys($members[$phid][$etype]));
                 $project->setIsUserMember($viewer_phid, isset($members[$phid][$etype][$viewer_phid]));
             }
         } else {
             foreach ($data as $row) {
                 $projects[$row['id']]->setIsUserMember($viewer_phid, $row['viewerIsMember'] !== null);
             }
         }
     }
     return $projects;
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:32,代码来源:PhabricatorProjectQuery.php

示例3: pht

<?php

$project_table = new PhabricatorProject();
$table_name = $project_table->getTableName();
$conn_w = $project_table->establishConnection('w');
$slug_table_name = id(new PhabricatorProjectSlug())->getTableName();
$time = time();
echo pht('Migrating project phriction slugs...') . "\n";
foreach (new LiskMigrationIterator($project_table) as $project) {
    $id = $project->getID();
    echo pht('Migrating project %d...', $id) . "\n";
    $phriction_slug = rtrim($project->getPhrictionSlug(), '/');
    $slug = id(new PhabricatorProjectSlug())->loadOneWhere('slug = %s', $phriction_slug);
    if ($slug) {
        echo pht('Already migrated %d... Continuing.', $id) . "\n";
        continue;
    }
    queryfx($conn_w, 'INSERT INTO %T (projectPHID, slug, dateCreated, dateModified) ' . 'VALUES (%s, %s, %d, %d)', $slug_table_name, $project->getPHID(), $phriction_slug, $time, $time);
    echo pht('Migrated %d.', $id) . "\n";
}
echo pht('Done.') . "\n";
开发者ID:pugong,项目名称:phabricator,代码行数:21,代码来源:20140521.projectslug.2.mig.php

示例4: PhabricatorProject

<?php

echo "Archiving projects with no members...\n";
$table = new PhabricatorProject();
$table->openTransaction();
foreach (new LiskMigrationIterator($table) as $project) {
    $members = PhabricatorEdgeQuery::loadDestinationPHIDs($project->getPHID(), PhabricatorEdgeConfig::TYPE_PROJ_MEMBER);
    if (count($members)) {
        echo sprintf('Project "%s" has %d members; skipping.', $project->getName(), count($members)), "\n";
        continue;
    }
    if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ARCHIVED) {
        echo sprintf('Project "%s" already archived; skipping.', $project->getName()), "\n";
        continue;
    }
    echo sprintf('Archiving project "%s"...', $project->getName()), "\n";
    queryfx($table->establishConnection('w'), 'UPDATE %T SET status = %s WHERE id = %d', $table->getTableName(), PhabricatorProjectStatus::STATUS_ARCHIVED, $project->getID());
}
$table->saveTransaction();
echo "\nDone.\n";
开发者ID:denghp,项目名称:phabricator,代码行数:20,代码来源:20130716.archivememberlessprojects.php

示例5: PhabricatorProject

<?php

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

示例6: PhabricatorProject

<?php

$app = PhabricatorApplication::getByClass('PhabricatorProjectApplication');
$view_policy = $app->getPolicy(ProjectDefaultViewCapability::CAPABILITY);
$edit_policy = $app->getPolicy(ProjectDefaultEditCapability::CAPABILITY);
$join_policy = $app->getPolicy(ProjectDefaultJoinCapability::CAPABILITY);
$table = new PhabricatorProject();
$conn_w = $table->establishConnection('w');
queryfx($conn_w, 'UPDATE %T SET viewPolicy = %s WHERE viewPolicy IS NULL', $table->getTableName(), $view_policy);
queryfx($conn_w, 'UPDATE %T SET editPolicy = %s WHERE editPolicy IS NULL', $table->getTableName(), $edit_policy);
queryfx($conn_w, 'UPDATE %T SET joinPolicy = %s WHERE joinPolicy IS NULL', $table->getTableName(), $join_policy);
开发者ID:truSense,项目名称:phabricator,代码行数:11,代码来源:20151219.proj.06.defaultpolicy.php

示例7: array

<?php

$icon_map = array('fa-briefcase' => 'project', 'fa-tags' => 'tag', 'fa-lock' => 'policy', 'fa-users' => 'group', 'fa-folder' => 'folder', 'fa-calendar' => 'timeline', 'fa-flag-checkered' => 'goal', 'fa-truck' => 'release', 'fa-bug' => 'bugs', 'fa-trash-o' => 'cleanup', 'fa-umbrella' => 'umbrella', 'fa-envelope' => 'communication', 'fa-building' => 'organization', 'fa-cloud' => 'infrastructure', 'fa-credit-card' => 'account', 'fa-flask' => 'experimental');
$table = new PhabricatorProject();
$conn_w = $table->establishConnection('w');
foreach ($icon_map as $old_icon => $new_key) {
    queryfx($conn_w, 'UPDATE %T SET icon = %s WHERE icon = %s', $table->getTableName(), $new_key, $old_icon);
}
开发者ID:truSense,项目名称:phabricator,代码行数:8,代码来源:20151231.proj.01.icon.php

示例8: pht

<?php

$project_table = new PhabricatorProject();
$conn_w = $project_table->establishConnection('w');
$conn_w->openTransaction();
$src_table = 'project_legacytransaction';
$dst_table = 'project_transaction';
echo pht('Migrating Project transactions to new format...') . "\n";
$content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_LEGACY, array())->serialize();
$rows = new LiskRawMigrationIterator($conn_w, $src_table);
foreach ($rows as $row) {
    $id = $row['id'];
    $project_id = $row['projectID'];
    echo pht('Migrating transaction #%d (Project %d)...', $id, $project_id) . "\n";
    $project_row = queryfx_one($conn_w, 'SELECT phid FROM %T WHERE id = %d', $project_table->getTableName(), $project_id);
    if (!$project_row) {
        continue;
    }
    $project_phid = $project_row['phid'];
    $type_map = array('name' => PhabricatorProjectTransaction::TYPE_NAME, 'members' => PhabricatorProjectTransaction::TYPE_MEMBERS, 'status' => PhabricatorProjectTransaction::TYPE_STATUS, 'canview' => PhabricatorTransactions::TYPE_VIEW_POLICY, 'canedit' => PhabricatorTransactions::TYPE_EDIT_POLICY, 'canjoin' => PhabricatorTransactions::TYPE_JOIN_POLICY);
    $new_type = idx($type_map, $row['transactionType']);
    if (!$new_type) {
        continue;
    }
    $xaction_phid = PhabricatorPHID::generateNewPHID(PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, PhabricatorProjectProjectPHIDType::TYPECONST);
    queryfx($conn_w, 'INSERT IGNORE INTO %T
      (phid, authorPHID, objectPHID,
        viewPolicy, editPolicy, commentPHID, commentVersion, transactionType,
        oldValue, newValue, contentSource, metadata,
        dateCreated, dateModified)
      VALUES
开发者ID:pugong,项目名称:phabricator,代码行数:31,代码来源:20131020.pxactionmig.php


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