Skip to content

Commit

Permalink
updated bootstrap.php
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Aug 14, 2010
1 parent 6461e27 commit c139fd6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/Symfony/Framework/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public function shutdown();
public function setContainer(ContainerInterface $container); }
namespace Symfony\Framework;
use Symfony\Framework\Bundle\Bundle;
use Symfony\Framework\ClassCollectionLoader;
class KernelBundle extends Bundle {
public function boot() {
if ($this->container->has('error_handler')) {
Expand Down Expand Up @@ -138,7 +137,11 @@ public function handle($level, $message, $file, $line, $context) {
return false; } }
namespace Symfony\Framework;
class ClassCollectionLoader {
static protected $loaded;
static public function load($classes, $cacheDir, $name, $autoReload) {
if (isset(self::$loaded[$name])) {
return; }
self::$loaded[$name] = true;
$classes = array_unique($classes);
$cache = $cacheDir.'/'.$name.'.php';
$reload = false;
Expand Down Expand Up @@ -172,15 +175,10 @@ static public function load($classes, $cacheDir, $name, $autoReload) {
self::writeCacheFile($metadata, serialize(array($files, $classes))); } }
static protected function writeCacheFile($file, $content) {
$tmpFile = tempnam(dirname($file), basename($file));
if (!$fp = @fopen($tmpFile, 'wb')) {
die(sprintf('Failed to write cache file "%s".', $tmpFile)); }
@fwrite($fp, $content);
@fclose($fp);
if ($content != file_get_contents($tmpFile)) {
die(sprintf('Failed to write cache file "%s" (cache corrupted).', $tmpFile)); }
if (!@rename($tmpFile, $file)) {
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file)); }
chmod($file, 0644); } }
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
chmod($file, 0644);
return; }
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file)); } }
namespace Symfony\Framework;
use Symfony\Components\EventDispatcher\EventDispatcher as BaseEventDispatcher;
use Symfony\Components\EventDispatcher\Event;
Expand Down

0 comments on commit c139fd6

Please sign in to comment.