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


PHP LocalFile::getArchiveVirtualUrl方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $this->params = $this->extractRequestParams();
     // Extract the file and archiveName from the request parameters
     $this->validateParameters();
     // Check whether we're allowed to revert this file
     $this->checkPermissions($this->getUser());
     $sourceUrl = $this->file->getArchiveVirtualUrl($this->archiveName);
     $status = $this->file->upload($sourceUrl, $this->params['comment'], $this->params['comment'], 0, false, false, $this->getUser());
     if ($status->isGood()) {
         $result = array('result' => 'Success');
     } else {
         $result = array('result' => 'Failure', 'errors' => $this->getResult()->convertStatusToArray($status));
     }
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:16,代码来源:ApiFileRevert.php

示例2: getHashes

 /**
  * @return array
  */
 protected function getHashes()
 {
     $hashes = array();
     list($oldRels, $deleteCurrent) = $this->getOldRels();
     if ($deleteCurrent) {
         $hashes['.'] = $this->file->getSha1();
     }
     if (count($oldRels)) {
         $dbw = $this->file->repo->getMasterDB();
         $res = $dbw->select('oldimage', array('oi_archive_name', 'oi_sha1'), array('oi_archive_name' => array_keys($oldRels)), __METHOD__);
         foreach ($res as $row) {
             if (rtrim($row->oi_sha1, "") === '') {
                 // Get the hash from the file
                 $oldUrl = $this->file->getArchiveVirtualUrl($row->oi_archive_name);
                 $props = $this->file->repo->getFileProps($oldUrl);
                 if ($props['fileExists']) {
                     // Upgrade the oldimage row
                     $dbw->update('oldimage', array('oi_sha1' => $props['sha1']), array('oi_name' => $this->file->getName(), 'oi_archive_name' => $row->oi_archive_name), __METHOD__);
                     $hashes[$row->oi_archive_name] = $props['sha1'];
                 } else {
                     $hashes[$row->oi_archive_name] = false;
                 }
             } else {
                 $hashes[$row->oi_archive_name] = $row->oi_sha1;
             }
         }
     }
     $missing = array_diff_key($this->srcRels, $hashes);
     foreach ($missing as $name => $rel) {
         $this->status->error('filedelete-old-unregistered', $name);
     }
     foreach ($hashes as $name => $hash) {
         if (!$hash) {
             $this->status->error('filedelete-missing', $this->srcRels[$name]);
             unset($hashes[$name]);
         }
     }
     return $hashes;
 }
开发者ID:spring,项目名称:spring-website,代码行数:42,代码来源:LocalFile.php


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