aboutsummaryrefslogtreecommitdiff
path: root/actions/upgrade.php
blob: 0ff04dadf2042c0438547bf01b01a665662af2be (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
33
34
35
36
37
38
<?php

/********************************************
 *
 * Upgrade from Tidypics 1.5 to 1.6
 *
 *********************************************/

	include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
 
	$result = true;
	
	// add image class
	$id = get_subtype_id("object", "image"); 
	if ($id != 0) {
		$table = $CONFIG->dbprefix . 'entity_subtypes';
		$result = update_data("UPDATE {$table} set class='TidypicsImage' where id={$id}");
		if (!result) {
			register_error(elgg_echo('tidypics:upgrade:failed'));
			forward($_SERVER['HTTP_REFERER']);
		}
	}

	// add album class
	$id = get_subtype_id("object", "album"); 
	if ($id != 0) {
		$table = $CONFIG->dbprefix . 'entity_subtypes';
		$result = update_data("UPDATE {$table} set class='TidypicsAlbum' where id={$id}");
		if (!result) {
			register_error(elgg_echo('tidypics:upgrade:failed'));
			forward($_SERVER['HTTP_REFERER']);
		}
	}

	system_message(elgg_echo('tidypics:upgrade:success'));
	
	forward($_SERVER['HTTP_REFERER']);
?>