Changeset 59626 in spip-zone


Ignore:
Timestamp:
Mar 22, 2012, 8:32:02 AM (8 years ago)
Author:
cedric@…
Message:

Definir un namespace unique par site car http_host ne suffit pas a distinguer deux sites sous le meme host
on cree une meta namespace initialisee au premier appel de inc/memoization
+ utiliser if(!defined()) au lieu de @define

Location:
_plugins_/memoization
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/memoization/inc/memoization.php

    r59581 r59626  
    106106
    107107
     108if (!isset($GLOBALS['meta']['cache_namespace'])){
     109        include_spip('inc/acces');
     110        ecrire_meta('cache_namespace', dechex(crc32($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SERVER_SIGNATURE"] . creer_uniqid())), 'non');
     111}
     112if (!defined('_CACHE_NAMESPACE'))
     113        define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':'.$GLOBALS['meta']['cache_namespace'].':');
     114
    108115global $Memoization;
    109116
    110117$cfg = @unserialize($GLOBALS['meta']['memoization']);
    111118$Memoization = new MCache(preg_replace(",\W,","",$cfg['methode']));
    112 
    113119
    114120
  • _plugins_/memoization/memo/apc.inc

    r53614 r59626  
    11<?php
    2 
    3 @define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':');
     2if (!defined('_CACHE_NAMESPACE'))
     3        define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':');
    44
    55class MCacheBackend_apc extends MCacheBackend {
  • _plugins_/memoization/memo/eaccelerator.inc

    r53614 r59626  
    33# http://bart.eaccelerator.net/doc/phpdoc/eAccelerator/_shared_memory_php.html
    44
    5 @define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':');
     5if (!defined('_CACHE_NAMESPACE'))
     6        define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':');
    67
    78class MCacheBackend_eaccelerator extends MCacheBackend {
  • _plugins_/memoization/memo/memcache.inc

    r53614 r59626  
    33# http://php.net/memcache
    44
    5 @define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':');
    6 @define('_LOCK_MAX', 30); # max lock time (seconds)
     5if (!defined('_CACHE_NAMESPACE'))
     6        define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':');
     7if (!defined('_LOCK_MAX'))
     8        define('_LOCK_MAX', 30); # max lock time (seconds)
    79
    810class MCacheBackend_memcache extends MCacheBackend {
  • _plugins_/memoization/memo/xcache.inc

    r53614 r59626  
    22
    33# http://xcache.lighttpd.net/wiki/XcacheApi
    4 @define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':');
    5 @define('_LOCK_MAX', 30); # max lock time (seconds)
     4if (!defined('_CACHE_NAMESPACE'))
     5        define('_CACHE_NAMESPACE', $_SERVER['HTTP_HOST'].':');
     6if (!defined('_LOCK_MAX'))
     7        define('_LOCK_MAX', 30); # max lock time (seconds)
    68
    79
  • _plugins_/memoization/plugin.xml

    r59581 r59626  
    99        <auteur>Fil</auteur>
    1010        <licence>&#169; 2009-2011 - GNU/LGPL - MIT</licence>
    11         <version>1.1.0</version>
     11        <version>1.1.1</version>
    1212        <etat>stable</etat>
    1313        <description>
Note: See TracChangeset for help on using the changeset viewer.