blob: 8c384a69beb828a0efb3b79064f420804f303600 (
plain)
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
|
#!/usr/bin/env php
<?php
sleep(rand(35, 70));
$BASEPATH = dirname(__FILE__);
chdir($BASEPATH);
require_once('../providers/Facebook.php');
$cacheFiles = glob('../cache/facebook.*');
$fileToFetch = NULL;
$oldestCache = PHP_INT_MAX;
foreach ($cacheFiles as $file) {
if (!preg_match('/\.Piwoteka$/', $file)) {
$cacheTime = filemtime($file);
if ($cacheTime < $oldestCache) {
$oldestCache = $cacheTime;
$fileToFetch = explode('.', basename($file));
array_shift($fileToFetch);
$fileToFetch = implode('.', $fileToFetch);
}
}
}
$filesToFetch = ['Piwoteka', $fileToFetch];
foreach ($filesToFetch as $feed) {
sleep(rand(35, 70));
$provider = new \Providers\Facebook($feed, ['force' => TRUE]);
if (!$provider->get()) {
throw new \Exception(sprintf('Feed %s failed to fetch!', $feed));
}
}
?>
|