- Timestamp:
- Nov 17, 2005 7:37:40 AM (19 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/SessionCache.inc.php
r20 r21 13 13 { 14 14 var $_params = array( 15 'enabled' => true, 15 16 'soft_limit' => 204800, 16 17 'hard_limit' => 4194304, … … 43 44 function setParam($params) 44 45 { 46 if (!isset($this) || !is_a($this, 'SessionCache')) { 47 $this =& SessionCache::getInstance(); 48 } 49 45 50 if (isset($params) && is_array($params)) { 46 51 // Merge new parameters with old overriding only those passed. … … 60 65 function getParam($param) 61 66 { 67 if (!isset($this) || !is_a($this, 'SessionCache')) { 68 $this =& SessionCache::getInstance(); 69 } 70 62 71 if (isset($this->_params[$param])) { 63 72 return $this->_params[$param]; … … 86 95 function putCache($var, $var_id, $force_it_in=false) 87 96 { 88 $cache =& SessionCache::getInstance(); 97 if (!isset($this) || !is_a($this, 'SessionCache')) { 98 $this =& SessionCache::getInstance(); 99 } 100 101 if (!$this->getParam('enabled')) { 102 return false; 103 } 89 104 90 105 $var_id = md5($var_id); … … 92 107 $serialized_var_len = strlen($serialized_var); 93 108 94 if ($serialized_var_len >= $ cache->getParam('soft_limit') && !$force_it_in) {95 App::logMsg(sprintf('Serialized variable (%s bytes) more than soft_limit (%s bytes).', $serialized_var_len, $ cache->getParam('soft_limit')), LOG_NOTICE, __FILE__, __LINE__);96 return false; 97 } 98 99 if ($serialized_var_len >= $ cache->getParam('hard_limit')) {100 App::logMsg(sprintf('Serialized variable (%s bytes) more than hard_limit (%s bytes).', $serialized_var_len, $ cache->getParam('hard_limit')), LOG_NOTICE, __FILE__, __LINE__);109 if ($serialized_var_len >= $this->getParam('soft_limit') && !$force_it_in) { 110 App::logMsg(sprintf('Serialized variable (%s bytes) more than soft_limit (%s bytes).', $serialized_var_len, $this->getParam('soft_limit')), LOG_NOTICE, __FILE__, __LINE__); 111 return false; 112 } 113 114 if ($serialized_var_len >= $this->getParam('hard_limit')) { 115 App::logMsg(sprintf('Serialized variable (%s bytes) more than hard_limit (%s bytes).', $serialized_var_len, $this->getParam('hard_limit')), LOG_NOTICE, __FILE__, __LINE__); 101 116 return false; 102 117 } … … 107 122 unset($_SESSION['_session_cache'][$var_id]); 108 123 // Continue to prune the cache if it's length is too long for the new variable to fit, but keep at least MIN_ITEMS at least. 109 while (strlen(serialize($_SESSION['_session_cache'])) + $serialized_var_len >= $ cache->getParam('soft_limit')110 && sizeof($_SESSION['_session_cache']) >= $ cache->getParam('min_items')) {124 while (strlen(serialize($_SESSION['_session_cache'])) + $serialized_var_len >= $this->getParam('soft_limit') 125 && sizeof($_SESSION['_session_cache']) >= $this->getParam('min_items')) { 111 126 array_shift($_SESSION['_session_cache']); 112 127 } … … 133 148 function getCache($var_id) 134 149 { 150 if (!isset($this) || !is_a($this, 'SessionCache')) { 151 $this =& SessionCache::getInstance(); 152 } 153 154 if (!$this->getParam('enabled')) { 155 return false; 156 } 157 135 158 $var_id = md5($var_id); 136 159 if (isset($_SESSION['_session_cache'][$var_id])) { … … 155 178 function isCached($var_id) 156 179 { 180 if (!isset($this) || !is_a($this, 'SessionCache')) { 181 $this =& SessionCache::getInstance(); 182 } 183 184 if (!$this->getParam('enabled')) { 185 return false; 186 } 187 157 188 $var_id = md5($var_id); 158 189 return isset($_SESSION['_session_cache'][$var_id]); -
trunk/lib/TemplateGlue.inc.php
r20 r21 72 72 return $enum[1]; 73 73 } else { 74 App::logMsg(sprintf('No set or enum fields found.', null), LOG_DEBUG, __FILE__, __LINE__); 74 75 return false; 75 76 } … … 87 88 $values = getSetEnumFieldValues($db_table, $db_col); 88 89 if ($values === false) { 89 ?><option value=""> <?php echo _("n/a"); ?></option>90 ?><option value=""> </option> 90 91 <?php 91 92 return false;
Note: See TracChangeset
for help on using the changeset viewer.