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


PHP FileManager::copyRecursive方法代码示例

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


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

示例1: setUp

 /**
  * PHPUnit default function.
  * Redefine this method only if you really need to do so.
  * In any other cases redefine the getRequest() one
  *
  * @return void
  * @access protected
  * @see    ____func_see____
  * @since  1.0.0
  */
 protected function setUp()
 {
     parent::setUp();
     \Includes\Utils\FileManager::copyRecursive(dirname(__FILE__) . LC_DS . 'SubstutionalSkin' . LC_DS . 'scripts' . LC_DS . 'CDev', LC_DIR_MODULES . 'CDev');
     \Includes\Utils\FileManager::copyRecursive(dirname(__FILE__) . LC_DS . 'SubstutionalSkin' . LC_DS . 'scripts' . LC_DS . 'CDev', LC_DIR_CACHE_CLASSES . 'XLite' . LC_DS . 'Module' . LC_DS . 'CDev');
     \Includes\Utils\FileManager::copyRecursive(dirname(__FILE__) . LC_DS . 'SubstutionalSkin' . LC_DS . 'skins', LC_DIR_SKINS);
     $skin = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->findOneBy(array('name' => 'TestSkin', 'author' => 'CDev'));
     if (!$skin) {
         $skin = new \XLite\Model\Module();
         $skin->setAuthor('CDev');
         $skin->setName('TestSkin');
         $skin->setMajorVersion('1.0');
         $skin->setMinorVersion('0');
         $skin->setModuleName('TestSkin');
         $skin->setAuthorName('CDev');
         \XLite\Core\Database::getEM()->persist($skin);
     }
     $skin->setInstalled(true);
     $skin->setEnabled(true);
     \XLite\Core\Database::getEM()->flush();
     \XLite\Core\Database::getCacheDriver()->deleteAll();
     \Includes\Utils\FileManager::unlinkRecursive(LC_DIR_COMPILE . 'skins');
 }
开发者ID:kingsj,项目名称:core,代码行数:33,代码来源:SubstutionalSkin.php

示例2: doRestoreDb

 /**
  * Restore database from common backup
  *
  * @return void
  * @access protected
  * @see    ____func_see____
  * @since  1.0.0
  */
 protected function doRestoreDb($path = null, $drop = true, $doNotAssert = false)
 {
     $message = '';
     $result = xlite_restore_sql_from_backup($path, false, $drop, $message);
     if (!$doNotAssert) {
         $this->assertTrue($result, $message);
     }
     \Includes\Utils\FileManager::copyRecursive(LC_DIR . '/.dev/tests/images', LC_DIR_IMAGES);
 }
开发者ID:kingsj,项目名称:core,代码行数:17,代码来源:TestCase.php

示例3: suite


//.........这里部分代码省略.........
             unset($includes[$k]);
         }
         foreach ($includes as $k => $v) {
             if ('-' == substr($v, 0, 1)) {
                 $excludes[] = substr($v, 1);
                 unset($includes[$k]);
             }
         }
         foreach ($includes as $k => $v) {
             $tmp = explode(':', $v, 2);
             $includes[$k] = $tmp[0];
             if (isset($tmp[1])) {
                 $includeTests[$tmp[0]] = $tmp[1];
             }
         }
     }
     if (isset($deploy) && !defined('DEPLOYMENT_TEST')) {
         define('DEPLOYMENT_TEST', true);
     }
     // Include abstract classes
     $classesDir = dirname(__FILE__);
     $pattern = '/^' . preg_quote($classesDir, '/') . '.*' . $ds . '(?:\\w*Abstract|A[A-Z][a-z]\\w*)\\.php$/Ss';
     $dirIterator = new RecursiveDirectoryIterator($classesDir . LC_DS);
     $iterator = new RecursiveIteratorIterator($dirIterator, RecursiveIteratorIterator::CHILD_FIRST);
     foreach ($iterator as $filePath => $fileObject) {
         if (preg_match($pattern, $filePath, $matches)) {
             require_once $filePath;
         }
     }
     // Include fake classes
     if (!defined('DEPLOYMENT_TEST')) {
         $classesDir = dirname(__FILE__) . LC_DS . 'FakeClass' . LC_DS;
         $pattern = '/^' . preg_quote($classesDir, '/') . '.+\\.php$/Ss';
         $dirIterator = new RecursiveDirectoryIterator($classesDir . LC_DS);
         $iterator = new RecursiveIteratorIterator($dirIterator, RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($iterator as $filePath => $fileObject) {
             if (preg_match($pattern, $filePath, $matches)) {
                 require_once $filePath;
             }
         }
     }
     if (!isset($deploy) || !$deploy) {
         \Includes\Utils\FileManager::unlinkRecursive(__DIR__ . '/images');
         \Includes\Utils\FileManager::mkdirRecursive(__DIR__ . '/images');
         \Includes\Utils\FileManager::copyRecursive(LC_DIR_IMAGES, __DIR__ . '/images/');
         //xlite_make_sql_backup();
     }
     // Classes tests
     if (!defined('UNITS_DISABLED')) {
         $classesDir = dirname(__FILE__) . LC_DS . 'Classes' . LC_DS;
         $pattern = '/^' . preg_quote($classesDir, '/') . '(.*)\\.php$/';
         $dirIterator = new RecursiveDirectoryIterator($classesDir);
         $iterator = new RecursiveIteratorIterator($dirIterator, RecursiveIteratorIterator::CHILD_FIRST);
         $siterator = new XLite_Tests_SortedIterator($iterator);
         foreach ($siterator as $filePath) {
             if (preg_match($pattern, $filePath, $matches) && !empty($matches[1]) && !preg_match('/' . $ds . '(\\w+Abstract|A[A-Z]\\w+)\\.php$/Ss', $filePath) && !preg_match('/' . $ds . '(?:scripts|skins)' . $ds . '/Ss', $filePath)) {
                 $matched = str_replace(LC_DS, '/', $matches[1]);
                 if ((!$includes || static::isPatternInArray($matched, $includes)) && (!$excludes || !static::isPatternInArray($matched, $excludes))) {
                     $class = XLite_Tests_TestCase::CLASS_PREFIX . str_replace('/', '_', $matched);
                     require_once $filePath;
                     $suite->addTest(new PHPUnit_Framework_TestSuite(new ReflectionClass($class)));
                     // Limit test range by a specific test if it was specified in call. Example: ./phpunit-report.sh Model/Zone:create
                     if (isset($includeTests[$matched])) {
                         eval($class . '::$testsRange = array($includeTests[$matched]);');
                     }
                 }
             }
         }
     }
     // Web tests
     if (!defined('SELENIUM_DISABLED')) {
         if (!defined('DIR_TESTS')) {
             define('DIR_TESTS', 'Web');
         }
         $classesDir = dirname(__FILE__) . LC_DS . constant('DIR_TESTS') . LC_DS;
         $pattern = '/^' . preg_quote($classesDir, '/') . '(.*)\\.php$/';
         $dirIterator = new RecursiveDirectoryIterator($classesDir);
         $iterator = new RecursiveIteratorIterator($dirIterator, RecursiveIteratorIterator::CHILD_FIRST);
         $siterator = new XLite_Tests_SortedIterator($iterator);
         foreach ($siterator as $filePath) {
             if (preg_match($pattern, $filePath, $matches) && !empty($matches[1]) && !preg_match('/' . $ds . '(\\w+Abstract|A[A-Z]\\w+)\\.php/Ss', $filePath) && !preg_match('/' . $ds . '(?:scripts|skins)' . $ds . '/Ss', $filePath)) {
                 $matched = str_replace(LC_DS, '/', $matches[1]);
                 if ((!$includes || static::isPatternInArray($matched, $includes)) && (!$excludes || !static::isPatternInArray($matched, $excludes))) {
                     $classPrefix = !isset($deploy) ? XLite_Tests_SeleniumTestCase::CLASS_PREFIX : 'XLite_Deploy_' . $deploy . '_';
                     $class = $classPrefix . str_replace('/', '_', $matched);
                     require_once $filePath;
                     $seleniumSuite = new PHPUnit_Framework_TestSuite();
                     $seleniumSuite->addTestSuite($class);
                     $suite->addTest($seleniumSuite);
                     // Limit test range by a specific test if it was specified in call. Example: ./phpunit-report.sh Model/Zone:create
                     if (isset($includeTests[$matched])) {
                         eval($class . '::$testsRange = array($includeTests[$matched]);');
                     }
                 }
             }
         }
     }
     error_reporting(E_ALL);
     return $suite;
 }
开发者ID:kingsj,项目名称:core,代码行数:101,代码来源:AllTests_no_restore.php

示例4: xlite_make_sql_backup

function xlite_make_sql_backup($path = null)
{
    // DB backup
    echo PHP_EOL . 'DB backup ... ';
    \Includes\Utils\FileManager::unlinkRecursive(__DIR__ . '/images');
    \Includes\Utils\FileManager::mkdirRecursive(__DIR__ . '/images');
    \Includes\Utils\FileManager::mkdirRecursive(__DIR__ . '/images/product');
    \Includes\Utils\FileManager::mkdirRecursive(__DIR__ . '/images/category');
    \Includes\Utils\FileManager::copyRecursive(LC_DIR_IMAGES, __DIR__ . '/images');
    $result = true;
    if (!isset($path)) {
        $path = dirname(__FILE__) . LC_DS . 'dump.sql';
    }
    if (file_exists(dirname($path))) {
        if (file_exists($path)) {
            unlink($path);
        }
        $config = \XLite::getInstance()->getOptions('database_details');
        $cmd = defined('TEST_MYSQLDUMP_BIN') ? TEST_MYSQLDUMP_BIN : 'mysqldump';
        $cmd .= ' --opt -h' . $config['hostspec'];
        if ($config['port']) {
            $cmd .= ' -P' . $config['port'];
        }
        $cmd .= ' -u' . $config['username'] . ('' == $config['password'] ? '' : ' -p' . $config['password']);
        if ($config['socket']) {
            $cmd .= ' -S' . $config['socket'];
        }
        $cmd .= ' ' . $config['database'];
        exec('echo "SET autocommit=0;
        SET unique_checks=0;
        SET foreign_key_checks=0;" > ' . $path . '
        ' . $cmd . ' >> ' . $path . '
        echo "COMMIT;" >> ' . $path);
        echo 'done' . PHP_EOL;
        sleep(1);
    } else {
        $result = false;
    }
    if (!$result) {
        echo 'ignored' . PHP_EOL;
    }
    return $result;
}
开发者ID:kingsj,项目名称:core,代码行数:43,代码来源:phpunit-parallel.php


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