Skip to content

Commit

Permalink
download files of forced-open conferences
Browse files Browse the repository at this point in the history
MaZderMind committed Dec 11, 2016
1 parent 4c9cc1f commit 6e0f742
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 12 additions & 1 deletion command/download.php
Original file line number Diff line number Diff line change
@@ -23,8 +23,19 @@
$conferencesAfter = new DateTime();
$conferencesAfter->sub(new DateInterval('P'.$months.'D'));

stdout('Filtering before %s', $conferencesAfter->format('Y-m-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) {
6 changes: 5 additions & 1 deletion model/Conference.php
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ public function getTitle() {
}

public function isPreviewEnabled() {
if($GLOBALS['forceopen'])
if(@$GLOBALS['forceopen'])
return true;

if($this->has('PREVIEW_DOMAIN') && ($this->get('PREVIEW_DOMAIN') == $_SERVER['SERVER_NAME']))
@@ -32,6 +32,10 @@ public function isClosed() {
return !$this->hasBegun() || $this->hasEnded();
}

public function isOpen() {
return !$this->isClosed();
}

public function startsAt() {
if(!$this->has('CONFERENCE.STARTS_AT'))
return null;

0 comments on commit 6e0f742

Please sign in to comment.