public

Postie 1.4.4 Patch #1

  • Download Gist
postie_1_4_4_patch_1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
diff --git a/wp-content/plugins/postie/postie-functions.php b/wp-content/plugins/postie/postie-functions.php
index ddf4cd8daf8ed4bdeb30978733e472ea97d96abd..75a598b1b6f77cb47a612a3d39b53a115f14a1cb 100644
--- a/wp-content/plugins/postie/postie-functions.php
+++ b/wp-content/plugins/postie/postie-functions.php
@@ -1,11 +1,41 @@
<?php
-$revisions= WP_POST_REVISIONS;
-define('WP_POST_REVISIONS', false);
-//define('POSTIE_DEBUG', true);
-if (!ini_get('safe_mode')) {
- $original_mem_limit = ini_get('memory_limit');
- ini_set('memory_limit', -1);
- ini_set('max_execution_time', 300);
+
+function postie_disable_revisions( $restore = false ) {
+ global $_wp_post_type_features, $_postie_revisions;
+
+ if ( !$restore ) {
+ $_postie_revisions = false;
+ if ( isset( $_wp_post_type_features['post'] ) && isset( $_wp_post_type_features['post']['revisions'] ) ) {
+ $_postie_revisions = $_wp_post_type_features['post']['revisions'];
+ unset($_wp_post_type_features['post']['revisions']);
+ }
+ } else {
+ if ( $_postie_revisions ) {
+ $_wp_post_type_features['post']['revisions'] = $_postie_revisions;
+ }
+ }
+}
+
+function postie_increase_memory( $restore = false ) {
+ global $_postie_original_memory_limit, $_postie_original_max_execution_time;
+
+ if ( !ini_get('safe_mode') ) {
+ if ( !$restore ) {
+
+ $_postie_original_memory_limit = ini_get('memory_limit');
+ $_postie_original_max_execution_time = ini_get('max_execution_time');
+ ini_set('memory_limit', -1);
+ ini_set('max_execution_time', 300);
+
+ } else {
+ if ( isset($_postie_original_memory_limit) ) {
+ ini_set('memory_limit', $_postie_original_memory_limit);
+ }
+ if ( isset($_postie_original_max_execution_time) ) {
+ ini_set('max_execution_time', $_postie_original_max_execution_time);
+ }
+ }
+ }
}
//include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR."wp-admin" . DIRECTORY_SEPARATOR . "upgrade-functions.php");
@@ -42,6 +72,8 @@ if (!function_exists('fnmatch')) {
* This is the main handler for all of the processing
*/
function PostEmail($poster,$mimeDecodedEmail,$config) {
+ postie_disable_revisions();
+ postie_increase_memory();
extract($config);
$post_to_db=true;
@@ -200,6 +232,8 @@ function PostEmail($poster,$mimeDecodedEmail,$config) {
$recipients, false, false);
}
}
+ postie_disable_revisions( true );
+ postie_increase_memory( true );
}
/** FUNCTIONS **/
@@ -2582,9 +2616,4 @@ function VodafoneHandler(&$content, &$attachments){
}
}
-
-define('WP_POST_REVISIONS', $revisions);
-if (!ini_get('safe_mode')) {
- ini_set('memory_limit', $original_mem_limit);
-}
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.