1.x - Chizra
+ * Config change. Added new entry. See upgrade/from-version-1.5.txt. It won't work if it is missing.
* Licence change to GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
1.5 - Sacred Passage 2023-05-01
--- /dev/null
+# Added new const to config.php file.
+Use config.php.default as a help. The new line is:
+const LOGFILE = PATH_SYSTEMOUT.'/bibliotheca.log';
\ No newline at end of file
# set the error reporting
ini_set('log_errors',true);
-ini_set('error_log',PATH_SYSTEMOUT.'/api.log');
if(DEBUG === true) {
ini_set('display_errors',true);
}
const PATH_SYSTEMOUT = PATH_ABSOLUTE.'/systemout';
const PATH_STORAGE = PATH_ABSOLUTE.'/storage';
const PATH_WEB_STORAGE = 'storage';
+const LOGFILE = PATH_SYSTEMOUT.'/bibliotheca.log';
# database config
const DB_HOST = '~dbhost~';
# set the error reporting
ini_set('log_errors',true);
-ini_set('error_log',PATH_SYSTEMOUT.'/error.log');
if(DEBUG === true) {
ini_set('display_errors',true);
}
`token` = '".$this->_DB->real_escape_string($tokenInfo['token'])."',
`salt` = '".$this->_DB->real_escape_string($tokenInfo['salt'])."',
`loginTime` = NOW()";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
$this->_loginActions();
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
$ret = true;
FROM `".DB_PREFIX."_user`
WHERE `apiToken` = '".$this->_DB->real_escape_string($token)."'
AND `apiTokenValidDate` > NOW()";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
}
}
}
else {
- error_log("[ERROR] ".__METHOD__." invalid rights string: ".var_export($this->_rightsArray, true));
+ Summoner::sysLog("[ERROR] ".__METHOD__." invalid rights string: ".Summoner::cleanForLog($this->_rightsArray));
}
return $str;
WHERE s.token = '".$this->_DB->real_escape_string($_SESSION[SESSION_NAME]['bibliothecatoken'])."'
AND s.salt <> ''
AND s.loginTime >= '".$timeframe."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
$ret = true;
}
else {
- error_log("[ERROR] ".__METHOD__." mismatched token.");
+ Summoner::sysLog("[ERROR] ".__METHOD__." mismatched token.");
if(isset($result['fk_user_id']) && !empty($result['fk_user_id'])) {
$this->userID = $result['fk_user_id'];
}
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
FROM `".DB_PREFIX."_user`
WHERE `login` = '". $this->_DB->real_escape_string($u)."'
AND `active` = '1'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
$timeframe = date("Y-m-d H:i:s",time()-SESSION_LIFETIME);
$queryStr = "DELETE FROM `".DB_PREFIX."_userSession`
WHERE `loginTime` <= '".$timeframe."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
LEFT JOIN `".DB_PREFIX."_user2group` AS u2g ON u2g.fk_user_id = u.id
LEFT JOIN `".DB_PREFIX."_group` AS g ON g.id= u2g.fk_group_id
WHERE u.`id` = '".$this->_DB->real_escape_string($this->userID)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
}
$queryStr = "DELETE FROM `".DB_PREFIX."_userSession`
WHERE `fk_user_id` = '".$this->_DB->real_escape_string($this->userID)."'
OR `loginTime` <= '".$timeframe."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
unset($_SESSION);
$url = $this->_VOLUMES_ENDPOINT;
$url .= '?q=isbn:'.$isbn;
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." isbn query url: $url");
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." isbn query url: $url");
$do = $this->_curlCall($url);
if(!empty($do)) {
$data = json_decode($do, true);
if(!empty($data)) {
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." isbn json data:".var_export($data,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." isbn json data:".Summoner::cleanForLog($data));
$data = $this->_buildDataFromISBNsearch($data);
}
else {
- error_log("[ERROR] ".__METHOD__." invalid isbn json data:".var_export($do,true));
+ Summoner::sysLog("[ERROR] ".__METHOD__." invalid isbn json data:".Summoner::cleanForLog($do));
}
}
$_tmpFile = tempnam(sys_get_temp_dir(), "bibliotheca-");
$fh = fopen($_tmpFile,"w+");
if($this->_DEBUG) {
- error_log('[DEBUG] '.__METHOD__.' url '.var_export($url,true));
+ Summoner::sysLog('[DEBUG] '.__METHOD__.' url '.Summoner::cleanForLog($url));
}
if($fh !== false) {
curl_close($ch);
if($this->_DEBUG) {
- error_log('[DEBUG] '.__METHOD__.' headers '.var_export($_headers,true));
+ Summoner::sysLog('[DEBUG] '.__METHOD__.' headers '.Summoner::cleanForLog($_headers));
}
return $ret;
FROM `".DB_PREFIX."_menu`
WHERE ".$this->_User->getSQLRightsString()."
ORDER BY position";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
`createstring`, `value`
FROM `".DB_PREFIX."_sys_fields`
ORDER BY `displayname`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $this->_cacheAvailableFields;
$queryStrDeleteFields = "DELETE FROM `".DB_PREFIX."_collection_fields_".$this->_collectionId."`
WHERE `fk_field_id` NOT IN (".implode(",",$ids).")";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrDeleteFields,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrDeleteFields));
$queryStrDeletee2l = "DELETE FROM `".DB_PREFIX."_collection_entry2lookup_".$this->_collectionId."`
WHERE `fk_field` NOT IN (".implode(",",$ids).")";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrDeletee2l,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrDeletee2l));
$queryStrInsertFields = "INSERT INTO `".DB_PREFIX."_collection_fields_".$this->_collectionId."` (`fk_field_id`,`sort`) VALUES ";
foreach ($ids as $k => $v) {
}
$queryStrInsertFields = trim($queryStrInsertFields, ",");
$queryStrInsertFields .= " ON DUPLICATE KEY UPDATE `sort` = VALUES(`sort`)";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrInsertFields,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrInsertFields));
if(!empty($_newColumns)) {
$queryStrAlterEntry = array();
// mysql implicit commit
if(!empty($queriesDeleteEntryTable)) {
foreach($queriesDeleteEntryTable as $q) {
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($q,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::sysLog($q));
$this->_DB->query($q);
}
}
// mysql implicit commit
if(!empty($_newColumns)) {
foreach ($queryStrAlterEntry as $q1) {
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($q1,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($q1));
$this->_DB->query($q1);
}
}
}
catch (Exception $e) {
$this->_DB->rollback();
- error_log("[ERROR] asd ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] asd ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
else {
$queryStr .= " ORDER BY `cf`.`sort`";
}
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $this->_cacheExistingSysFields;
$ret = array();
$queryStr = "SHOW COLUMNS FROM `".DB_PREFIX."_collection_entry_".$this->_collectionId."`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
LEFT JOIN `".DB_PREFIX."_group` AS g ON `c`.`group` = `g`.`id`
WHERE ".$this->_User->getSQLRightsString("write", "c")."
ORDER BY `c`.`name`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
FROM `".DB_PREFIX."_group`
WHERE ".$this->_User->getSQLRightsString()."
ORDER BY `name`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
$queryStr = "SELECT `id`, `name`, `login`
FROM `".DB_PREFIX."_user`
WHERE ".$this->_User->getSQLRightsString()."";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
$queryStr = "SELECT `id`, `name`, `description`
FROM `".DB_PREFIX."_tool`
WHERE ".$this->_User->getSQLRightsString()."";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
`defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."',
`defaultSortOrder` = '".$this->_DB->real_escape_string($data['defaultSortOrder'])."',
`advancedSearchTableFields` = '".$this->_DB->real_escape_string($data['advancedSearchTableFields'])."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
$this->_DB->query($queryStr);
$newId = $this->_DB->insert_id;
KEY `fk_field` (`fk_field`),
FULLTEXT KEY `value` (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryEntry2lookup,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryEntry2lookup));
$this->_DB->query($queryEntry2lookup);
$queryCollectionFields = "CREATE TABLE `".DB_PREFIX."_collection_fields_".$newId."` (
UNIQUE KEY `fk_field_id` (`fk_field_id`),
KEY `sort` (`sort`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryCollectionFields,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryCollectionFields));
$this->_DB->query($queryCollectionFields);
$queryCollectionEntry = "CREATE TABLE `".DB_PREFIX."_collection_entry_".$newId."` (
`rights` char(9) COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryCollectionEntry,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryCollectionEntry));
$this->_DB->query($queryCollectionEntry);
$ret = true;
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
$this->_DB->rollback();
}
}
LEFT JOIN `".DB_PREFIX."_group` AS g ON `c`.`group` = `g`.`id`
WHERE ".$this->_User->getSQLRightsString("write", "c")."
AND `c`.`id` = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
public function updateCollection(array $data): bool {
$ret = false;
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." data: ".var_export($data,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." data: ".Summoner::cleanForLog($data));
if(!empty($data['name']) === true
&& $this->_validUpdateCollectionName($data['name'], $data['id']) === true
`defaultSortOrder` = '".$this->_DB->real_escape_string($data['defaultSortOrder'])."',
`advancedSearchTableFields` = '".$this->_DB->real_escape_string($data['advancedSearchTableFields'])."'
WHERE `id` = '".$this->_DB->real_escape_string($data['id'])."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
$this->_updateToolRelation($data['id'],$data['tool']);
$ret = true;
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
// update the search field if it is a field from the collection entry table
$queryStr = "CREATE FULLTEXT INDEX ".$this->_DB->real_escape_string($data['defaultSearchField'])."
ON `".DB_PREFIX."_collection_entry_".$data['id']."`
(`".$this->_DB->real_escape_string($data['defaultSearchField'])."`)";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryCheck,true));
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryCheck));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryCheck);
if($query !== false && $query->num_rows > 0) {
} catch (Exception $e) {
if($e->getCode() == "1061") {
// duplicate key message if the index is already there.
- error_log("[NOTICE] ".__METHOD__." mysql query: ".$e->getMessage());
+ Summoner::sysLog("[NOTICE] ".__METHOD__." mysql query: ".$e->getMessage());
}
else {
- error_log("[ERROR] ".__METHOD__." mysql query: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql query: ".$e->getMessage());
}
}
}
if(!empty($id) && Summoner::validate($id, 'digit')) {
$queryStr = "DELETE FROM `".DB_PREFIX."_collection`
WHERE `id` = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
$queryStrTool = "DELETE FROM `".DB_PREFIX."_tool2collection`
WHERE `fk_collection_id` = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrTool,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrTool));
$queryStre2l = "DROP TABLE `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($id)."`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStre2l,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStre2l));
$queryStrEntry = "DROP TABLE `".DB_PREFIX."_collection_entry_".$this->_DB->real_escape_string($id)."`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrEntry,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrEntry));
$queryStrFields = "DROP TABLE `".DB_PREFIX."_collection_fields_".$this->_DB->real_escape_string($id)."`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrFields,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrFields));
// mysql implicit commit with drop command
}
catch (Exception $e) {
$this->_DB->rollback();
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
FROM `".DB_PREFIX."_tool2collection` AS t2c
LEFT JOIN `".DB_PREFIX."_tool` AS t ON t.id = t2c.fk_tool_id
WHERE t2c.fk_collection_id = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
if (Summoner::validate($name, 'nospace')) {
$queryStr = "SELECT `id` FROM `".DB_PREFIX."_collection`
WHERE `name` = '".$this->_DB->real_escape_string($name)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows < 1) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
$queryStr = "SELECT `id` FROM `".DB_PREFIX."_collection`
WHERE `name` = '".$this->_DB->real_escape_string($name)."'
AND `id` != '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows < 1) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
$queryStr = "DELETE FROM `".DB_PREFIX."_tool2collection`
WHERE `fk_collection_id` = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->begin_transaction(MYSQLI_TRANS_START_READ_WRITE);
$insertQueryStr = "INSERT IGNORE INTO `".DB_PREFIX."_tool2collection`
SET `fk_tool_id` = '".$this->_DB->real_escape_string($v)."',
`fk_collection_id` = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($insertQueryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($insertQueryStr));
$this->_DB->query($insertQueryStr);
}
}
}
catch (Exception $e) {
$this->_DB->rollback();
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
}
$queryStr = trim($queryStr, ",");
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
}
FROM `".DB_PREFIX."_collection_fields_".$this->_DB->real_escape_string($this->_collectionId)."` AS cf
LEFT JOIN `".DB_PREFIX."_sys_fields` AS sf ON `cf`.`fk_field_id` = `sf`.`id`
ORDER BY `cf`.`sort`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
FROM `".DB_PREFIX."_collection_entry_".$this->_DB->real_escape_string($this->_collectionId)."`
WHERE ".$this->_User->getSQLRightsString("write")."
AND `id` = '".$this->_DB->real_escape_string($entryId)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
public function create(array $data, string $owner, string $group, string $rights, mixed $update=false): int {
$ret = 0;
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." data: ".var_export($data,true));
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." update: ".var_export($update,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." data: ".Summoner::cleanForLog($data));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." update: ".Summoner::cleanForLog($update));
if(!empty($data) && !empty($owner) && !empty($group) && !empty($rights)) {
$queryData = $this->$_mn($d, $queryData);
}
else {
- if(DEBUG)error_log("[DEBUG] ".__METHOD__." Missing query function for: ".var_export($d, true));
+ if(DEBUG)Summoner::sysLog("[DEBUG] ".__METHOD__." Missing query function for: ".Summoner::cleanForLog($d));
}
}
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." queryData: ".var_export($queryData,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." queryData: ".Summoner::sysLog($queryData));
if(!empty($queryData['init']) || ($update !== false && is_numeric($update))) {
$queryStr .= " WHERE `id` = '".$this->_DB->real_escape_string($update)."'";
}
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->begin_transaction(MYSQLI_TRANS_START_READ_WRITE);
}
catch (Exception $e) {
$this->_DB->rollback();
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
else {
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." empty init in: ".var_export($queryData,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." empty init in: ".Summoner::cleanForLog($queryData));
}
}
// remove assets
$_path = PATH_STORAGE.'/'.$this->_collectionId.'/'.$entryId;
if(is_dir($_path) && is_readable($_path)) {
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." remove assets :".$_path);
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." remove assets :".$_path);
$rmDir = Summoner::recursive_remove_directory($_path);
if($rmDir === false) {
throw new Exception("Failed to delete path: ".$_path);
$queryStr = "DELETE
FROM `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($this->_collectionId)."`
WHERE `fk_entry` = '".$this->_DB->real_escape_string($entryId)."'";
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." remove lookup queryStr: ".var_export($queryStr,true));
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." remove lookup queryStr: ".Summoner::cleanForLog($queryStr));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
$this->_DB->query($queryStr);
// delete entry
FROM `".DB_PREFIX."_collection_entry_".$this->_collectionId."`
WHERE `id` = '".$this->_DB->real_escape_string($entryId)."'
AND " . $this->_User->getSQLRightsString("delete") . "";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
$this->_DB->query($queryStr);
$this->_DB->commit();
}
catch (Exception $e) {
$this->_DB->rollback();
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
}
FROM `".DB_PREFIX."_collection_entry_".$this->_collectionId."`
WHERE `id` = '".$this->_DB->real_escape_string($entryId)."'
AND ".$this->_User->getSQLRightsString("write")."";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
FROM `".DB_PREFIX."_collection_entry_".$this->_collectionId."`
WHERE `id` = '".$this->_DB->real_escape_string($entryId)."'
AND ".$this->_User->getSQLRightsString("delete")."";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
FROM `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($this->_collectionId)."`
WHERE `fk_field` = '".$this->_DB->real_escape_string($fieldData['id'])."'
AND `fk_entry` = '".$this->_DB->real_escape_string($entryId)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
$queryStr = "SELECT DISTINCT(`value`)
FROM `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($this->_collectionId)."`
WHERE `fk_field` = '".$this->_DB->real_escape_string($data['id'])."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
return $data;
if(!empty($queryString) && !empty($insertId)) {
// replace only once to avoid replacing actual data
$queryStr = Summoner::replaceOnce($queryString,$this->_replaceEntryString, $insertId);
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
}
*/
private function _runAfter_upload(array $uploadData, string $insertId) {
if(!empty($uploadData) && !empty($insertId)) {
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." uploadata: ".var_export($uploadData,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." uploadata: ".Summoner::cleanForLog($uploadData));
$_path = PATH_STORAGE.'/'.$this->_collectionId.'/'.$insertId;
if(!is_dir($_path)) {
if(!mkdir($_path, 0777, true)) {
// single upload. Delete existing first.
// also triggered if the single needs to be deleted
$_existingFiles = glob($_path.'/'.$uploadData['identifier'].'-*');
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." remove single existing: ".var_export($_existingFiles,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." remove single existing: ".Summoner::cleanForLog($_existingFiles));
if(!empty($_existingFiles)) {
foreach ($_existingFiles as $f) {
unlink($f);
}
if($uploadData['multiple'] === true && isset($uploadData['deleteData'])) {
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." remove multiple existing: ".var_export($uploadData['deleteData'],true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." remove multiple existing: ".Summoner::cleanForLog($uploadData['deleteData']));
foreach ($uploadData['deleteData'] as $k=>$v) {
$_file = $_path.'/'.$v;
if(file_exists($_file)) {
SET `value` = '".$this->_DB->real_escape_string($to)."'
WHERE `fk_field` = '".$this->_DB->real_escape_string($field)."'
AND `value` = BINARY '".$this->_DB->real_escape_string($from)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
$ret = 'Error in move/rename query. See logs.';
}
$queryStr = "DELETE FROM `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($this->_collectionId)."`
WHERE `fk_field` = '".$this->_DB->real_escape_string($field)."'
AND `value` = BINARY '".$this->_DB->real_escape_string($what)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
$ret = 'Error in delete query. See logs.';
}
WHERE ".$this->_User->getSQLRightsString("read", "c")."
ORDER BY `c`.`name`
LIMIT $selections";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
);
}
else {
- error_log("[WARN] ".__METHOD__." missing default search field for collectionid: ".$result['id']);
+ Summoner::sysLog("[WARN] ".__METHOD__." missing default search field for collectionid: ".$result['id']);
}
}
else {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
}
$queryStr = $querySelect.$queryFrom.$queryJoin.$queryWhere.$queryOrder.$queryLimit;
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
}
$queryStrCount = "SELECT COUNT(t.id) AS amount ".$queryFrom.$queryJoin.$queryWhere;
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrCount,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrCount));
$query = $this->_DB->query($queryStrCount);
$result = $query->fetch_assoc();
$ret['amount'] = $result['amount'];
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
FROM `".DB_PREFIX."_collection_entry_".$this->_DB->real_escape_string($this->_collectionId)."`
WHERE ".$this->_User->getSQLRightsString()."
AND `id` = '".$this->_DB->real_escape_string($entryId)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
}
$queryStr = $querySelect.$queryFrom.$queryWhere.$queryOrder.$queryLimit;
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
}
$queryCountStr = "SELECT COUNT(t.value) AS amount ".$queryFrom.$queryWhere;
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryCountStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryCountStr));
$query = $this->_DB->query($queryCountStr);
$result = $query->fetch_assoc();
$ret['amount'] = $result['amount'];
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
FROM `".DB_PREFIX."_collection_fields_".$this->_DB->real_escape_string($this->_collectionId)."` AS cf
LEFT JOIN `".DB_PREFIX."_sys_fields` AS sf ON `cf`.`fk_field_id` = `sf`.`id`
ORDER BY `cf`.`sort`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
else {
$queryStr = "SELECT `fk_field`, `value`, `fk_entry`
FROM `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($this->_collectionId)."`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
if(isset($this->_cacheLookupValuesForEntry[$this->_collectionId][$entryId][$fieldData['id']])) {
$ret = $this->_cacheLookupValuesForEntry[$this->_collectionId][$entryId][$fieldData['id']];
$url .= '?&fmt=json&limit='.$this->_resultLimit.'&query=';
$url .= 'artist:'.$artist.'%20AND%20release:'.$album.'%20AND%20format:CD';
- if(DEBUG) error_log("[DEBUG] musicbrainz release url: $url");
+ if(DEBUG) Summoner::sysLog("[DEBUG] musicbrainz release url: $url");
$do = $this->_curlCall($url);
$data = '';
if(!empty($do)) {
$data = json_decode($do, true);
if(!empty($data)) {
- if(DEBUG) error_log("[DEBUG] musicbrainz releases json data:".var_export($data,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] musicbrainz releases json data:".Summoner::cleanForLog($data));
}
else {
- error_log("[ERROR] musicbrainz invalid releases json data:".var_export($do,true));
+ Summoner::sysLog("[ERROR] musicbrainz invalid releases json data:".Summoner::cleanForLog($do));
}
}
if(!empty($do)) {
$data = json_decode($do, true);
if(!empty($data)) {
- if(DEBUG) error_log("[DEBUG] musicbrainz release json data:".var_export($data,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] musicbrainz release json data:".Summoner::cleanForLog($data));
}
else {
- error_log("[ERROR] musicbrainz invalid release json data:".var_export($do,true));
+ Summoner::sysLog("[ERROR] musicbrainz invalid release json data:".Summoner::cleanForLog($do));
}
}
if(!empty($do)) {
$imageData = json_decode($do, true);
if(!empty($imageData)) {
- if(DEBUG) error_log("[DEBUG] image release json data:".var_export($imageData,true));
+ if(DEBUG) Summoner::sysLog("[DEBUG] image release json data:".Summoner::cleanForLog($imageData));
$ret['image'] = isset($imageData['images'][0]['image']) ? $imageData['images'][0]['image'] : '';
}
else {
- error_log("[ERROR] image invalid release json data:".var_export($do,true));
+ Summoner::sysLog("[ERROR] image invalid release json data:".Summoner::cleanForLog($do));
}
}
}
curl_close($ch);
if($this->_DEBUG) {
- error_log('[DEBUG] '.__METHOD__.' headers '.var_export($_headers,true));
+ Summoner::sysLog('[DEBUG] '.__METHOD__.' headers '.Summoner::cleanForLog($_headers));
}
$ret = $_tmpFile;
curl_close($ch);
if($this->_DEBUG) {
- error_log('[DEBUG] '.__METHOD__.' headers '.var_export($_headers,true));
+ Summoner::sysLog('[DEBUG] '.__METHOD__.' headers '.Summoner::cleanForLog($_headers));
}
return $ret;
FROM `".DB_PREFIX."_group`
WHERE ".$this->_User->getSQLRightsString("delete")."
ORDER BY `name`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
$queryStr = "SELECT `id`, `login`, `name`, `active`, `baseGroupId`, `protected`, `created`
FROM `".DB_PREFIX."_user`
WHERE ".$this->_User->getSQLRightsString("delete")."";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
`rights` = 'rwxr--r--',
`owner` = 0,
`group` = '".$this->_DB->real_escape_string($group)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->begin_transaction(MYSQLI_TRANS_START_READ_WRITE);
$queryStrOwner = "UPDATE `".DB_PREFIX . "_user`
SET `owner` = '".$this->_DB->real_escape_string($_userid)."'
WHERE `id` = '".$this->_DB->real_escape_string($_userid)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrOwner,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrOwner));
$this->_DB->query($queryStrOwner);
if(!empty($groups)) {
$groups[] = $group;
}
catch (Exception $e) {
$this->_DB->rollback();
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
}
$queryStr .= " WHERE `id` = '".$this->_DB->real_escape_string($id)."'
AND ".$this->_User->getSQLRightsString("delete")."";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->begin_transaction(MYSQLI_TRANS_START_READ_WRITE);
}
catch (Exception $e) {
$this->_DB->rollback();
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
FROM `".DB_PREFIX."_user`
WHERE ".$this->_User->getSQLRightsString("delete")."
AND `id` = '".$this->_DB->real_escape_string($userId)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows == 1) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
}
catch (Exception $e) {
$this->_DB->rollback();
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
`owner` = '".$this->_DB->real_escape_string($this->_User->param('id'))."',
`group` = '".ADMIN_GROUP_ID."',
`rights` = 'rwxr--r--'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
$ret = true;
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
`modificationuser` = '".$this->_DB->real_escape_string($this->_User->param('id'))."'
WHERE `id` = '".$this->_DB->real_escape_string($id)."'
AND ".$this->_User->getSQLRightsString("delete")."";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
$ret = true;
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
WHERE ".$this->_User->getSQLRightsString("delete")."
AND `protected` = '0'
AND `id` = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$this->_DB->query($queryStr);
$ret = true;
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
FROM `".DB_PREFIX."_group`
WHERE ".$this->_User->getSQLRightsString("delete")."
AND `id` = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
if (Summoner::validate($name, 'nospace')) {
$queryStr = "SELECT `id` FROM `".DB_PREFIX."_group`
WHERE `name` = '".$this->_DB->real_escape_string($name)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows < 1) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
$queryStr = "SELECT `id` FROM `" . DB_PREFIX . "_group`
WHERE `name` = '".$this->_DB->real_escape_string($name)."'
AND `id` != '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows < 1) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
if (Summoner::validate($login, 'nospace')) {
$queryStr = "SELECT `id` FROM `".DB_PREFIX."_user`
WHERE `login` = '".$this->_DB->real_escape_string($login)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows < 1) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
$queryStr = "SELECT `id` FROM `" . DB_PREFIX . "_user`
WHERE `login` = '".$this->_DB->real_escape_string($login)."'
AND `id` != '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows < 1) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
if(Summoner::validate($groupId,'digit')) {
$queryStr = "SELECT `id` FROM `".DB_PREFIX."_group`
WHERE `id` = '".$this->_DB->real_escape_string($groupId)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
if($clean === true) {
$queryStrDelete = "DELETE FROM `".DB_PREFIX."_user2group`
WHERE `fk_user_id` = '".$this->_DB->real_escape_string($userid)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStrDelete,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStrDelete));
$this->_DB->query($queryStrDelete);
}
$queryStr .= "('".$this->_DB->real_escape_string($userid)."','".$this->_DB->real_escape_string($g)."'),";
}
$queryStr = trim($queryStr, ",");
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
$ret = $this->_DB->query($queryStr);
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
`".DB_PREFIX."_group` AS g
WHERE u2g.fk_user_id = '".$this->_DB->real_escape_string($userId)."'
AND u2g.fk_group_id = g.id";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
}
return round($bytes, 2) . ' ' . $units[$i];
}
+
+ /**
+ * Make the input more safe for logging
+ *
+ * @param mixed $input The string|array to be made more safe
+ * @return string
+ */
+ static function cleanForLog(mixed $input): string {
+ $input = var_export($input, true);
+ $input = preg_replace( "/[\t\n\r]/", " ", $input);
+ return addcslashes($input, "\000..\037\177..\377\\");
+ }
+
+ /**
+ * error_log with a dedicated destination
+ * Uses LOGFILE const
+ *
+ * @param string $msg The string to be written to the log
+ */
+ static function sysLog(string $msg): void {
+ error_log(date("c")." ".$msg."\n", 3, LOGFILE);
+ }
}
FROM `".DB_PREFIX."_tool`
WHERE ".$this->_User->getSQLRightsString()."
AND `action` = '".$this->_DB->real_escape_string($identifier)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows > 0) {
}
} catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
- if(DEBUG) error_log("[DEBUG] ".__METHOD__." mysql query: ".$queryStr);
+ Summoner::cleanForLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ if(QUERY_DEBUG) Summoner::sysLog("[DEBUG] ".__METHOD__." mysql query: ".$queryStr);
}
return $ret;
LEFT JOIN `".DB_PREFIX."_group` AS g ON `c`.`group` = `g`.`id`
WHERE ".$this->_User->getSQLRightsString($right, "c")."
AND `c`.`id` = '".$this->_DB->real_escape_string($id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if ($query !== false && $query->num_rows > 0) {
$this->_id = $this->_collectionData['id'];
}
} catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
}
LEFT JOIN `".DB_PREFIX."_group` AS g ON `c`.`group` = `g`.`id`
WHERE ".$this->_User->getSQLRightsString($rightsMode, "c")."
ORDER BY `c`.`name`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
FROM `".DB_PREFIX."_collection_fields_".$this->_id."` AS cf
LEFT JOIN `".DB_PREFIX."_sys_fields` AS sf ON `cf`.`fk_field_id` = `sf`.`id`
ORDER BY `cf`.`sort`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
$query = $this->_DB->query($queryStr);
try {
if($query !== false && $query->num_rows > 0) {
}
}
} catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $this->_cacheExistingCollectionFields;
else {
$queryStr .= " ORDER BY `sf`.`displayname`, `e2l`.`value`";
}
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
$query = $this->_DB->query($queryStr);
try {
if($query !== false && $query->num_rows > 0) {
}
}
} catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
FROM `".DB_PREFIX."_tool2collection` AS t2c
LEFT JOIN `".DB_PREFIX."_tool` AS t ON t.id = t2c.fk_tool_id
WHERE t2c.fk_collection_id = '".$this->_DB->real_escape_string($this->_id)."'";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
return $ret;
$this->_collectionData['stats'] = array();
$queryStr = "SELECT COUNT(*) AS entries FROM `".DB_PREFIX."_collection_entry_".$this->_id."`";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
$tags = $this->getTags();
WHERE TABLE_SCHEMA = 'bibliotheca'
AND TABLE_NAME LIKE 'bib_collection_%_".$this->_id."'
ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC";
- if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+ if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $this->_DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
$this->_collectionData['stats']['tableSize'] = Summoner::bytesToHuman($tableSize);
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'bibliotheca'
ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC";
-if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
+if(QUERY_DEBUG) Summoner::sysLog("[QUERY] ".__METHOD__." query: ".Summoner::cleanForLog($queryStr));
try {
$query = $DB->query($queryStr);
if($query !== false && $query->num_rows > 0) {
}
}
catch (Exception $e) {
- error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
+ Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
}
$TemplateData['overallTableSize'] = Summoner::bytesToHuman($overallTableSize);
$IMDB->search($search);
}
catch (Exception $e) {
- if(DEBUG) error_log("[DEBUG] imdb search catch: ".$e->getMessage());
+ if(DEBUG) Summoner::sysLog("[DEBUG] imdb search catch: ".$e->getMessage());
}
if ($IMDB->isReady) {
$IMDB->search($_imdbId); // cache used
}
catch (Exception $e) {
- if(DEBUG) error_log("[DEBUG] imdb search catch: ".$e->getMessage());
+ if(DEBUG) Summoner::sysLog("[DEBUG] imdb search catch: ".$e->getMessage());
}
if ($IMDB->isReady) {