|
Cookbook /
DownloadManagerSummary: How can I know how many times a file was downloaded from my wiki?
Version: 0.6 - 07.18.2008
Prerequisites: Probably requires at least PmWiki version: 2.0; last tested on PmWiki version: 2.1.beta17
Status:
Maintainer:
Questions answered by this recipeHow can I know how many times a file was downloaded from my wiki? AnswerDownload unofficial version 0.5: downloadman_0_5_aidin.phpΔ (see changelog, old official version 0.4. is still available: downloadman.phpΔ ).
It is a very simple download manager. It keeps track of every file download and displays the counter next to it. After you install it (see below) you can use instead than the usual syntax NotesInstallation:Download the script from above and place it in your cookbook directory. Then add Configuration:No particular configuration is necessary but if you want you can change the "action=" that the script uses by giving a value to the ex. $DownloadManagerAction = 'downloadman';
Use:To see the download count next to your attachments use instead than the usual syntax New in 0.5: To only display the download count use syntax DownloadCount:filename.ext.
i18n:The $[downloads] string is used and can be internationalized (i18n). OtherOf course the download count is strictly dependent to the upload system of PmWiki. For example if in two different pages we have two occurances of the same file, the same download count will be displayed. Two occurances of two different files with same name will correctly display the two distinct download count. A single text file is saved in the
Part of the code is based on the original PmWiki Examples:You can see the recipe live this one Releases
CommentsSummary page for downloadsA summary page for all downloads is now possible with TotalCounter. Micha April 25, 2007, 01:37 PM Integration of "Attach:" markup?I have just installed the recipe, and it seems that only attachments with the "Download:" markup are counted. Is it possible to configure the script so that the existing (thousands of) attachments using the "Attach:" markup are counted, too? I'd prefer 'silent' counting without display because the layout of existing pages might be affected. --Henning June 06, 2006, at 08:11 AM
SDV($IMap['Attach:'], '$1');
SDV($LinkFunctions['Attach:'], 'LinkDownloadManager');
DownloadList?Is there a way to modify the (:attachlist:) directive to give a quick list all the attached files using the DownloadMan style? Paul? October 16, 2006, at 02:39 PM Problem with filenames that have spacesAs currently coded,
/* // Fix for Internet Explorer 6.0 or prior bug.
header('Cache-Control: maxage=3600'); //Adjust maxage appropriately
header('Pragma: public');
//echo "filepath: $filepath";
preg_match('/\\.([^.]+)$/',$filepath,$match);
if ($UploadExts[@$match[1]])
header("Content-Type: {$UploadExts[@$match[1]]}");
header("Content-Length: ".filesize($filepath));
header("Content-disposition: $DownloadDisposition; filename=$upname");
$fp = fopen($filepath, "r");
if ($fp) {
while (!feof($fp)) echo fread($fp, 4096);
fclose($fp);
}
umask($oldumask);
exit();
*/
//Redirect($pagename, "$filepath");
Redirect($pagename, "$PmWikiDir/$filepath");
## $PmWikiDir is basically: http://mysite.com/pmwiki -- $filepath contains 'uploads/$Group/$upname'
## be sure to include $PmWikiDir in your globals at the top of the function
See Also
ContributorsUser notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |