⌈⌋ ⎇ branch:  freshcode


Artifact [9b48f730a8]

Artifact 9b48f730a8b8bc279b2f76574a2cd88f4558be4a:

  • File cron.daily/news_launchpad.php — part of check-in [3622816360] at 2015-01-18 22:49:23 on branch trunk — Remove doubled `em` tag. (user: mario size: 1000)

<?php
/**
 * title: launchpad releases news feed
 * description: query last 20 entries from cache in launchpad.db
 * version: 0.1
 * category: template
 * api: cli
 * type: cron
 * x-cron: 10 10 * * *
 *
 * Short summary
 *     → ./template/feed.launchpad.htm
 *
 */


chdir(dirname(__DIR__));
include("./config.php");
db(new PDO("sqlite:launchpad.db"));

// query
$q = db("
     SELECT r.name, r.title, r.version, SUBSTR(r.release_notes, 1, 200) AS release_notes,
            r.web_link, p.title AS proj_title, SUBSTR(p.summary, 1, 200) AS summary
       FROM releases AS r
  LEFT JOIN projects AS p
         ON p.name = r.name
   ORDER BY date_created DESC
      LIMIT 20
");

// collect
$out = "";
foreach ($q as $row) {
   $row = array_map("input::html", $row);
   $out .= <<<HTML
  <a href="$row[web_link]" title="$row[summary]">$row[proj_title] <em class=version title="$row[release_notes]">$row[version]</em></a>
HTML;
}

// write
file_put_contents("./template/feed.launchpad.htm", $out);