aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2012-01-02 17:01:18 -0500
committercash <cash.costello@gmail.com>2012-01-02 17:01:18 -0500
commitf5e8d5e9be7873132fbfddf74ef8ff68f01fccae (patch)
treedaa66614fd7f5ed70c96c57882dfd1a9470894bb /lib
parent599d1068636f8c1ba5c899ecdbd03aca7ebc5a0f (diff)
downloadelgg-f5e8d5e9be7873132fbfddf74ef8ff68f01fccae.tar.gz
elgg-f5e8d5e9be7873132fbfddf74ef8ff68f01fccae.tar.bz2
updated the upgrade system
Diffstat (limited to 'lib')
-rw-r--r--lib/tidypics.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/tidypics.php b/lib/tidypics.php
index 0a4586c29..4e56ae829 100644
--- a/lib/tidypics.php
+++ b/lib/tidypics.php
@@ -109,6 +109,38 @@ function tidypics_get_image_libraries() {
return $options;
}
+/**
+ * Are there upgrade scripts to be run?
+ *
+ * @return bool
+ */
+function tidypics_is_upgrade_available() {
+ // sets $version based on code
+ require_once elgg_get_plugins_path() . "tidypics/version.php";
+
+ $local_version = elgg_get_plugin_setting('version', 'tidypics');
+ if ($local_version === false) {
+ // no version set so either new install or really old one
+ if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album')) {
+ $local_version = 0;
+ } else {
+ // set initial version for new install
+ elgg_set_plugin_setting('version', $version, 'tidypics');
+ $local_version = $version;
+ }
+ } elseif ($local_version === '1.62') {
+ // special work around to handle old upgrade system
+ $local_version = 2010010101;
+ elgg_set_plugin_setting('version', $local_version, 'tidypics');
+ }
+
+ if ($local_version == $version) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
/*********************************************************************
* the functions below replace broken core functions or add functions
* that could/should exist in the core