diff options
Diffstat (limited to 'views/default/tidypics')
-rw-r--r-- | views/default/tidypics/admin/settings.php | 3 | ||||
-rw-r--r-- | views/default/tidypics/admin/upgrade.php | 30 | ||||
-rw-r--r-- | views/default/tidypics/forms/settings.php | 6 |
3 files changed, 31 insertions, 8 deletions
diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php index 60c34b64e..6dace1830 100644 --- a/views/default/tidypics/admin/settings.php +++ b/views/default/tidypics/admin/settings.php @@ -7,8 +7,7 @@ echo elgg_view('output/longtext', array('value' => elgg_echo("tidypics:admin:ins <?php echo elgg_view('tidypics/admin/upgrade'); -global $CONFIG; -$url = $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; +$url = "{$vars['url']}mod/tidypics/pages/server_analysis.php"; $text = elgg_echo('tidypics:settings:server:analysis'); echo "<a href=\"$url\">$text</a>"; diff --git a/views/default/tidypics/admin/upgrade.php b/views/default/tidypics/admin/upgrade.php new file mode 100644 index 000000000..5a21aa136 --- /dev/null +++ b/views/default/tidypics/admin/upgrade.php @@ -0,0 +1,30 @@ +<?php + +require_once "{$CONFIG->pluginspath}tidypics/version.php"; + +$upgrade_url = "{$vars['url']}action/tidypics/admin/upgrade"; +//$upgrade_url = elgg_add_action_tokens_to_url($upgrade_url); + +// determine whether an upgrade is required +$local_version = 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_plugin_setting('version', $local_version, 'tidypics'); + $local_version = $version; + } +} elseif ($local_version == '1.62') { + $local_version = 2010010101; + set_plugin_setting('version', $local_version, 'tidypics'); +} +if ($local_version == $version) { + // no upgrade required + return TRUE; +} + +echo elgg_view('output/url', array( 'text' => 'Upgrade', + 'href' => $upgrade_url, + 'is_action' => TRUE)); +echo '<br />';
\ No newline at end of file diff --git a/views/default/tidypics/forms/settings.php b/views/default/tidypics/forms/settings.php index e7d05adcc..c102b044e 100644 --- a/views/default/tidypics/forms/settings.php +++ b/views/default/tidypics/forms/settings.php @@ -10,12 +10,6 @@ $action = $vars['url'] . 'action/tidypics/settings'; $plugin = find_plugin_settings('tidypics'); -// bootstrap the plugin version here for now -if (!$plugin->version) { - set_plugin_setting('version', 1.62, 'tidypics'); -} - - // Main settings $form_body = '<h3>' . elgg_echo('tidypics:settings:heading:main') . '</h3>'; |