aurweb/web/template/stats/updates_table.php
Dan McGee 1f252eba64 Always set ModifiedTS including new packages
Set it equal to the SubmittedTS field, which will be our indication the
package is new when we show the logo on the front page of the AUR.

This results in the ability to remove the use of the unindexable
GREATEST() function from the AUR code everywhere we had to use it before
to handle the 0 timestamp case.

Note that there is no race condition here in calling UNIX_TIMESTAMP()
twice- it always returns the time at the beginning of statment
execution:

    mysql> select unix_timestamp(), sleep(2), unix_timestamp();
    +------------------+----------+------------------+
    | unix_timestamp() | sleep(2) | unix_timestamp() |
    +------------------+----------+------------------+
    |       1300851746 |        0 |       1300851746 |
    +------------------+----------+------------------+
    1 row in set (2.00 sec)

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-03 22:59:31 +02:00

36 lines
899 B
PHP

<table class="boxSoft">
<tr>
<th colspan="2" class="boxSoftTitle" style="text-align: right">
<span class="f3"><?php print __("Recent Updates") ?><span class="f5"></span></span>
<a href="rss.php"><img src="images/feed-icon-14x14.png" alt="RSS Feed" /></a>
</th>
</tr>
<?php foreach ($newest_packages->getIterator() as $row): ?>
<tr>
<td class="boxSoft">
<span class="f4"><span class="blue">
<a href="packages.php?ID=<?php print intval($row["ID"]); ?>">
<?php print $row["Name"] . ' ' . $row["Version"]; ?>
</a></span></span>
</td>
<td class="boxSoft">
<?php
$mod_int = intval($row["ModifiedTS"]);
$sub_int = intval($row["SubmittedTS"]);
if ($mod_int == $sub_int):
$modstring = '<img src="images/new.gif" alt="New!" /> ' . gmdate("r", $sub_int);
else:
$modstring = gmdate("r", $mod_int);
endif;
?>
<span class="f4"><?php print $modstring; ?></span>
</td>
</tr>
<?php endforeach; ?>
</table>