예제 #1
0
 protected function loadPage()
 {
     $table = new ReleephRequest();
     $conn_r = $table->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     return $table->loadAllFromArray($data);
 }
예제 #2
0
 private function getWarnings(ReleephRequest $pull)
 {
     $warnings = array();
     switch ($pull->getStatus()) {
         case ReleephRequestStatus::STATUS_NEEDS_PICK:
             if ($pull->getPickStatus() == ReleephRequest::PICK_FAILED) {
                 $warnings[] = pht('Last pull failed!');
             }
             break;
         case ReleephRequestStatus::STATUS_NEEDS_REVERT:
             if ($pull->getPickStatus() == ReleephRequest::REVERT_FAILED) {
                 $warnings[] = pht('Last revert failed!');
             }
             break;
     }
     return $warnings;
 }
<?php

$pull_table = new ReleephRequest();
$table_name = $pull_table->getTableName();
$conn_w = $pull_table->establishConnection('w');
echo "Setting object PHIDs for requests...\n";
foreach (new LiskMigrationIterator($pull_table) as $pull) {
    $id = $pull->getID();
    echo "Migrating pull request {$id}...\n";
    if ($pull->getRequestedObjectPHID()) {
        // We already have a valid PHID, so skip this request.
        continue;
    }
    $commit_phids = $pull->getCommitPHIDs();
    if (count($commit_phids) != 1) {
        // At the time this migration was written, all requests had exactly one
        // commit. If a request has more than one, we don't have the information
        // we need to process it.
        continue;
    }
    $commit_phid = head($commit_phids);
    $revision_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($commit_phid, PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV);
    if ($revision_phids) {
        $object_phid = head($revision_phids);
    } else {
        $object_phid = $commit_phid;
    }
    queryfx($conn_w, 'UPDATE %T SET requestedObjectPHID = %s WHERE id = %d', $table_name, $object_phid, $id);
}
echo "Done.\n";
<?php

echo "Populating Releeph requests with mail keys...\n";
$table = new ReleephRequest();
$table->openTransaction();
// From ponder-mailkey-populate.php...
foreach (new LiskMigrationIterator($table) as $rq) {
    $id = $rq->getID();
    echo "RQ{$id}: ";
    if (!$rq->getMailKey()) {
        queryfx($rq->establishConnection('w'), 'UPDATE %T SET mailKey = %s WHERE id = %d', $rq->getTableName(), Filesystem::readRandomCharacters(20), $id);
        echo "Generated Key\n";
    } else {
        echo "-\n";
    }
}
$table->saveTransaction();
echo "Done.\n";
 private function setInBranchFromAction(ReleephRequest $rq, ReleephRequestTransaction $xaction)
 {
     $action = $xaction->getMetadataValue('action');
     switch ($action) {
         case 'pick':
             $rq->setInBranch(1);
             break;
         case 'revert':
             $rq->setInBranch(0);
             break;
         default:
             $id = $rq->getID();
             $type = $xaction->getTransactionType();
             $new = $xaction->getNewValue();
             phlog(pht("Unknown discovery action '%s' for xaction of type %s " . "with new value %s mentioning %s!", $action, $type, $new, 'RQ' . $id));
             break;
     }
     return $this;
 }
 private function setInBranchFromAction(ReleephRequest $rq, ReleephRequestTransaction $xaction)
 {
     $action = $xaction->getMetadataValue('action');
     switch ($action) {
         case 'pick':
             $rq->setInBranch(1);
             break;
         case 'revert':
             $rq->setInBranch(0);
             break;
         default:
             $id = $rq->getID();
             $type = $xaction->getTransactionType();
             $new = $xaction->getNewValue();
             phlog("Unknown discovery action '{$action}' " . "for xaction of type {$type} " . "with new value {$new} " . "mentioning RQ{$id}!");
             break;
     }
 }