file permissions fixing, #8

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@98 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
pzinovkin
2009-06-02 18:05:57 +00:00
parent d40f59fd9e
commit 8a649d983a

View File

@ -69,7 +69,14 @@ final class Cache
{
if ($this->cache_time != 0 && is_writable($this->cache_folder)) {
$this->clearOld(); //очистка старых файлов.
return (bool) file_put_contents($this->cache_file, $data);
// а был-ли кеш?
$exists = file_exists($this->cache_file);
$result = file_put_contents($this->cache_file, $data);
// если не существовал кеш - выставляем корректные права на него.
if ($result && !$exists) {
chmod($this->cache_file, 0664);
}
return (bool)$result;
}
return false;
}