aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php41
-rw-r--r--engine/lib/version.php49
2 files changed, 89 insertions, 1 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 2f9396da1..78afe49ce 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -812,12 +812,51 @@
*/
function __elgg_php_exception_handler($exception) {
-
+
error_log("*** FATAL EXCEPTION *** : " . $exception);
$body = elgg_view("messages/exceptions/exception",array('object' => $exception));
echo page_draw("We've encountered a problem.", $body);
}
+
+ /**
+ * Data lists
+ */
+
+ /**
+ * Get the value of a particular piece of data in the datalist
+ *
+ * @param string $name The name of the datalist
+ * @return string|false Depending on success
+ */
+ function datalist_get($name) {
+
+ global $CONFIG;
+ $name = sanitise_string($name);
+ if ($row = get_data_row("select value from {$CONFIG->prefix}datalists where name = '{$name}'")) {
+ return $row->value;
+ }
+ return false;
+
+ }
+
+ /**
+ * Sets the value for a system-wide piece of data (overwriting a previous value if it exists)
+ *
+ * @param string $name The name of the datalist
+ * @param string $value The new value
+ * @return true
+ */
+ function datalist_set($name, $value) {
+
+ global $CONFIG;
+ $name = sanitise_string($name);
+ $value = sanitise_string($value);
+ delete_data("delete from {$CONFIG->prefix}datalists where name = '{$name}'");
+ insert_data("insert into {$CONFIG->prefix}datalists set name = '{$name}', value = '{$value}'");
+ return true;
+
+ }
?> \ No newline at end of file
diff --git a/engine/lib/version.php b/engine/lib/version.php
new file mode 100644
index 000000000..ee707ca1d
--- /dev/null
+++ b/engine/lib/version.php
@@ -0,0 +1,49 @@
+<?php
+
+ /**
+ * Elgg version library.
+ * Contains code for handling versioning and upgrades.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ /**
+ * Get the current version information
+ *
+ * @param true|false $humanreadable Whether to return a human readable version (default: false)
+ * @return string|false Depending on success
+ */
+ function get_version($humanreadable = false) {
+
+ global $CONFIG;
+ if (@include($CONFIG->path . "version.php")) {
+ if ($humanreadable) return $version;
+ return $release;
+ }
+
+ return false;
+
+ }
+
+ /**
+ * Determines whether or not the database needs to be upgraded.
+ *
+ * @return true|false Depending on whether or not the db version matches the code version
+ */
+ function db_upgrade_check() {
+
+ $dbversion = (int) get_datalist('version');
+ $version = get_version();
+
+ if ($version > $dbversion) {
+ return true;
+ }
+ return false;
+
+ }
+
+?> \ No newline at end of file