blob: d0999b4ffd1b7db9e653032f38723f83378b7946 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
<?php
$conf = $GLOBALS['CONFIG']['DOWNLOAD'];
if(isset($conf['REQUIRE_USER']))
{
if(get_current_user() != $conf['require-user'])
{
stderr(
'Not downloading files for user %s, run this script as user %s',
get_current_user(),
$conf['require-user']
);
exit(2);
}
}
$conferences = Conferences::getConferences();
if(isset($conf['MAX_CONFERENCE_AGE']))
{
$months = intval($conf['MAX_CONFERENCE_AGE']);
$conferencesAfter = new DateTime();
$conferencesAfter->sub(new DateInterval('P'.$months.'D'));
stdout('Skipping Conferences before %s', $conferencesAfter->format('Y-m-d'));
$conferences = array_filter($conferences, function($conference) use ($conferencesAfter) {
if($conference->isOpen())
{
stdout(
' %s: %s',
'---open---',
$conference->getSlug()
);
return true;
}
$isBefore = $conference->endsAt() < $conferencesAfter;
if($isBefore) {
stdout(
' %s: %s',
$conference->endsAt()->format('Y-m-d'),
$conference->getSlug()
);
}
return !$isBefore;
});
}
stdout('');
foreach ($conferences as $conference)
{
stdout('== %s ==', $conference->getSlug());
}
|