allolex
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Download Codes] [Plugin: WP Download Codes] Download stop at 21mb@gleon You said before it was always stopping at 13MB. If it’s now varying between 3 and 4MB, then there is likely another cause—perhaps in addition to the object buffer not being flushed.
Try raising your memory limit for PHP and see if that changes anything. Also, look at your web server error logs (e.g. apache, nginx) and see if there are any clues in there.
Forum: Plugins
In reply to: [WP Download Codes] [Plugin: WP Download Codes] Download stop at 21mbFor clarity’s sake, in case a less experienced person wants to make the change himself:
/** * Sends headers to redirect to dc_download.php when download code was entered successfully. */ function dc_headers() { global $wpdb; if (isset( $_GET['lease'] )) { // Set timeout set_time_limit( 1200 ); // Get details for code and release $release = $wpdb->get_row( "SELECT r.*, c.ID as code, c.code_prefix, c.code_suffix FROM " . dc_tbl_releases() . " r INNER JOIN " . dc_tbl_codes() ." c ON c.release = r.ID WHERE MD5(CONCAT('wp-dl-hash',c.ID)) = '" . $_GET['lease'] . "'" ); // Get # of downloads with this code $downloads = $wpdb->get_row( "SELECT COUNT(*) AS downloads FROM " . dc_tbl_downloads() . " WHERE code= " . $release->code ); // Start download if maximum of allowed downloads is not reached if ($downloads->downloads < $release->allowed_downloads) { // Get current IP $IP = $_SERVER['REMOTE_ADDR']; // Insert download in downloads table $wpdb->insert( dc_tbl_downloads(), array( 'code' => $release->code, 'IP' => $IP), array( '%d', '%s') ); // Send headers for download header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=\"" . $release->filename . "\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize( dc_file_location() . $release->filename )); flush(); ob_end_flush(); // Stream file $handle = fopen( dc_file_location() . $release->filename, 'rb' ); $chunksize = 1*(1024*1024); $buffer = ''; if ($handle === false) { exit; } while (!feof($handle)) { $buffer = fread($handle, $chunksize); echo $buffer; flush(); } // Close file fclose($handle); } }Forum: Plugins
In reply to: [WP Download Codes] [Plugin: WP Download Codes] Download stop at 21mbOK, a colleague and I looked at it and the output buffer was not being flushed, creating a memory leak. I don’t know why it didn’t reach the memory limit before.
Just add
ob_end_flush();
to line 141 of the dc_template.php, right after the initial flush() call.
Forum: Plugins
In reply to: [WP Download Codes] [Plugin: WP Download Codes] Download stop at 21mbWe are having the same problem. The .zip files all truncate to 12,583,259 bytes on download.
Perhaps there is an interaction with the new WordPress core update? I was looking at the changelog and the new version has some commits in areas that might affect the plugin. Maybe looking at a diff between 3.3.2 and 3.4.1 (we skipped 3.4.0) might help.
Forum: Fixing WordPress
In reply to: Content Types / The LoopJust add something like this within The Loop.
<?php query_posts(array('post_type' => array('post', 'content_type_1','content_type_2'))); ?>And change your the content_type_$n stuff to your content type names. You can use multiple loops on the same page to display different things.