當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhabricatorFile::getTableName方法代碼示例

本文整理匯總了PHP中PhabricatorFile::getTableName方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorFile::getTableName方法的具體用法?PHP PhabricatorFile::getTableName怎麽用?PHP PhabricatorFile::getTableName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhabricatorFile的用法示例。


在下文中一共展示了PhabricatorFile::getTableName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: PhabricatorFile

<?php

// This corrects files which incorrectly had a 'cancdn' property written;
// the property should be 'canCDN'.
$table = new PhabricatorFile();
$conn_w = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $file) {
    $id = $file->getID();
    echo pht("Updating capitalization of %s property for file %d...\n", 'canCDN', $id);
    $meta = $file->getMetadata();
    if (isset($meta['cancdn'])) {
        $meta['canCDN'] = $meta['cancdn'];
        unset($meta['cancdn']);
        queryfx($conn_w, 'UPDATE %T SET metadata = %s WHERE id = %d', $table->getTableName(), json_encode($meta), $id);
    }
}
開發者ID:truSense,項目名稱:phabricator,代碼行數:16,代碼來源:20140815.cancdncase.php

示例2: pht

<?php

echo pht('Populating Phabricator files with mail keys xactions...') . "\n";
$table = new PhabricatorFile();
$table_name = $table->getTableName();
$conn_w = $table->establishConnection('w');
$conn_w->openTransaction();
$sql = array();
foreach (new LiskRawMigrationIterator($conn_w, 'file') as $row) {
    // NOTE: MySQL requires that the INSERT specify all columns which don't
    // have default values when configured in strict mode. This query will
    // never actually insert rows, but we need to hand it values anyway.
    $sql[] = qsprintf($conn_w, '(%d, %s, 0, 0, 0, 0, 0, 0, 0, 0)', $row['id'], Filesystem::readRandomCharacters(20));
}
if ($sql) {
    foreach (PhabricatorLiskDAO::chunkSQL($sql, ', ') as $chunk) {
        queryfx($conn_w, 'INSERT INTO %T
        (id, mailKey, phid, byteSize, storageEngine, storageFormat,
          storageHandle, dateCreated, dateModified, metadata) VALUES %Q ' . 'ON DUPLICATE KEY UPDATE mailKey = VALUES(mailKey)', $table_name, $chunk);
    }
}
$table->saveTransaction();
echo pht('Done.') . "\n";
開發者ID:barcelonascience,項目名稱:phabricator,代碼行數:23,代碼來源:20130820.file-mailkey-populate.php

示例3: loadPage

 protected function loadPage()
 {
     $table = new PhabricatorFile();
     $conn_r = $table->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT f.* FROM %T f %Q %Q %Q %Q', $table->getTableName(), $this->buildJoinClause($conn_r), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     $files = $table->loadAllFromArray($data);
     if (!$files) {
         return $files;
     }
     // We need to load attached objects to perform policy checks for files.
     // First, load the edges.
     $edge_type = PhabricatorEdgeConfig::TYPE_FILE_HAS_OBJECT;
     $file_phids = mpull($files, 'getPHID');
     $edges = id(new PhabricatorEdgeQuery())->withSourcePHIDs($file_phids)->withEdgeTypes(array($edge_type))->execute();
     $object_phids = array();
     foreach ($files as $file) {
         $phids = array_keys($edges[$file->getPHID()][$edge_type]);
         $file->attachObjectPHIDs($phids);
         foreach ($phids as $phid) {
             $object_phids[$phid] = true;
         }
     }
     // If this file is a transform of another file, load that file too. If you
     // can see the original file, you can see the thumbnail.
     // TODO: It might be nice to put this directly on PhabricatorFile and remove
     // the PhabricatorTransformedFile table, which would be a little simpler.
     $xforms = id(new PhabricatorTransformedFile())->loadAllWhere('transformedPHID IN (%Ls)', $file_phids);
     $xform_phids = mpull($xforms, 'getOriginalPHID', 'getTransformedPHID');
     foreach ($xform_phids as $derived_phid => $original_phid) {
         $object_phids[$original_phid] = true;
     }
     $object_phids = array_keys($object_phids);
     // Now, load the objects.
     $objects = array();
     if ($object_phids) {
         // NOTE: We're explicitly turning policy exceptions off, since the rule
         // here is "you can see the file if you can see ANY associated object".
         // Without this explicit flag, we'll incorrectly throw unless you can
         // see ALL associated objects.
         $objects = id(new PhabricatorObjectQuery())->setParentQuery($this)->setViewer($this->getViewer())->withPHIDs($object_phids)->setRaisePolicyExceptions(false)->execute();
         $objects = mpull($objects, null, 'getPHID');
     }
     foreach ($files as $file) {
         $file_objects = array_select_keys($objects, $file->getObjectPHIDs());
         $file->attachObjects($file_objects);
     }
     foreach ($files as $key => $file) {
         $original_phid = idx($xform_phids, $file->getPHID());
         if ($original_phid == PhabricatorPHIDConstants::PHID_VOID) {
             // This is a special case for builtin files, which are handled
             // oddly.
             $original = null;
         } else {
             if ($original_phid) {
                 $original = idx($objects, $original_phid);
                 if (!$original) {
                     // If the viewer can't see the original file, also prevent them from
                     // seeing the transformed file.
                     $this->didRejectResult($file);
                     unset($files[$key]);
                     continue;
                 }
             } else {
                 $original = null;
             }
         }
         $file->attachOriginalFile($original);
     }
     return $files;
 }
開發者ID:denghp,項目名稱:phabricator,代碼行數:70,代碼來源:PhabricatorFileQuery.php


注:本文中的PhabricatorFile::getTableName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。