[25109] users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb

source_changes at macosforge.org source_changes at macosforge.org
Sun May 13 22:03:55 PDT 2007


Revision: 25109
          http://trac.macosforge.org/projects/macports/changeset/25109
Author:   jberry at macports.org
Date:     2007-05-13 22:03:54 -0700 (Sun, 13 May 2007)

Log Message:
-----------
mpwa: track download counts for files and portpkgs

Modified Paths:
--------------
    users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb

Modified: users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb	2007-05-14 04:49:49 UTC (rev 25108)
+++ users/jberry/mpwa/app/controllers/port_pkg_file_controller.rb	2007-05-14 05:03:54 UTC (rev 25109)
@@ -52,6 +52,12 @@
   def emit
     file = PortPkgFile.find(params[:id])
     send_data file.data, :filename => file.file_path, :type => file.mime_type, :disposition => 'inline'
+
+    # Bump download counts for the file, and for the portpkg too if the file is a portpkg.
+    file.increment! 'download_count'
+    if (file.file_path == "portpkg.portpkg")
+      file.port_pkg.increment! 'download_count'
+    end
   end
   
   private :create, :edit, :update, :destroy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070513/b6a680c2/attachment.html


More information about the macports-changes mailing list