本文整理汇总了PHP中Symfony\Component\Filesystem\Filesystem::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::remove方法的具体用法?PHP Filesystem::remove怎么用?PHP Filesystem::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Filesystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanup
/**
* {@inheritDoc}
*/
public function cleanup()
{
if (!is_null($this->path) && $this->path !== '/') {
$this->filesystem->remove($this->path);
$this->path = null;
}
}
示例2: tearDownTestProject
protected function tearDownTestProject()
{
$projectDir = self::ProjectDir();
if (self::$fs->exists($projectDir)) {
self::$fs->remove($projectDir);
}
}
示例3: clear
/**
* {@inheritdoc}
*/
public function clear($cacheDir)
{
$this->filesystem->remove($cacheDir . '/contao/config');
$this->filesystem->remove($cacheDir . '/contao/dca');
$this->filesystem->remove($cacheDir . '/contao/languages');
$this->filesystem->remove($cacheDir . '/contao/sql');
}
示例4: tearDown
protected function tearDown()
{
if (PHP_VERSION_ID < 50400) {
return;
}
$this->filesystem->remove($this->directory);
}
示例5: tearDown
public function tearDown()
{
// Delete local files
$finder = new Finder();
$fs = new Filesystem();
$fs->remove($finder->files()->in($this->tmpDir . "/download"));
$fs->remove($finder->files()->in($this->tmpDir));
$fs->remove($this->tmpDir . "/download");
$fs->remove($this->tmpDir);
// Delete file uploads
$options = new ListFilesOptions();
$options->setTags(["docker-bundle-test"]);
$files = $this->client->listFiles($options);
foreach ($files as $file) {
$this->client->deleteFile($file["id"]);
}
if ($this->client->bucketExists("in.c-docker-test")) {
// Delete tables
foreach ($this->client->listTables("in.c-docker-test") as $table) {
$this->client->dropTable($table["id"]);
}
// Delete bucket
$this->client->dropBucket("in.c-docker-test");
}
if ($this->client->bucketExists("in.c-docker-test-redshift")) {
// Delete tables
foreach ($this->client->listTables("in.c-docker-test-redshift") as $table) {
$this->client->dropTable($table["id"]);
}
// Delete bucket
$this->client->dropBucket("in.c-docker-test-redshift");
}
}
示例6: testBeforeSendPerformedWithInvalidPrivateKey
/**
* @expectedException \Sonatra\Bundle\MailerBundle\Exception\RuntimeException
* @expectedExceptionMessageRegExp /Impossible to read the private key of the DKIM swiftmailer signer "([\w.~:\\\/]+)\/private_key"/
*/
public function testBeforeSendPerformedWithInvalidPrivateKey()
{
$path = $this->cache . '/private_key';
$this->fs->remove($path);
$this->message->expects($this->never())->method('attachSigner');
$this->plugin->beforeSendPerformed($this->event);
}
示例7: tearDown
protected function tearDown()
{
parent::tearDown();
$filesystem = new Filesystem();
$filesystem->remove($this->getRootCacheDirectory());
$filesystem->remove($this->builder->buildPrefix());
}
示例8: tearDown
protected function tearDown()
{
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
return;
}
$this->filesystem->remove($this->directory);
}
示例9: publish
/**
* @param string $targetPath
* @param string $installPath
* @param array $map
* @param bool $isSymlink
* @param bool $isRelative
*
* @throws IOException
* @throws \InvalidArgumentException
*
* @api
*
* @quality:method [B]
*/
public function publish($targetPath, $installPath, array $map, $isSymlink, $isRelative)
{
$targetPath = rtrim($targetPath, '/');
$installPath = rtrim($installPath, '/');
$this->filesystem->mkdir($targetPath, 0777);
foreach ($map as $from => $to) {
$targetDir = realpath($targetPath) . '/' . $to;
$sourceDir = realpath($installPath) . '/' . $from;
$this->filesystem->remove($targetDir);
if ($isSymlink) {
$this->io->write(sprintf('Trying to install AdminLTE %s assets as symbolic links.', $from));
$originDir = $sourceDir;
if ($isRelative) {
$originDir = $this->filesystem->makePathRelative($sourceDir, realpath($targetPath));
}
try {
$this->filesystem->symlink($originDir, $targetDir);
$this->io->write(sprintf('The AdminLTE %s assets were installed using symbolic links.', $from));
} catch (IOException $e) {
$this->hardCopy($sourceDir, $targetDir);
$this->io->write(sprintf('It looks like your system doesn\'t support symbolic links,
so the AdminLTE %s assets were installed by copying them.', $from));
}
} else {
$this->io->write(sprintf('Installing AdminLTE %s assets as <comment>hard copies</comment>.', $from));
$this->hardCopy($sourceDir, $targetDir);
}
}
}
示例10: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$fs = new Filesystem();
$fs->remove($this->cacheDirectory . '/app');
$fs->remove($this->cacheDirectory . '/github');
$output->writeln('Caches cleared');
}
示例11: create
/**
* @param Attachment $attachment
* @param array $dimensionIds
*
* @return ImageInstance
*/
public function create(Attachment $attachment, DimensionContainer $dimensionContainer)
{
$validate = $this->constraints->getConstraints($attachment, $dimensionContainer);
if ($validate) {
$fs = new Filesystem();
$fs->remove(sprintf('%s/%s', $this->tempPath, $attachment->getFile()));
$fs->remove(sprintf('%s/%s', $this->uploadPath, $attachment->getFile()));
$this->objectManager->remove($attachment);
$this->objectManager->flush();
return $validate;
}
$instance = new ImageInstance();
$instance->setName($attachment->getName());
$this->objectManager->persist($instance);
foreach ($dimensionContainer->getDimensions() as $dimension) {
$cropping = new ImageCropping();
$cropping->setAttachment($attachment);
$cropping->setInstance($instance);
$cropping->setDimension($dimension);
$cropping->setName($attachment->getName());
$this->objectManager->persist($cropping);
}
$this->objectManager->flush();
return $instance;
}
示例12: deploy
/**
*
* @param Project $project
* @return string
* @throws DeployException
*/
public function deploy(Project $project)
{
$path = sys_get_temp_dir() . '/AwesomeDeployer';
$this->filesystem->mkdir($path);
chdir($path);
$process = new Process('git clone ' . $project->getRepo() . ' project');
$process->mustRun();
$out = $process->getOutput();
$pathProject = $path . '/project';
chdir($pathProject);
$script = $project->getScript();
if ($script !== null) {
$script = new Process($script);
$script->mustRun();
$out .= $script->getOutput();
}
switch ($project->getStrategy()) {
case Project::STRATEGY_FABRIC:
$command = $project->getCommand();
break;
default:
throw new DeployException('Strategy not supported');
}
$deployment = new Process($command);
$deployment->mustRun();
$this->filesystem->remove($path);
$out .= $deployment->getOutput();
return $out;
}
示例13: setUp
protected function setUp()
{
$this->previousCurrentDir = getcwd();
chdir(__DIR__);
$fs = new Filesystem();
if ($fs->exists(static::$cacheDir)) {
$fs->remove(static::$cacheDir);
}
if ($fs->exists(static::$dumpDir)) {
$fs->remove(static::$dumpDir);
}
$app = new Application();
$app->register(new ValidatorServiceProvider());
$app['validator.mapping.class_metadata_factory'] = new ClassMetadataFactory(new YamlFilesLoader([static::$originalConfigDir . '/validation.yml']));
//custom providers and services
$app['fakery.faker.config'] = $app->share(function ($app) {
return new FakerConfig(static::$configDir, 'faker.yml', static::$cacheDir . '/cache/', true);
});
$app['fakery.config_serializer'] = $app->share(function ($app) {
return new ConfigSerializer(static::$cacheDir . '/cache/', static::$configDir, true);
});
$app['fakery.dumper_manager'] = $app->share(function ($app) {
return new DumpManager($app['fakery.config_serializer']);
});
$app['fakery.console_dumper_manager'] = $app->share(function ($app) {
return new ConsoleDumpManager($app['fakery.config_serializer']);
});
$this->silex = $app;
}
示例14: tearDown
/**
* {@inheritdoc}
*/
public function tearDown()
{
$fs = new Filesystem();
$fs->remove($this->getRootDir() . '/system/logs');
$fs->remove($this->getRootDir() . '/system/themes');
$fs->remove($this->getRootDir() . '/web');
}
示例15: clear
/**
* キャッシュを削除する.
*
* doctrine, profiler, twig によって生成されたキャッシュディレクトリを削除する.
* キャッシュは $app['config']['root_dir'].'/app/cache' に生成されます.
*
* @param Application $app
* @param boolean $isAll .gitkeep を残してすべてのファイル・ディレクトリを削除する場合 true, 各ディレクトリのみを削除する場合 false
* @param boolean $isTwig Twigキャッシュファイルのみ削除する場合 true
* @return boolean 削除に成功した場合 true
*/
public static function clear($app, $isAll, $isTwig = false)
{
$cacheDir = $app['config']['root_dir'] . '/app/cache';
$filesystem = new Filesystem();
if ($isAll) {
$finder = Finder::create()->in($cacheDir)->notName('.gitkeep');
$filesystem->remove($finder);
} elseif ($isTwig) {
if (is_dir($cacheDir . '/twig')) {
$finder = Finder::create()->in($cacheDir . '/twig');
$filesystem->remove($finder);
}
} else {
if (is_dir($cacheDir . '/doctrine')) {
$finder = Finder::create()->in($cacheDir . '/doctrine');
$filesystem->remove($finder);
}
if (is_dir($cacheDir . '/profiler')) {
$finder = Finder::create()->in($cacheDir . '/profiler');
$filesystem->remove($finder);
}
if (is_dir($cacheDir . '/twig')) {
$finder = Finder::create()->in($cacheDir . '/twig');
$filesystem->remove($finder);
}
}
return true;
}