Browse files

Appcast sparkle downloads get counted

  • Loading branch information...
1 parent 1260e93 commit af89d8e11573ec73e1723dda06589c9bfff405f5 @holtwick committed Oct 27, 2009
Showing with 7 additions and 5 deletions.
  1. +3 −1 appcast.php
  2. +3 −3 update.php
  3. +1 −1 versions.php
View
4 appcast.php
@@ -30,7 +30,9 @@
<title><?PHP echo $app->name; ?> <?PHP echo $v->human_version; ?></title>
<description><![CDATA[ <?PHP echo $v->release_notes; ?> ]]></description>
<pubDate><?PHP echo(date('D, d M Y H:i:s O')); ?></pubDate>
- <enclosure url="<?PHP echo $v->url; ?>" sparkle:shortVersionString="<?PHP echo $v->human_version; ?>" sparkle:version="<?PHP echo $v->version_number; ?>" length="<?PHP echo $v->filesize; ?>" type="application/octet-stream" sparkle:dsaSignature="<?PHP echo $v->signature; ?>" />
+ <enclosure url="<?PHP
+ echo("http://".$_SERVER['HTTP_HOST'].slash(WEB_ROOT)."update.php?id=$v->id");
+ ?>" sparkle:shortVersionString="<?PHP echo $v->human_version; ?>" sparkle:version="<?PHP echo $v->version_number; ?>" length="<?PHP echo $v->filesize; ?>" type="application/octet-stream" sparkle:dsaSignature="<?PHP echo $v->signature; ?>" />
</item>
<?PHP endforeach; ?>
</channel>
View
6 update.php
@@ -7,11 +7,11 @@
require 'includes/master.inc.php';
- $app_id = 1; // Set this to the ID of the application to download
+ $id = $_GET['id'];
- $v = DBObject::glob('Version', "SELECT * FROM versions WHERE app_id = $app_id ORDER BY dt DESC LIMIT 1");
+ $v = DBObject::glob('Version', "SELECT * FROM versions WHERE id = $id ORDER BY dt DESC LIMIT 1");
$v = array_pop($v);
- $v->downloads++;
+ $v->updates++;
$v->update();
Download::track();
View
2 versions.php
@@ -66,7 +66,7 @@
<tr>
<td><a href="version-edit.php?id=<?PHP echo $v->id; ?>"><?PHP echo $v->human_version; ?></a></td>
<td><?PHP echo $v->version_number; ?></td>
- <td><?PHP echo dater($v->dt, 'Y-m-d h:m'); ?></td>
+ <td><?PHP echo dater($v->dt, 'Y-m-d h:i'); ?></td>
<td><?PHP
echo number_format($v->downloads);
echo (" / ");

0 comments on commit af89d8e

Please sign in to comment.