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 418 2012-09-06 13:23:14Z aurelien $
|
19 |
* @version $Id: CacheSimple.php 435 2013-09-04 14:29:43Z jpm $
|
20 |
* @link /doc/framework/
|
20 |
* @link /doc/framework/
|
21 |
*/
|
21 |
*/
|
- |
|
22 |
// TODO : voir ce qui est le plus pratique : error_log ou le gestionnaire de bogue du framework
|
22 |
class CacheSimple {
|
23 |
class CacheSimple {
|
Line 23... |
Line 24... |
23 |
|
24 |
|
24 |
private $mise_en_cache = null;
|
25 |
private $mise_en_cache = null;
|
25 |
private $stockage_chemin = null;
|
26 |
private $stockage_chemin = null;
|
Line 35... |
Line 36... |
35 |
extract($options);
|
36 |
extract($options);
|
36 |
$this->mise_en_cache = is_bool($mise_en_cache) ? $mise_en_cache : true;
|
37 |
$this->mise_en_cache = is_bool($mise_en_cache) ? $mise_en_cache : true;
|
Line 37... |
Line 38... |
37 |
|
38 |
|
38 |
if ($this->mise_en_cache) {
|
39 |
if ($this->mise_en_cache) {
|
- |
|
40 |
$this->stockage_chemin = isset($stockage_chemin) ? realpath($stockage_chemin) : Fichier::getDossierTmp();
|
- |
|
41 |
if (!realpath($stockage_chemin)) {
|
- |
|
42 |
error_log(sprintf("%s: Attention, %s invalide: creation [%s]",
|
- |
|
43 |
__FILE__,
|
- |
|
44 |
$stockage_chemin,
|
- |
|
45 |
$_SERVER['REQUEST_URI']));
|
- |
|
46 |
mkdir($stockage_chemin, 0755, TRUE);
|
- |
|
47 |
}
|
- |
|
48 |
if (!realpath($stockage_chemin)) {
|
- |
|
49 |
error_log(sprintf("%s: Attention, realpath(%s) invalide [%s]",
|
- |
|
50 |
__FILE__,
|
- |
|
51 |
$stockage_chemin,
|
- |
|
52 |
$_SERVER['REQUEST_URI']));
|
- |
|
53 |
} else if(!is_writable(realpath($stockage_chemin))) {
|
- |
|
54 |
error_log(sprintf("%s: Attention, realpath(%s) non-inscriptible [%s]",
|
- |
|
55 |
__FILE__,
|
- |
|
56 |
realpath($stockage_chemin),
|
- |
|
57 |
$_SERVER['REQUEST_URI']));
|
39 |
$this->stockage_chemin = isset($stockage_chemin) ? realpath($stockage_chemin) : Fichier::getDossierTmp();
|
58 |
} else {
|
40 |
$this->duree_de_vie = isset($duree_de_vie) ? $duree_de_vie : 3600*24;
|
59 |
$this->duree_de_vie = isset($duree_de_vie) ? $duree_de_vie : 3600*24;
|
41 |
}
|
60 |
}
|
- |
|
61 |
}
|
Line 42... |
Line 62... |
42 |
}
|
62 |
}
|
43 |
|
63 |
|
44 |
private function initialiserOptionsParConfig() {
|
64 |
private function initialiserOptionsParConfig() {
|
45 |
while (list($nom, $valeur) = each($this->options)) {
|
65 |
while (list($nom, $valeur) = each($this->options)) {
|