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


PHP sfFilesystem::mirror方法代码示例

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


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

示例1: execute

 public function execute($arguments = array(), $options = array())
 {
     $projectDir = UtilPsdf::fixPath($arguments['pjpath']);
     $packagesDir = $projectDir . DIRECTORY_SEPARATOR . $arguments['pkpath'] . DIRECTORY_SEPARATOR;
     if (is_dir($projectDir)) {
         throw new sfCommandException(sprintf('The project "%s" already exists.', $projectDir));
     }
     $filesystem = new sfFilesystem();
     // Create basic workspace structure
     $skeletonDir = dirname(__FILE__) . '/../../data/generator/skeleton/psdfProject';
     $finder = sfFinder::type('any')->discard('.sf');
     $filesystem->mirror($skeletonDir, $projectDir, $finder);
     // Actualizo tokens
     $constants = array('PROJECT_NAME' => $arguments['pjname']);
     $finder = sfFinder::type('file')->name('.project');
     $filesystem->replaceTokens($finder->in($projectDir), '##', '##', $constants);
     // Create packages files (subdir por cada macro)
     $packages = $arguments['packages'];
     foreach ($packages as $pack) {
         if (!is_dir($packagesDir . $pack['macro'])) {
             $filesystem->mkdirs($packagesDir . $pack['macro']);
         }
         $file = $packagesDir . $pack['macro'] . DIRECTORY_SEPARATOR . $pack['name'] . '.xpdl';
         $filesystem->touch($file);
         file_put_contents($file, $pack['xpdl']);
     }
 }
开发者ID:psdf,项目名称:psdfCorePlugin,代码行数:27,代码来源:psdfGenerateProject.class.php

示例2: refresh_assets

function refresh_assets()
{
    $uploadDir = dirname(__FILE__) . '/../fixtures/project/web/uploads';
    sfToolkit::clearDirectory($uploadDir);
    $finder = new sfFinder();
    $filesystem = new sfFilesystem();
    $filesystem->mirror(dirname(__FILE__) . '/../fixtures/assets', $uploadDir, $finder);
}
开发者ID:sympal,项目名称:sympal,代码行数:8,代码来源:cleanup.php

示例3: copyWebAssets

 private function copyWebAssets($plugin, $dir)
 {
     $webDir = $dir . DIRECTORY_SEPARATOR . 'web';
     $filesystem = new sfFilesystem();
     if (is_dir($webDir)) {
         $finder = sfFinder::type('any');
         $this->dirctoryRecusiveDelete(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $plugin);
         $filesystem->mirror($webDir, sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $plugin, $finder);
     }
     return;
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:11,代码来源:orangehrmPublishAssetsTask.class.php

示例4: _doUpgrade

 public function _doUpgrade()
 {
     $this->logSection('sympal', 'Moving model/form/filter files from lib/*/doctrine/sfSympalPlugin to lib/*/doctrine/sfSympalCMFPlugin');
     $finder = sfFinder::type('file');
     $filesystem = new sfFilesystem($this->_dispatcher, $this->_formatter);
     foreach ($this->_dirs as $origin => $destination) {
         $this->logSection('sympal', sprintf('Mirroring %s to %s', $origin, $destination));
         $filesystem->mirror(sfConfig::get('sf_root_dir') . '/' . $origin, sfConfig::get('sf_root_dir') . '/' . $destination, $finder);
         $this->logSection('sympal', sprintf('Deleting %s', $origin));
         // remove the files first
         foreach ($finder->in(sfConfig::get('sf_root_dir') . '/' . $origin) as $file) {
             $filesystem->remove(sfConfig::get('sf_root_dir') . '/' . $origin . '/' . $file);
         }
         // remove the dirs
         $dirs = array(sfConfig::get('sf_root_dir') . '/' . $origin . '/base', sfConfig::get('sf_root_dir') . '/' . $origin);
         foreach ($dirs as $dir) {
             if (file_exists($dir)) {
                 $filesystem->remove($dir);
             }
         }
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:22,代码来源:1.0.0_ALPHA4__2.php

示例5: isValid

 /**
  * Validates the response.
  *
  * @param mixed $checkDTD Either true to validate against the response DTD or
  *                        provide the path to a *.xsd, *.rng or *.rnc schema
  *
  * @return sfTestFunctionalBase|sfTester
  *
  * @throws LogicException If the response is neither XML nor (X)HTML
  */
 public function isValid($checkDTD = false)
 {
     if (preg_match('/(x|ht)ml/i', $this->response->getContentType())) {
         $revert = libxml_use_internal_errors(true);
         $dom = new DOMDocument('1.0', $this->response->getCharset());
         $content = $this->response->getContent();
         if (true === $checkDTD) {
             $cache = sfConfig::get('sf_cache_dir') . '/sf_tester_response/w3';
             if ($cache[1] == ':') {
                 // On Windows systems the path will be like c:\symfony\cache\xml.dtd
                 // I did not manage to get DOMDocument loading a file protocol url including the drive letter
                 // file://c:\symfony\cache\xml.dtd or file://c:/symfony/cache/xml.dtd
                 // The first one simply doesnt work, the second one is treated as remote call.
                 // However the following works. Unfortunatly this means we can only access the current disk
                 // file:///symfony/cache/xml.dtd
                 // Note that all work for file_get_contents so the bug is most likely in DOMDocument.
                 $local = 'file://' . substr(str_replace(DIRECTORY_SEPARATOR, '/', $cache), 2);
             } else {
                 $local = 'file://' . $cache;
             }
             if (!file_exists($cache . '/TR/xhtml11/DTD/xhtml11.dtd')) {
                 $filesystem = new sfFilesystem();
                 $finder = sfFinder::type('any')->discard('.sf');
                 $filesystem->mirror(dirname(__FILE__) . '/w3', $cache, $finder);
                 $finder = sfFinder::type('file');
                 $filesystem->replaceTokens($finder->in($cache), '##', '##', array('LOCAL_W3' => $local));
             }
             $content = preg_replace('#(<!DOCTYPE[^>]+")http://www.w3.org(.*")#i', '\\1' . $local . '\\2', $content);
             $dom->validateOnParse = $checkDTD;
         }
         $dom->loadXML($content);
         switch (pathinfo($checkDTD, PATHINFO_EXTENSION)) {
             case 'xsd':
                 $dom->schemaValidate($checkDTD);
                 $message = sprintf('response validates per XSD schema "%s"', basename($checkDTD));
                 break;
             case 'rng':
             case 'rnc':
                 $dom->relaxNGValidate($checkDTD);
                 $message = sprintf('response validates per relaxNG schema "%s"', basename($checkDTD));
                 break;
             default:
                 $message = $dom->validateOnParse ? sprintf('response validates as "%s"', $dom->doctype->name) : 'response is well-formed "xml"';
         }
         if (count($errors = libxml_get_errors())) {
             foreach ($errors as $error) {
                 $message .= sprintf("\n * (line:%d) %s", $error->line, $error->message);
             }
             $this->tester->fail($message);
         } else {
             $this->tester->pass($message);
         }
         libxml_use_internal_errors($revert);
     } else {
         throw new LogicException(sprintf('Unable to validate responses of content type "%s"', $this->response->getContentType()));
     }
     return $this->getObjectToReturn();
 }
开发者ID:ru-easyfinance,项目名称:Symfony,代码行数:68,代码来源:sfTesterResponse.class.php

示例6: executeCollectAnonymousVisite

 public function executeCollectAnonymousVisite(sfWebRequest $request)
 {
     $this->forward404unless($request->getParameter('visiteur_id') && $request->getParameter('visite_id'));
     $visiteur_id = $request->getParameter('visiteur_id');
     $visite_id = $request->getParameter('visite_id');
     $request->setRequestFormat('html');
     $serializer = $this->getSerializer();
     // check visiteur
     $visiteur = Doctrine_Query::create()->from('Visiteur')->where('guid = ?', $visiteur_id)->andWhereIn('is_anonyme', array(0, null))->limit(1)->execute();
     if (!$visiteur) {
         $this->getResponse()->setStatusCode(406);
         $result = array(array('message' => sprintf('visiteur %s not exist', $visiteur_id), 'code' => 'E_VISITEUR_00'));
         $this->output = $serializer->serialize($result, 'error');
         return sfView::SUCCESS;
     }
     // check visite
     $visite = Doctrine_Core::getTable('Visite')->findOneByGuid($visite_id);
     if (!$visite) {
         $this->getResponse()->setStatusCode(406);
         $result = array(array('message' => sprintf('visite %s not exist', $visite_id), 'code' => 'E_VISITE_00'));
         $this->output = $serializer->serialize($result, 'error');
         return sfView::SUCCESS;
     } else {
         $details = array();
         // get anonymous_visiteur
         $anonymous_visiteur_id = $visite->getVisiteurId();
         //$anonymous_visiteur_id->deleteActionFromCreateVisiteur();
         // already change
         if ($anonymous_visiteur_id == $visiteur_id) {
             $this->getResponse()->setStatusCode(406);
             $result = array(array('message' => 'visite already changed'));
             $this->output = $serializer->serialize($result, 'error');
             return sfView::SUCCESS;
         }
         // update Visite
         $visite->setVisiteurId($visiteur_id);
         $visite->save();
         // update LogVisite
         $log_visites = Doctrine_Core::getTable('LogVisite')->findByVisiteurId($anonymous_visiteur_id);
         $details['logVisite'] = count($log_visites);
         foreach ($log_visites as $log_visite) {
             $log_visite->setVisiteurId($visiteur_id);
             $log_visite->setVisiteId($visite_id);
             $log_visite->save();
         }
         // visiteur medaille
         $visiteur_medailles = Doctrine_Core::getTable('VisiteurMedaille')->findByVisiteurId($anonymous_visiteur_id);
         $details['VisiteurMedaille'] = count($visiteur_medailles);
         foreach ($visiteur_medailles as $visiteur_medaille) {
             $visiteur_medaille->setVisiteurId($visiteur_id);
             $visiteur_medaille->save();
         }
         // visiteur medaille
         $visiteur_univers = Doctrine_Core::getTable('VisiteurUniversStatusGain')->findByVisiteurId($anonymous_visiteur_id);
         $details['VisiteurUniversStatusGain'] = count($visiteur_univers);
         foreach ($visiteur_univers as $visiteur_univer) {
             $visiteur_univer->setVisiteurId($visiteur_id);
             $visiteur_univer->save();
         }
         // udate Xp
         $xps = Doctrine_Core::getTable('Xp')->findByVisiteurId($anonymous_visiteur_id);
         $details['Xp'] = count($xps);
         foreach ($xps as $xp) {
             $xp->setVisiteurId($visiteur_id);
             $xp->save();
         }
         // update Notification
         $notifications = Doctrine_Core::getTable('Notification')->findByVisiteurId($anonymous_visiteur_id);
         $details['Notification'] = count($notifications);
         foreach ($notifications as $notification) {
             $notification->setVisiteurId($visiteur_id);
             $notification->save();
         }
         $fileSystem = new sfFilesystem();
         $finder = new sfFinder();
         $path = sfConfig::get('sf_web_dir') . "/visiteur/" . $anonymous_visiteur_id;
         @$fileSystem->mirror(sfConfig::get('sf_web_dir') . "/visiteur/" . $anonymous_visiteur_id, sfConfig::get('sf_web_dir') . "/visiteur/" . $visiteur_id, $finder, array('override' => true));
         $result = array(array_merge(array('message' => 'ok'), array('details' => $details)));
         $this->output = $serializer->serialize($result, 'result');
         return sfView::SUCCESS;
     }
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:82,代码来源:actions.class.php

示例7: sympal_cleanup

<?php

function sympal_cleanup()
{
    sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/cache');
    sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/log');
    @unlink(dirname(__FILE__) . '/../fixtures/project/data/test.sqlite');
}
copy(dirname(__FILE__) . '/../fixtures/project/data/fresh_test_db.sqlite', dirname(__FILE__) . '/../fixtures/project/data/test.sqlite');
copy(dirname(__FILE__) . '/../fixtures/project/config/fresh_app.yml', dirname(__FILE__) . '/../fixtures/project/config/app.yml');
register_shutdown_function('sympal_cleanup');
if (isset($refresh_assets) && $refresh_assets) {
    $uploadDir = dirname(__FILE__) . '/../fixtures/project/web/uploads';
    sfToolkit::clearDirectory($uploadDir);
    $finder = new sfFinder();
    $filesystem = new sfFilesystem();
    $filesystem->mirror(dirname(__FILE__) . '/../fixtures/assets', $uploadDir, $finder);
}
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:18,代码来源:cleanup.php

示例8: mirrorDir

 private function mirrorDir($src, $dest)
 {
     $finder = sfFinder::type('any');
     $filesystem = new sfFilesystem();
     $filesystem->mirror($src, $dest, $finder, array('override' => true));
 }
开发者ID:EFForg,项目名称:lemonhrm,代码行数:6,代码来源:orangehrmPublishAPIsTask.class.php

示例9: isValid

 /**
  * Validates the response.
  *
  * @param mixed $checkDTD Either true to validate against the response DTD or
  *                        provide the path to a *.xsd, *.rng or *.rnc schema
  *
  * @return sfTestFunctionalBase|sfTester
  *
  * @throws LogicException If the response is neither XML nor (X)HTML
  */
 public function isValid($checkDTD = false)
 {
     if (preg_match('/(x|ht)ml/i', $this->response->getContentType())) {
         $revert = libxml_use_internal_errors(true);
         $dom = new DOMDocument('1.0', $this->response->getCharset());
         $content = $this->response->getContent();
         if (true === $checkDTD) {
             $cache = sfConfig::get('sf_cache_dir') . '/sf_tester_response/w3';
             $local = 'file://' . str_replace(DIRECTORY_SEPARATOR, '/', $cache);
             if (!file_exists($cache . '/TR/xhtml11/DTD/xhtml11.dtd')) {
                 $filesystem = new sfFilesystem();
                 $finder = sfFinder::type('any')->discard('.sf');
                 $filesystem->mirror(dirname(__FILE__) . '/w3', $cache, $finder);
                 $finder = sfFinder::type('file');
                 $filesystem->replaceTokens($finder->in($cache), '##', '##', array('LOCAL_W3' => $local));
             }
             $content = preg_replace('#(<!DOCTYPE[^>]+")http://www.w3.org(.*")#i', '\\1' . $local . '\\2', $content);
             $dom->validateOnParse = $checkDTD;
         }
         $dom->loadXML($content);
         switch (pathinfo($checkDTD, PATHINFO_EXTENSION)) {
             case 'xsd':
                 $dom->schemaValidate($checkDTD);
                 $message = sprintf('response validates per XSD schema "%s"', basename($checkDTD));
                 break;
             case 'rng':
             case 'rnc':
                 $dom->relaxNGValidate($checkDTD);
                 $message = sprintf('response validates per relaxNG schema "%s"', basename($checkDTD));
                 break;
             default:
                 $message = $dom->validateOnParse ? sprintf('response validates as "%s"', $dom->doctype->name) : 'response is well-formed "xml"';
         }
         if (count($errors = libxml_get_errors())) {
             $lines = explode(PHP_EOL, $this->response->getContent());
             $this->tester->fail($message);
             foreach ($errors as $error) {
                 $this->tester->diag('    ' . trim($error->message));
                 if (preg_match('/line (\\d+)/', $error->message, $match) && $error->line != $match[1]) {
                     $this->tester->diag('      ' . str_pad($match[1] . ':', 6) . trim($lines[$match[1] - 1]));
                 }
                 $this->tester->diag('      ' . str_pad($error->line . ':', 6) . trim($lines[$error->line - 1]));
             }
         } else {
             $this->tester->pass($message);
         }
         libxml_use_internal_errors($revert);
     } else {
         throw new LogicException(sprintf('Unable to validate responses of content type "%s"', $this->response->getContentType()));
     }
     return $this->getObjectToReturn();
 }
开发者ID:sundesz,项目名称:crafthouse,代码行数:62,代码来源:sfTesterResponse.class.php

示例10: cleanupUploads

 protected function cleanupUploads(sfFilesystem $filesystem)
 {
     @sfToolkit::clearDirectory(sfConfig::get('sf_upload_dir'));
     $filesystem->mirror(dmOs::join(sfConfig::get('dm_core_dir'), 'test/fixtures/uploads'), sfConfig::get('sf_upload_dir'), sfFinder::type('any'));
 }
开发者ID:jdart,项目名称:diem,代码行数:5,代码来源:ProjectConfiguration.class.php

示例11: mirrorDir

 private function mirrorDir($src, $dest)
 {
     $finder = sfFinder::type('any');
     $filesystem = new sfFilesystem();
     $filesystem->mirror($src, $dest, $finder);
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:6,代码来源:orangehrmPublishAssetsTask.class.php

示例12: realpath

$this->logSection('install', 'fix sqlite database permissions');
touch(sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR .'propel.db');
chmod(sfConfig::get('sf_data_dir'), 0777);
chmod(sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'propel.db', 0777);


$this->logSection('install', 'install propel 1.6');
sfSymfonyPluginManager::disablePlugin('sfPropelPlugin', sfConfig::get('sf_config_dir'));
$fs->mkdirs(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . 'sfPropelORMPlugin');

$root_dir = realpath(sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
$plugin_dir = realpath(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . 'sfPropelORMPlugin');

$finder = sfFinder::type('any')->ignore_version_control(false)->discard('mockproject')->prune('mockproject');
$fs->mirror($root_dir, $plugin_dir, $finder);

$fs->execute(sprintf('cd %s && git submodule update --init --recursive', $plugin_dir));
sfSymfonyPluginManager::enablePlugin('sfPropelORMPlugin', sfConfig::get('sf_config_dir'));

$this->logSection('install', 'setup propel behavior');
$ini_file = sfConfig::get('sf_config_dir'). DIRECTORY_SEPARATOR . 'propel.ini';
$content = file_get_contents($ini_file);
preg_replace('#^propel.behavior#', ';\1', $content);
$content .= <<<EOF
propel.behavior.default                        = symfony,symfony_i18n
propel.behavior.symfony.class                  = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorSymfony
propel.behavior.symfony_i18n.class             = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorI18n
propel.behavior.symfony_i18n_translation.class = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorI18nTranslation
propel.behavior.symfony_behaviors.class        = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorSymfonyBehaviors
propel.behavior.symfony_timestampable.class    = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorTimestampable
开发者ID:nurhidayatullah,项目名称:inventory,代码行数:30,代码来源:installer.php

示例13: setUp

 protected function setUp()
 {
     $appConfig = ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true);
     sfContext::createInstance($appConfig);
     $this->cache = $this->getCache(sfConfig::get('sf_cache_dir') . '/sfImageTransformExtraPluginUnitTests');
     $fs = new sfFilesystem();
     $src_dir = dirname(__FILE__) . '/../../../fixtures/thumbnails';
     $dst_dir = $this->cache->getOption('cache_dir') . '/thumbnails';
     $fs->mirror($src_dir, $dst_dir, new sfFinder(), array('override' => true));
 }
开发者ID:robo47,项目名称:sfImageTransformExtraPlugin,代码行数:10,代码来源:sfRawFileCacheTest.php


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