Version Description
= 7.7.04 =
- This version addresses various minor bug fixes and feature requests.
Download this release
Release Info
Developer | opajaap |
Plugin | ![]() |
Version | 7.7.04.009 |
Comparing to | |
See all releases |
Code changes from version 7.7.04.008 to 7.7.04.009
- wppa-dashboard-widgets.php +2 -2
- wppa-mailing.php +23 -45
- wppa-setup.php +8 -2
- wppa.php +2 -2
wppa-dashboard-widgets.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Contains dashboard widgets code
|
6 |
*
|
7 |
-
* Version 7.7.
|
8 |
*
|
9 |
*/
|
10 |
|
@@ -127,7 +127,7 @@ function wppa_show_email_subscription() {
|
|
127 |
class="wppa-notify-label"
|
128 |
style="float:left;padding-left:4px;width:90%;margin-top:-3px;"
|
129 |
> ' .
|
130 |
-
( wppa_switch( 'commentnotify_limit' ) ?
|
131 |
__( 'A comment on my photo is given', 'wp-photo-album-plus' ) :
|
132 |
__( 'A comment on any photo is given', 'wp-photo-album-plus' ) ) . '
|
133 |
</label>
|
4 |
*
|
5 |
* Contains dashboard widgets code
|
6 |
*
|
7 |
+
* Version 7.7.04.009
|
8 |
*
|
9 |
*/
|
10 |
|
127 |
class="wppa-notify-label"
|
128 |
style="float:left;padding-left:4px;width:90%;margin-top:-3px;"
|
129 |
> ' .
|
130 |
+
( ( wppa_switch( 'commentnotify_limit' ) && ! wppa_user_is( 'administrator' ) ) ?
|
131 |
__( 'A comment on my photo is given', 'wp-photo-album-plus' ) :
|
132 |
__( 'A comment on any photo is given', 'wp-photo-album-plus' ) ) . '
|
133 |
</label>
|
wppa-mailing.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Contains mailing functions
|
6 |
*
|
7 |
-
* Version 7.7.04.
|
8 |
*
|
9 |
*/
|
10 |
|
@@ -134,13 +134,20 @@ global $wpdb;
|
|
134 |
wppa_exit();
|
135 |
}
|
136 |
|
137 |
-
// There is a bug in wp cron
|
138 |
// The cron lock sometimes fails, so there is a possbility that two processes execute the same cron job simultaneously
|
139 |
-
// To prevent
|
140 |
|
141 |
// Check for 'lock'
|
142 |
if ( wppa_is_cron() ) {
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
// Mailinglist just done or executoing?
|
145 |
$lock_file = WPPA_LOCKDIR . '/' . $type;
|
146 |
$lock_value = wppa_get_contents( $lock_file );
|
@@ -149,14 +156,14 @@ global $wpdb;
|
|
149 |
// Is last mailing equal to our mailing?
|
150 |
if ( $lock_value == $our_lock ) {
|
151 |
|
152 |
-
// Is this lock not older than
|
153 |
-
if ( wppa_filetime( $lock_file ) >= ( time() -
|
154 |
-
wppa_log( 'Eml', '{span style="color:red;" }CRON ERROR{/span} Duplicate cron process detected. Aborting ' . $type );
|
155 |
}
|
156 |
|
157 |
// It's older, so it is a regular re-run, but unneeded
|
158 |
else {
|
159 |
-
wppa_log( 'Eml', 'Duplicate mailing detected. Aborting ' . $type );
|
160 |
}
|
161 |
wppa_exit();
|
162 |
}
|
@@ -742,7 +749,7 @@ global $wpdb;
|
|
742 |
|
743 |
// If the comment is already approved by a vote when comment needs vote is on, we're done
|
744 |
if ( $comment['status'] == 'approved' ) {
|
745 |
-
wppa_log( 'Eml', 'Comment approved by voting. Mailing
|
746 |
wppa_exit();
|
747 |
}
|
748 |
|
@@ -911,12 +918,6 @@ function wppa_unsubscribe_link( $user_id, $listtype ) {
|
|
911 |
|
912 |
// Send a mail
|
913 |
function wppa_send_mail( $args ) {
|
914 |
-
global $wppa_sent_mails_hashes;
|
915 |
-
|
916 |
-
// Get the saved sent mail hashes
|
917 |
-
if ( ! $wppa_sent_mails_hashes ) {
|
918 |
-
$wppa_sent_mails_hashes = get_option( 'wppa_sent_mails', '' );
|
919 |
-
}
|
920 |
|
921 |
// Enhance $args
|
922 |
$defaults = array( 'to' => '',
|
@@ -1030,7 +1031,8 @@ global $wppa_sent_mails_hashes;
|
|
1030 |
|
1031 |
// If this mail has already been sent, skip and report
|
1032 |
$hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
|
1033 |
-
if (
|
|
|
1034 |
wppa_log( 'Eml', 'Hash: ' . $hash . ' Sending duplicate mail skipped to: ' . $to . ' (' . $id . ') subject: ' . $subject );
|
1035 |
return;
|
1036 |
}
|
@@ -1039,7 +1041,7 @@ global $wppa_sent_mails_hashes;
|
|
1039 |
$iret = wp_mail( $to,
|
1040 |
$subject,
|
1041 |
$message,
|
1042 |
-
$headers
|
1043 |
);
|
1044 |
if ( $iret ) {
|
1045 |
wppa_log( 'Eml',
|
@@ -1047,11 +1049,13 @@ global $wppa_sent_mails_hashes;
|
|
1047 |
'Mail sent to: ' . $to . ' (' . $id . ') ' .
|
1048 |
'subject: ' . $subject . ', ' .
|
1049 |
'photo: ' . ( $photo ? ( is_array( $photo ) ? serialize( $photo ) : $photo ) : 'not supplied.' ) );
|
1050 |
-
|
|
|
|
|
1051 |
return;
|
1052 |
}
|
1053 |
|
1054 |
-
wppa_log( 'Err', 'Mail sending failed.
|
1055 |
|
1056 |
// Failed
|
1057 |
if ( ! wppa_is_cron() ) {
|
@@ -1084,32 +1088,6 @@ function wppa_get_mail_hash( $to = '', $subject = '', $message = '', $headers =
|
|
1084 |
return md5( ( is_array( $to ) ? implode( '|', $to ) : $to ) . $subject . $mes );
|
1085 |
}
|
1086 |
|
1087 |
-
// Register mail has been sent
|
1088 |
-
function wppa_process_success_mail( $hash ) {
|
1089 |
-
global $wppa_sent_mails_hashes;
|
1090 |
-
|
1091 |
-
// Get the saved sent mail hashes
|
1092 |
-
if ( ! $wppa_sent_mails_hashes ) {
|
1093 |
-
$wppa_sent_mails_hashes = get_option( 'wppa_sent_mails', '' );
|
1094 |
-
}
|
1095 |
-
|
1096 |
-
// Trim optionally
|
1097 |
-
if ( strlen( $wppa_sent_mails_hashes ) > 33000 ) {
|
1098 |
-
$wppa_sent_mails_hashes = substr( $wppa_sent_mails_hashes, 66 );
|
1099 |
-
}
|
1100 |
-
|
1101 |
-
// Add our hash optionally
|
1102 |
-
if ( strpos( $wppa_sent_mails_hashes, $hash ) === false ) {
|
1103 |
-
$wppa_sent_mails_hashes .= ',' . $hash;
|
1104 |
-
|
1105 |
-
// Save new saved hashes
|
1106 |
-
update_option( 'wppa_sent_mails', ltrim( $wppa_sent_mails_hashes, ',' ) );
|
1107 |
-
}
|
1108 |
-
else {
|
1109 |
-
wppa_log( 'eml', 'Hash: ' . $hash . ' NOT added to sent mails' );
|
1110 |
-
}
|
1111 |
-
}
|
1112 |
-
|
1113 |
// Save failed mail data to retry later
|
1114 |
function wppa_process_failed_mail( $to = '', $subject = '', $message = '', $headers = '' ) {
|
1115 |
|
@@ -1119,7 +1097,7 @@ function wppa_process_failed_mail( $to = '', $subject = '', $message = '', $head
|
|
1119 |
}
|
1120 |
|
1121 |
// Log mail failed
|
1122 |
-
wppa_log( 'Err', 'Failed mail. To = ' . ( is_array( $to ) ? implode( '|', $to ) : $to ) . ', Subject = ' . $subject . ', Message = ' . $message );
|
1123 |
|
1124 |
// Compute mail id
|
1125 |
$id = wppa_get_mail_hash( $to, $subject, $message, $headers );
|
4 |
*
|
5 |
* Contains mailing functions
|
6 |
*
|
7 |
+
* Version 7.7.04.009
|
8 |
*
|
9 |
*/
|
10 |
|
134 |
wppa_exit();
|
135 |
}
|
136 |
|
137 |
+
// There is a bug in wp cron
|
138 |
// The cron lock sometimes fails, so there is a possbility that two processes execute the same cron job simultaneously
|
139 |
+
// To prevent duplicate emails, we have our own 'lock' that can not run stuck because it needs no release
|
140 |
|
141 |
// Check for 'lock'
|
142 |
if ( wppa_is_cron() ) {
|
143 |
|
144 |
+
// Before going on, we wait a small period dependant of our process id,
|
145 |
+
// to make sure that if there are two simultaneous cron processes,
|
146 |
+
// they will get out of sync
|
147 |
+
$sleep = getmypid() % 17;
|
148 |
+
wppa_log( 'Eml', "Waiting $sleep seconds" );
|
149 |
+
sleep( $sleep );
|
150 |
+
|
151 |
// Mailinglist just done or executoing?
|
152 |
$lock_file = WPPA_LOCKDIR . '/' . $type;
|
153 |
$lock_value = wppa_get_contents( $lock_file );
|
156 |
// Is last mailing equal to our mailing?
|
157 |
if ( $lock_value == $our_lock ) {
|
158 |
|
159 |
+
// Is this lock not older than 18 second?
|
160 |
+
if ( wppa_filetime( $lock_file ) >= ( time() - 18 ) ) {
|
161 |
+
wppa_log( 'Eml', '{span style="color:red;" }CRON ERROR{/span} Duplicate cron process detected. Aborting {b}' . $type . '{/b}' );
|
162 |
}
|
163 |
|
164 |
// It's older, so it is a regular re-run, but unneeded
|
165 |
else {
|
166 |
+
wppa_log( 'Eml', 'Duplicate mailing detected. Aborting {b}' . $type . '{/b}' );
|
167 |
}
|
168 |
wppa_exit();
|
169 |
}
|
749 |
|
750 |
// If the comment is already approved by a vote when comment needs vote is on, we're done
|
751 |
if ( $comment['status'] == 'approved' ) {
|
752 |
+
wppa_log( 'Eml', 'Comment approved by voting. Mailing {b}moderatecomment{/b} aborted' );
|
753 |
wppa_exit();
|
754 |
}
|
755 |
|
918 |
|
919 |
// Send a mail
|
920 |
function wppa_send_mail( $args ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
921 |
|
922 |
// Enhance $args
|
923 |
$defaults = array( 'to' => '',
|
1031 |
|
1032 |
// If this mail has already been sent, skip and report
|
1033 |
$hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
|
1034 |
+
if ( get_transient( 'wppa_' . $hash ) ) {
|
1035 |
+
|
1036 |
wppa_log( 'Eml', 'Hash: ' . $hash . ' Sending duplicate mail skipped to: ' . $to . ' (' . $id . ') subject: ' . $subject );
|
1037 |
return;
|
1038 |
}
|
1041 |
$iret = wp_mail( $to,
|
1042 |
$subject,
|
1043 |
$message,
|
1044 |
+
$headers
|
1045 |
);
|
1046 |
if ( $iret ) {
|
1047 |
wppa_log( 'Eml',
|
1049 |
'Mail sent to: ' . $to . ' (' . $id . ') ' .
|
1050 |
'subject: ' . $subject . ', ' .
|
1051 |
'photo: ' . ( $photo ? ( is_array( $photo ) ? serialize( $photo ) : $photo ) : 'not supplied.' ) );
|
1052 |
+
|
1053 |
+
// Remember this mail has been sent
|
1054 |
+
set_transient( 'wppa_' . $hash, getmypid(), 7 * 24 * 3600 );
|
1055 |
return;
|
1056 |
}
|
1057 |
|
1058 |
+
wppa_log( 'Err', 'Mail sending failed. Hash: ' . $hash . ', To=' . $to . ', subject=' . $subject . ', message=' . $message );
|
1059 |
|
1060 |
// Failed
|
1061 |
if ( ! wppa_is_cron() ) {
|
1088 |
return md5( ( is_array( $to ) ? implode( '|', $to ) : $to ) . $subject . $mes );
|
1089 |
}
|
1090 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1091 |
// Save failed mail data to retry later
|
1092 |
function wppa_process_failed_mail( $to = '', $subject = '', $message = '', $headers = '' ) {
|
1093 |
|
1097 |
}
|
1098 |
|
1099 |
// Log mail failed
|
1100 |
+
// wppa_log( 'Err', 'Failed mail. To = ' . ( is_array( $to ) ? implode( '|', $to ) : $to ) . ', Subject = ' . $subject . ', Message = ' . $message );
|
1101 |
|
1102 |
// Compute mail id
|
1103 |
$id = wppa_get_mail_hash( $to, $subject, $message, $headers );
|
wppa-setup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
-
* Version 7.7.04.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -655,7 +655,13 @@ global $wppa_error;
|
|
655 |
}
|
656 |
|
657 |
if ( $old_rev <= '7704999' ) {
|
658 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
659 |
delete_option( 'wppa_sent_mails' );
|
660 |
}
|
661 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
+
* Version 7.7.04.009
|
7 |
*
|
8 |
*/
|
9 |
|
655 |
}
|
656 |
|
657 |
if ( $old_rev <= '7704999' ) {
|
658 |
+
$sent_mails = get_option( 'wppa_sent_mails', '' );
|
659 |
+
if ( $sent_mails ) {
|
660 |
+
$week = 7 * 24 * 3600;
|
661 |
+
$arr = explode( ',', $sent_mails );
|
662 |
+
foreach( $arr as $item ) {
|
663 |
+
set_transient( 'wppa_' . $item, getmypid(), $week );
|
664 |
+
}
|
665 |
delete_option( 'wppa_sent_mails' );
|
666 |
}
|
667 |
}
|
wppa.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
-
* Version: 7.7.04.
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
@@ -24,7 +24,7 @@ global $wp_version;
|
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
global $wppa_api_version;
|
27 |
-
$wppa_api_version = '7.7.04.
|
28 |
global $wppa_revno;
|
29 |
$wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
|
30 |
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
+
* Version: 7.7.04.009
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
global $wppa_api_version;
|
27 |
+
$wppa_api_version = '7.7.04.009'; // WPPA software version
|
28 |
global $wppa_revno;
|
29 |
$wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
|
30 |
|