-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbackup_likes.php
56 lines (36 loc) · 1.09 KB
/
backup_likes.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
<?php
$root = dirname(dirname(__FILE__));
ini_set("include_path", "{$root}/www:{$root}/www/include");
set_time_limit(0);
include("include/init.php");
loadlib("backfill");
loadlib("instagram_backups");
loadlib("instagram_likes_import");
function _backup($backup, $more=array()){
$user = users_get_by_id($backup['user_id']);
$likes_more = array(
'per_page' => 1
);
$import_more = array();
if ($last_update = json_decode($backup['details'], 'as hash')){
$rsp = instagram_likes_for_user($user, $likes_more);
if (($rsp['ok']) && (count($rsp['rows']))){
$like = $rsp['rows'][0];
$import_more['max_like_id'] = $like['id'];
}
}
$rsp = instagram_likes_import_for_user($user, $import_more);
dumper($rsp);
if ($rsp['ok']){
$update = array(
'details' => json_encode($rsp)
);
instagram_backups_update($backup, $update);
}
}
$map = instagram_backups_type_map("string keys");
$enc_type = AddSlashes($map['likes']);
$sql = "SELECT * FROM InstagramBackups WHERE type_id='{$enc_type}' AND disabled=0";
backfill_db_main($sql, '_backup');
exit();
?>