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


PHP sfToolkit::clearDirectory方法代码示例

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


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

示例1: execute

 protected function execute($arguments = array(), $options = array())
 {
     $this->standardBootstrap($arguments['application'], $options['env']);
     $remove = sfLuceneToolkit::getDirtyIndexRemains();
     if (count($remove) == 0) {
         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Nothing to do!', 'INFO'))));
     } elseif ($arguments['confirmation'] == 'delete') {
         $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Delete confirmation provided.  Deleting directories now...', array('fg' => 'red', 'bold' => true)))));
         foreach ($remove as $dir) {
             sfToolkit::clearDirectory($dir);
             rmdir($dir);
             $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('dir-', $dir))));
         }
     } else {
         $messages = array($this->formatter->format('The following directories are alien and not referenced by your configuration:', 'INFO'));
         for ($c = count($remove), $x = 0; $x < $c; $x++) {
             $messages[] = '  ' . ($x + 1) . ') ' . $remove[$x];
         }
         $messages[] = '';
         $messages[] = 'These directories were ' . $this->formatter->format('not', array('fg' => 'red', 'bold' => true)) . ' deleted.  To delete these directories, please run:';
         $messages[] = '';
         $messages[] = '     ' . $this->formatter->format('symfony lucene:clean ' . $arguments['application'] . ' delete', 'INFO');
         $messages[] = '';
         $this->dispatcher->notify(new sfEvent($this, 'command.log', $messages));
     }
 }
开发者ID:palcoprincipal,项目名称:sfLucenePlugin,代码行数:26,代码来源:sfLuceneCleanupTask.class.php

示例2: deleteApplication

 public function deleteApplication()
 {
     sfToolkit::clearDirectory(sfConfig::get('sf_apps_dir') . '/' . $this->slug);
     rmdir(sfConfig::get('sf_apps_dir') . '/' . $this->slug);
     @unlink(sfConfig::get('sf_web_dir') . '/' . $this->slug . '_dev.php');
     @unlink(sfConfig::get('sf_web_dir') . '/' . $this->slug . '.php');
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:7,代码来源:PluginsfSympalSite.class.php

示例3: cleanup

function cleanup()
{
    //sfToolkit::clearDirectory(dirname(__FILE__).'/../fixtures/project/cache');
    sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/log');
    @unlink(sfConfig::get('sf_data_dir') . '/test.sqlite');
    @unlink(sfConfig::get('sf_config_dir') . '/app.yml');
}
开发者ID:blt04,项目名称:sfDoctrine2Plugin,代码行数:7,代码来源:cleanup.php

示例4: task_extra_cleanup

function task_extra_cleanup()
{
    sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/cache');
    sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/log');
    sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/plugins');
    sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/test/unit');
}
开发者ID:jmiridis,项目名称:atcsf1,代码行数:7,代码来源:unit.php

示例5: clearDirectory

 protected function clearDirectory($dir)
 {
     sfToolkit::clearDirectory($dir);
     if (is_dir($dir)) {
         rmdir($dir);
     }
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:7,代码来源:crudBrowser.class.php

示例6: sf_unit_test_shutdown

function sf_unit_test_shutdown()
{
  $sf_root_dir = sys_get_temp_dir().'/sf_test_project';
  if(is_dir($sf_root_dir))
  {
    sfToolkit::clearDirectory($sf_root_dir);
    @rmdir($sf_root_dir);
  }

  $sessions = glob(sys_get_temp_dir().'/sessions*');
  $tmp_files = glob(sys_get_temp_dir().'/sf*');

  $files = array_merge((empty($sessions) ? array() : $sessions), (empty($tmp_files) ? array() : $tmp_files));
  foreach ($files as $file)
  {
    if(is_dir($file))
    {
      sfToolkit::clearDirectory($file);
      @rmdir($file);
    }
    else
    {
      @unlink($file);
    }
  }
}
开发者ID:nationalfield,项目名称:symfony,代码行数:26,代码来源:unit.php

示例7: customize

 public function customize($params)
 {
     $params['moduleName'] = 'search';
     sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
     $generatorManager = new sfGeneratorManager(sfProjectConfiguration::getActive());
     sfGeneratorConfigHandler::getContent($generatorManager, 'xfGeneratorInterface', $params);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:7,代码来源:xfGeneratorInterfaceTest.php

示例8: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $this->logSection('Diem Extended', 'Setup ' . dmProject::getKey());
     $this->dispatcher->notify(new sfEvent($this, 'dm.setup.before', array('clear-db' => $options['clear-db'])));
     // don't use cache:clear task because it changes current app & environment
     @sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir'));
     if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineRecord.php'))) {
         $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineRecord.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineRecord.php'));
     }
     if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineQuery.php'))) {
         $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineQuery.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineQuery.php'));
     }
     if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineTable.php'))) {
         $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineTable.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineTable.php'));
     }
     $this->runTask('doctrine:build', array(), array('model' => true));
     if ($options['clear-db'] || $options['clear-tables'] || $this->isProjectLocked()) {
         $this->reloadAutoload();
         if ($options['clear-db']) {
             $this->runTask('doctrine:drop-db', array(), array('env' => $options['env'], 'no-confirmation' => dmArray::get($options, 'no-confirmation', false)));
         } else {
             $this->runTask('dm:drop-tables', array(), array('env' => $options['env']));
         }
         if ($options['clear-db'] && ($ret = $this->runTask('doctrine:build-db', array(), array('env' => $options['env'])))) {
             return $ret;
         }
         $this->runTask('doctrine:build-sql', array(), array('env' => $options['env']));
         $this->runTask('doctrine:insert-sql', array(), array('env' => $options['env']));
     } else {
         $this->runTask('dm:upgrade', array(), array('env' => $options['env']));
     }
     $this->reloadAutoload();
     $this->withDatabase();
     $this->runTask('dm:clear-cache', array(), array('env' => $options['env']));
     $this->getContext()->reloadModuleManager();
     $this->runTask('doctrine:build-forms', array(), array('generator-class' => 'dmDoctrineFormGenerator'));
     $this->runTask('doctrine:build-filters', array(), array('generator-class' => 'dmDoctrineFormFilterGenerator'));
     $this->runTask('dm:publish-assets');
     $this->runTask('dm:clear-cache', array(), array('env' => $options['env']));
     $this->reloadAutoload();
     $this->getContext()->reloadModuleManager();
     $this->runTask('dmAdmin:generate', array(), array('env' => $options['env']));
     if (!$options['dont-load-data']) {
         $this->runTask('dm:data', array(), array('load-doctrine-data' => $options['load-doctrine-data'], 'env' => $options['env']));
     }
     $this->logSection('Diem Extended', 'generate front modules');
     if (!($return = $this->context->get('filesystem')->sf('dmFront:generate --env=' . dmArray::get($options, 'env', 'dev')))) {
         $this->logBlock(array('Can\'t run dmFront:generate: ' . $this->context->get('filesystem')->getLastExec('output'), 'Please run "php symfony dmFront:generate" manually to generate front templates'), 'ERROR');
     }
     $this->runTask('dm:permissions');
     // fix db file permissions
     if ('Sqlite' === Doctrine_Manager::connection()->getDriverName()) {
         $this->filesystem->chmod(sfConfig::get('sf_data_dir'), 0777, 00);
     }
     $this->runTask('dm:clear-cache', array(), array('env' => $options['env']));
     $this->dispatcher->notify(new sfEvent($this, 'dm.setup.after', array('clear-db' => $options['clear-db'])));
     $this->logBlock('Setup successful', 'INFO_LARGE');
     $this->unlockProject();
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:62,代码来源:dmSetupTask.class.php

示例9: 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

示例10: boot

 protected function boot()
 {
     $configuration = ProjectConfiguration::getApplicationConfiguration($this->options['app'], $this->options['env'], $this->options['debug']);
     $this->context = dm::createContext($configuration);
     sfConfig::set('sf_logging_enabled', false);
     // remove all cache
     sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
 }
开发者ID:theolymp,项目名称:diem,代码行数:8,代码来源:dmCoreFunctionalCoverageTest.php

示例11: doDeleteAll

 public static function doDeleteAll(PropelPDO $con = null)
 {
     if (file_exists($index = self::getLuceneIndexFile())) {
         sfToolkit::clearDirectory($index);
         rmdir($index);
     }
     return parent::doDeleteAll($con);
 }
开发者ID:rafix,项目名称:gesCorreo,代码行数:8,代码来源:GcMailboxPeer.php

示例12: sf_functional_test_shutdown_cleanup

function sf_functional_test_shutdown_cleanup()
{
    sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir'));
    sfToolkit::clearDirectory(sfConfig::get('sf_log_dir'));
    $databases = glob(sfConfig::get('sf_data_dir') . '/*.sqlite');
    foreach ($databases as $database) {
        unlink($database);
    }
}
开发者ID:sensorsix,项目名称:app,代码行数:9,代码来源:functional.php

示例13: removeIndex

 public static function removeIndex($class)
 {
   $index = self::getLuceneIndexFile($class);
   if ($index && file_exists($index))
   {
     sfToolkit::clearDirectory($index);
     rmdir($index);
   }
 }
开发者ID:nibsirahsieu,项目名称:sfPropelLuceneableBehaviorPlugin,代码行数:9,代码来源:sfLuceneableToolkit.class.php

示例14: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $plugin = $arguments['plugin'];
     $modules = $options['module'];
     // validate the plugin name
     if ('Plugin' != substr($plugin, -6) || !preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $plugin)) {
         throw new sfCommandException(sprintf('The plugin name "%s" is invalid.', $plugin));
     }
     // validate the test application name
     if (!preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $options['test-application'])) {
         throw new sfCommandException(sprintf('The application name "%s" is invalid.', $options['test-application']));
     }
     $this->checkPluginExists($plugin, false);
     if (is_readable(sfConfig::get('sf_data_dir') . '/skeleton/plugin')) {
         $skeletonDir = sfConfig::get('sf_data_dir') . '/skeleton/plugin';
     } else {
         $skeletonDir = dirname(__FILE__) . '/skeleton/plugin';
     }
     $pluginDir = sfConfig::get('sf_plugins_dir') . '/' . $plugin;
     $testProject = $pluginDir . '/test/fixtures/project';
     $testApp = $testProject . '/apps/' . $options['test-application'];
     $properties = parse_ini_file(sfConfig::get('sf_config_dir') . '/properties.ini', true);
     $constants = array('PLUGIN_NAME' => $plugin, 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here', 'APP_NAME' => $options['test-application']);
     // plugin
     $finder = sfFinder::type('any')->discard('.sf');
     $this->getFilesystem()->mirror($skeletonDir . '/plugin', $pluginDir, $finder);
     // PluginConfiguration
     $this->getFilesystem()->rename($pluginDir . '/config/PluginConfiguration.class.php', $pluginDir . '/config/' . $plugin . 'Configuration.class.php');
     // tokens
     $finder = sfFinder::type('file')->name('*.php', '*.yml', 'package.xml.tmpl');
     $this->getFilesystem()->replaceTokens($finder->in($pluginDir), '##', '##', $constants);
     if ($options['skip-test-dir']) {
         sfToolkit::clearDirectory($pluginDir . '/test');
         $this->getFilesystem()->remove($pluginDir . '/test');
     } else {
         // test project and app
         $finder = sfFinder::type('any')->discard('.sf');
         $this->getFilesystem()->mirror(sfConfig::get('sf_symfony_lib_dir') . '/task/generator/skeleton/project', $testProject, $finder);
         $this->getFilesystem()->mirror(sfConfig::get('sf_symfony_lib_dir') . '/task/generator/skeleton/app/app', $testApp, $finder);
         // ProjectConfiguration
         $this->getFilesystem()->copy($skeletonDir . '/project/ProjectConfiguration.class.php', $testProject . '/config/ProjectConfiguration.class.php', array('override' => true));
         $this->getFileSystem()->replaceTokens($testProject . '/config/ProjectConfiguration.class.php', '##', '##', $constants);
         // ApplicationConfiguration
         $this->getFilesystem()->rename($testApp . '/config/ApplicationConfiguration.class.php', $testApp . '/config/' . $options['test-application'] . 'Configuration.class.php');
         $this->getFilesystem()->replaceTokens($testApp . '/config/' . $options['test-application'] . 'Configuration.class.php', '##', '##', $constants);
         // settings.yml
         $this->getFilesystem()->replaceTokens($testApp . '/config/settings.yml', '##', '##', array('NO_SCRIPT_NAME' => 'off', 'CSRF_SECRET' => $plugin, 'ESCAPING_STRATEGY' => 'on'));
     }
     // modules
     foreach ($modules as $module) {
         $moduleTask = new sfGeneratePluginModuleTask($this->dispatcher, $this->formatter);
         $moduleTask->setCommandApplication($this->commandApplication);
         $moduleTask->setConfiguration($this->configuration);
         $moduleTask->run(array($plugin, $module));
     }
 }
开发者ID:cbsistem,项目名称:appflower_studio_playground,代码行数:59,代码来源:sfGeneratePluginTask.class.php

示例15: initializeContext

 /**
  * Intializes the context for this test
  *
  */
 private function initializeContext()
 {
     // only initialize the context one time
     if (!$this->context) {
         $configuration = ProjectConfiguration::getApplicationConfiguration($this->getApplication(), $this->getEnvironment(), $this->isDebug());
         sfContext::createInstance($configuration);
         // remove all cache
         sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
     }
 }
开发者ID:hansrip,项目名称:transzam,代码行数:14,代码来源:sfBasePhpunitFunctionalTestCase.class.php


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