PluginProbe
JetBackup – Backup, Restore & Migrate / 1.5.1
JetBackup – Backup, Restore & Migrate v1.5.1
3.1.23.6 3.1.23.5 3.1.23.3 3.1.22.4 3.1.22.3 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.8.1 1.4.9 1.5.0 1.5.1 1.5.1.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.10 All 82 releases
backup / com / core / SGPing.php
SGPing.php
38 lines 616 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class SGPing
4 {
5 private static $lastUpdateTs;
6
7 private static function shouldUpdate()
8 {
9 if ((int)time()-self::$lastUpdateTs < SG_PING_DATE_UPDATE_FREQUENCY) {
10 return false;
11 }
12
13 return true;
14 }
15
16 public static function ping()
17 {
18 $time = @file_get_contents(SG_PING_FILE_PATH);
19 $time = json_decode($time, true);
20
21 if (time()-$time['ts'] >= SG_BACKUP_TIMEOUT) {
22 return false;
23 }
24
25 return true;
26 }
27
28 public static function update()
29 {
30 if (self::shouldUpdate()) {
31 @file_put_contents(SG_PING_FILE_PATH, json_encode(array(
32 'ts' => time()
33 )));
34 self::$lastUpdateTs = time();
35 }
36 }
37 }
38