-
Notifications
You must be signed in to change notification settings - Fork 0
/
migration-sceneorgrecommended.php
63 lines (55 loc) · 1.32 KB
/
migration-sceneorgrecommended.php
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?
require_once("scripts-bootstrap.inc.php");
//SQLLib::Query("truncate awards");
//SQLLib::Query("truncate awards_categories");
$rows = SQLLib::SelectRows("select * from sceneorgrecommended_DEPRECATED");
foreach($rows as $v)
{
$a = array();
$series = "";
$awardType = "";
$category = $v->category;
switch ($v->type)
{
case 'awardwinner':
$series = "Scene.org Awards";
$awardType = "winner";
break;
case 'awardnominee':
$series = "Scene.org Awards";
$awardType = "nominee";
break;
case 'viewingtip':
$series = "Scene.org Viewing Tips";
$awardType = "winner";
$category = "Viewing Tip";
break;
case 'meteorikwinner':
$series = "The Meteoriks";
$awardType = "winner";
break;
case 'meteoriknominee':
$series = "The Meteoriks";
$awardType = "nominee";
break;
}
$r = SQLLib::SelectRow(sprintf_esc("select * from awards_categories where series='%s' and category='%s'",$series,$category));
if (!$r)
{
$id = SQLLib::InsertRow("awards_categories",array(
"series" => $series,
"category" => $category,
));
$categoryID = $id;
}
else
{
$categoryID = $r->id;
}
SQLLib::InsertRow("awards",array(
"prodID" => $v->prodid,
"categoryID" => $categoryID,
));
echo ".";
}
?>