mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-07-30 17:57:13 +02:00
Added a timestamp to logs
Ignore errors about table "options" not existing when installing git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@458029 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
@ -122,13 +122,21 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$initial = $sql;
|
||||||
$sql = pg4wp_rewrite( $sql);
|
$sql = pg4wp_rewrite( $sql);
|
||||||
|
|
||||||
$GLOBALS['pg4wp_result'] = pg_query($sql);
|
$GLOBALS['pg4wp_result'] = pg_query($sql);
|
||||||
if( (PG4WP_DEBUG || PG4WP_LOG_ERRORS) && $GLOBALS['pg4wp_result'] === false && $err = pg_last_error())
|
if( (PG4WP_DEBUG || PG4WP_LOG_ERRORS) && $GLOBALS['pg4wp_result'] === false && $err = pg_last_error())
|
||||||
if( false === strpos($err, 'relation "'.$wpdb->options.'"'))
|
{
|
||||||
error_log("Error running :\n$initial\n---- converted to ----\n$sql\n----\n$err\n---------------------\n", 3, PG4WP_LOG.'pg4wp_errors.log');
|
$ignore = false;
|
||||||
|
if( defined('WP_INSTALLING') && WP_INSTALLING)
|
||||||
|
{
|
||||||
|
global $table_prefix;
|
||||||
|
$ignore = strpos($err, 'relation "'.$table_prefix.'options"');
|
||||||
|
}
|
||||||
|
if( ! $ignore )
|
||||||
|
error_log('['.microtime(true)."] Error running :\n$initial\n---- converted to ----\n$sql\n----> $err\n---------------------\n", 3, PG4WP_LOG.'pg4wp_errors.log');
|
||||||
|
}
|
||||||
return $GLOBALS['pg4wp_result'];
|
return $GLOBALS['pg4wp_result'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +159,7 @@
|
|||||||
$res = pg_query($sql);
|
$res = pg_query($sql);
|
||||||
$data = pg_fetch_result($res, 0, 0);
|
$data = pg_fetch_result($res, 0, 0);
|
||||||
if( PG4WP_DEBUG && $sql)
|
if( PG4WP_DEBUG && $sql)
|
||||||
error_log("Getting inserted ID for '$t' : $sql => $data\n", 3, PG4WP_LOG.'pg4wp_insertid.log');
|
error_log( '['.microtime(true)."] Getting inserted ID for '$t' : $sql => $data\n", 3, PG4WP_LOG.'pg4wp_insertid.log');
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +183,7 @@
|
|||||||
$sql = str_replace('SQL_CALC_FOUND_ROWS', '', $sql);
|
$sql = str_replace('SQL_CALC_FOUND_ROWS', '', $sql);
|
||||||
$GLOBALS['pg4wp_numrows_query'] = $sql;
|
$GLOBALS['pg4wp_numrows_query'] = $sql;
|
||||||
if( PG4WP_DEBUG)
|
if( PG4WP_DEBUG)
|
||||||
error_log( "Number of rows required for :\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_NUMROWS.log');
|
error_log( '['.microtime(true)."] Number of rows required for :\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_NUMROWS.log');
|
||||||
}
|
}
|
||||||
elseif( false !== strpos($sql, 'FOUND_ROWS()'))
|
elseif( false !== strpos($sql, 'FOUND_ROWS()'))
|
||||||
{
|
{
|
||||||
@ -419,9 +427,9 @@
|
|||||||
if( PG4WP_DEBUG)
|
if( PG4WP_DEBUG)
|
||||||
{
|
{
|
||||||
if( $initial != $sql)
|
if( $initial != $sql)
|
||||||
error_log("Converting :\n$initial\n---- to ----\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_'.$logto.'.log');
|
error_log( '['.microtime(true)."] Converting :\n$initial\n---- to ----\n$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_'.$logto.'.log');
|
||||||
else
|
else
|
||||||
error_log("$sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_unmodified.log');
|
error_log( '['.microtime(true)."] $sql\n---------------------\n", 3, PG4WP_LOG.'pg4wp_unmodified.log');
|
||||||
}
|
}
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user