aboutsummaryrefslogtreecommitdiffstats
path: root/updateapplication.php
blob: 7a067309973adfa55e9c03d38b79f17357b763b8 (plain) (blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
set_time_limit(0);
require_once("authenticate.php");
require_once("databaseauthenticate.php");
?>

<html>
<head>
<title>ZX2C4 Music Updater</title>
<style>
pre
{
	margin: 0px 0px 0px 20px;
}
p
{
	margin: 0px;
}
</style>
</head>
<body>
<?php
echo "<h2>ZX2C4 Music Updater</h2>";
echo "<p>Downloading tarball...";
if(copy("http://git.zx2c4.com/ZX2C4Music/snapshot/ZX2C4Music-master.tar.gz", "latest.tar.gz"))
{
	echo "done.</p>";
}
else
{
	echo "error!</p>";
	exit;
}
echo "<p>Unpacking tarball:<pre>";
ob_flush();
flush();
system("tar -xvzf latest.tar.gz");
echo "</pre></p>";
if($_GET["updatetagreader"] != "true")
{
	echo "<p>Removing binary blob in case of custom compilation:<pre>";
	ob_flush();
	flush();
	system("rm -rv ZX2C4Music-master/tagreader");
	echo "</pre></p>";
}
echo "<p>Merging new files:<pre>";
ob_flush();
flush();
system("mv -v ZX2C4Music-master/* .");
echo "</pre></p>";
if($_GET["recompiletagreader"] == "true")
{
	echo "<p>Compiling tag reader:<pre>";
	ob_flush();
	flush();
	system("./compiletagreader.sh");
	echo "</pre></p>";
}
echo "<p>Cleaning up:<pre>";
ob_flush();
flush();
system("rm -rv ZX2C4Music-master latest.tar.gz");
echo "</pre></p>";
if($_GET["rescandatabase"] == "true")
{
	require_once("databaseconnect.php");
	echo "<p>Removing old database table and rescanning collection:<pre>";
	ob_flush();
	flush();
	mysql_query("DROP TABLE `musictags`;");
	require_once("updatedatabase.php");
	echo "</pre>";
}
echo "<h2>Finished!</h2>";
ob_flush();
flush();
?>
</body>
</html>