aboutsummaryrefslogtreecommitdiff
path: root/views/default/tidypics/admin/upgrade.php
blob: fd324b2d9a9902c8cbfe239fb92d475e68b6c465 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

// sets $version based on code
require_once "{$CONFIG->pluginspath}tidypics/version.php";

$upgrade_url = "{$vars['url']}action/tidypics/admin/upgrade";

// 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 initial version for new install
		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;
	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 />';