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


PHP queryfx函数代码示例

本文整理汇总了PHP中queryfx函数的典型用法代码示例。如果您正苦于以下问题:PHP queryfx函数的具体用法?PHP queryfx怎么用?PHP queryfx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: collectGarbage

 protected function collectGarbage()
 {
     $table = new DifferentialChangeset();
     $conn_w = $table->establishConnection('w');
     queryfx($conn_w, 'DELETE FROM %T WHERE dateCreated < %d LIMIT 100', DifferentialChangeset::TABLE_CACHE, $this->getGarbageEpoch());
     return $conn_w->getAffectedRows() == 100;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:DifferentialParseCacheGarbageCollector.php

示例2: recordCommit

 protected function recordCommit($commit_identifier, $epoch)
 {
     $repository = $this->getRepository();
     $commit = new PhabricatorRepositoryCommit();
     $commit->setRepositoryID($repository->getID());
     $commit->setCommitIdentifier($commit_identifier);
     $commit->setEpoch($epoch);
     try {
         $commit->save();
         $event = new PhabricatorTimelineEvent('cmit', array('id' => $commit->getID()));
         $event->recordEvent();
         queryfx($repository->establishConnection('w'), 'INSERT INTO %T (repositoryID, size, lastCommitID, epoch)
       VALUES (%d, 1, %d, %d)
       ON DUPLICATE KEY UPDATE
         size = size + 1,
         lastCommitID =
           IF(VALUES(epoch) > epoch, VALUES(lastCommitID), lastCommitID),
         epoch = IF(VALUES(epoch) > epoch, VALUES(epoch), epoch)', PhabricatorRepository::TABLE_SUMMARY, $repository->getID(), $commit->getID(), $epoch);
         $this->commitCache[$commit_identifier] = true;
     } catch (AphrontQueryDuplicateKeyException $ex) {
         // Ignore. This can happen because we discover the same new commit
         // more than once when looking at history, or because of races or
         // data inconsistency or cosmic radiation; in any case, we're still
         // in a good state if we ignore the failure.
         $this->commitCache[$commit_identifier] = true;
     }
     $this->stillWorking();
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:28,代码来源:PhabricatorRepositoryCommitDiscoveryDaemon.php

示例3: applyInternalEffects

 public function applyInternalEffects($object, $value)
 {
     $parent = $object->getParentEvent();
     $object->setInstanceOfEventPHID(null);
     $object->attachParentEvent(null);
     $rrule = $parent->newRecurrenceRule();
     $object->setRecurrenceRule($rrule);
     $until = $parent->newUntilDateTime();
     if ($until) {
         $object->setUntilDateTime($until);
     }
     $old_sequence_index = $object->getSequenceIndex();
     $object->setSequenceIndex(0);
     // Stop the parent event from recurring after the start date of this event.
     // Since the "until" time is inclusive, rewind it by one second. We could
     // figure out the previous instance's time instead or use a COUNT, but this
     // seems simpler as long as it doesn't cause any issues.
     $until_cutoff = $object->newStartDateTime()->newRelativeDateTime('-PT1S')->newAbsoluteDateTime();
     $parent->setUntilDateTime($until_cutoff);
     $parent->save();
     // NOTE: If we implement "COUNT" on editable events, we need to adjust
     // the "COUNT" here and divide it up between the parent and the fork.
     // Make all following children of the old parent children of this node
     // instead.
     $conn = $object->establishConnection('w');
     queryfx($conn, 'UPDATE %T SET
     instanceOfEventPHID = %s,
     sequenceIndex = (sequenceIndex - %d)
     WHERE instanceOfEventPHID = %s
     AND utcInstanceEpoch > %d', $object->getTableName(), $object->getPHID(), $old_sequence_index, $parent->getPHID(), $object->getUTCInstanceEpoch());
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:31,代码来源:PhabricatorCalendarEventForkTransaction.php

示例4: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $chrono_key = $request->getStr('chronoKey');
     $user = $request->getUser();
     if ($request->isDialogFormPost()) {
         $table = new PhabricatorFeedStoryNotification();
         queryfx($table->establishConnection('w'), 'UPDATE %T SET hasViewed = 1 ' . 'WHERE userPHID = %s AND hasViewed = 0 and chronologicalKey <= %s', $table->getTableName(), $user->getPHID(), $chrono_key);
         return id(new AphrontReloadResponse())->setURI('/notification/');
     }
     $dialog = new AphrontDialogView();
     $dialog->setUser($user);
     $dialog->addCancelButton('/notification/');
     if ($chrono_key) {
         $dialog->setTitle(pht('Really mark all notifications as read?'));
         $dialog->addHiddenInput('chronoKey', $chrono_key);
         $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
         if ($is_serious) {
             $dialog->appendChild(pht('All unread notifications will be marked as read. You can not ' . 'undo this action.'));
         } else {
             $dialog->appendChild(pht("You can't ignore your problems forever, you know."));
         }
         $dialog->addSubmitButton(pht('Mark All Read'));
     } else {
         $dialog->setTitle(pht('No notifications to mark as read.'));
         $dialog->appendChild(pht('You have no unread notifications.'));
     }
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:29,代码来源:PhabricatorNotificationClearController.php

示例5: 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');
     $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());
     $project->saveTransaction();
 }
开发者ID:phpengineer,项目名称:phabricator,代码行数:29,代码来源:PhabricatorProjectsMembershipIndexEngineExtension.php

示例6: doUnlock

 protected function doUnlock()
 {
     queryfx($this->conn, 'SELECT RELEASE_LOCK(%s)', 'phabricator:' . $this->lockname);
     $this->conn->close();
     self::$pool[] = $this->conn;
     $this->conn = null;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:PhabricatorGlobalLock.php

示例7: testTransactionStack

 public function testTransactionStack()
 {
     $conn = $this->newIsolatedConnection();
     $conn->openTransaction();
     queryfx($conn, 'INSERT');
     $conn->saveTransaction();
     $this->assertEqual(array('START TRANSACTION', 'INSERT', 'COMMIT'), $conn->getQueryTranscript());
     $conn = $this->newIsolatedConnection();
     $conn->openTransaction();
     queryfx($conn, 'INSERT 1');
     $conn->openTransaction();
     queryfx($conn, 'INSERT 2');
     $conn->killTransaction();
     $conn->openTransaction();
     queryfx($conn, 'INSERT 3');
     $conn->openTransaction();
     queryfx($conn, 'INSERT 4');
     $conn->saveTransaction();
     $conn->saveTransaction();
     $conn->openTransaction();
     queryfx($conn, 'INSERT 5');
     $conn->killTransaction();
     queryfx($conn, 'INSERT 6');
     $conn->saveTransaction();
     $this->assertEqual(array('START TRANSACTION', 'INSERT 1', 'SAVEPOINT Aphront_Savepoint_1', 'INSERT 2', 'ROLLBACK TO SAVEPOINT Aphront_Savepoint_1', 'SAVEPOINT Aphront_Savepoint_1', 'INSERT 3', 'SAVEPOINT Aphront_Savepoint_2', 'INSERT 4', 'SAVEPOINT Aphront_Savepoint_1', 'INSERT 5', 'ROLLBACK TO SAVEPOINT Aphront_Savepoint_1', 'INSERT 6', 'COMMIT'), $conn->getQueryTranscript());
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:26,代码来源:AphrontIsolatedDatabaseConnectionTestCase.php

示例8: updateHint

 public static function updateHint($repository_phid, $old, $new, $type)
 {
     switch ($type) {
         case self::HINT_NONE:
             break;
         case self::HINT_REWRITTEN:
             if (!$new) {
                 throw new Exception(pht('When hinting a commit ("%s") as rewritten, you must provide ' . 'the commit it was rewritten into.', $old));
             }
             break;
         case self::HINT_UNREADABLE:
             if ($new) {
                 throw new Exception(pht('When hinting a commit ("%s") as unreadable, you must not ' . 'provide a new commit ("%s").', $old, $new));
             }
             break;
         default:
             $all_types = self::getAllHintTypes();
             throw new Exception(pht('Hint type ("%s") for commit ("%s") is not valid. Valid hints ' . 'are: %s.', $type, $old, implode(', ', $all_types)));
     }
     $table = new self();
     $table_name = $table->getTableName();
     $conn = $table->establishConnection('w');
     if ($type == self::HINT_NONE) {
         queryfx($conn, 'DELETE FROM %T WHERE repositoryPHID = %s AND oldCommitIdentifier = %s', $table_name, $repository_phid, $old);
     } else {
         queryfx($conn, 'INSERT INTO %T
       (repositoryPHID, oldCommitIdentifier, newCommitIdentifier, hintType)
       VALUES (%s, %s, %ns, %s)
       ON DUPLICATE KEY UPDATE
         newCommitIdentifier = VALUES(newCommitIdentifier),
         hintType = VALUES(hintType)', $table_name, $repository_phid, $old, $new, $type);
     }
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:33,代码来源:PhabricatorRepositoryCommitHint.php

示例9: saveVote

 public function saveVote()
 {
     if (!$this->votable) {
         throw new Exception("Must set votable before saving vote");
     }
     if (!$this->user) {
         throw new Exception("Must set user before saving vote");
     }
     $user = $this->user;
     $votable = $this->votable;
     $newvote = $this->vote;
     // prepare vote add, or update if this user is amending an
     // earlier vote
     $editor = id(new PhabricatorEdgeEditor())->setUser($user)->addEdge($user->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID(), array('data' => $newvote))->removeEdge($user->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID());
     $conn = $votable->establishConnection('w');
     $trans = $conn->openTransaction();
     $trans->beginReadLocking();
     $votable->reload();
     $curvote = (int) PhabricatorEdgeQuery::loadSingleEdgeData($user->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID());
     if (!$curvote) {
         $curvote = PonderConstants::NONE_VOTE;
     }
     // adjust votable's score by this much
     $delta = $newvote - $curvote;
     queryfx($conn, 'UPDATE %T as t
     SET t.`voteCount` = t.`voteCount` + %d
     WHERE t.`PHID` = %s', $votable->getTableName(), $delta, $votable->getVotablePHID());
     $editor->save();
     $trans->endReadLocking();
     $trans->saveTransaction();
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:31,代码来源:PonderVoteEditor.php

示例10: collectGarbage

 protected function collectGarbage()
 {
     $table = new PhabricatorDaemonLog();
     $conn_w = $table->establishConnection('w');
     queryfx($conn_w, 'DELETE FROM %T WHERE dateCreated < %d AND status != %s LIMIT 100', $table->getTableName(), $this->getGarbageEpoch(), PhabricatorDaemonLog::STATUS_RUNNING);
     return $conn_w->getAffectedRows() == 100;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:PhabricatorDaemonLogGarbageCollector.php

示例11: saveVote

 public function saveVote()
 {
     $actor = $this->requireActor();
     if (!$this->votable) {
         throw new PhutilInvalidStateException('setVotable');
     }
     $votable = $this->votable;
     $newvote = $this->vote;
     // prepare vote add, or update if this user is amending an
     // earlier vote
     $editor = id(new PhabricatorEdgeEditor())->addEdge($actor->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID(), array('data' => $newvote))->removeEdge($actor->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID());
     $conn = $votable->establishConnection('w');
     $trans = $conn->openTransaction();
     $trans->beginReadLocking();
     $votable->reload();
     $curvote = (int) PhabricatorEdgeQuery::loadSingleEdgeData($actor->getPHID(), $votable->getUserVoteEdgeType(), $votable->getVotablePHID());
     if (!$curvote) {
         $curvote = PonderVote::VOTE_NONE;
     }
     // Adjust votable's score by this much.
     $delta = $newvote - $curvote;
     queryfx($conn, 'UPDATE %T as t
     SET t.voteCount = t.voteCount + %d
     WHERE t.PHID = %s', $votable->getTableName(), $delta, $votable->getVotablePHID());
     $editor->save();
     $trans->endReadLocking();
     $trans->saveTransaction();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:28,代码来源:PonderVoteEditor.php

示例12: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $repository_phid = $request->getValue('repositoryPHID');
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withPHIDs(array($repository_phid))->executeOne();
     if (!$repository) {
         throw new Exception(pht('No repository exists with PHID "%s".', $repository_phid));
     }
     $commit_name = $request->getValue('commit');
     $commit = id(new DiffusionCommitQuery())->setViewer($viewer)->withRepository($repository)->withIdentifiers(array($commit_name))->executeOne();
     if (!$commit) {
         throw new Exception(pht('No commit exists with identifier "%s".', $commit_name));
     }
     $branch = PhabricatorRepositoryBranch::loadOrCreateBranch($repository->getID(), $request->getValue('branch'));
     $coverage = $request->getValue('coverage');
     $path_map = id(new DiffusionPathIDQuery(array_keys($coverage)))->loadPathIDs();
     $conn = $repository->establishConnection('w');
     $sql = array();
     foreach ($coverage as $path => $coverage_info) {
         $sql[] = qsprintf($conn, '(%d, %d, %d, %s)', $branch->getID(), $path_map[$path], $commit->getID(), $coverage_info);
     }
     $table_name = 'repository_coverage';
     $conn->openTransaction();
     queryfx($conn, 'DELETE FROM %T WHERE branchID = %d', $table_name, $branch->getID());
     foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
         queryfx($conn, 'INSERT INTO %T (branchID, pathID, commitID, coverage) VALUES %Q', $table_name, $chunk);
     }
     $conn->saveTransaction();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:29,代码来源:DiffusionUpdateCoverageConduitAPIMethod.php

示例13: execute

 public function execute(PhutilArgumentParser $args)
 {
     $is_dry = $args->getArg('dryrun');
     $is_force = $args->getArg('force');
     if (!$is_dry && !$is_force) {
         echo phutil_console_wrap("Are you completely sure you really want to permanently destroy all " . "storage for Phabricator data? This operation can not be undone and " . "your data will not be recoverable if you proceed.");
         if (!phutil_console_confirm('Permanently destroy all data?')) {
             echo "Cancelled.\n";
             exit(1);
         }
         if (!phutil_console_confirm('Really destroy all data forever?')) {
             echo "Cancelled.\n";
             exit(1);
         }
     }
     $api = $this->getAPI();
     $patches = $this->getPatches();
     $databases = $api->getDatabaseList($patches);
     $databases[] = $api->getDatabaseName('meta_data');
     foreach ($databases as $database) {
         if ($is_dry) {
             echo "DRYRUN: Would drop database '{$database}'.\n";
         } else {
             echo "Dropping database '{$database}'...\n";
             queryfx($api->getConn('meta_data', $select_database = false), 'DROP DATABASE IF EXISTS %T', $database);
         }
     }
     if (!$is_dry) {
         echo "Storage was destroyed.\n";
     }
     return 0;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:32,代码来源:PhabricatorStorageManagementDestroyWorkflow.php

示例14: doUnlock

 protected function doUnlock()
 {
     queryfx($this->conn, 'SELECT RELEASE_LOCK(%s)', $this->getName());
     $this->conn->close();
     self::$pool[] = $this->conn;
     $this->conn = null;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:7,代码来源:PhabricatorGlobalLock.php

示例15: collectGarbage

 protected function collectGarbage()
 {
     $table = new PhabricatorUserLog();
     $conn_w = $table->establishConnection('w');
     queryfx($conn_w, 'DELETE FROM %T WHERE dateCreated < %d LIMIT 100', $table->getTableName(), $this->getGarbageEpoch());
     return $conn_w->getAffectedRows() == 100;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:PeopleUserLogGarbageCollector.php


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