| verzia 1.48, 2002/11/11 22:09:19 |
verzia 1.49, 2003/01/27 01:03:33 |
|
|
| * http://www.platon.sk/projects/phpWebLogAnalyzer/ |
* http://www.platon.sk/projects/phpWebLogAnalyzer/ |
| */ |
*/ |
| |
|
| /* $Platon: phpWebLogAnalyzer/phpWebLogAnalyzer.inc.php,v 1.47 2002/10/28 20:10:01 nepto Exp $ */ |
/* $Platon: phpWebLogAnalyzer/phpWebLogAnalyzer.inc.php,v 1.48 2002/11/11 22:09:19 nepto Exp $ */ |
| |
|
| define('WEB_LOG_VALUE_SUBSTR_LENGTH', 255); |
define('WEB_LOG_VALUE_SUBSTR_LENGTH', 255); |
| define('WEB_LOG_SESSION_TIMEOUT_DEFAULT', 1800); |
define('WEB_LOG_SESSION_TIMEOUT_DEFAULT', 1800); |
| define('WEB_LOG_RAW_LOG_DEFAULT', 1); |
define('WEB_LOG_RAW_LOG_DEFAULT', 1); |
| define('WEB_LOG_TRUNCATE_NAMES_DEFAULT', 0); |
define('WEB_LOG_TRUNCATE_NAMES_DEFAULT', 0); |
| define('WEB_LOG_TRUNCATE_QUERY_STRINGS_DEFAULT', 1); |
define('WEB_LOG_TRUNCATE_QUERY_STRINGS_DEFAULT', 1); |
| |
define('WEB_LOG_CACHE_MAX_PROPERTY_COUNT', 6000); |
| |
|
| /* Internally used for _getCount() */ |
/* Internally used for _getCount() */ |
| define('WEB_LOG_SESSIONS_COUNT_TYPE', 1); |
define('WEB_LOG_SESSIONS_COUNT_TYPE', 1); |
|
|
| |
|
| function _setIDs() /* {{{ */ |
function _setIDs() /* {{{ */ |
| { |
{ |
| /* |
// Counting IDs according to values. |
| * Counting IDs according to values. |
|
| */ |
|
| |
|
| foreach (array_keys($this->_props) as $prop_name) { |
foreach (array_keys($this->_props) as $prop_name) { |
| if (isset($this->_props[$prop_name]['value'])) { |
if (isset($this->_props[$prop_name]['value'])) { |
| |
|
| if (! empty($this->_props[$prop_name]['table'])) { |
if (! empty($this->_props[$prop_name]['table'])) { |
| /* |
|
| $id = $this->_getID( |
|
| $this->_props[$prop_name]['table'], |
|
| $this->_props[$prop_name]['value']); |
|
| */ |
|
| $id = $this->_getID($prop_name); |
$id = $this->_getID($prop_name); |
| |
|
| if (DB::isError($id)) |
if (DB::isError($id)) |
| return $id; |
return $id; |
| |
|
| if (intval($id)) |
if (intval($id)) |
| $this->_props[$prop_name]['id'] = $id; |
$this->_props[$prop_name]['id'] = $id; |
| } else { |
} else { |
|
|
| } |
} |
| } |
} |
| } |
} |
| |
|
| return true; |
return true; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| Riadok 1212 class Web_Log |
|
| Riadok 1202 class Web_Log |
|
| $enabled_cache = $this->_props[$property]['enabled_cache']; |
$enabled_cache = $this->_props[$property]['enabled_cache']; |
| |
|
| if ($enabled_cache) { |
if ($enabled_cache) { |
| //echo "DEBUG: cache is enabled for '$property'\n"; |
|
| if (! isset($this->_props[$property]['cache'])) { |
if (! isset($this->_props[$property]['cache'])) { |
| $query = 'SELECT id, value FROM ' . $table; |
$count = $this->getPropertyCount($property); |
| |
if (DB::isError($count)) { |
| if (DB::isError($cache = $this->_db->getAssoc($query))) |
return $count; |
| return $cache; |
} |
| |
$count = intval($count); |
| $this->_props[$property]['cache'] = $cache; |
if ($count <= 0 || $count > WEB_LOG_CACHE_MAX_PROPERTY_COUNT) { |
| unset($cache); |
// setting empty cache |
| |
$this->_props[$property]['cache'] = array(); |
| |
} else { |
| |
$query = 'SELECT id, value FROM ' . $table; |
| |
if (DB::isError($cache = $this->_db->getAssoc($query))) |
| |
return $cache; |
| |
$this->_props[$property]['cache'] = $cache; |
| |
unset($cache); |
| |
} |
| } |
} |
| |
|
| $ret = array_search($value, $this->_props[$property]['cache']); |
$ret = array_search($value, $this->_props[$property]['cache']); |
| if ($ret) |
if ($ret !== null) |
| return $ret; |
return $ret; |
| } |
} |
| |
|
| Riadok 1370 class Web_Log |
|
| Riadok 1367 class Web_Log |
|
| return 1; |
return 1; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
/* |
| |
* getPropertyCount() |
| |
* |
| |
* Return number of items in DB for particular property. |
| |
*/ |
| |
|
| |
function getPropertyCount($prop_name) /* {{{ */ |
| |
{ |
| |
if ($this->_checkDB() == false) |
| |
return $this->_db; |
| |
if (! isset($this->_props[$prop_name])) { |
| |
return false; |
| |
} |
| |
if ($this->_raw_log) { |
| |
$column = @$this->_props[$prop_name]['column']; |
| |
if (strlen($column) <= 0) { |
| |
return false; |
| |
} |
| |
$query = "SELECT COUNT(DISTINCT $column) FROM weblog_accesses_raw"; |
| |
} else { |
| |
$table = @$this->_props[$prop_name]['table']; |
| |
if (strlen($table) <= 0) { |
| |
return false; |
| |
} |
| |
$query = "SELECT COUNT(*) FROM $table"; |
| |
} |
| |
if (DB::isError($count = $this->_db->getOne($query))) |
| |
return $count; |
| |
if (isset($count)) |
| |
return $count; |
| |
return false; |
| |
} /* }}} */ |
| |
|
| /* |
/* |
| * getSessionsCount() |
* getSessionsCount() |
| * getAccessesCount() |
* getAccessesCount() |