本文整理汇总了PHP中sfFinder类的典型用法代码示例。如果您正苦于以下问题:PHP sfFinder类的具体用法?PHP sfFinder怎么用?PHP sfFinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfFinder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
$visiteurs_dir = sfConfig::get('sf_root_dir') . '/web/visiteur/';
$interactifs_dir = sfConfig::get('sf_root_dir') . '/web/interactif';
$finder = new sfFinder();
$fileSystem = new sfFilesystem();
foreach ($finder->in($visiteurs_dir) as $file) {
//echo 'search in '. $file;
if (is_file($file) && basename($file) != '.DS_Store') {
$realpath = str_replace($visiteurs_dir, "", $file);
$split = explode('/', $realpath);
if (count($split) > 2) {
//print_r($split);
//exit;
$visiteur_id = $split[0];
$interactif_id = $split[1];
$filename = basename($file);
// check if symlink exist
if (Doctrine::getTable('Interactif')->symlinkDocument($interactif_id, $visiteur_id, $filename, $file)) {
$this->logSection("INFO", "Symlink " . $interactifs_dir . '/' . $interactif_id . '/' . $visiteur_id . '/' . $filename);
}
}
}
}
$this->logSection("INFO", "END Symlink interactif directory");
}
开发者ID:pmoutet,项目名称:navinum,代码行数:28,代码来源:symlinkVisiteursDocumentsToInteractifsTask.class.php
示例2: getUpgrades
/**
* Returns an array of all possible upgrade files as an array with
* the upgrade's key and version
*
* This first looks for all .php files in the versions directory.
* The files should have the format of VERSION_NUMBER (e.g. 1.0.0__1).
* The project is then checked to see if
*/
public function getUpgrades()
{
if (!$this->_upgrades) {
$this->_upgrades = array();
$versions = array();
$dir = dirname(__FILE__) . '/versions';
$files = sfFinder::type('file')->name('*.php')->in($dir);
foreach ($files as $file) {
$info = pathinfo($file);
if (strpos($info['filename'], '__') === false) {
throw new sfException(sprintf('Invalid upgrade filename format for file "%s" - must contain a double underscore - VERSION__NUMBER (e.g. 1.0.0__1) ', $info['filename']));
}
$e = explode('__', $info['filename']);
$version = $e[0];
$number = $e[1];
if ($this->_isVersionNew($info['filename'])) {
$versions[] = array('version' => $version, 'number' => $number);
$this->_upgrades[] = $version . '__' . $number;
}
}
natcasesort($this->_upgrades);
foreach ($this->_upgrades as $key => $version) {
$this->_upgrades[$key] = $versions[$key];
}
}
return $this->_upgrades;
}
开发者ID:sympal,项目名称:sympal,代码行数:35,代码来源:sfSympalProjectUpgrade.class.php
示例3: testRemovePatternForMockSources
public function testRemovePatternForMockSources()
{
$route = $this->getRoute('sf_image_mock');
$route->preassemblePattern(array());
$finder = new sfFinder();
$starting_count = count($finder->type('file')->in($this->cache->getOption('cache_dir')));
$this->cache->removePattern($route);
$files = $finder->type('file')->in($this->cache->getOption('cache_dir'));
$this->assertNotContains($this->cache->getOption('cache_dir') . '/thumbnails/default.gif', $files);
$this->assertNotContains($this->cache->getOption('cache_dir') . '/thumbnails/original.jpg', $files);
$this->assertEquals($starting_count - 2, count($files));
}
开发者ID:robo47,项目名称:sfImageTransformExtraPlugin,代码行数:12,代码来源:sfRawFileCacheTest.php
示例4: generate
/**
* Generates classes and templates in cache.
*
* @param array The parameters
*
* @return string The data to put in configuration cache
*/
public function generate($params = array())
{
$logger = sfContext::getInstance()->getLogger();
$logger->err("WOW generate enter");
$logger->err(print_r($params, true));
$this->params = $params;
// check if all required parameters are present
$required_parameters = array('moduleName');
foreach ($required_parameters as $entry) {
if (!isset($this->params[$entry])) {
throw new sfParseException(sprintf('You must specify a "%s".', $entry));
}
}
// generated module name
$this->setGeneratedModuleName('auto' . ucfirst($this->params['moduleName']));
$this->setModuleName($this->params['moduleName']);
// check if the theme exists?
$theme = isset($this->params['theme']) ? $this->params['theme'] : 'default';
$themeDir = $this->generatorManager->getConfiguration()->getGeneratorTemplate($this->getGeneratorClass(), $theme, '');
if (!is_dir($themeDir)) {
throw new sfConfigurationException(sprintf('The theme "%s" does not exist.', $theme));
}
$this->setTheme($theme);
$files = sfFinder::type('file')->relative()->in($themeDir);
$this->generatePhpFiles($this->generatedModuleName, $files);
// require generated action class
$data = "require_once(sfConfig::get('sf_module_cache_dir').'/" . $this->generatedModuleName . "/actions/actions.class.php');\n";
$logger->err("WOW generate leave");
return $data;
}
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:37,代码来源:sfWebRPCGenerator.class.php
示例5: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
// remove lib/symfony and data/symfony directories
if (!is_dir('lib/symfony')) {
throw new sfCommandException('You can unfreeze only if you froze the symfony libraries before.');
}
// change symfony path in ProjectConfiguration.class.php
$config = sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php';
$content = file_get_contents($config);
if (preg_match('/^# FROZEN_SF_LIB_DIR\\: (.+?)$/m', $content, $match)) {
$publishAssets = new sfPluginPublishAssetsTask($this->dispatcher, $this->formatter);
$publishAssets->setCommandApplication($this->commandApplication);
$symfonyLibDir = $match[1];
$content = str_replace("# FROZEN_SF_LIB_DIR: {$match[1]}\n\n", '', $content);
// need to escape windows pathes "symfony\1.2" -> "symfony\\1.2"
// because preg_replace would then use \1 as group identifier resulting in "symfony.2"
$content = preg_replace('#^require_once.+?$#m', sprintf("require_once '%s/autoload/sfCoreAutoload.class.php';", str_replace('\\', '\\\\', $symfonyLibDir)), $content, 1);
file_put_contents($config, $content);
// re-publish assets
$publishAssets->run(array(), array('--symfony-lib-dir=' . $symfonyLibDir));
// remove files
$finder = sfFinder::type('any');
$this->getFilesystem()->remove($finder->in(sfConfig::get('sf_lib_dir') . '/symfony'));
$this->getFilesystem()->remove(sfConfig::get('sf_lib_dir') . '/symfony');
$this->getFilesystem()->remove($finder->in(sfConfig::get('sf_data_dir') . '/symfony'));
$this->getFilesystem()->remove(sfConfig::get('sf_data_dir') . '/symfony');
$this->getFilesystem()->remove($finder->in(sfConfig::get('sf_web_dir') . '/sf'));
$this->getFilesystem()->remove(sfConfig::get('sf_web_dir') . '/sf');
}
}
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:33,代码来源:sfProjectUnfreezeTask.class.php
示例6: loadMapBuilderClasses
/**
* Loads map builder classes.
*
* This method is ORM dependant.
*
* @throws sfException
*/
protected function loadMapBuilderClasses()
{
// we must load all map builder classes to be able to deal with foreign keys (cf. editSuccess.php template)
$classes = sfFinder::type('file')->ignore_version_control()->name('*MapBuilder.php')->in(sfLoader::getModelDirs());
foreach ($classes as $class)
{
$class_map_builder = basename($class, '.php');
$maps[$class_map_builder] = new $class_map_builder();
if (!$maps[$class_map_builder]->isBuilt())
{
$maps[$class_map_builder]->doBuild();
}
if ($this->className == str_replace('MapBuilder', '', $class_map_builder))
{
$this->map = $maps[$class_map_builder];
}
}
if (!$this->map)
{
throw new sfException('The model class "'.$this->className.'" does not exist.');
}
$this->tableMap = $this->map->getDatabaseMap()->getTable(constant($this->className.'Peer::TABLE_NAME'));
}
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:32,代码来源:sfPropelCrudGenerator.class.php
示例7: combineModuleFiles
/**
*
* Combine files defined in module's view.yml files
*/
public function combineModuleFiles()
{
// get the all modules
$modules = sfConfig::get('sf_enabled_modules', array());
$app_modules = sfFinder::type('directory')->maxdepth(0)->in(sfConfig::get('sf_app_module_dir'));
foreach ($app_modules as $module) {
$modules[] = str_replace(sfConfig::get('sf_app_module_dir') . '/', '', $module);
}
foreach ($modules as $module) {
$this->logSection('combine', 'module : ' . $module);
$configPath = sprintf('modules/%s/config/view.yml', $module);
$files = $this->configuration->getConfigPaths($configPath);
$config = swCombineViewConfigHandler::getConfiguration($files);
$this->view_handler->setYamlConfig($config);
foreach ($config as $view => $params) {
$this->logSection('combine', ' > view : ' . $module . '::' . $view);
// Generate css module files
$stylesheets = $this->view_handler->exposeMergeConfigValue('stylesheets', $view);
if (count($stylesheets) > 0) {
$assets = $this->view_handler->exposeAddAssets('stylesheet', $stylesheets, false);
$this->combineAndOptimize('stylesheet', $assets);
}
// Generate js module files
$javascripts = $this->view_handler->exposeMergeConfigValue('javascripts', $view);
if (count($javascripts) > 0) {
$assets = $this->view_handler->exposeAddAssets('javascript', $javascripts, false);
$this->combineAndOptimize('javascript', $assets);
}
}
}
}
开发者ID:resid,项目名称:swCombinePlugin,代码行数:35,代码来源:swOptimizeCreateFilesTask.class.php
示例8: loadAllFilesInDir
public function loadAllFilesInDir($dir)
{
$files = sfFinder::type('file')->name('*.schema.sql')->follow_link()->in($dir);
foreach ($files as $file) {
$this->loadFromFile($file);
}
}
开发者ID:sgrove,项目名称:cothinker,代码行数:7,代码来源:dbInfo.php
示例9: generate
/**
* Generates classes and templates in cache.
*
* @param array $params The parameters
*
* @return string The data to put in configuration cache
*/
public function generate($params = array())
{
$this->validateParameters($params);
$this->modelClass = $this->params['model_class'];
// generated module name
$this->setModuleName($this->params['moduleName']);
$this->setGeneratedModuleName('auto' . ucfirst($this->params['moduleName']));
// theme exists?
$theme = isset($this->params['theme']) ? $this->params['theme'] : 'default';
$this->setTheme($theme);
$themeDir = $this->generatorManager->getConfiguration()->getGeneratorTemplate($this->getGeneratorClass(), $theme, '');
if (!is_dir($themeDir)) {
throw new sfConfigurationException(sprintf('The theme "%s" does not exist.', $theme));
}
// configure the model
$this->configure();
$this->configuration = $this->loadConfiguration();
// generate files
$this->generatePhpFiles($this->generatedModuleName, sfFinder::type('file')->relative()->in($themeDir));
// move helper file
if (file_exists($file = $this->generatorManager->getBasePath() . '/' . $this->getGeneratedModuleName() . '/lib/helper.php')) {
@rename($file, $this->generatorManager->getBasePath() . '/' . $this->getGeneratedModuleName() . '/lib/Base' . ucfirst($this->moduleName) . 'GeneratorHelper.class.php');
}
return "require_once(sfConfig::get('sf_module_cache_dir').'/" . $this->generatedModuleName . "/actions/actions.class.php');";
}
开发者ID:Phennim,项目名称:symfony1,代码行数:32,代码来源:sfModelGenerator.class.php
示例10: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
// check that the symfony librairies are not already freeze for this project
if (is_readable(sfConfig::get('sf_lib_dir') . '/symfony')) {
throw new sfCommandException('You can only freeze when lib/symfony is empty.');
}
if (is_readable(sfConfig::get('sf_data_dir') . '/symfony')) {
throw new sfCommandException('You can only freeze when data/symfony is empty.');
}
if (is_readable(sfConfig::get('sf_web_dir') . '/sf')) {
throw new sfCommandException('You can only freeze when web/sf is empty.');
}
if (is_link(sfConfig::get('sf_web_dir') . '/sf')) {
$this->getFilesystem()->remove(sfConfig::get('sf_web_dir') . '/sf');
}
$symfonyLibDir = sfConfig::get('sf_symfony_lib_dir');
$symfonyDataDir = $arguments['symfony_data_dir'];
if (!is_readable($symfonyDataDir)) {
throw new sfCommandException(sprintf('The symfony data dir does not seem to be located at "%s".', $symfonyDataDir));
}
$this->logSection('freeze', sprintf('freezing lib found in "%s', $symfonyLibDir));
$this->logSection('freeze', sprintf('freezing data found in "%s"', $symfonyDataDir));
$this->getFilesystem()->mkdirs('lib' . DIRECTORY_SEPARATOR . 'symfony');
$this->getFilesystem()->mkdirs('data' . DIRECTORY_SEPARATOR . 'symfony');
$finder = sfFinder::type('any')->exec(array($this, 'excludeTests'));
$this->getFilesystem()->mirror($symfonyLibDir, sfConfig::get('sf_lib_dir') . '/symfony', $finder);
$this->getFilesystem()->mirror($symfonyDataDir, sfConfig::get('sf_data_dir') . '/symfony', $finder);
$this->getFilesystem()->rename(sfConfig::get('sf_data_dir') . '/symfony/web/sf', sfConfig::get('sf_web_dir') . '/sf');
// change symfony path in ProjectConfiguration.class.php
$config = sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php';
$content = file_get_contents($config);
$content = str_replace('<?php', "<?php\n\n# FROZEN_SF_LIB_DIR: {$symfonyLibDir}", $content);
$content = preg_replace('#(\'|")' . preg_quote($symfonyLibDir, '#') . '#', "dirname(__FILE__).\$1/../lib/symfony", $content);
file_put_contents($config, $content);
}
开发者ID:ajith24,项目名称:ajithworld,代码行数:38,代码来源:sfProjectFreezeTask.class.php
示例11: loadTasks
/**
* Loads all available tasks.
*
* Looks for tasks in the symfony core, the current project and all project plugins.
*
* @param sfProjectConfiguration $configuration The project configuration
*/
protected function loadTasks(sfProjectConfiguration $configuration)
{
// Symfony core tasks
$dirs = array(sfConfig::get('sf_symfony_lib_dir') . '/task');
// Plugin tasks
foreach ($configuration->getPluginPaths() as $path) {
if (is_dir($taskPath = $path . '/lib/task')) {
$dirs[] = $taskPath;
}
}
// project tasks
$dirs[] = sfConfig::get('sf_lib_dir') . '/task';
$finder = sfFinder::type('file')->name('*Task.class.php');
foreach ($finder->in($dirs) as $file) {
$this->taskFiles[basename($file, '.class.php')] = $file;
}
// register local autoloader for tasks
spl_autoload_register(array($this, 'autoloadTask'));
// require tasks
foreach ($this->taskFiles as $task => $file) {
// forces autoloading of each task class
class_exists($task, true);
}
// unregister local autoloader
spl_autoload_unregister(array($this, 'autoloadTask'));
}
开发者ID:yasirgit,项目名称:afids,代码行数:33,代码来源:sfSymfonyCommandApplication.class.php
示例12: executeAddon
/**
* @see sfTaskExtraAddon
*/
public function executeAddon($arguments = array(), $options = array())
{
$finder = sfFinder::type('file')->maxdepth(0);
foreach ($finder->in($this->pluginConfiguration->getConnectedPluginSubPaths('/lib/model')) as $file) {
if (!file_exists($pluginFile = dirname($file) . '/plugin/Plugin' . basename($file)) && preg_match('/(\\w+) extends (\\w+)/', $contents = file_get_contents($file), $match) && 0 !== strpos($match[2], 'Plugin')) {
$pluginContents = <<<EOF
<?php
/**
* Plugin model class generated by sfTaskExtraPlugin.
*/
class Plugin{$match[1]} extends {$match['2']}
{
}
EOF;
// create plugin class
$this->getFilesystem()->mkdirs(dirname($pluginFile));
$this->getFilesystem()->touch($pluginFile);
file_put_contents($pluginFile, $pluginContents);
// edit stub class
$this->logSection('edit', $file);
file_put_contents($file, str_replace('extends ' . $match[2], 'extends Plugin' . $match[1], $contents));
}
}
}
开发者ID:real-chocopanda,项目名称:sfTaskExtraPlugin,代码行数:29,代码来源:sfTaskExtraBuildModelAddon.class.php
示例13: executeIndex
/**
* Executes index action
*
* @param sfWebRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->task = $request->getParameter('task', null);
if (!is_null($this->task))
{
$this->form = new opKdtPluginBackendForm(array('task' => $this->task));
if ($request->isMethod(sfRequest::POST))
{
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid())
{
$this->form->executeTask();
$this->getUser()->setFlash('notice', 'Execute the tasks.');
$this->redirect('opKdtPlugin/index');
}
}
return sfView::INPUT;
}
$finder = sfFinder::type('file')->maxdepth(0)->ignore_version_control(false)->follow_link()->name('opKdt*Task.class.php');
$dir = array(sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'opKdtPlugin'.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'task');
$this->tasks = array();
foreach ($finder->in($dir) as $path)
{
preg_match('/^opKdt(.*)Task.class.php$/', basename($path), $matches);
$this->tasks[] = $matches[1];
}
}
开发者ID:nise-nabe,项目名称:opKdtPlugin,代码行数:36,代码来源:actions.class.php
示例14: upgrade
public function upgrade()
{
if (!file_exists($file = sfConfig::get('sf_lib_dir') . '/form/BaseForm.class.php')) {
$properties = parse_ini_file(sfConfig::get('sf_config_dir') . '/properties.ini', true);
$tokens = array('PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here');
$this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir') . '/task/generator/skeleton/project/lib/form/BaseForm.class.php', $file);
$this->getFilesystem()->replaceTokens(array($file), '##', '##', $tokens);
}
$finder = sfFinder::type('file')->name('*.php');
foreach ($finder->in($this->getProjectLibDirectories('/form')) as $file) {
$contents = file_get_contents($file);
$changed = false;
// forms that extend sfForm should now extend BaseForm
$contents = preg_replace('/(\\bextends\\s+)sfForm\\b/i', '\\1BaseForm', $contents, -1, $count);
$changed = $count || $changed;
// change instances of sfWidgetFormInput to sfWidgetFormInputText
$contents = preg_replace('/\\bnew\\s+sfWidgetFormInput\\b/i', '\\0Text', $contents, -1, $count);
$changed = $count || $changed;
// change signature of sfFormDoctrine::processValues()
$contents = preg_replace('/public\\s+function\\s+processValues\\s*\\(\\s*\\$\\w+(\\s*=\\s*null\\s*)\\)/ie', "str_replace('\$1', '', '\$0')", $contents, -1, $count);
$changed = $count || $changed;
if ($changed) {
$this->logSection('form', 'Migrating ' . $file);
file_put_contents($file, $contents);
}
}
}
开发者ID:bigcalm,项目名称:urlcatcher,代码行数:27,代码来源:sfFormsUpgrade.class.php
示例15: execute
protected function execute($arguments = array(), $options = array())
{
$plugin = $arguments['plugin'];
$app = $arguments['application'];
$module = $arguments['module'];
$pluginsDir = sfConfig::get('sf_plugins_dir') . '/' . $plugin;
// Validate the module name
if (!preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $module)) {
throw new sfCommandException(sprintf('The module name "%s" is invalid.', $module));
}
$moduleDir = $pluginsDir . '/apps/' . $app . '/modules/' . $module;
if (is_dir($moduleDir)) {
throw new sfCommandException(sprintf('The module "%s" already exists in the "%s" application.in the "%s" plugin', $moduleDir, $app, $plugin));
}
$properties = parse_ini_file(sfConfig::get('sf_config_dir') . '/properties.ini', true);
if (is_readable($pluginsDir . '/config/properties.ini')) {
$pluginProperties = parse_ini_file($pluginsDir . '/config/properties.ini', true);
$properties = array_merge($properties, $pluginProperties);
}
$constants = array('PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', 'APP_NAME' => $app, 'MODULE_NAME' => $module, 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here');
$skeletonDir = dirname(__FILE__) . '/skeleton/module';
// create basic application structure
$finder = sfFinder::type('any')->discard('.sf');
$this->getFilesystem()->mirror($skeletonDir . '/module', $moduleDir, $finder);
// customize php and yml files
$finder = sfFinder::type('file')->name('*.php', '*.yml');
$this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $constants);
}
开发者ID:te-koyama,项目名称:openpne,代码行数:28,代码来源:opGenerateModuleTask.class.php
示例16: execute
protected function execute($arguments = array(), $options = array())
{
$app = $arguments['application'];
$override = $options['override'];
$testAppDir = sfConfig::get('sf_test_dir').'/features/'.$app;
if (is_readable(sfConfig::get('sf_data_dir').'/skeleton/features'))
{
$skeletonDir = sfConfig::get('sf_data_dir').'/skeleton/features';
}
else
{
$skeletonDir = dirname(__FILE__).'/skeleton/features';
}
if (file_exists(sfConfig::get('sf_root_dir') . '/behat.yml')) {
$this->getFilesystem()->remove(sfConfig::get('sf_root_dir') . '/behat.yml');
}
// create basic application features
$finder = sfFinder::type('any')->discard('.sf');
$this->getFilesystem()->mirror($skeletonDir.'/app', $testAppDir, $finder, array(
'override' => $override
));
$this->getFilesystem()->mirror($skeletonDir.'/root', sfConfig::get('sf_root_dir'), $finder, array(
'override' => $override
));
}
开发者ID:nresni,项目名称:sfBehatPlugin,代码行数:29,代码来源:behatSetupTask.class.php
示例17: execute
/**
*
*
* @param unknown_type $arguments
* @param unknown_type $options
* @todo run in build task
* @todo add lock file
*/
protected function execute($arguments = array(), $options = array())
{
// run only in staging or dev mode
if ($options['env'] == "dev") {
throw new sfException(sprintf("Don't run the s3sync in the '%s' environment.", $options['env']));
}
$lReleaseName = sfConfig::get('app_release_name');
$lBucket = sfConfig::get('app_amazons3_bucket');
$lNewPath = CdnSingleton::getInstance()->getNextHost() . '/' . $lReleaseName;
$lCssDirectory = sfConfig::get('sf_web_dir') . "/css";
$lS3Directory = sfConfig::get('sf_web_dir') . "/s3sync";
$this->getFilesystem()->execute("rm -rf " . $lS3Directory . "/css");
$this->getFilesystem()->execute("rsync -aC --exclude .svn " . $lCssDirectory . " " . $lS3Directory);
$lFiles = sfFinder::type('file')->follow_link()->relative()->in($lS3Directory . "/css");
foreach ($lFiles as $lFile) {
// absolute path
$lFile = $lS3Directory . "/css/" . $lFile;
$lContent = file_get_contents($lFile);
$lContent = str_replace('url("/img/', 'url("' . $lNewPath . "/img/", $lContent);
$fp = fopen($lFile, 'w');
fwrite($fp, $lContent);
fclose($fp);
}
$this->getFilesystem()->execute("s3cmd --bucket-location=EU -P -r --exclude='*.svn*' --add-header 'Expires: Sat, 08 May 2015 15:22:28 GMT' sync web/s3sync/css/ s3://{$lBucket}/{$lReleaseName}/css/");
$this->getFilesystem()->execute("s3cmd --bucket-location=EU -P -r --exclude='*.svn*' --add-header 'Expires: Sat, 08 May 2015 15:22:28 GMT' sync web/img/ s3://{$lBucket}/{$lReleaseName}/img/");
$this->getFilesystem()->execute("s3cmd --bucket-location=EU -P -r --exclude='*.svn*' --add-header 'Expires: Sat, 08 May 2015 15:22:28 GMT' sync web/js/100_main/include/ s3://{$lBucket}/{$lReleaseName}/js/100_main/include/");
$this->getFilesystem()->execute("find ./web/js/100_main/include -type f -exec 7z a -tgzip -x\\!\\*.svn -x\\!\\*.gz {}.gz {} \\;");
$this->getFilesystem()->execute("s3cmd --bucket-location=EU -P -r --exclude='*.*' --include '*.gz' --mime-type 'application/javascript' --add-header 'Content-Encoding: gzip' sync web/js/100_main/include/ s3://{$lBucket}/{$lReleaseName}/js/100_main/include/");
$this->getFilesystem()->execute("find ./web/js/100_main/include -name '*.gz' -exec rm {} \\;");
$this->getFilesystem()->execute("find ./web/s3sync/css -type f -exec 7z a -tgzip -x\\!\\*.svn -x\\!\\*.gz {}.gz {} \\;");
$this->getFilesystem()->execute("s3cmd --bucket-location=EU -P -r --exclude='*.*' --include '*.gz' --mime-type 'text/css' --add-header 'Content-Encoding: gzip' sync web/s3sync/css/ s3://{$lBucket}/{$lReleaseName}/css/");
$this->getFilesystem()->execute("find ./web/s3sync/css -name '*.gz' -exec rm {} \\;");
}
开发者ID:42medien,项目名称:spreadly,代码行数:41,代码来源:S3SyncTask.class.php
示例18: clearCache
/**
* Clears the super cache by listening to the task.cache.clear event.
*
* @param sfEvent An sfEvent instance
*/
public static function clearCache(sfEvent $event)
{
$config = sfFilterConfigHandler::getConfiguration($event['app']->getConfigPaths('config/filters.yml'));
$event->getSubject()->logSection('cache', 'Clearing super cache');
// find super cache configuration
$found = false;
$cacheDir = 'cache';
foreach ($config as $value) {
if ('sfSuperCacheFilter' == $value['class']) {
$found = true;
if (isset($value['param']['cache_dir'])) {
$cacheDir = $value['param']['cache_dir'];
}
break;
}
}
if ($found) {
// clear the cache
$cacheDir = sfConfig::get('sf_web_dir') . '/' . $cacheDir;
if (is_dir($cacheDir)) {
// remove cache files
$event->getSubject()->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in($cacheDir));
}
}
}
开发者ID:GustavoAdolfo,项目名称:cmais-frontend-2,代码行数:30,代码来源:sfSuperCache.class.php
示例19: testFolderCorrelations
public function testFolderCorrelations(lime_test $t)
{
$t->diag('Verify that each db folder exist in fs');
$errors = 0;
foreach ($this->folderTable->findAll() as $f) {
if (!is_dir($f->fullPath)) {
$t->diag(sprintf('folder %s does not exist in fs', $f));
$errors++;
}
}
$t->is($errors, 0, 'Each db folder exist in fs');
if ($errors > 0) {
die;
}
$t->diag('Verify that each fs folder exist in db');
$errors = 0;
foreach (sfFinder::type('dir')->discard(".*")->ignore_version_control()->maxdepth(20)->in($this->folderTable->getTree()->fetchRoot()->fullPath) as $f) {
if (strpos($f, '/.')) {
continue;
}
$f = dmOs::normalize($f);
$f = str_replace(dmOs::normalize(sfConfig::get('sf_upload_dir')) . '/', '', $f);
if (!$this->folderTable->createQuery('f')->where('f.rel_path = ?', $f)->exists()) {
$t->diag(sprintf('folder %s does not exist in db', $f));
$errors++;
}
}
$t->is($errors, 0, 'Each fs folder exist in db');
}
开发者ID:theolymp,项目名称:diem,代码行数:29,代码来源:dmMediaUnitTestHelper.php
示例20: extract
/**
* @see sfI18nExtract
*/
public function extract()
{
foreach (sfFinder::type('dir')->maxdepth(0)->relative()->in($this->parameters['path'] . '/modules') as $moduleName) {
$this->extractFromPhpFiles(array($this->parameters['path'] . '/modules/' . $moduleName . '/actions', $this->parameters['path'] . '/modules/' . $moduleName . '/lib', $this->parameters['path'] . '/modules/' . $moduleName . '/templates'));
}
$this->extractFromPhpFiles($this->parameters['path'] . '/lib');
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:10,代码来源:sfI18nPluginExtract.class.php
注:本文中的sfFinder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论