-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdate_db.php
More file actions
32 lines (24 loc) · 819 Bytes
/
update_db.php
File metadata and controls
32 lines (24 loc) · 819 Bytes
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
<?php
if($_GET['hieronymus'] != "jerome") {
// To try to avoid bots/search engines from triggering this.
http_response_code(404);
die;
}
set_time_limit(0);
//Download the latest compile SQLITE file from Commentaries-Database
$url = "https://github.com/HistoricalChristianFaith/Commentaries-Database/releases/download/latest/commentaries.sqlite";
$fp = fopen (dirname(__FILE__) . '/data2.sqlite', 'w+');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
curl_close($ch);
fclose($fp);
$fs = filesize("data2.sqlite");
//Ensure db is > 50 mb
if($fs > 50000000) {
// After it's been fully downloaded, replace the existing database file.
rename("data2.sqlite", "data.sqlite");
}
?>