本文整理汇总了PHP中sfFilesystem类的典型用法代码示例。如果您正苦于以下问题:PHP sfFilesystem类的具体用法?PHP sfFilesystem怎么用?PHP sfFilesystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfFilesystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
$this->logSection('Create directory', "Visiteur");
$q = Doctrine_Query::create()->from('Visiteur v');
$visiteurs = $q->execute();
foreach ($visiteurs as $visiteur) {
$visiteur->createDataFolder();
}
$this->logSection('Create directory', "Interactif");
$q = Doctrine_Query::create()->from('Interactif i');
$interactifs = $q->execute();
foreach ($interactifs as $interactif) {
$interactif->createDataFolder();
}
$this->logSection('Create directory', "Exposition");
$q = Doctrine_Query::create()->from('Exposition v');
$expositions = $q->execute();
foreach ($expositions as $exposition) {
$exposition->createDataFolder();
}
$this->logSection('Create directory', "Medaille");
$fileSystem = new sfFilesystem();
$fileSystem->mkdirs(sfConfig::get('sf_web_dir') . "/medaille");
$this->logSection('Create directory', "MedailleType");
$fileSystem = new sfFilesystem();
$fileSystem->mkdirs(sfConfig::get('sf_web_dir') . "/medaille_type");
}
开发者ID:pmoutet,项目名称:navinum,代码行数:30,代码来源:createUserMediaTask.class.php
示例2: 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
示例3: createDataFolder
public function createDataFolder()
{
$fileSystem = new sfFilesystem();
$oldumask = umask(0);
$fileSystem->mkdirs($this->getExpositionDataPath(), 0777);
$fileSystem->chmod($this->getExpositionDataPath(), 0777);
umask($oldumask);
}
开发者ID:pmoutet,项目名称:navinum,代码行数:8,代码来源:Exposition.class.php
示例4: installPluginAssets
/**
* Installs web content for a plugin.
*
* @param string $plugin The plugin name
* @param string $dir The plugin directory
*/
protected function installPluginAssets($plugin, $dir)
{
$webDir = $dir . DIRECTORY_SEPARATOR . 'web';
if (is_dir($webDir)) {
$filesystem = new sfFilesystem();
$filesystem->relativeSymlink($webDir, sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $plugin, true);
}
}
开发者ID:yasirgit,项目名称:afids,代码行数:14,代码来源:sfPluginPublishAssetsTask.class.php
示例5: 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
示例6: listenToClearCache
/**
* Clear dynamics folder cache.
*/
static function listenToClearCache(sfEvent $event)
{
$dymanics_cache_path = sfConfig::get('sf_web_dir') . '/dynamics';
if (file_exists($dymanics_cache_path)) {
$filesystem = new sfFilesystem(new sfEventDispatcher(), new sfFormatter());
$filesystem->remove(sfFinder::type('file')->discard('.sf')->in($dymanics_cache_path));
}
}
开发者ID:hartym,项目名称:php-dynamics,代码行数:11,代码来源:sfDynamicsSymfonyCacheAdapter.class.php
示例7: installPluginAssets
protected function installPluginAssets($name, $path)
{
$webDir = $path . '/web';
if (is_dir($webDir)) {
$filesystem = new sfFilesystem();
$filesystem->relativeSymlink($webDir, sfConfig::get('sf_web_dir') . '/' . $name, true);
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:8,代码来源:pluginsAction.class.php
示例8: delete
public function delete(Doctrine_Connection $conn = null)
{
parent::delete($conn);
$path = $this->getChartPath('system');
if (file_exists($path)) {
$fs = new sfFilesystem(new sfEventDispatcher());
$fs->remove($path);
}
}
开发者ID:rbolliger,项目名称:otokou,代码行数:9,代码来源:Chart.class.php
示例9: save
public function save()
{
Doctrine::getTable('SnsConfig')->set('customizing_css', $this->getValue('css'));
$filesystem = new sfFilesystem();
$cssPath = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'customizing.css';
if (is_file($cssPath)) {
@$filesystem->remove($cssPath);
}
}
开发者ID:te-koyama,项目名称:openpne,代码行数:9,代码来源:opCustomCssForm.class.php
示例10: execute
public static function execute($arguments = array(), $options = array())
{
$app = $arguments['application'];
$module = $arguments['module'];
$action = $arguments['action'];
$process = $arguments['process'];
$activity = $arguments['activity'];
$scripts = $arguments['scripts'];
// Fuerzo el cero (0) si no contiene valor
if (!$activity['is_autocomplete']) {
$activity['is_autocomplete'] = '0';
}
$actionDir = sfConfig::get('sf_apps_dir') . '/' . $app . '/modules/' . $module . '/actions';
$templateDir = sfConfig::get('sf_apps_dir') . '/' . $app . '/modules/' . $module . '/templates';
$actionFile = $action . 'Action.class.php';
$templateFile = $action . 'Success.php';
$errorFile = $action . 'Error.php';
$filesystem = new sfFilesystem();
if (!is_dir($actionDir)) {
throw new sfCommandException(sprintf("No se pudo identificar el modulo symfony '%s' implementacion del paquete '%s'", $actionDir, $module));
}
if (is_file($actionDir . '/' . $actionFile)) {
// Borro el archivo porque lo voy a recrear
$filesystem->remove($actionDir . '/' . $actionFile);
//throw new sfCommandException(sprintf('The action "%s" already exists.', $actionFile));
}
if (is_file($templateDir . '/' . $templateFile)) {
// Borro el archivo porque lo voy a recrear
$filesystem->remove($templateDir . '/' . $templateFile);
//throw new sfCommandException(sprintf('The template "%s" already exists.', $templateFile));
}
// Activity Type determine skeleton
if ($activity['type'] == 'StartEvent') {
$skeletonAction = dirname(__FILE__) . '/../../data/generator/skeleton/psdfActivity/startAction.class.php';
} elseif ($activity['type'] == 'EndEvent') {
$skeletonAction = dirname(__FILE__) . '/../../data/generator/skeleton/psdfActivity/endAction.class.php';
} elseif ($activity['type'] == 'TaskUser' or $activity['type'] == 'TaskManual') {
$skeletonAction = dirname(__FILE__) . '/../../data/generator/skeleton/psdfActivity/activityUserAction.class.php';
$skeletonTemplate = dirname(__FILE__) . '/../../data/generator/skeleton/psdfActivity/activityUserSuccess.php';
$skeletonError = dirname(__FILE__) . '/../../data/generator/skeleton/psdfActivity/activityUserError.php';
} else {
$skeletonAction = dirname(__FILE__) . '/../../data/generator/skeleton/psdfActivity/activityAction.class.php';
}
// create basic action
$filesystem->copy($skeletonAction, $actionDir . '/' . $actionFile);
// customize action
$constants = array('ACTIVITY' => $action, 'ACTIVITY_NAME' => $activity['name'], 'MODULE' => $module, 'PROCESS_ID' => $process['id'], 'PROCESS_NAME' => $process['name'], 'SET_DATAFIELDS' => $scripts['set_datafields'], 'PTN_NAME' => $scripts['ptn_name'], 'PTN_SET_PARAMS' => $scripts['ptn_set_params'], 'PTN_URL_TEMPLATE' => file_exists($scripts['ptn_url_template']) ? file_get_contents($scripts['ptn_url_template']) : '', 'RULES_NEXT' => $scripts['rules_next'], 'ACTIVITY_AUTOCOMPLETE' => $activity['is_autocomplete']);
$finder = sfFinder::type('file')->name($actionFile);
$filesystem->replaceTokens($finder->in($actionDir), '##', '##', $constants);
// Personalize template Success y Error
if ($activity['type'] == 'TaskUser' or $activity['type'] == 'TaskManual') {
$filesystem->copy($skeletonTemplate, $templateDir . '/' . $templateFile);
$finder = sfFinder::type('file')->name($templateFile);
$filesystem->replaceTokens($finder->in($templateDir), '##', '##', $constants);
$filesystem->copy($skeletonError, $templateDir . '/' . $errorFile);
$finder = sfFinder::type('file')->name($errorFile);
$filesystem->replaceTokens($finder->in($templateDir), '##', '##', $constants);
}
}
开发者ID:psdf,项目名称:psdfCorePlugin,代码行数:59,代码来源:psdfGenerateActivity.class.php
示例11: replaceTokens
/**
*
*/
protected function replaceTokens($file)
{
$properties = parse_ini_file(sfConfig::get('sf_config_dir') . '/properties.ini', true);
$constants = array('PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here', 'PACKAGE_NAME' => !is_null($this->package) ? $this->package : 'package name');
if (!is_readable($file)) {
throw new sfCommandException("Failed to replace tokens as file is not accessible.");
}
// customize service file
$sfFilesystem = new sfFilesystem();
$sfFilesystem->replaceTokens($file, '##', '##', $constants);
}
开发者ID:rande,项目名称:sfAmfPlugin,代码行数:14,代码来源:sfAmfPluginGenerator.class.php
示例12: delete
public function delete(Doctrine_Connection $conn = null)
{
$guid = $this->getGuid();
parent::delete($conn);
$delete_log = new DeleteLog();
$delete_log->setGuid($guid);
$delete_log->setModelName(get_class($this));
$delete_log->save();
$fileSystem = new sfFilesystem();
@$fileSystem->remove($this->getInteractifDataPath());
}
开发者ID:pmoutet,项目名称:navinum,代码行数:11,代码来源:Interactif.class.php
示例13: 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
示例14: execute
public function execute($request)
{
$css = Doctrine::getTable('SnsConfig')->get('customizing_css');
$this->getResponse()->setContent($css);
$this->getResponse()->setContentType('text/css');
// cache
$filesystem = new sfFilesystem();
$dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'css';
@$filesystem->mkdirs($dir);
file_put_contents($dir . DIRECTORY_SEPARATOR . 'customizing.css', $css);
return sfView::NONE;
}
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:12,代码来源:customizingCssAction.class.php
示例15: uninstallModelFiles
public function uninstallModelFiles($plugin)
{
$filesystem = new sfFilesystem();
$baseDir = sfConfig::get('sf_lib_dir');
$subpackages = array('model', 'form', 'filter');
foreach ($subpackages as $subpackage) {
$targetDir = $baseDir . DIRECTORY_SEPARATOR . $subpackage . DIRECTORY_SEPARATOR . 'doctrine' . DIRECTORY_SEPARATOR . $plugin;
if (is_dir($targetDir)) {
$filesystem->remove(sfFinder::type('any')->in($targetDir));
$filesystem->remove($targetDir);
}
}
}
开发者ID:phenom,项目名称:OpenPNE3,代码行数:13,代码来源:opPluginManager.class.php
示例16: uninstallWebContent
/**
* Unnstalls web content for a plugin.
*
* @param string $plugin The plugin name
*/
public function uninstallWebContent($plugin)
{
$targetDir = $this->environment->getOption('web_dir') . DIRECTORY_SEPARATOR . $plugin;
if (is_dir($targetDir)) {
$this->dispatcher->notify(new sfEvent($this, 'application.log', array('Uninstalling web data for plugin')));
$filesystem = new sfFilesystem();
if (is_link($targetDir)) {
$filesystem->remove($targetDir);
} else {
$filesystem->remove(sfFinder::type('any')->in($targetDir));
$filesystem->remove($targetDir);
}
}
}
开发者ID:cuongnv540,项目名称:jobeet,代码行数:19,代码来源:sfSymfonyPluginManager.class.php
示例17: cacheCss
public static function cacheCss($event, $content)
{
$lastEntry = sfContext::getInstance()->getActionStack()->getLastEntry();
if (!$lastEntry) {
return $content;
}
if ('opSkinClassicPlugin' === $lastEntry->getModuleName() && 'css' === $lastEntry->getActionName()) {
$filesystem = new sfFilesystem();
$dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'css';
@$filesystem->mkdirs($dir);
file_put_contents($dir . DIRECTORY_SEPARATOR . opSkinClassicConfig::getCurrentTheme() . '.css', $content);
}
return $content;
}
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:14,代码来源:opSkinClassicObserver.class.php
示例18: createDataFolder
public function createDataFolder($dir = "")
{
$fileSystem = new sfFilesystem();
$oldumask = umask(0);
$fileSystem->mkdirs($this->getGroupeVisiteurDataPath(), 0755);
$fileSystem->chmod($this->getGroupeVisiteurDataPath(), 0755);
umask($oldumask);
if ($dir != '') {
$oldumask = umask(0);
$fileSystem->mkdirs($this->getGroupeVisiteurDataPath() . '/' . $dir, 0755);
$fileSystem->chmod($this->getGroupeVisiteurDataPath() . '/' . $dir, 0755);
umask($oldumask);
}
}
开发者ID:pmoutet,项目名称:navinum,代码行数:14,代码来源:RfidGroupeVisiteur.class.php
示例19: execute
protected function execute($arguments = array(), $options = array())
{
if (!extension_loaded('openssl')) {
throw Exception('this task requires the openssl php extension, see http://www.php.net/openssl');
}
$days = null;
while (!is_numeric($days)) {
$days = $this->ask('The Days of Validity (default:365)');
if (!$days) {
$days = 365;
}
}
while (!($phrase = $this->ask('Private Key Phrase'))) {
}
$country = null;
while (!($country = strtoupper($this->ask('Country Name (2 letter code)'))) || strlen($country) != 2) {
$this->logBlock('invalid format.', 'ERROR');
}
while (!($state = $this->ask('State or Province Name (full name)'))) {
}
while (!($locality = $this->ask('Locality Name (eg,city)'))) {
}
while (!($org = $this->ask('Organization Name(eg,company)'))) {
}
while (!($orgUnit = $this->ask('Organization Unit Name(eg,section)'))) {
}
while (!($common = $this->ask('Common Name(eg,Your name)'))) {
}
while (!($email = $this->ask('Email Address'))) {
}
$dn = array('countryName' => $country, 'stateOrProvinceName' => $state, 'localityName' => $locality, 'organizationName' => $org, 'organizationalUnitName' => $orgUnit, 'commonName' => $common, 'emailAddress' => $email);
$dirname = sfConfig::get('sf_plugins_dir') . '/opOpenSocialPlugin/certs';
$filesystem = new sfFilesystem($this->dispatcher, $this->formatter);
$filesystem->mkdirs($dirname);
$privatekey = openssl_pkey_new();
$csr = openssl_csr_new($dn, $privatekey);
$sscert = openssl_csr_sign($csr, null, $privatekey, $days);
openssl_x509_export($sscert, $certout);
openssl_pkey_export($privatekey, $pkeyout, $phrase);
$cert_filename = $dirname . '/public.crt';
file_put_contents($cert_filename, $certout);
$this->logSection('file+', $cert_filename);
$pkey_filename = $dirname . '/private.key';
file_put_contents($pkey_filename, $pkeyout);
$this->logSection('file+', $pkey_filename);
$databaseManager = new sfDatabaseManager($this->configuration);
Doctrine::getTable('SnsConfig')->set('shindig_private_key_phrase', $phrase);
}
开发者ID:niryuu,项目名称:opOpenSocialPlugin,代码行数:48,代码来源:opOpenSocialGeneratekeyTask.class.php
示例20: execute
public function execute($request)
{
$css = Doctrine::getTable('SnsConfig')->get('customizing_css', '');
$this->getResponse()->setContent($css);
$this->getResponse()->setContentType('text/css');
// cache
$filesystem = new sfFilesystem();
$dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'css';
@$filesystem->mkdirs($dir);
$filesystem->chmod($dir, 0777);
$cssPath = $dir . DIRECTORY_SEPARATOR . 'customizing.css';
file_put_contents($cssPath, $css);
$filesystem->chmod($cssPath, 0666);
$this->getResponse()->setHttpHeader('Last-Modified', sfWebResponse::getDate(time()));
return sfView::NONE;
}
开发者ID:te-koyama,项目名称:openpne,代码行数:16,代码来源:customizingCssAction.class.php
注:本文中的sfFilesystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论