本文整理汇总了PHP中sfFilesystem::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP sfFilesystem::remove方法的具体用法?PHP sfFilesystem::remove怎么用?PHP sfFilesystem::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfFilesystem
的用法示例。
在下文中一共展示了sfFilesystem::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: cleanup
public function cleanup(sfFilesystem $filesystem)
{
sfToolkit::clearDirectory(sfConfig::get('sf_log_dir'));
sfToolkit::clearDirectory(dmOs::join(sfConfig::get('sf_web_dir'), 'cache'));
sfToolkit::clearDirectory(dmOs::join(sfConfig::get('sf_root_dir'), 'cache'));
sfToolkit::clearDirectory(sfConfig::get('sf_web_dir') . '/themeAdmin');
$filesystem->remove(sfFinder::type('any')->not_name('*.sqlite')->in(sfConfig::get('sf_data_dir')));
$filesystem->remove(sfFinder::type('file')->name('sitemap*')->in(sfConfig::get('sf_web_dir')));
copy(dmOs::join(sfConfig::get('sf_data_dir'), 'fresh_db.sqlite'), dmOs::join(sfConfig::get('sf_data_dir'), 'db.sqlite'));
$this->cleanupUploads($filesystem);
$this->removeWebSymlinks();
}
示例3: 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);
}
}
}
示例4: 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);
}
}
}
示例5: 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));
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: 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());
}
示例9: _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);
}
}
}
}
示例10: writeCacheFile
public static function writeCacheFile($pathToCacheFile, $content)
{
$filesystem = new sfFilesystem();
$currentUmask = umask();
umask(00);
$tmpFile = tempnam(dirname($pathToCacheFile), basename($pathToCacheFile));
if (!($fp = @fopen($tmpFile, 'wb'))) {
throw new sfCacheException('Failed to write cache file.');
}
@fwrite($fp, $content);
@fclose($fp);
if (!@rename($tmpFile, $pathToCacheFile)) {
if ($filesystem->copy($tmpFile, $pathToCacheFile, array('override' => true))) {
$filesystem->remove($tmpFile);
}
}
$filesystem->chmod($pathToCacheFile, 0666);
umask($currentUmask);
}
示例11: clearWebCache
public function clearWebCache($params = array())
{
$dir = sfConfig::get('sf_web_dir') . '/cache/';
if (is_dir($dir)) {
$filesystem = new sfFilesystem();
@$filesystem->remove(sfFinder::type('any')->in($dir));
}
}
示例12: unpublishAsset
/**
* Publishes Web Assets for third party themes. Originally written to be used
* in tasks only, readapted to be used in whole application
*
* @author Yevgeniy Viktorov <wik@osmonitoring.com>
* Giansimon Diblas <giansimon.diblas@w3studiocms.com>
*
* @param Array
* @param Array
*
* @return Array - Contain the description of the generated assets publishing events
*
*/
public function unpublishAsset($param, $filesystem = null)
{
$result = '';
$theme = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $param;
if (is_dir($theme)) {
if ($filesystem == null) {
$filesystem = new sfFilesystem();
}
$filesystem->remove($theme);
$result = 'Unpublished assets for ' . $param;
}
return $result;
}
示例13: executeDelete
public function executeDelete(sfWebRequest $request)
{
$request->checkCSRFProtection();
$this->forward404Unless($ad = Doctrine_Core::getTable('Ad')->find(array($request->getParameter('id'))), sprintf('Object ad does not exist (%s).', $request->getParameter('id')));
//Get user Id
$userId = $this->getUser()->getGuardUser()->getId();
//Get company owned by that user
$companyUserId = CompanyTable::getInstance()->findOneByUserId($userId)->getId();
//Get id number sent by the user (never trust the users)
$adId = $request->getParameter('id');
$companyId = AdTable::getInstance()->findOneById($adId)->getCompanyId();
$this->forward404Unless($companyId == $companyUserId, sprintf('Ad does not exist (%s).', $request->getParameter('id')));
//Remove picture from file system.
$fs = new sfFilesystem();
$fs->remove(sfConfig::get('app_default_picture_directory') . $ad->getAdMobileImage());
//Remove ad from database.
$ad->delete();
$this->redirect('ad/index');
}
示例14: importSCMFile
protected function importSCMFile($pear, $memberId, $dir)
{
$filesystem = new sfFilesystem();
$info = $pear->infoFromDescriptionFile($dir . '/package.xml');
if ($info instanceof PEAR_Error) {
throw new RuntimeException($info->message());
}
$filename = sprintf('%s-%s.tgz', $info['name'], $info['version']);
opPluginChannelServerToolkit::generateTarByPluginDir($info, $filename, $dir, sfConfig::get('sf_cache_dir'));
$file = $this->getImportedPluginFile($filename, sfConfig::get('sf_cache_dir') . '/' . $filename);
$release = Doctrine::getTable('PluginRelease')->createByPackageInfo($info, $file, $memberId, file_get_contents($dir . '/package.xml'));
$this->package->PluginRelease[] = $release;
$this->package->save();
$filesystem = new sfFilesystem();
sfToolkit::clearDirectory($dir);
$filesystem->remove($dir);
$filesystem->remove(sfConfig::get('sf_cache_dir') . '/' . $filename);
}
示例15: clearPluginCache
public function clearPluginCache($params = array())
{
$appConfiguration = $params['app'];
$environment = $params['env'];
$subDir = sfConfig::get('sf_cache_dir') . '/' . $appConfiguration->getApplication() . '/' . $environment . '/plugins';
if (is_dir($subDir)) {
$filesystem = new sfFilesystem();
$filesystem->remove(sfFinder::type('any')->discard('.sf')->in($subDir));
}
}