Skip to content

Commit

Permalink
Adds new changelog repository to site and sitemap, removes old collector
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobemerick committed Jan 2, 2016
1 parent be7d91c commit e3ab56e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
20 changes: 0 additions & 20 deletions collector/data/ChangelogCollector.class.inc.php

This file was deleted.

15 changes: 9 additions & 6 deletions controller/site/ChangelogController.class.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?

use Jacobemerick\Web\Domain\Stream\Changelog\MysqlChangelogRepository;

Loader::load('controller', 'site/DefaultPageController');

final class ChangelogController extends DefaultPageController
Expand All @@ -26,17 +28,18 @@ protected function set_body_data()

private function get_changelog()
{
Loader::load('collector', 'data/ChangelogCollector');
$changelog_result = ChangelogCollector::getLast20Changes();
global $container;
$changelogRepository = new MysqlChangelogRepository($container['db_connection_locator']);
$changelog_result = $changelogRepository->getChanges(40);

foreach($changelog_result as $change)
{
$changelog[] = (object) array(
'date' => (object) array(
'stamp' => date('c', strtotime($change->date)),
'short' => date('M j', strtotime($change->date)),
'friendly' => date('F j, Y g:i A', strtotime($change->date))),
'message' => $change->message);
'stamp' => date('c', strtotime($change['datetime'])),
'short' => date('M j', strtotime($change['datetime'])),
'friendly' => date('F j, Y g:i A', strtotime($change['datetime']))),
'message' => $change['message_short']);
}

return array('changelog' => $changelog);
Expand Down
7 changes: 6 additions & 1 deletion script/cron/generate-sitemaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository as BlogPostRepository;
use Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository as BlogTagRepository;
use Jacobemerick\Web\Domain\Portfolio\Piece\MysqlPieceRepository as PortfolioPieceRepository;
use Jacobemerick\Web\Domain\Stream\Changelog\MysqlChangelogRepository as ChangelogRepository;
use Jacobemerick\Web\Domain\Stream\Post\MysqlPostRepository as StreamPostRepository;
use Jacobemerick\Web\Domain\Waterfall\Companion\MysqlCompanionRepository as WaterfallCompanionRepository;
use Jacobemerick\Web\Domain\Waterfall\County\MysqlCountyRepository as WaterfallCountyRepository;
Expand Down Expand Up @@ -350,6 +351,10 @@
/*********************************************
* site.jacobemerick.com
*********************************************/
$changelogRepository = new ChangelogRepository($container['db_connection_locator']);
$mostRecentChange = $changelogRepository->getChanges(1);
$mostRecentChange = current($mostRecentChange);

$entryArray = [
'/' => [
'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'),
Expand All @@ -362,7 +367,7 @@
'priority' => .3,
],
'/change-log/' => [
'lastmod' => (new DateTime('now'))->format('Y-m-d'), // todo lookup based on changelog
'lastmod' => (new DateTime($mostRecentChange['datetime']))->format('c'),
'changefreq' => 'daily',
'priority' => .1,
],
Expand Down

0 comments on commit e3ab56e

Please sign in to comment.