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


PHP Filesystem::unlink方法代码示例

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


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

示例1: deleteRemovedFiles

 /**
  * Delete, from Rubedo root dir, all files that have been remove since previous package version
  *
  * @param array $removedFiles files list to be removed
  */
 protected function deleteRemovedFiles($removedFiles)
 {
     foreach ($removedFiles as $file) {
         $filePath = $this->rubedoRootDir . '/' . $file;
         if ($file != '' && file_exists($filePath) && is_file($filePath)) {
             if ($this->io->isVerbose()) {
                 $this->io->write(sprintf('removing file %s ', $filePath));
             }
             $this->fileSystem->unlink($filePath);
         }
     }
 }
开发者ID:novactive,项目名称:rubedo-core-installer,代码行数:17,代码来源:CoreInstaller.php

示例2: unInstall

 /**
  * UnInstall the extension given the list of install files
  *
  * @param array $files
  */
 public function unInstall(array $files)
 {
     foreach ($files as $file) {
         $file = $this->rootDir . $file;
         /*
         because of different reasons the file can be already gone.
         example:
         - file got deployed by multiple modules(should only happen with copy force)
         - user did things
         
         when the file is a symlink, but the target is already gone, file_exists returns false
         */
         if (file_exists($file) xor is_link($file)) {
             $this->fileSystem->unlink($file);
             $parentDir = dirname($file);
             while ($this->fileSystem->isDirEmpty($parentDir) && $parentDir !== $this->rootDir) {
                 $this->fileSystem->removeDirectory($parentDir);
                 $parentDir = dirname($parentDir);
             }
         }
     }
 }
开发者ID:Aleksandr-Kachura,项目名称:magento,代码行数:27,代码来源:UnInstallStrategy.php

示例3: unInstall

 /**
  * @param string $source
  * @param string $destination
  */
 public function unInstall($source, $destination)
 {
     $iterator = $this->getIterator($source, RecursiveIteratorIterator::CHILD_FIRST);
     foreach ($iterator as $item) {
         $destinationFile = sprintf("%s/%s", $destination, $iterator->getSubPathName());
         if ($this->exclude->exclude($iterator->getSubPathName())) {
             continue;
         }
         if (!file_exists($destinationFile)) {
             $this->gitIgnore->removeEntry($iterator->getSubPathName());
             continue;
         }
         if ($item->isDir()) {
             //check if there are not other files in this dir
             if ($this->fileSystem->isDirEmpty($destinationFile)) {
                 $this->fileSystem->removeDirectory($destinationFile);
             }
             continue;
         }
         $this->fileSystem->unlink($destinationFile);
         $this->gitIgnore->removeEntry('/' . $iterator->getSubPathName());
     }
     $this->gitIgnore->removeIgnoreDirectories();
 }
开发者ID:hhirsch,项目名称:magento-core-composer-installer,代码行数:28,代码来源:CoreInstaller.php

示例4: testUnlinkSymlinkedDirectory

 /**
  * @link https://github.com/composer/composer/issues/3157
  * @requires function symlink
  */
 public function testUnlinkSymlinkedDirectory()
 {
     $basepath = $this->workingDir;
     $symlinked = $basepath . "/linked";
     @mkdir($basepath . "/real", 0777, true);
     touch($basepath . "/real/FILE");
     $result = @symlink($basepath . "/real", $symlinked);
     if (!$result) {
         $this->markTestSkipped('Symbolic links for directories not supported on this platform');
     }
     if (!is_dir($symlinked)) {
         $this->fail('Precondition assertion failed (is_dir is false on symbolic link to directory).');
     }
     $fs = new Filesystem();
     $result = $fs->unlink($symlinked);
     $this->assertTrue($result);
     $this->assertFalse(file_exists($symlinked));
 }
开发者ID:neon64,项目名称:composer,代码行数:22,代码来源:FilesystemTest.php


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