-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatocheka.php
40 lines (30 loc) · 1.12 KB
/
batocheka.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
<?php
//////////////////////////////////////////////////////
// CHECK IF NEW BATOCERA LINUX VERSION IS AVAILABLE //
//////////////////////////////////////////////////////
// Pre-Check: Save version to file if file doesn't exist, yet
if (!file_exists('batocera_old.txt')) {
$batocera_old = file_get_contents('https://batocera.org/upgrades/installs.txt');
file_put_contents('batocera_old.txt', $batocera_old);
sleep(1);
}
// Compare versions
$batocera_new = file_get_contents('https://batocera.org/upgrades/installs.txt');
$batocera_old = file_get_contents('batocera_old.txt');
// Send mail if new version is available
if ($batocera_old != $batocera_new) {
$receiver = 'YOUREMAILADDRESSHERE';
$subject = 'New Batocera version(s) available!';
$message = $batocera_new;
$headers = 'From: ' . $receiver . "\r\n" .
'Reply-To: ' . $receiver . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($receiver, $subject, $message, $headers);
echo $subject;
}
else {
echo 'No new version(s) available (current version still '.$batocera_old.')';
}
// Update temp file
file_put_contents('batocera_old.txt', $batocera_new);
?>