ozh / yourls-geoip-update

🌍 YOURLS plugin to update the GeoIP database
7 stars 2 forks source link

use of run.php to update #2

Closed un99known99 closed 2 years ago

un99known99 commented 2 years ago

Hi, thx a ton for the version 1.9.0 - upgrade worked out perfect for me, just one point open, I would like to useh the run.php for geopip updates.

Do I only need to insert the maxmind key and just use "/usr/bin/php run.php" in a cron script?

I am not sure how to handle the automatic update?

Thanks in advance for ur help.

Best regards, Mike

ozh commented 2 years ago

There's an example of use as a comment at the beginning of run.php

 * Example :
 *      <?php
 *      $key = 'your-license-key';
 *      include_once __DIR__ . '/run.php';
 *      $results = ozh_yourls_geoip2_update_client_run($key);
 *      // do something with $results
 *      ?>

Put this in cron.php and call this file with your cron script

un99known99 commented 2 years ago

uh, that was a fast one, thank u very much :)

un99known99 commented 2 years ago

hm what am I doing wrong?

for testing purposes:

pi@raspberrypi:[~/TEST/YOURLS_UPGRADE] $ /usr/bin/php ./run.php PHP Fatal error: Uncaught Error: Call to undefined function ozh_yourls_geoip2_update_client_run() in /home/pi/TEST/YOURLS_UPGRADE/run.php:4 Stack trace:

0 {main}

thrown in /home/pi/TEST/YOURLS_UPGRADE/run.php on line 4

Do I mixed something with path?

un99known99 commented 2 years ago

should it run like a shell-script or with/usr/bin/php do I need to enter more besides the license-key? Would be great to have more infos on that as I am not a php guy :) Thanks.

ozh commented 2 years ago

/home/bob/site.com/users/plugin/yourls-geoip-update/cron.php :

<?php
$key = 'your-license-key';
include_once __DIR__ . '/run.php';
$results = ozh_yourls_geoip2_update_client_run($key);
var_dump($results);

Crontab :

0 0 1 * * /usr/bin/php /home/bob/site.com/users/plugin/yourls-geoip-update/cron.php

Path to be edited to suit your install obviously.

un99known99 commented 2 years ago

many thanks @ozh !!!