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


PHP LocalFile::getExtension方法代码示例

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


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

示例1: execute

 /**
  * Run the transaction
  * @return FileRepoStatus
  */
 function execute()
 {
     wfProfileIn(__METHOD__);
     $this->file->lock();
     // Leave private files alone
     $privateFiles = array();
     list($oldRels, ) = $this->getOldRels();
     $dbw = $this->file->repo->getMasterDB();
     if (!empty($oldRels)) {
         $res = $dbw->select('oldimage', array('oi_archive_name'), array('oi_name' => $this->file->getName(), 'oi_archive_name' => array_keys($oldRels), $dbw->bitAnd('oi_deleted', File::DELETED_FILE) => File::DELETED_FILE), __METHOD__);
         foreach ($res as $row) {
             $privateFiles[$row->oi_archive_name] = 1;
         }
     }
     // Prepare deletion batch
     $hashes = $this->getHashes();
     $this->deletionBatch = array();
     $ext = $this->file->getExtension();
     $dotExt = $ext === '' ? '' : ".{$ext}";
     foreach ($this->srcRels as $name => $srcRel) {
         // Skip files that have no hash (missing source).
         // Keep private files where they are.
         if (isset($hashes[$name]) && !array_key_exists($name, $privateFiles)) {
             $hash = $hashes[$name];
             $key = $hash . $dotExt;
             $dstRel = $this->file->repo->getDeletedHashPath($key) . $key;
             $this->deletionBatch[$name] = array($srcRel, $dstRel);
         }
     }
     // Lock the filearchive rows so that the files don't get deleted by a cleanup operation
     // We acquire this lock by running the inserts now, before the file operations.
     //
     // This potentially has poor lock contention characteristics -- an alternative
     // scheme would be to insert stub filearchive entries with no fa_name and commit
     // them in a separate transaction, then run the file ops, then update the fa_name fields.
     $this->doDBInserts();
     // Removes non-existent file from the batch, so we don't get errors.
     $this->deletionBatch = $this->removeNonexistentFiles($this->deletionBatch);
     // Execute the file deletion batch
     $status = $this->file->repo->deleteBatch($this->deletionBatch);
     if (!$status->isGood()) {
         $this->status->merge($status);
     }
     if (!$this->status->isOK()) {
         // Critical file deletion error
         // Roll back inserts, release lock and abort
         // TODO: delete the defunct filearchive rows if we are using a non-transactional DB
         $this->file->unlockAndRollback();
         wfProfileOut(__METHOD__);
         return $this->status;
     }
     // Delete image/oldimage rows
     $this->doDBDeletes();
     // Commit and return
     $this->file->unlock();
     wfProfileOut(__METHOD__);
     return $this->status;
 }
开发者ID:spring,项目名称:spring-website,代码行数:62,代码来源:LocalFile.php

示例2: getDeletedPath

 protected function getDeletedPath(LocalRepo $repo, LocalFile $file)
 {
     $hash = $repo->getFileSha1($file->getPath());
     $key = "{$hash}.{$file->getExtension()}";
     return $repo->getDeletedHashPath($key) . $key;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:6,代码来源:purgeChangedFiles.php

示例3: testGetExtension

 public function testGetExtension()
 {
     $this->assertEquals('ext', $this->fixture_file->getExtension());
     $otherFile = new LocalFile(TESTS_FSI_LOCALFILE_TMP_PATH . '/my.File.2.EXT');
     $this->assertEquals('EXT', $otherFile->getExtension());
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:6,代码来源:LocalFileTest.php

示例4: execute

 /**
  * Run the transaction
  * @return FileRepoStatus
  */
 public function execute()
 {
     $repo = $this->file->getRepo();
     $this->file->lock();
     // Prepare deletion batch
     $hashes = $this->getHashes();
     $this->deletionBatch = array();
     $ext = $this->file->getExtension();
     $dotExt = $ext === '' ? '' : ".{$ext}";
     foreach ($this->srcRels as $name => $srcRel) {
         // Skip files that have no hash (e.g. missing DB record, or sha1 field and file source)
         if (isset($hashes[$name])) {
             $hash = $hashes[$name];
             $key = $hash . $dotExt;
             $dstRel = $repo->getDeletedHashPath($key) . $key;
             $this->deletionBatch[$name] = array($srcRel, $dstRel);
         }
     }
     // Lock the filearchive rows so that the files don't get deleted by a cleanup operation
     // We acquire this lock by running the inserts now, before the file operations.
     // This potentially has poor lock contention characteristics -- an alternative
     // scheme would be to insert stub filearchive entries with no fa_name and commit
     // them in a separate transaction, then run the file ops, then update the fa_name fields.
     $this->doDBInserts();
     if (!$repo->hasSha1Storage()) {
         // Removes non-existent file from the batch, so we don't get errors.
         // This also handles files in the 'deleted' zone deleted via revision deletion.
         $checkStatus = $this->removeNonexistentFiles($this->deletionBatch);
         if (!$checkStatus->isGood()) {
             $this->status->merge($checkStatus);
             return $this->status;
         }
         $this->deletionBatch = $checkStatus->value;
         // Execute the file deletion batch
         $status = $this->file->repo->deleteBatch($this->deletionBatch);
         if (!$status->isGood()) {
             $this->status->merge($status);
         }
     }
     if (!$this->status->isOK()) {
         // Critical file deletion error
         // Roll back inserts, release lock and abort
         // TODO: delete the defunct filearchive rows if we are using a non-transactional DB
         $this->file->unlockAndRollback();
         return $this->status;
     }
     // Delete image/oldimage rows
     $this->doDBDeletes();
     // Commit and return
     $this->file->unlock();
     return $this->status;
 }
开发者ID:paladox,项目名称:2,代码行数:56,代码来源:LocalFile.php

示例5: execute

 /**
  * Run the transaction
  * @return Status
  */
 public function execute()
 {
     $repo = $this->file->getRepo();
     $this->file->lock();
     // Prepare deletion batch
     $hashes = $this->getHashes();
     $this->deletionBatch = [];
     $ext = $this->file->getExtension();
     $dotExt = $ext === '' ? '' : ".{$ext}";
     foreach ($this->srcRels as $name => $srcRel) {
         // Skip files that have no hash (e.g. missing DB record, or sha1 field and file source)
         if (isset($hashes[$name])) {
             $hash = $hashes[$name];
             $key = $hash . $dotExt;
             $dstRel = $repo->getDeletedHashPath($key) . $key;
             $this->deletionBatch[$name] = [$srcRel, $dstRel];
         }
     }
     if (!$repo->hasSha1Storage()) {
         // Removes non-existent file from the batch, so we don't get errors.
         // This also handles files in the 'deleted' zone deleted via revision deletion.
         $checkStatus = $this->removeNonexistentFiles($this->deletionBatch);
         if (!$checkStatus->isGood()) {
             $this->status->merge($checkStatus);
             return $this->status;
         }
         $this->deletionBatch = $checkStatus->value;
         // Execute the file deletion batch
         $status = $this->file->repo->deleteBatch($this->deletionBatch);
         if (!$status->isGood()) {
             $this->status->merge($status);
         }
     }
     if (!$this->status->isOK()) {
         // Critical file deletion error; abort
         $this->file->unlock();
         return $this->status;
     }
     // Copy the image/oldimage rows to filearchive
     $this->doDBInserts();
     // Delete image/oldimage rows
     $this->doDBDeletes();
     // Commit and return
     $this->file->unlock();
     return $this->status;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:50,代码来源:LocalFile.php


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