Subversion Repositories Applications.framework

Rev

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

Rev 431 Rev 432
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 431 2013-08-23 13:45:13Z raphael $
19
 * @version	$Id: CacheSimple.php 432 2013-08-30 08:09:26Z raphael $
20
 * @link		/doc/framework/
20
 * @link		/doc/framework/
21
 */
21
 */
22
class CacheSimple {
22
class CacheSimple {
Line 23... Line 23...
23
	
23
	
Line 32... Line 32...
32
	);
32
	);
Line 33... Line 33...
33
	
33
	
34
	public function __construct($options = array()) {
34
	public function __construct($options = array()) {
35
		extract($options);
35
		extract($options);
36
		$this->mise_en_cache = is_bool($mise_en_cache) ? $mise_en_cache : true;
36
		$this->mise_en_cache = is_bool($mise_en_cache) ? $mise_en_cache : true;
-
 
37
 
37
		
38
		// cache inactif
-
 
39
		if (!$this->mise_en_cache) return;
38
		if ($this->mise_en_cache) {
40
 
39
			$this->stockage_chemin = isset($stockage_chemin) ? realpath($stockage_chemin) : Fichier::getDossierTmp();
41
		$this->stockage_chemin = isset($stockage_chemin) ? realpath($stockage_chemin) : Fichier::getDossierTmp();
40
			if(!realpath($stockage_chemin)) {
42
		if(!realpath($stockage_chemin)) {
41
				error_log(sprintf("%s: Attention, realpath(%s) invalide [%s]",
43
			error_log(sprintf("%s: Attention, %s invalide: creation [%s]",
42
								  __FILE__,
44
							  __FILE__,
43
								  $stockage_chemin,
45
							  $stockage_chemin,
44
								  $_SERVER['REQUEST_URI']));
46
							  $_SERVER['REQUEST_URI']));
45
			}
47
 
46
			$this->duree_de_vie = isset($duree_de_vie) ? $duree_de_vie : 3600*24;
48
			mkdir($stockage_chemin, 0755, TRUE);
-
 
49
		}
-
 
50
		if(!realpath($stockage_chemin)) {
-
 
51
			error_log(sprintf("%s: Attention, realpath(%s) invalide [%s]",
-
 
52
							  __FILE__,
-
 
53
							  $stockage_chemin,
-
 
54
							  $_SERVER['REQUEST_URI']));
-
 
55
			return;
-
 
56
		}
-
 
57
		else if(!is_writable(realpath($stockage_chemin))) {
-
 
58
			error_log(sprintf("%s: Attention, realpath(%s) non-inscriptible [%s]",
-
 
59
							  __FILE__,
-
 
60
							  realpath($stockage_chemin),
-
 
61
							  $_SERVER['REQUEST_URI']));
-
 
62
			return;
-
 
63
		}
47
		}
64
		$this->duree_de_vie = isset($duree_de_vie) ? $duree_de_vie : 3600*24;
Line 48... Line 65...
48
	}
65
	}
49
	
66
	
50
	private function initialiserOptionsParConfig() {
67
	private function initialiserOptionsParConfig() {