本文整理汇总了PHP中FileSystem::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP FileSystem::remove方法的具体用法?PHP FileSystem::remove怎么用?PHP FileSystem::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem
的用法示例。
在下文中一共展示了FileSystem::remove方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear
/**
* Clear destination folder
*/
public function clear()
{
if ($this->files->exists($this->destination)) {
$this->files->remove($this->destination);
}
$this->files->mkdir($this->destination);
}
示例2: clearDrupal
public static function clearDrupal()
{
if (FALSE === is_dir(self::$drupalPath)) {
return;
}
self::$filesystem->chmod(self::$drupalPath, 0777, 00, TRUE);
self::$filesystem->remove(self::$drupalPath);
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln("<error>Be carreful, you might removes files you don't want to. You should backup your files beforehand to be sure everything still works as intended.</error>");
$force = $input->getOption('force');
$container = $this->getContainer();
$fs = new FileSystem();
$helper = $this->getHelper('question');
//Parse the file directory and fetch the other directories
//We should find Workspaces and Users. Workspaces being formatted like "WORKSPACE_[ID]
$fileDir = $container->getParameter('claroline.param.files_directory');
$iterator = new \DirectoryIterator($fileDir);
foreach ($iterator as $pathinfo) {
if ($pathinfo->isDir()) {
$name = $pathinfo->getBasename();
//look for workspaces
if (strpos('_' . $name, 'WORKSPACE')) {
$parts = explode('_', $name);
$id = $parts[1];
$workspace = $container->get('claroline.manager.workspace_manager')->getWorkspaceById($id);
if (!$workspace) {
$continue = false;
if (!$force) {
$question = new ConfirmationQuestion('Do you really want to remove the directory ' . $pathinfo->getPathname() . ' [y/n] y ', true);
$continue = $helper->ask($input, $output, $question);
}
if ($continue || $force) {
$fs->remove($pathinfo->getPathname());
}
}
}
}
}
}
示例4: connect
public function connect(Application $app)
{
// creates a new controller based on the default route
$controllers = $app['controllers_factory'];
$names = [];
foreach ($this->faculty->professors as $professor) {
$names[] = $professor->name;
}
$fs = new FileSystem();
$fs->remove($this->faculty->baseCacheDestination);
$names = '(' . implode('|', $names) . ')';
$faculty = $this->faculty;
$controllers->get('/{processor}/{path}', function (Application $app, $processor, $path) use($faculty) {
$exten = [];
preg_match($faculty->extenstions, $path, $exten);
$exten = ltrim($exten[0], '.');
if (empty($exten)) {
return $app->abort(404);
}
$faculty->process($processor, $path);
$imagePath = $faculty->getLastProcessed()[0];
return $app->sendFile($imagePath, 200, array('Content-Type' => 'image/' . $exten));
})->assert('path', $this->faculty->extenstions);
return $controllers;
}
示例5: cleanupClientSpec
public function cleanupClientSpec()
{
$client = $this->getClient();
$command = 'p4 client -d $client';
$this->executeCommand($command);
$clientSpec = $this->getP4ClientSpec();
$fileSystem = new FileSystem($this->process);
$fileSystem->remove($clientSpec);
}
示例6: onKernelTerminate
/**
* @DI\Observe("kernel.terminate")
*/
public function onKernelTerminate(PostResponseEvent $event)
{
if (count($this->elementsToRemove) > 0) {
$fs = new FileSystem();
foreach ($this->elementsToRemove as $element) {
$fs->remove($element);
}
}
}
示例7: removeModuleFromDisk
public function removeModuleFromDisk($name)
{
$fs = new FileSystem();
try {
$fs->remove(_PS_MODULE_DIR_ . '/' . $name);
return true;
} catch (IOException $e) {
return false;
}
}
示例8: emptyDir
public static function emptyDir($dirPath, $includeDir = false)
{
$fileSystem = new FileSystem();
if (!$fileSystem->exists($dirPath)) {
return;
}
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dirPath, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST) as $path) {
$path->isFile() ? $fileSystem->remove($path->getPathname()) : rmdir($path->getPathname());
}
if ($includeDir) {
rmdir($dirPath);
}
}
示例9: writeConfig
/**
* Write the docker-compose.yml file.
*
* @return bool
*/
public function writeConfig()
{
// Create the app/environment folder
$fs = new FileSystem();
try {
$fs->mkdir($this->getDockerComposePath());
} catch (IOExceptionInterface $e) {
return false;
}
// Create the environments docker-compose file.
$dumper = new Dumper();
try {
$fs->remove($this->getDockerComposePath() . '/docker-compose.yml');
$fs->dumpFile($this->getDockerComposePath() . '/docker-compose.yml', $dumper->dump($this->getDockerComposeArray(), 10));
return true;
} catch (IOExceptionInterface $e) {
return false;
}
}
示例10: tearDown
public function tearDown()
{
$fs = new FileSystem();
$fs->remove($this->tmpDir);
}
示例11: removeTemplate
public function removeTemplate(File $file)
{
$fileName = $file->getBasename();
$extractPath = $this->templateDirectory . DIRECTORY_SEPARATOR . $fileName;
$fs = new FileSystem();
$fs->remove($extractPath);
}
示例12: deleteFile
/**
* @param $file
* @return StandardResponseInterface
*/
public function deleteFile($file)
{
$fullPath = $this->getRealPath($file);
$this->fs->remove($fullPath);
return new StandardResponse();
}
示例13: removeFile
/**
* Remove a file from the filesystem by hash
* @param [string] $relativePath
*/
public function removeFile($relativePath)
{
$this->fileSystem->remove($this->getPath($relativePath));
}
示例14: removeFile
/**
* Remove a file from the file system by hash
* @param string $hash
*/
public function removeFile($hash)
{
$this->fileSystem->remove($this->getPath($hash));
}