summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/bootstrap.inc2
-rw-r--r--includes/common.inc14
2 files changed, 10 insertions, 6 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 174ca6243..d0240fa8a 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -148,7 +148,7 @@ function cache_set($cid, $data, $expire = CACHE_PERMANENT, $headers = NULL) {
db_query("UPDATE {cache} SET data = '%s', created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $data, time(), $expire, $headers, $cid);
if (!db_affected_rows()) {
- db_query("INSERT INTO {cache} (cid, data, created, expire, headers) VALUES ('%s', '%s', %d, %d, '%s')", $cid, $data, time(), $expire, $headers);
+ @db_query("INSERT INTO {cache} (cid, data, created, expire, headers) VALUES ('%s', '%s', %d, %d, '%s')", $cid, $data, time(), $expire, $headers);
}
}
diff --git a/includes/common.inc b/includes/common.inc
index bc9cac4eb..da0e588fc 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -390,15 +390,19 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
*/
/**
- * Log errors in the database rather than displaying them to the user.
+ * Log errors as defined by administrator
+ * Error levels:
+ * 1 = Log errors to database.
+ * 2 = Log errors to database and to screen.
*/
function error_handler($errno, $message, $filename, $line, $variables) {
- $types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning');
- $entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.';
+ if ($errno & E_ALL ^ E_NOTICE) {
+ $types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning');
+ $entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.';
- if ($errno & (E_ALL ^ E_NOTICE)) {
watchdog('error', t('%error: %message in %file on line %line.', array('%error' => $types[$errno], '%message' => $message, '%file' => $filename, '%line' => $line)));
- if (error_reporting()) {
+
+ if (variable_get('error_level', 1) == 1) {
print '<pre>'. $entry .'</pre>';
}
}