Subversion Repositories Applications.framework

Rev

Rev 299 | Rev 431 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 299 Rev 419
Line 14... Line 14...
14
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org> 
14
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org> 
15
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
15
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
16
 * @license	http://framework.zend.com/license/new-bsd Licence New BSD
16
 * @license	http://framework.zend.com/license/new-bsd Licence New BSD
17
 * @license	http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
17
 * @license	http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
18
 * @license	http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
18
 * @license	http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
19
 * @version	$Id: CacheSimple.php 299 2011-01-18 14:03:46Z jpm $
19
 * @version	$Id: CacheSimple.php 419 2012-09-06 13:24:12Z aurelien $
20
 * @link		/doc/framework/
20
 * @link		/doc/framework/
21
 */
21
 */
22
class CacheSimple {
22
class CacheSimple {
Line 23... Line 23...
23
	
23
	
Line 77... Line 77...
77
	 */
77
	 */
78
	public function sauver($contenu, $id) {
78
	public function sauver($contenu, $id) {
79
		$ok = false;
79
		$ok = false;
80
		if ($this->mise_en_cache) {
80
		if ($this->mise_en_cache) {
81
			$chemin_fichier_cache = $this->stockage_chemin.DS.$id.'.txt';
81
			$chemin_fichier_cache = $this->stockage_chemin.DS.$id.'.txt';
82
		
-
 
83
			if (!file_exists($chemin_fichier_cache) || (time() - @filemtime($chemin_fichier_cache) > $this->duree_de_vie)) {
82
			if (!file_exists($chemin_fichier_cache) || (time() - @filemtime($chemin_fichier_cache) > $this->duree_de_vie)) {
-
 
83
				$dossier_fichier_cache = dirname($chemin_fichier_cache);
-
 
84
				if (!is_dir($dossier_fichier_cache))
-
 
85
				{
-
 
86
					mkdir($dossier_fichier_cache, 0755, true);
-
 
87
				}
-
 
88
				
84
				$fh = fopen($chemin_fichier_cache,'w+');
89
				$fh = fopen($chemin_fichier_cache,'w+');
85
				if ($fh) {
90
				if ($fh) {
86
					if (fwrite($fh, $contenu)) {
91
					if (fwrite($fh, $contenu)) {
87
						if (fclose($fh)) {
92
						if (fclose($fh)) {
88
							$ok = true;
93
							$ok = true;