equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony package. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
7 * |
|
8 * For the full copyright and license information, please view the LICENSE |
|
9 * file that was distributed with this source code. |
|
10 */ |
|
11 |
|
12 namespace Symfony\Component\HttpKernel\CacheWarmer; |
|
13 |
|
14 /** |
|
15 * |
|
16 * @author Fabien Potencier <fabien@symfony.com> |
|
17 */ |
|
18 abstract class CacheWarmer implements CacheWarmerInterface |
|
19 { |
|
20 protected function writeCacheFile($file, $content) |
|
21 { |
|
22 $tmpFile = tempnam(dirname($file), basename($file)); |
|
23 if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { |
|
24 chmod($file, 0644); |
|
25 |
|
26 return; |
|
27 } |
|
28 |
|
29 throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file)); |
|
30 } |
|
31 } |