forked from etsy/411
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathes_sync.php
More file actions
executable file
·45 lines (36 loc) · 882 Bytes
/
Copy pathes_sync.php
File metadata and controls
executable file
·45 lines (36 loc) · 882 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
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env php
<?php
/**
* Entrypoint for syncing Alerts in ES with db.
*/
require_once(__DIR__ . '/../phplib/411bootstrap.php');
$args = getopt('h', [
'help',
'site:',
'search:'
]);
// Syntax checks
$site_set = FOO\Util::exists($args, 'site');
if(
$args === false ||
FOO\Util::exists($args, 'h') ||
FOO\Util::exists($args, 'help') ||
!FOO\Util::exists($args, 'site')
) {
print "Usage: es_sync.php --site=site_id [--search=search_id]\n";
exit(0);
}
$site = FOO\SiteFinder::getById((int) FOO\Util::get($args, 'site'));
if(is_null($site)) {
print "Unable to find site\n";
exit(1);
}
FOO\SiteFinder::setSite($site);
$search_id = (int) FOO\Util::get($args, 'search', 0);
$job = new FOO\Sync_Job();
$job['target_date'] = $_SERVER['REQUEST_TIME'];
if($search_id > 0) {
$job['target_id'] = $search_id;
}
$job->run();
exit(0);