Skip to content

Commit

Permalink
[HttpKernel] fixed file storage for the profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Nov 7, 2011
1 parent ae154c8 commit 47fca8e
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -129,7 +129,6 @@ public function read($token)
public function write(Profile $profile)
{
$file = $this->getFilename($profile->getToken());
$exists = file_exists($file);

// Create directory
$dir = dirname($file);
Expand All @@ -150,7 +149,10 @@ public function write(Profile $profile)
file_put_contents($file, serialize($data));

// Add to index
$file = fopen($this->getIndexFilename(), 'a');
if (false === $file = fopen($this->getIndexFilename(), 'w')) {
return false;
}

fputcsv($file, array(
$profile->getToken(),
$profile->getIp(),
Expand All @@ -160,7 +162,7 @@ public function write(Profile $profile)
));
fclose($file);

return !$exists;
return true;
}

/**
Expand Down

0 comments on commit 47fca8e

Please sign in to comment.