Skip to content

Commit ed861ba

Browse files
committed
Remove unused methods.
The only client of these methods was removed in 669898b.
1 parent 669898b commit ed861ba

File tree

1 file changed

+9
-37
lines changed

1 file changed

+9
-37
lines changed

src/Symfony/Component/Config/Util/CacheFileUtils.php

+9-37
Original file line numberDiff line numberDiff line change
@@ -20,58 +20,30 @@
2020
*/
2121
class CacheFileUtils
2222
{
23-
2423
/**
25-
* Make sure the given directory can be used as a cache directory, creating it if necessary.
26-
* @param string $dir The directory path
27-
* @param string $name An optional name to be used in the exception message in case of failure
28-
* @throws \RuntimeException if the directory cannot be created or written to.
24+
* Dumps content into a file, trying to make it atomically. The directory for the file must exist.
25+
* @param string $filename The file to be written to.
26+
* @param string $content The data to write into the file.
27+
* @throws \RuntimeException If the file cannot be written to.
2928
*/
30-
public static function createCacheDir($dir, $name = null)
29+
public static function dumpInFile($filename, $content)
3130
{
32-
if ($name) {
33-
$name = " ($name)";
34-
}
31+
$dir = dirname($filename);
3532

3633
if (!is_dir($dir)) {
3734
if (false === @mkdir($dir, 0777, true)) {
38-
throw new \RuntimeException(sprintf('Unable to create the %s directory%s\n', $dir, $name));
35+
throw new \RuntimeException(sprintf('Unable to create the %s directory\n', $dir));
3936
}
4037
} elseif (!is_writable($dir)) {
41-
throw new \RuntimeException(sprintf('Unable to write in the %s directory%s\n', $dir, $name));
38+
throw new \RuntimeException(sprintf('Unable to write in the %s directory\n', $dir));
4239
}
43-
}
44-
45-
/**
46-
* Tries to create a writeable directory that can contain a given file.
47-
*
48-
* @param string $filename The file the containing directory has to be created for
49-
* @return string The directory now available for caching
50-
* @throws \RuntimeException If the directory cannot be created or written to
51-
*/
52-
public static function createDirectoryForFile($filename)
53-
{
54-
$dir = dirname($filename);
55-
self::createCacheDir($dir);
56-
return $dir;
57-
}
58-
59-
/**
60-
* Dumps content into a file, trying to make it atomically. The directory for the file must exist.
61-
* @param string $filename The file to be written to.
62-
* @param string $content The data to write into the file.
63-
* @throws \RuntimeException If the file cannot be written to.
64-
*/
65-
public static function dumpInFile($filename, $content)
66-
{
67-
$dir = self::createDirectoryForFile($filename);
6840

6941
$tmpFile = tempnam($dir, basename($filename));
42+
7043
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $filename)) {
7144
@chmod($filename, 0666 & ~umask());
7245
} else {
7346
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $filename));
7447
}
75-
7648
}
7749
}

0 commit comments

Comments
 (0)