-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.php
33 lines (29 loc) · 855 Bytes
/
run.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
<?php
/**
* You can include this file in a custom file to run the update script.
* This is useful if you want to run the update script manually or from a cron job.
*
* Example :
* <?php
* $key = 'your-license-key';
* include_once __DIR__ . '/run.php';
* $results = ozh_yourls_geoip2_update_client_run($key);
* // do something with $results
* ?>
*/
function ozh_yourls_geoip2_update_client_run($key) {
require 'vendor/autoload.php';
// configuration
$client = new \tronovav\GeoIP2Update\Client(array(
'license_key' => $key,
'dir' => __DIR__,
'editions' => array('GeoLite2-Country'),
));
// run update
$client->run();
// return update status and errors
return array(
'updated' => $client->updated(),
'errors' => $client->errors(),
);
}