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


PHP RecursiveIteratorIterator::getSubPathName方法代码示例

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


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

示例1: copy

 /**
  * Copies a file or directory.
  * @return void
  * @throws Nette\IOException
  */
 public static function copy($source, $dest, $overwrite = TRUE)
 {
     if (stream_is_local($source) && !file_exists($source)) {
         throw new Nette\IOException("File or directory '{$source}' not found.");
     } elseif (!$overwrite && file_exists($dest)) {
         throw new Nette\InvalidStateException("File or directory '{$dest}' already exists.");
     } elseif (is_dir($source)) {
         static::createDir($dest);
         foreach (new \FilesystemIterator($dest) as $item) {
             static::delete($item);
         }
         foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
             if ($item->isDir()) {
                 static::createDir($dest . '/' . $iterator->getSubPathName());
             } else {
                 static::copy($item, $dest . '/' . $iterator->getSubPathName());
             }
         }
     } else {
         static::createDir(dirname($dest));
         if (@stream_copy_to_stream(fopen($source, 'r'), fopen($dest, 'w')) === FALSE) {
             // @ is escalated to exception
             throw new Nette\IOException("Unable to copy file '{$source}' to '{$dest}'.");
         }
     }
 }
开发者ID:Richmond77,项目名称:learning-nette,代码行数:31,代码来源:FileSystem.php

示例2: copyFile

function copyFile($source, $dest)
{
    $is_dot = array('.', '..');
    if (is_dir($source)) {
        if (version_compare((double) phpversion(), (double) '5.3', '<')) {
            $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
        } else {
            $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
        }
        foreach ($iterator as $file) {
            if (version_compare((double) phpversion(), (double) '5.2.17', '<=')) {
                if (in_array($file->getBasename(), $is_dot)) {
                    continue;
                }
            } elseif (version_compare((double) phpversion(), (double) '5.3', '<')) {
                if ($file->isDot()) {
                    continue;
                }
            }
            if ($file->isDir()) {
                mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName(), true);
            } else {
                copy($file, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
            }
        }
        unset($iterator, $file);
    } else {
        copy($source, $dest);
    }
    return true;
}
开发者ID:johnulist,项目名称:autoindex,代码行数:31,代码来源:index.php

示例3: is_extension_changed

 private static function is_extension_changed($name)
 {
     $name = strtolower($name);
     $extension_build_dir = ROOT_PATH . DS . 'build' . DS . $name;
     $extension_path = ROOT_PATH . DS . 'extensions' . DS . $name . '.tar.gz';
     if (file_exists($extension_build_dir) && file_exists($extension_path)) {
         $dir_iterator = new \RecursiveDirectoryIterator($extension_build_dir);
         /**
          * @var $iterator \RecursiveDirectoryIterator
          */
         $iterator = new \RecursiveIteratorIterator($dir_iterator);
         $iterator->rewind();
         while ($iterator->valid()) {
             if (!$iterator->isDot()) {
                 $file = $extension_build_dir . DS . $iterator->getSubPathName();
                 $phar_file = "phar://{$extension_path}/" . $iterator->getSubPathName();
                 if (!file_exists($phar_file)) {
                     return true;
                 } else {
                     $build_file_hash = md5(file_get_contents($file));
                     $phar_file_hash = md5(file_get_contents($phar_file));
                     if ($build_file_hash != $phar_file_hash) {
                         return true;
                     }
                 }
             }
             $iterator->next();
         }
         return false;
     } else {
         return false;
     }
 }
开发者ID:one-more,项目名称:peach_framework,代码行数:33,代码来源:autoloader.php

示例4: runTest

 /**
  * Executes a specific Selenium System Tests in your machine
  *
  * @param string $seleniumPath   Optional path to selenium-standalone-server-x.jar
  * @param string $pathToTestFile Optional name of the test to be run
  * @param string $suite          Optional name of the suite containing the tests, Acceptance by default.
  *
  * @return mixed
  */
 public function runTest($pathToTestFile = null, $suite = 'acceptance')
 {
     $this->runSelenium();
     // Make sure to Run the Build Command to Generate AcceptanceTester
     $this->_exec("php vendor/bin/codecept build");
     if (!$pathToTestFile) {
         $this->say('Available tests in the system:');
         $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('tests/' . $suite, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
         $tests = array();
         $iterator->rewind();
         $i = 1;
         while ($iterator->valid()) {
             if (strripos($iterator->getSubPathName(), 'cept.php') || strripos($iterator->getSubPathName(), 'cest.php')) {
                 $this->say('[' . $i . '] ' . $iterator->getSubPathName());
                 $tests[$i] = $iterator->getSubPathName();
                 $i++;
             }
             $iterator->next();
         }
         $this->say('');
         $testNumber = $this->ask('Type the number of the test  in the list that you want to run...');
         $test = $tests[$testNumber];
     }
     $pathToTestFile = 'tests/' . $suite . '/' . $test;
     $this->taskCodecept()->test($pathToTestFile)->arg('--steps')->arg('--debug')->run()->stopOnFail();
     // Kill selenium server
     // $this->_exec('curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer');
 }
开发者ID:remotehelp,项目名称:weblinks,代码行数:37,代码来源:RoboFile.php

示例5: copy

 public function copy($target)
 {
     $result = false;
     $encoded = $this->encodePath($target);
     $dir = dirname($encoded);
     if (!is_dir($encoded)) {
         $result = mkdir($encoded, 0755, true);
     }
     if (is_dir($encoded)) {
         $result = true;
         // needed for empty directories
         $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_encoded), \RecursiveIteratorIterator::SELF_FIRST);
         foreach ($iterator as $f) {
             if ($f->isDir()) {
                 $path = $encoded . '/' . $iterator->getSubPathName();
                 if (!is_dir($path)) {
                     $result = mkdir($path);
                 }
             } else {
                 $result = copy($f, $encoded . '/' . $iterator->getSubPathName());
             }
             if ($result === false) {
                 break;
             }
         }
     }
     if ($result) {
         $this->setPath($target);
     }
     return $result;
 }
开发者ID:janssit,项目名称:nickys.janss.be,代码行数:31,代码来源:folder.php

示例6: copyOldVersion

function copyOldVersion()
{
    if (!is_dir(PATH)) {
        echo 'Creating new oldVersion dir...<br>';
        mkdir(PATH);
    }
    $source = "../";
    $dest = PATH;
    // Set a stream context timeout for file reading
    $context = stream_context_create(array('http' => array('timeout' => 60)));
    echo 'Moving current ICEcoder files...<br>';
    foreach ($iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST) as $item) {
        if (strpos($source . DIRECTORY_SEPARATOR . $iterator->getSubPathName(), "oldVersion") == false) {
            // Don't move backups, plugins or .git away
            $testPath = $source . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
            $testPath = str_replace("\\", "/", $testPath);
            if (strpos($testPath, "/backups/") == false && strpos($testPath, "/plugins/") == false && strpos($testPath, "/.git/") == false) {
                if ($item->isDir()) {
                    mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName(), 0755);
                } else {
                    rename($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
                }
            }
        }
    }
    $icv_url = "https://icecoder.net/latest-version.txt";
    echo 'Detecting current version of ICEcoder...<br>';
    $icvInfo = getData($icv_url, 'curl', 'Sorry, couldn\'t figure out latest version.');
    echo 'Latest version of ICEcoder is ' . $icvInfo . '<br>';
    openZipNew($icvInfo);
}
开发者ID:JpaKaagman,项目名称:ICEcoder,代码行数:31,代码来源:updater.php

示例7: execute

 /**
  * {@inheritdoc}
  *
  * @see \Symfony\Component\Console\Command\Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $assets = $this->getContainer()->getParameter('asf_layout.assets');
     $this->tinymce_config = $assets['tinymce'];
     $dest_dir = $input->getArgument('target_dir') ? $input->getArgument('target_dir') : null;
     if (is_null($dest_dir) && isset($this->tinymce_config['customize']['dest_dir'])) {
         $dest_dir = $this->tinymce_config['customize']['dest_dir'];
     }
     $exclude_files = $input->getOption('exclude_files') ? $input->getOption('exclude_files') : $this->tinymce_config['customize']['exclude_files'];
     $src_dir = sprintf('%s', $this->tinymce_config['tinymce_dir']);
     $fs = new Filesystem();
     try {
         if (!$fs->exists($dest_dir)) {
             $fs->mkdir($dest_dir);
         }
     } catch (IOException $e) {
         $output->writeln(sprintf('<error>Could not create directory %s.</error>', $dest_dir));
         return;
     }
     if (false === file_exists($src_dir)) {
         $output->writeln(sprintf('<error>Source directory "%s" does not exist. Did you install TinyMCE ? ' . 'Don\'t forget to specify the path to TinyMCE folder in ' . '"asf_layout.assets.tinymce.tinymce_dir".</error>', $src_dir));
         return;
     }
     foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($src_dir, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
         if ($item->isDir() && !in_array($item->getBasename(), $exclude_files)) {
             $fs->mkdir($dest_dir . '/' . $iterator->getSubPathName());
         } elseif (!in_array($item->getBasename(), $exclude_files)) {
             $fs->copy($item, $dest_dir . '/' . $iterator->getSubPathName());
         }
     }
     $output->writeln(sprintf('[OK] TinyMCE files was successfully copied in "%s".', $dest_dir));
 }
开发者ID:artscorestudio,项目名称:layout-bundle,代码行数:37,代码来源:CopyTinyMCEFilesCommand.php

示例8: foreach

 function copy_r($source, $dest)
 {
     @mkdir($dest, 0755, TRUE);
     foreach ($iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST) as $item) {
         if ($item->isDir()) {
             @mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
         } else {
             @copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
         }
     }
 }
开发者ID:mehulsbhatt,项目名称:MDIgniter,代码行数:11,代码来源:file.php

示例9: moveDirectory

function moveDirectory($source, $dest)
{
    foreach ($iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST) as $item) {
        if ($item->isDir()) {
            mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
        } else {
            rename($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
        }
        echo 'Move: ' . $iterator->getSubPathName() . PHP_EOL;
    }
}
开发者ID:gotcms,项目名称:gotcms,代码行数:11,代码来源:2014-03.php

示例10: recursiveCopy

 /**
  * Recursive Copy
  *
  * @param string $src
  * @param string $dst
  */
 private static function recursiveCopy($src, $dst)
 {
     mkdir($dst, 0755);
     $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
     foreach ($iterator as $file) {
         if ($file->isDir()) {
             mkdir($dst . '/' . $iterator->getSubPathName());
         } else {
             copy($file, $dst . '/' . $iterator->getSubPathName());
         }
     }
 }
开发者ID:bobseven,项目名称:Belajar-REST-CodeIgniter,代码行数:18,代码来源:Installer.php

示例11: copy

 public function copy($src, $dst)
 {
     $this->createDirectory($dst);
     $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
     foreach ($iterator as $item) {
         if (!$item->isLink() && $item->isDir()) {
             mkdir($dst . '/' . $iterator->getSubPathName());
             continue;
         }
         copy($item, $dst . '/' . $iterator->getSubPathName());
     }
 }
开发者ID:phpixie,项目名称:filesystem,代码行数:12,代码来源:Actions.php

示例12: DirectoryContent

 public static function DirectoryContent($Directory, $UserLanguage)
 {
     $ReadDirectory = $Directory . str_replace('.language', '', $UserLanguage);
     $Iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($ReadDirectory));
     $FilesArray = array();
     while ($Iterator->valid()) {
         if (!$Iterator->isDot()) {
             $FilesArray[] = array('FileLink' => $Iterator->key(), 'FileName' => $Iterator->getSubPathName(), 'SmallFileName' => strtolower(str_replace('.language', '', $Iterator->getSubPathName())), 'LinesCount' => File::CountLines($Iterator->key()));
         }
         $Iterator->next();
     }
     return $FilesArray;
 }
开发者ID:Refuge89,项目名称:FreedomCore,代码行数:13,代码来源:File.FreedomCore.php

示例13: copyStub

 /**
  * Because phing needs to use files from stub directory, we need to copy them to the
  * directory, to make them readable by phing.
  * When phing finishes work, this directory will be removed.
  */
 public function copyStub()
 {
     $source = 'phar://vegaser.phar' . DIRECTORY_SEPARATOR . 'stub';
     $dest = '.' . DIRECTORY_SEPARATOR . 'stub';
     shell_exec('mkdir ' . $dest);
     foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
         if ($item->isDir()) {
             mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
         } else {
             copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
         }
     }
 }
开发者ID:maniolek,项目名称:vegaser,代码行数:18,代码来源:BuildHelperTrait.php

示例14: copyDirectory

/**
 * Copies a directory recursively.
 *
 * @param string $source The source path to copy.
 * @param string $target The target path to copy to.
 */
function copyDirectory($source, $target)
{
    /** @var $iterator \RecursiveIteratorIterator|\RecursiveDirectoryIterator */
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
    foreach ($iterator as $file) {
        /** @var $file SplFileInfo */
        if ($file->isDir()) {
            mkdir($target . '/' . $iterator->getSubPathName());
            continue;
        }
        copy($file, $target . '/' . $iterator->getSubPathName());
    }
}
开发者ID:mauricecalhoun,项目名称:phpcs-calisthenics-rules,代码行数:19,代码来源:bootstrap.php

示例15: copyFolder

 public static function copyFolder($source, $dest)
 {
     if (!is_dir($dest)) {
         @mkdir($dest);
     }
     foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
         if ($item->isDir()) {
             @mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
         } else {
             copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
         }
     }
 }
开发者ID:predever,项目名称:keosu,代码行数:13,代码来源:FilesUtil.php


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