From: nickw ';
+ print_r($value);
+ echo '
';
+}
+
/**
* Custom exception handler.
* This function catches any thrown exceptions and handles them appropriately.
@@ -2015,7 +2069,7 @@ function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = fals
return false;
}
- if ($CONFIG->debug) {
+ if (isset($CONFIG->debug)) {
system_message("Gatekeeper'd function called from {$callstack[1]['file']}:{$callstack[1]['line']}\n\nStack trace:\n\n" . print_r($callstack, true));
}
@@ -2263,13 +2317,12 @@ function js_page_handler($page) {
*
*/
function __elgg_shutdown_hook() {
- global $CONFIG, $START_MICROTIME;
+ global $START_MICROTIME;
trigger_elgg_event('shutdown', 'system');
-
- if ($CONFIG->debug) {
- error_log("Page {$_SERVER['REQUEST_URI']} generated in ".(float)(microtime(true)-$START_MICROTIME)." seconds");
- }
+
+ $time = (float)(microtime(TRUE) - $START_MICROTIME);
+ elgg_log("Page {$_SERVER['REQUEST_URI']} generated in $time seconds", 'DEBUG');
}
/**
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 211fbc05c..373654431 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1479,27 +1479,9 @@ function get_entity_as_row($guid) {
}
$guid = (int) $guid;
-
- /*$row = retrieve_cached_entity_row($guid);
- if ($row)
- {
- // We have already cached this object, so retrieve its value from the cache
- if (isset($CONFIG->debug) && $CONFIG->debug)
- error_log("** Retrieving GUID:$guid from cache");
-
- return $row;
- }
- else
- {*/
- // Object not cached, load it.
- if (isset($CONFIG->debug) && $CONFIG->debug == true) {
- error_log("** GUID:$guid loaded from DB");
- }
-
- $access = get_access_sql_suffix();
-
- return get_data_row("SELECT * from {$CONFIG->dbprefix}entities where guid=$guid and $access");
- //}
+ $access = get_access_sql_suffix();
+
+ return get_data_row("SELECT * from {$CONFIG->dbprefix}entities where guid=$guid and $access");
}
/**
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 664837a27..9fc937ff3 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -318,24 +318,7 @@ function get_group_entity_as_row($guid) {
$guid = (int)$guid;
- /*$row = retrieve_cached_entity_row($guid);
- if ($row)
- {
- // We have already cached this object, so retrieve its value from the cache
- if (isset($CONFIG->debug) && $CONFIG->debug)
- error_log("** Retrieving sub part of GUID:$guid from cache");
-
- return $row;
- }
- else
- {*/
- // Object not cached, load it.
- if (isset($CONFIG->debug) && $CONFIG->debug == true) {
- error_log("** Sub part of GUID:$guid loaded from DB");
- }
-
return get_data_row("SELECT * from {$CONFIG->dbprefix}groups_entity where guid=$guid");
- //}
}
/**
diff --git a/engine/lib/languages.php b/engine/lib/languages.php
index 19f3c138a..898fc725f 100644
--- a/engine/lib/languages.php
+++ b/engine/lib/languages.php
@@ -125,10 +125,7 @@ function register_translations($path, $load_all = false) {
// Get the current language based on site defaults and user preference
$current_language = get_current_language();
-
- if (isset($CONFIG->debug) && $CONFIG->debug == true) {
- error_log("Translations loaded from : $path");
- }
+ elgg_log("Translations loaded from: $path");
if ($handle = opendir($path)) {
while ($language = readdir($handle)) {
@@ -140,7 +137,7 @@ function register_translations($path, $load_all = false) {
}
}
} else {
- error_log("Missing translation path $path");
+ elgg_log("Missing translation path $path", 'ERROR');
}
}
diff --git a/engine/lib/memcache.php b/engine/lib/memcache.php
index 498d1ff4f..ed93cacf0 100644
--- a/engine/lib/memcache.php
+++ b/engine/lib/memcache.php
@@ -77,9 +77,7 @@ class ElggMemcache extends ElggSharedMemoryCache {
}
}
} else {
- if ((isset($CONFIG->debug)) && ($CONFIG->debug == true)) {
- error_log(elgg_echo('memcache:noaddserver'));
- }
+ elgg_log(elgg_echo('memcache:noaddserver'), 'ERROR');
$server = $CONFIG->memcache_servers[0];
if (is_array($server)) {
@@ -131,8 +129,8 @@ class ElggMemcache extends ElggSharedMemoryCache {
$key = $this->make_memcache_key($key);
$result = $this->memcache->set($key, $data, null, $this->expires);
- if ((isset($CONFIG->debug)) && ($CONFIG->debug == true) && (!$result)) {
- error_log("MEMCACHE: FAILED TO SAVE $key");
+ if (!$result) {
+ elgg_log("MEMCACHE: FAILED TO SAVE $key", 'ERROR');
}
return $result;
@@ -142,8 +140,8 @@ class ElggMemcache extends ElggSharedMemoryCache {
$key = $this->make_memcache_key($key);
$result = $this->memcache->get($key);
- if ((isset($CONFIG->debug)) && ($CONFIG->debug == true) && (!$result)) {
- error_log("MEMCACHE: FAILED TO LOAD $key");
+ if (!$result) {
+ elgg_log("MEMCACHE: FAILED TO LOAD $key", 'ERROR');
}
return $result;
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php
index 519d186e4..3e8796d3f 100644
--- a/engine/lib/metastrings.php
+++ b/engine/lib/metastrings.php
@@ -28,10 +28,7 @@ function get_metastring_id($string, $case_sensitive = true) {
$string = sanitise_string($string);
$result = array_search($string, $METASTRINGS_CACHE);
if ($result!==false) {
- if (isset($CONFIG->debug) && $CONFIG->debug) {
- error_log("** Returning id for string:$string from cache.");
- }
-
+ elgg_log("** Returning id for string:$string from cache.");
return $result;
}
@@ -68,9 +65,7 @@ function get_metastring_id($string, $case_sensitive = true) {
$metastrings_memcache->save($row->string, $row->id);
}
- if (isset($CONFIG->debug) && $CONFIG->debug) {
- error_log("** Cacheing string '{$row->string}'");
- }
+ elgg_log("** Cacheing string '{$row->string}'");
return $row->id;
} else {
@@ -92,9 +87,7 @@ function get_metastring($id) {
$id = (int) $id;
if (isset($METASTRINGS_CACHE[$id])) {
- if ($CONFIG->debug) {
- error_log("** Returning string for id:$id from cache.");
- }
+ elgg_log("** Returning string for id:$id from cache.");
return $METASTRINGS_CACHE[$id];
}
@@ -102,10 +95,7 @@ function get_metastring($id) {
$row = get_data_row("SELECT * from {$CONFIG->dbprefix}metastrings where id='$id' limit 1");
if ($row) {
$METASTRINGS_CACHE[$id] = $row->string; // Cache it
-
- if ($CONFIG->debug) {
- error_log("** Cacheing string '{$row->string}'");
- }
+ elgg_log("** Cacheing string '{$row->string}'");
return $row->string;
}
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index 6284e874d..ad65455f3 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -109,9 +109,7 @@ function notify_user($to, $from, $subject, $message, array $params = NULL, $meth
error_log(sprintf(elgg_echo('NotificationException:NoHandlerFound'), $method));
}
- if ($CONFIG->debug) {
- error_log("Sending message to $guid using $method");
- }
+ elgg_log("Sending message to $guid using $method");
// Trigger handler and retrieve result.
try {
diff --git a/engine/lib/objects.php b/engine/lib/objects.php
index a81925ce1..7e21550aa 100644
--- a/engine/lib/objects.php
+++ b/engine/lib/objects.php
@@ -215,25 +215,7 @@ function get_object_entity_as_row($guid) {
global $CONFIG;
$guid = (int)$guid;
-
- /*$row = retrieve_cached_entity_row($guid);
- if ($row)
- {
- // We have already cached this object, so retrieve its value from the cache
- if (isset($CONFIG->debug) && $CONFIG->debug)
- error_log("** Retrieving sub part of GUID:$guid from cache");
-
- return $row;
- }
- else
- {*/
- // Object not cached, load it.
- if ($CONFIG->debug) {
- error_log("** Sub part of GUID:$guid loaded from DB");
- }
-
- return get_data_row("SELECT * from {$CONFIG->dbprefix}objects_entity where guid=$guid");
- //}
+ return get_data_row("SELECT * from {$CONFIG->dbprefix}objects_entity where guid=$guid");
}
/**
diff --git a/engine/lib/sites.php b/engine/lib/sites.php
index 7a1375d46..d38113d27 100644
--- a/engine/lib/sites.php
+++ b/engine/lib/sites.php
@@ -252,25 +252,7 @@ function get_site_entity_as_row($guid) {
global $CONFIG;
$guid = (int)$guid;
-
- /*$row = retrieve_cached_entity_row($guid);
- if ($row)
- {
- // We have already cached this object, so retrieve its value from the cache
- if (isset($CONFIG->debug) && $CONFIG->debug)
- error_log("** Retrieving sub part of GUID:$guid from cache");
-
- return $row;
- }
- else
- {*/
- // Object not cached, load it.
- if (isset($CONFIG->debug) && $CONFIG->debug == true) {
- error_log("** Sub part of GUID:$guid loaded from DB");
- }
-
return get_data_row("SELECT * from {$CONFIG->dbprefix}sites_entity where guid=$guid");
- //}
}
/**
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 7d1fa3d58..29a2dd42f 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -372,26 +372,8 @@ class ElggUser extends ElggEntity
function get_user_entity_as_row($guid) {
global $CONFIG;
- /*$row = retrieve_cached_entity_row($guid);
- if ($row)
- {
- // We have already cached this object, so retrieve its value from the cache
- if (isset($CONFIG->debug) && $CONFIG->debug == true)
- error_log("** Retrieving sub part of GUID:$guid from cache");
-
- return $row;
- }
- else
- {*/
- // Object not cached, load it.
- if (isset($CONFIG->debug) && $CONFIG->debug == true) {
- error_log("** Sub part of GUID:$guid loaded from DB");
- }
-
$guid = (int)$guid;
-
return get_data_row("SELECT * from {$CONFIG->dbprefix}users_entity where guid=$guid");
- //}
}
/**
diff --git a/engine/start.php b/engine/start.php
index b6699309b..7caa35b0f 100644
--- a/engine/start.php
+++ b/engine/start.php
@@ -133,9 +133,7 @@ if ($sanitised = sanitised()) {
// Include them
foreach($files as $file) {
- if (isset($CONFIG->debug) && $CONFIG->debug) {
- error_log("Loading $file...");
- }
+ elgg_log("Loading $file...");
if (!include_once($file)) {
throw new InstallationException("Could not load {$file}");
}
diff --git a/engine/tests/suite.php b/engine/tests/suite.php
index 01056a218..c3de185ff 100755
--- a/engine/tests/suite.php
+++ b/engine/tests/suite.php
@@ -28,19 +28,19 @@ foreach ($test_files as $file) {
}
// Only run tests in debug mode.
-if ($CONFIG->debug > 0) {
- if (TextReporter::inCli()) {
- // In CLI error codes are returned.
- // 0 is success.
- elgg_set_ignore_access(TRUE);
- exit ($suite->Run(new TextReporter()) ? 0 : 1 );
- }
- // Ensure that only logged-in users can see this page
- //admin_gatekeeper();
- $old = elgg_set_ignore_access(TRUE);
- $suite->Run(new HtmlReporter());
- elgg_set_ignore_access($old);
-} else {
+if (!isset($CONFIG->debug)) {
// @todo display an error?
exit (1);
}
+
+if (TextReporter::inCli()) {
+ // In CLI error codes are returned: 0 is success
+ elgg_set_ignore_access(TRUE);
+ exit ($suite->Run(new TextReporter()) ? 0 : 1 );
+}
+
+// Ensure that only logged-in users can see this page
+//admin_gatekeeper();
+$old = elgg_set_ignore_access(TRUE);
+$suite->Run(new HtmlReporter());
+elgg_set_ignore_access($old);
diff --git a/views/default/messages/exceptions/exception.php b/views/default/messages/exceptions/exception.php
index c93883cbc..65ec7cdbf 100644
--- a/views/default/messages/exceptions/exception.php
+++ b/views/default/messages/exceptions/exception.php
@@ -24,7 +24,7 @@ $body = <<< END