aboutsummaryrefslogtreecommitdiff
path: root/actions/upgrade.php
blob: 596b90a22ba1f1a5aef91c83004803a44f0e6386 (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
39
<?php

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

include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";

admin_gatekeeper();

$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']);