[Phpslash-commit] CVS: phpslash-dev/public_html config-dist.php,1.29,1.30
Brought to you by:
joestewart,
nhruby
From: Luis M <le...@us...> - 2004-10-20 22:04:48
|
Update of /cvsroot/phpslash/phpslash-dev/public_html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23026 Modified Files: config-dist.php Log Message: clean up code for jpcache initialization Index: config-dist.php =================================================================== RCS file: /cvsroot/phpslash/phpslash-dev/public_html/config-dist.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** config-dist.php 20 Oct 2004 17:11:07 -0000 1.29 --- config-dist.php 20 Oct 2004 22:04:39 -0000 1.30 *************** *** 310,331 **** - // TODO - move out of config to generalized function - jvs - 11/20/2003 // begin built-in jpcache ! if($_PSL['jpcache.enable'] == 'internal') { ! // if(empty($GLOBALS['JPCACHE_TYPE'])) { ! // jpcachedir -> the full directory path to the jpcache scripts. if(empty($_PSL['jpcachedir'])) { $_PSL['jpcachedir'] = $_PSL['classdir'] . "/jpcache"; } ! // $JPCACHE_TYPE = "file"; ! // $JPCACHE_TYPE = "mysql"; ! // $JPCACHE_TYPE = "dbm"; ! $JPCACHE_TYPE = "phplib"; ! ! /** ! * General jpcache configuration options. ! */ $JPCACHE_TIME = 900; // Default number of seconds to cache a page $JPCACHE_DEBUG = 0; // Turn debugging on/off --- 310,324 ---- // begin built-in jpcache ! if ( $_PSL['jpcache.enable'] != 'off' ) { ! /* Full path to jpcache class dir */ if(empty($_PSL['jpcachedir'])) { $_PSL['jpcachedir'] = $_PSL['classdir'] . "/jpcache"; } ! /** ! * General jpcache configuration options. ! */ $JPCACHE_TIME = 900; // Default number of seconds to cache a page $JPCACHE_DEBUG = 0; // Turn debugging on/off *************** *** 339,343 **** $JPCACHE_HASHSCRIPTKEY = 0; // Hash SCRIPT-KEY or not $JPCACHE_HASHVARKEY = 1; // Hash VAR-KEY or not - /** * File based caching setting. --- 332,335 ---- *************** *** 349,391 **** // us to (more accuratly) recognize jpcache- // files. - - /** - * DB based caching settings. - */ - $JPCACHE_DB_HOST = $_PSL['DB_Host']; // Database Server - $JPCACHE_DB_DATABASE = $_PSL['DB_Database']; // Database-name to use - $JPCACHE_DB_USERNAME = $_PSL['DB_User']; // Username - $JPCACHE_DB_PASSWORD = $_PSL['DB_Password']; // Password - $JPCACHE_DB_TABLE = "CACHEDATA"; // Table that holds the data - $JPCACHE_OPTIMIZE = 0; // If 'OPTIMIZE TABLE' after garbage - // collection is executed. Please check - // first if this works on your mySQL! - - /** - * Memcache based caching settings - */ - $JPCACHE_MEMCACHE_HOST = "localhost"; // Memcache Server - $JPCACHE_MEMCACHE_PORT = "11211"; // Port - $JPCACHE_VERSION = "2.0.0rc1"; ! // Standard jpcache functions // require $_PSL['jpcachedir']. "/jpcache-main.php"; addLibraryRequirement("jpcache",$_PSL['jpcachedir'] . "/jpcache-main.php"); - // Type specific jpcache implementations - if ('phplib' == $JPCACHE_TYPE) { - addClassRequirement("jpcacheDB","db_sql"); - addClassRequirement("jpcacheDB",$_PSL['jpcachedir'] ."/type/phplib.php"); - } - addLibraryRequirement("jpcache",$_PSL['jpcachedir'] ."/type/$JPCACHE_TYPE.php"); - loadLibrary("jpcache"); // require $_PSL['jpcachedir'] ."/type/$JPCACHE_TYPE.php"; // end of jpcache configuration ! ! // cache invocation $varkey = ''; ! $scriptkey = ''; // to avoid ugly warnings/notices if (!empty($HTTP_COOKIE_VARS['slashSess'])) { // later - we check for login after page_open --- 341,359 ---- // us to (more accuratly) recognize jpcache- // files. $JPCACHE_VERSION = "2.0.0rc1"; ! ! // Standard jpcache functions // require $_PSL['jpcachedir']. "/jpcache-main.php"; addLibraryRequirement("jpcache",$_PSL['jpcachedir'] . "/jpcache-main.php"); // require $_PSL['jpcachedir'] ."/type/$JPCACHE_TYPE.php"; // end of jpcache configuration ! ! // Declare some variables to avoid warnings: $varkey = ''; ! $scriptkey = ''; + // sets caching in motion: if (!empty($HTTP_COOKIE_VARS['slashSess'])) { // later - we check for login after page_open *************** *** 394,398 **** $varkey = md5("POST=" . serialize($HTTP_POST_VARS) . " GET=" . serialize($HTTP_GET_VARS) . " COOKIE=" . serialize($HTTP_COOKIE_VARS)); } else { - // $scriptkey = "-uid-nobody"; $scriptkey = ''; --- 362,365 ---- *************** *** 426,436 **** } $scriptkey .= "-"; if (!array_key_exists('slashSess', $HTTP_COOKIE_VARS)) { jpcache_start('',$scriptkey, $varkey); } - // end of jpcache invocation ! // end of built-in jpcache portion ! } elseif($_PSL['jpcache.enable'] == 'static') { --- 393,435 ---- } $scriptkey .= "-"; + + } + + if ( $_PSL['jpcache.enable'] == 'mysql' ) { + /* Uses mysql table for caching */ + $JPCACHE_TYPE = "phplib"; + /** + * DB based caching settings. + */ + $JPCACHE_DB_HOST = $_PSL['DB_Host']; // Database Server + $JPCACHE_DB_DATABASE = $_PSL['DB_Database']; // Database-name to use + $JPCACHE_DB_USERNAME = $_PSL['DB_User']; // Username + $JPCACHE_DB_PASSWORD = $_PSL['DB_Password']; // Password + $JPCACHE_DB_TABLE = "CACHEDATA"; // Table that holds the data + $JPCACHE_OPTIMIZE = 0; /* If 'OPTIMIZE TABLE' after garbage + collection is executed. Please check + first if this works on your mySQL!*/ + // PHPLIB Type specific jpcache implementations + addClassRequirement("jpcacheDB","db_sql"); + addClassRequirement("jpcacheDB",$_PSL['jpcachedir'] ."/type/phplib.php"); + addLibraryRequirement("jpcache",$_PSL['jpcachedir'] ."/type/$JPCACHE_TYPE.php"); + loadLibrary("jpcache"); if (!array_key_exists('slashSess', $HTTP_COOKIE_VARS)) { jpcache_start('',$scriptkey, $varkey); } ! } elseif($_PSL['jpcache.enable'] == 'file') { ! $JPCACHE_TYPE = "file"; ! $JPCACHE_DIR = $_PSL['jpcache.cachedir']; ! $JPCACHE_FILEPREFIX = ""; ! ! addLibraryRequirement("jpcache",$_PSL['jpcachedir'] ."/type/$JPCACHE_TYPE.php"); ! loadLibrary("jpcache"); ! ! // append html file extension ! $varkey .= ".html"; ! if (!array_key_exists('slashSess', $HTTP_COOKIE_VARS)) { ! jpcache_start('',$scriptkey, $varkey); ! } } elseif($_PSL['jpcache.enable'] == 'static') { *************** *** 443,474 **** // other way. - // jpcachedir -> the full directory path to the jpcache scripts. - if(empty($_PSL['jpcachedir'])) { - $_PSL['jpcachedir'] = $_PSL['classdir'] . "/jpcache"; - } - $JPCACHE_TYPE = "static"; - // $JPCACHE_TYPE = "file"; - - /** - * General jpcache configuration options. - */ - $JPCACHE_TIME = 900; // Default number of seconds to cache a page - $JPCACHE_DEBUG = 0; // Turn debugging on/off - $JPCACHE_IGNORE_DOMAIN= 1; // Ignore domain name in request(single site) - $JPCACHE_ON = 1; // Turn caching on/off - $JPCACHE_USE_GZIP = 0; // Whether or not to use GZIP - $JPCACHE_POST = 1; // Should POST's be cached - $JPCACHE_GC = 100; // Probability % of garbage collection - $JPCACHE_GZIP_LEVEL = 9; // GZIPcompressionlevel to use (1=low,9=high) - $JPCACHE_DELAY_START = 1; // Immediate or manual call to jpcache_start() - $JPCACHE_HASHSCRIPTKEY = 0; // Hash SCRIPT-KEY or not - $JPCACHE_HASHVARKEY = 0; // Hash VAR-KEY or not /** * File based caching setting. */ ! $JPCACHE_DIR = $_PSL['basedir']; // store cache files in basedir ! // $JPCACHE_DIR = "/tmp/jpcache"; // Directory where jpcache must store // generated files. Please use a dedicated // directory, and make it writable --- 442,452 ---- // other way. $JPCACHE_TYPE = "static"; /** * File based caching setting. */ ! $JPCACHE_DIR = $_PSL['jpcache.cachedir']; // store cache files in basedir ! // Directory where jpcache must store // generated files. Please use a dedicated // directory, and make it writable *************** *** 477,534 **** // files. ! $JPCACHE_VERSION = "2.0.0rc1"; ! // Standard jpcache functions ! // require $_PSL['jpcachedir']. "/jpcache-main.php"; ! addLibraryRequirement("jpcache",$_PSL['jpcachedir'] . "/jpcache-main.php"); ! ! addLibraryRequirement("jpcache",$_PSL['jpcachedir'] ."/type/$JPCACHE_TYPE.php"); loadLibrary("jpcache"); - - // end of jpcache configuration - // cache invocation - $varkey = ''; - $scriptkey = ''; // to avoid ugly warnnings/notices - - if (!empty($HTTP_COOKIE_VARS['slashSess'])) { - // later - we check for login after page_open - // $scriptkey = "-slashSess-". $HTTP_COOKIE_VARS['slashSess']; - } elseif (!empty($HTTP_COOKIE_VARS['user_info']) ) { - $varkey = md5("POST=" . serialize($HTTP_POST_VARS) . " GET=" . serialize($HTTP_GET_VARS) . " COOKIE=" . serialize($HTTP_COOKIE_VARS)); - } else { - - // $scriptkey = "-uid-nobody"; - $scriptkey = ''; - // skin can be set directly with a cookie - if(!empty($HTTP_COOKIE_VARS['skin'])) { - $scriptkey .= "-skin-". $_PSL['skin']; - } - } - // if we're not using the default language - if($_PSL['language'] != $_PSL['language.current']) { - $scriptkey .= "-lang-". $_PSL['language.current']; - } - - // if we're not in the default timezone - if( !empty($HTTP_COOKIE_VARS['TZ']) && $HTTP_COOKIE_VARS['TZ'] != $_PSL['timezone']['name']) { - $scriptkey .= "-TZ-". $HTTP_COOKIE_VARS['TZ']; - } - // add GET variables to scriptkey - foreach( $_GET as $key => $value) { - $scriptkey = $key ."/". $value ."/". $scriptkey; - // $scriptkey .= "-". $key ."-". $value; - } - // if home section - add section id - /* - if ((empty($HTTP_GET_VARS['section'])) AND - (empty($HTTP_GET_VARS['section_id']))){ - $scriptkey .= "-section_id-". $_PSL['home_section_id']; - } - */ - // not too goofy key names - $scriptkey = preg_replace("'/|:|\\|\*|<|>|\|'","-", str_replace('.php', '',basename($_PSL['phpself'])).$scriptkey); - if($GLOBALS['JPCACHE_IGNORE_DOMAIN'] == 0) { - $scriptkey = str_replace(".","-", $HTTP_SERVER_VARS['HTTP_HOST'] .$scriptkey); - } // append html file extension $varkey .= ".html"; --- 455,461 ---- // files. ! addLibraryRequirement("jpcache",$_PSL['jpcachedir'] ."/type/$JPCACHE_TYPE.php"); loadLibrary("jpcache"); // append html file extension $varkey .= ".html"; *************** *** 536,542 **** jpcache_start('',$scriptkey, $varkey); } ! // end of jpcache invocation ! } // end of static jpcache portion // 1.11.4) Other Variables... --- 463,480 ---- jpcache_start('',$scriptkey, $varkey); } ! } else if ( $_PSL['jpcache.enable'] == 'memcache' ) { ! /** ! * Memcache based caching settings ! */ ! $JPCACHE_TYPE = "memcache"; ! $JPCACHE_MEMCACHE_HOST = "localhost"; // Memcache Server ! $JPCACHE_MEMCACHE_PORT = "11211"; // Port ! addLibraryRequirement("jpcache",$_PSL['jpcachedir'] ."/type/$JPCACHE_TYPE.php"); ! loadLibrary("jpcache"); // TODO this could be called from != off block ! if (!array_key_exists('slashSess', $HTTP_COOKIE_VARS)) { ! jpcache_start('',$scriptkey, $varkey); ! } ! } // end of memcache jpcache portion // 1.11.4) Other Variables... |