Plugin Directory

Changeset 3289955


Ignore:
Timestamp:
05/08/2025 02:50:29 PM (7 months ago)
Author:
deliciousbrains
Message:

Deploy version 1.7.2

Location:
wp-ses
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-ses/tags/1.7.2/README.md

    r3272205 r3289955  
    66**Tested up to:** 6.8 \
    77**Requires PHP:** 7.4 \
    8 **Stable tag:** 1.7.1 \
     8**Stable tag:** 1.7.2 \
    99**License:** GPLv2
    1010
     
    199199## Changelog
    200200
     201### 1.7.2 - 2025-05-08
     202
     203* Bug fix: Detecting whether running as a must-use plugin is now more robust
     204* Bug fix: Clash with WP Offload SES (Pro) avoided if both are installed as must-use plugins
     205* Bug fix: AWS SES account rate limit exceeded failures no longer occur for high volume bulk sends
     206
    201207### 1.7.1 - 2024-10-04
    202208
  • wp-ses/tags/1.7.2/classes/Command-Pool.php

    r3110370 r3289955  
    3636     * @var array
    3737     */
    38     public $commands = array();
     38    private $commands = array();
    3939
    4040    /**
    4141     * The maximum concurrency for the AWS CommandPool.
    4242     *
     43     * Equates to the number of emails that we can send per second.
     44     *
    4345     * @var int
    4446     */
     
    5153     */
    5254    private $connection;
     55
     56    /**
     57     * How many emails have been sent within this interval.
     58     *
     59     * @var int
     60     */
     61    private $send_count = 0;
     62
     63    /**
     64     * When did this sending interval start.
     65     *
     66     * @var int
     67     */
     68    private $send_started_at = 0;
    5369
    5470    /**
     
    6682     * Add a command to be run via the CommandPool.
    6783     *
     84     * If there are no more jobs to process, or if the batch send rate has been
     85     * reached, the command pool will be executed.
     86     *
    6887     * @param Command $command The command to add.
    6988     */
    7089    public function add_command( Command $command ) {
    7190        $this->commands[] = $command;
    72         $num_commands     = count( $this->commands );
    7391
    7492        // Execute if we've reached our max concurrency, or if there are no more unreserved jobs.
    75         if ( $this->get_concurrency() <= $num_commands || 0 === $this->connection->jobs( true ) ) {
     93        if ( $this->get_concurrency() <= $this->num_commands() || 0 === $this->connection->jobs( true ) ) {
    7694            $this->execute();
    77             $this->commands = array();
    7895        }
    7996    }
     
    99116        }
    100117
    101         $this->concurrency = (int) apply_filters( 'wposes_max_concurrency', $send_rate );
     118        $send_rate         = (int) apply_filters( 'wposes_max_concurrency', $send_rate );
     119        $this->concurrency = max( 1, min( PHP_INT_MAX, $send_rate ) );
    102120
    103121        return $this->concurrency;
     
    105123
    106124    /**
    107      * Create the command pool and execute the commands.
     125     * Create the AWS command pool and execute the commands.
     126     *
     127     * Does nothing if there are no commands in the pool.
     128     *
     129     * Empties the command pool once the commands have all attempted execution.
    108130     */
    109131    public function execute() {
     132        if ( 0 === $this->num_commands() ) {
     133            return;
     134        }
     135
     136        // Comply with SES per second rate limit.
     137        $this->maybe_wait_for_rate_limit_reset();
     138
    110139        /** @var WP_Offload_SES $wp_offload_ses */
    111140        global $wp_offload_ses;
     
    210239        $promise = $command_pool->promise();
    211240        $promise->wait();
     241
     242        // One way or another we're done with the current commands.
     243        $this->clear();
     244    }
     245
     246    /**
     247     * How many commands are in the pool?
     248     *
     249     * @return int
     250     */
     251    public function num_commands(): int {
     252        return count( $this->commands );
     253    }
     254
     255    /**
     256     * Empty the command pool.
     257     *
     258     * @return void
     259     */
     260    public function clear() {
     261        $this->commands = array();
     262    }
     263
     264    /**
     265     * Determines whether the current second needs to be ticked down
     266     * before another batch of items can be processed, and does so.
     267     *
     268     * Keeps track of how many emails have been sent in the current second,
     269     * making sure that if the next batch would exceed the rate limit, then
     270     * the wait happens and the count is updated appropriately.
     271     *
     272     * @return void
     273     */
     274    private function maybe_wait_for_rate_limit_reset() {
     275        if ( ! $this->send_started() ) {
     276            $this->start_send();
     277
     278            return;
     279        }
     280
     281        // Update current send interval's item count.
     282        $this->send_count += $this->num_commands();
     283
     284        if ( ! $this->rate_limit_exceeded() ) {
     285            return;
     286        }
     287
     288        $this->maybe_wait_until_next_second();
     289
     290        $this->start_send();
     291    }
     292
     293    /**
     294     * Have we already started a sending interval?
     295     *
     296     * @return bool
     297     */
     298    private function send_started(): bool {
     299        return 0 !== $this->send_started_at && 0 !== $this->send_count;
     300    }
     301
     302    /**
     303     * Start a new send interval.
     304     *
     305     * @return void
     306     */
     307    private function start_send(): void {
     308        $this->send_count      = $this->num_commands();
     309        $this->send_started_at = time();
     310    }
     311
     312    /**
     313     * Has the rate limit been exceeded for the current send interval?
     314     *
     315     * @return bool
     316     */
     317    private function rate_limit_exceeded(): bool {
     318        if ( $this->get_concurrency() < $this->send_count ) {
     319            return true;
     320        }
     321
     322        return false;
     323    }
     324
     325    /**
     326     * If a second hasn't ticked over since last send started, wait until it has.
     327     *
     328     * @return void
     329     */
     330    private function maybe_wait_until_next_second(): void {
     331        $next_send_time = $this->send_started_at + 1;
     332
     333        if ( time() < $next_send_time ) {
     334            time_sleep_until( $next_send_time );
     335        }
    212336    }
    213337}
  • wp-ses/tags/1.7.2/classes/Queue/Email-Cron.php

    r3110370 r3289955  
    1212 */
    1313class Email_Cron extends Cron {
     14    /**
     15     * @var Email_Worker
     16     */
     17    protected $worker;
    1418
    1519    /**
     
    6468
    6569        while ( ! $this->time_exceeded() && ! $this->memory_exceeded() ) {
     70            // Puts the next job into the command pool.
     71            // If the command pool is full (we've hit the per second rate limit),
     72            // or queue emptied, the command pool will be executed and cleared.
    6673            if ( ! $this->worker->process() ) {
    6774                break;
    6875            }
    6976        }
     77
     78        // Executes remaining commands in the command pool.
     79        $this->worker->cleanup();
    7080
    7181        $this->unlock_worker();
  • wp-ses/tags/1.7.2/classes/Queue/Email-Worker.php

    r3033377 r3289955  
    3535
    3636    /**
    37      * Process a job on the queue.
     37     * Process a job on the queue, adding it to the command pool.
     38     *
     39     * The command pool will be executed if there are no more jobs, or
     40     * if the batch send limit (concurrency) is reached.
     41     *
     42     * Returns false if:
     43     *  - no job was retrieved but there are still jobs to process; or
     44     *  - the AWS command for the job could not be constructed.
     45     *
     46     * Returns true otherwise, but note that this does not mean the job
     47     * was added to the command pool; it may have been failed or released.
    3848     *
    3949     * @return bool
     
    4757                /**
    4858                 * We couldn't get the job, but there are still unreserved jobs.
    49                  * This shouldn't happen, so let's log an error and fire off the command pool just in case.
     59                 * This shouldn't happen, so let's log an error and bail.
    5060                 */
    5161                new Error(
     
    5363                    __( 'There was an error retrieving the job while processing the queue.', 'wp-offload-ses' )
    5464                );
    55 
    56                 if ( 0 !== count( $this->command_pool->commands ) ) {
    57                     $this->command_pool->execute();
    58                 }
    5965            }
    6066
     
    6268        }
    6369
    64         try {
    65             if ( $job->attempts() >= $this->attempts ) {
     70        // Assemble command unless job already reached current attempts limit.
     71        if ( $job->attempts() >= $this->attempts ) {
     72            $job->release();
     73        } else {
     74            try {
     75                $command = $job->handle();
     76            } catch ( Exception $exception ) {
    6677                $job->release();
    67             } else {
    68                 $command = $job->handle();
    6978            }
    70         } catch ( Exception $exception ) {
    71             $job->release();
    7279        }
    7380
     
    7986        }
    8087
     88        // Record failed job and shortcut out.
    8189        if ( $job->failed() ) {
    8290            $this->connection->failure( $job, $exception );
    83         } else {
    84             if ( ! $job->released() ) {
    85                 if ( empty( $command ) ) {
    86                     /**
    87                      * We couldn't get the job's command.
    88                      * This shouldn't happen, so let's log an error and fire off the command pool just in case.
    89                      */
    90                     new Error(
    91                         Error::$cmd_construction_failure,
    92                         __( 'There was an error constructing the job while processing the queue.', 'wp-offload-ses' )
    93                     );
    9491
    95                     if ( 0 !== count( $this->command_pool->commands ) ) {
    96                         $this->command_pool->execute();
    97                     }
     92            return true;
     93        }
    9894
    99                     return false;
    100                 }
     95        // Record unhandled job and shortcut out.
     96        if ( $job->released() ) {
     97            $this->connection->release( $job );
    10198
    102                 $this->command_pool->add_command( $command );
    103             } else {
    104                 $this->connection->release( $job );
    105             }
     99            return true;
    106100        }
     101
     102        if ( empty( $command ) ) {
     103            /**
     104             * We couldn't get the job's command.
     105             * This shouldn't happen, so let's log an error and bail.
     106             */
     107            new Error(
     108                Error::$cmd_construction_failure,
     109                __( 'There was an error constructing the job while processing the queue.', 'wp-offload-ses' )
     110            );
     111
     112            return false;
     113        }
     114
     115        $this->command_pool->add_command( $command );
    107116
    108117        return true;
    109118    }
    110119
     120    /**
     121     * Execute any commands already retrieved.
     122     *
     123     * @return void
     124     */
     125    public function cleanup() {
     126        $this->command_pool->execute();
     127    }
    111128}
  • wp-ses/tags/1.7.2/classes/SES-API.php

    r3228120 r3289955  
    121121     * Get the sending quota.
    122122     *
     123     * Returns an array in the form:
     124     *
     125     * [
     126     *   'used'  => float,  // Percentage of the quota used over the last 24 hours
     127     *   'limit' => string, // The maximum number of emails that can be sent in a 24 hour period
     128     *   'sent'  => string, // The number of emails sent in the last 24 hours
     129     *   'rate'  => string, // The maximum number of emails that can be sent per second
     130     * ]
     131     *
     132     * Returns an OSES Error object if the quotas could not be retrieved.
     133     *
    123134     * @return array|Error
    124135     */
  • wp-ses/tags/1.7.2/languages/wp-ses-en.pot

    r3228120 r3289955  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WP Offload SES Lite 1.7.1\n"
     5"Project-Id-Version: WP Offload SES Lite 1.7.2\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-ses\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-01-24T15:02:36+00:00\n"
     12"POT-Creation-Date: 2025-05-08T14:43:38+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    116116msgstr ""
    117117
    118 #: classes/Command-Pool.php:132
    119 #: classes/Command-Pool.php:185
     118#: classes/Command-Pool.php:161
     119#: classes/Command-Pool.php:214
    120120msgid "Failed to retrieve the job while executing the command pool."
    121121msgstr ""
     
    313313msgstr ""
    314314
    315 #: classes/Queue/Email-Worker.php:53
     315#: classes/Queue/Email-Worker.php:63
    316316msgid "There was an error retrieving the job while processing the queue."
    317317msgstr ""
    318318
    319 #: classes/Queue/Email-Worker.php:92
     319#: classes/Queue/Email-Worker.php:109
    320320msgid "There was an error constructing the job while processing the queue."
    321321msgstr ""
     
    441441msgstr ""
    442442
    443 #: classes/SES-API.php:172
     443#: classes/SES-API.php:183
    444444msgid "There was an error attempting to receive your SES identities."
    445445msgstr ""
    446446
    447 #: classes/SES-API.php:220
     447#: classes/SES-API.php:231
    448448msgid "There was an error deleting the provided identity."
    449449msgstr ""
    450450
    451 #: classes/SES-API.php:240
     451#: classes/SES-API.php:251
    452452msgid "There was an error retrieving the details of your \"%s\" SES identity."
    453453msgstr ""
    454454
    455 #: classes/SES-API.php:266
     455#: classes/SES-API.php:277
    456456msgid "There was an error attempting to validate the domain."
    457457msgstr ""
    458458
    459 #: classes/SES-API.php:289
     459#: classes/SES-API.php:300
    460460msgid "There was an error attempting to validate the email address."
    461461msgstr ""
  • wp-ses/tags/1.7.2/readme.txt

    r3272205 r3289955  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.7.1
     7Stable tag: 1.7.2
    88License: GPLv2
    99
     
    186186== Changelog ==
    187187
     188= 1.7.2 - 2025-05-08 =
     189* Bug fix: Detecting whether running as a must-use plugin is now more robust
     190* Bug fix: Clash with WP Offload SES (Pro) avoided if both are installed as must-use plugins
     191* Bug fix: AWS SES account rate limit exceeded failures no longer occur for high volume bulk sends
     192
    188193= 1.7.1 - 2024-10-04 =
    189194* Security: The plugin can now serve updates from WP Engine servers, however this update mechanism is not included when installed directly from WordPress.org
  • wp-ses/tags/1.7.2/vendor/Carbon/AbstractTranslator.php

    r2914170 r3289955  
    137137            return \true;
    138138        }
     139        $this->assertValidLocale($locale);
    139140        foreach ($this->getDirectories() as $directory) {
    140141            $data = @(include \sprintf('%s/%s.php', \rtrim($directory, '\\/'), $locale));
  • wp-ses/tags/1.7.2/wp-ses.php

    r3228120 r3289955  
    44Description: Automatically send WordPress mail through Amazon SES (Simple Email Service).
    55Author: Delicious Brains
    6 Version: 1.7.1
     6Version: 1.7.2
    77Author URI: https://deliciousbrains.com/
    88Plugin URI: https://deliciousbrains.com/
     
    3232}
    3333
    34 $GLOBALS['wposes_meta']['wp-ses']['version'] = '1.7.1';
     34// Avoid clash with WP Offload SES (Pro) if both installed as must-use plugins.
     35if ( defined( 'WPOSES_FILE' ) ) {
     36    return;
     37}
     38
     39$GLOBALS['wposes_meta']['wp-ses']['version'] = '1.7.2';
    3540
    3641if ( ! defined( 'WPOSESLITE_FILE' ) ) {
     
    105110 */
    106111function wposes_lite_get_plugin_dir_path() {
    107     $abspath = wp_normalize_path( dirname( WPOSESLITE_FILE ) );
    108     $mu_path = wp_normalize_path( WPMU_PLUGIN_DIR );
    109 
    110     if ( $mu_path === $abspath ) {
    111         $abspath = $abspath . '/wp-ses/';
     112    $abspath    = wp_normalize_path( dirname( WPOSESLITE_FILE ) );
     113    $mu_path    = $abspath . '/wp-ses';
     114    $core_class = '/classes/WP-Offload-SES.php';
     115
     116    // Is entry point file in directory above where plugin's files are?
     117    if ( file_exists( $mu_path . $core_class ) ) {
     118        $abspath = $mu_path;
    112119    }
    113120
  • wp-ses/trunk/README.md

    r3272205 r3289955  
    66**Tested up to:** 6.8 \
    77**Requires PHP:** 7.4 \
    8 **Stable tag:** 1.7.1 \
     8**Stable tag:** 1.7.2 \
    99**License:** GPLv2
    1010
     
    199199## Changelog
    200200
     201### 1.7.2 - 2025-05-08
     202
     203* Bug fix: Detecting whether running as a must-use plugin is now more robust
     204* Bug fix: Clash with WP Offload SES (Pro) avoided if both are installed as must-use plugins
     205* Bug fix: AWS SES account rate limit exceeded failures no longer occur for high volume bulk sends
     206
    201207### 1.7.1 - 2024-10-04
    202208
  • wp-ses/trunk/classes/Command-Pool.php

    r3110370 r3289955  
    3636     * @var array
    3737     */
    38     public $commands = array();
     38    private $commands = array();
    3939
    4040    /**
    4141     * The maximum concurrency for the AWS CommandPool.
    4242     *
     43     * Equates to the number of emails that we can send per second.
     44     *
    4345     * @var int
    4446     */
     
    5153     */
    5254    private $connection;
     55
     56    /**
     57     * How many emails have been sent within this interval.
     58     *
     59     * @var int
     60     */
     61    private $send_count = 0;
     62
     63    /**
     64     * When did this sending interval start.
     65     *
     66     * @var int
     67     */
     68    private $send_started_at = 0;
    5369
    5470    /**
     
    6682     * Add a command to be run via the CommandPool.
    6783     *
     84     * If there are no more jobs to process, or if the batch send rate has been
     85     * reached, the command pool will be executed.
     86     *
    6887     * @param Command $command The command to add.
    6988     */
    7089    public function add_command( Command $command ) {
    7190        $this->commands[] = $command;
    72         $num_commands     = count( $this->commands );
    7391
    7492        // Execute if we've reached our max concurrency, or if there are no more unreserved jobs.
    75         if ( $this->get_concurrency() <= $num_commands || 0 === $this->connection->jobs( true ) ) {
     93        if ( $this->get_concurrency() <= $this->num_commands() || 0 === $this->connection->jobs( true ) ) {
    7694            $this->execute();
    77             $this->commands = array();
    7895        }
    7996    }
     
    99116        }
    100117
    101         $this->concurrency = (int) apply_filters( 'wposes_max_concurrency', $send_rate );
     118        $send_rate         = (int) apply_filters( 'wposes_max_concurrency', $send_rate );
     119        $this->concurrency = max( 1, min( PHP_INT_MAX, $send_rate ) );
    102120
    103121        return $this->concurrency;
     
    105123
    106124    /**
    107      * Create the command pool and execute the commands.
     125     * Create the AWS command pool and execute the commands.
     126     *
     127     * Does nothing if there are no commands in the pool.
     128     *
     129     * Empties the command pool once the commands have all attempted execution.
    108130     */
    109131    public function execute() {
     132        if ( 0 === $this->num_commands() ) {
     133            return;
     134        }
     135
     136        // Comply with SES per second rate limit.
     137        $this->maybe_wait_for_rate_limit_reset();
     138
    110139        /** @var WP_Offload_SES $wp_offload_ses */
    111140        global $wp_offload_ses;
     
    210239        $promise = $command_pool->promise();
    211240        $promise->wait();
     241
     242        // One way or another we're done with the current commands.
     243        $this->clear();
     244    }
     245
     246    /**
     247     * How many commands are in the pool?
     248     *
     249     * @return int
     250     */
     251    public function num_commands(): int {
     252        return count( $this->commands );
     253    }
     254
     255    /**
     256     * Empty the command pool.
     257     *
     258     * @return void
     259     */
     260    public function clear() {
     261        $this->commands = array();
     262    }
     263
     264    /**
     265     * Determines whether the current second needs to be ticked down
     266     * before another batch of items can be processed, and does so.
     267     *
     268     * Keeps track of how many emails have been sent in the current second,
     269     * making sure that if the next batch would exceed the rate limit, then
     270     * the wait happens and the count is updated appropriately.
     271     *
     272     * @return void
     273     */
     274    private function maybe_wait_for_rate_limit_reset() {
     275        if ( ! $this->send_started() ) {
     276            $this->start_send();
     277
     278            return;
     279        }
     280
     281        // Update current send interval's item count.
     282        $this->send_count += $this->num_commands();
     283
     284        if ( ! $this->rate_limit_exceeded() ) {
     285            return;
     286        }
     287
     288        $this->maybe_wait_until_next_second();
     289
     290        $this->start_send();
     291    }
     292
     293    /**
     294     * Have we already started a sending interval?
     295     *
     296     * @return bool
     297     */
     298    private function send_started(): bool {
     299        return 0 !== $this->send_started_at && 0 !== $this->send_count;
     300    }
     301
     302    /**
     303     * Start a new send interval.
     304     *
     305     * @return void
     306     */
     307    private function start_send(): void {
     308        $this->send_count      = $this->num_commands();
     309        $this->send_started_at = time();
     310    }
     311
     312    /**
     313     * Has the rate limit been exceeded for the current send interval?
     314     *
     315     * @return bool
     316     */
     317    private function rate_limit_exceeded(): bool {
     318        if ( $this->get_concurrency() < $this->send_count ) {
     319            return true;
     320        }
     321
     322        return false;
     323    }
     324
     325    /**
     326     * If a second hasn't ticked over since last send started, wait until it has.
     327     *
     328     * @return void
     329     */
     330    private function maybe_wait_until_next_second(): void {
     331        $next_send_time = $this->send_started_at + 1;
     332
     333        if ( time() < $next_send_time ) {
     334            time_sleep_until( $next_send_time );
     335        }
    212336    }
    213337}
  • wp-ses/trunk/classes/Queue/Email-Cron.php

    r3110370 r3289955  
    1212 */
    1313class Email_Cron extends Cron {
     14    /**
     15     * @var Email_Worker
     16     */
     17    protected $worker;
    1418
    1519    /**
     
    6468
    6569        while ( ! $this->time_exceeded() && ! $this->memory_exceeded() ) {
     70            // Puts the next job into the command pool.
     71            // If the command pool is full (we've hit the per second rate limit),
     72            // or queue emptied, the command pool will be executed and cleared.
    6673            if ( ! $this->worker->process() ) {
    6774                break;
    6875            }
    6976        }
     77
     78        // Executes remaining commands in the command pool.
     79        $this->worker->cleanup();
    7080
    7181        $this->unlock_worker();
  • wp-ses/trunk/classes/Queue/Email-Worker.php

    r3033377 r3289955  
    3535
    3636    /**
    37      * Process a job on the queue.
     37     * Process a job on the queue, adding it to the command pool.
     38     *
     39     * The command pool will be executed if there are no more jobs, or
     40     * if the batch send limit (concurrency) is reached.
     41     *
     42     * Returns false if:
     43     *  - no job was retrieved but there are still jobs to process; or
     44     *  - the AWS command for the job could not be constructed.
     45     *
     46     * Returns true otherwise, but note that this does not mean the job
     47     * was added to the command pool; it may have been failed or released.
    3848     *
    3949     * @return bool
     
    4757                /**
    4858                 * We couldn't get the job, but there are still unreserved jobs.
    49                  * This shouldn't happen, so let's log an error and fire off the command pool just in case.
     59                 * This shouldn't happen, so let's log an error and bail.
    5060                 */
    5161                new Error(
     
    5363                    __( 'There was an error retrieving the job while processing the queue.', 'wp-offload-ses' )
    5464                );
    55 
    56                 if ( 0 !== count( $this->command_pool->commands ) ) {
    57                     $this->command_pool->execute();
    58                 }
    5965            }
    6066
     
    6268        }
    6369
    64         try {
    65             if ( $job->attempts() >= $this->attempts ) {
     70        // Assemble command unless job already reached current attempts limit.
     71        if ( $job->attempts() >= $this->attempts ) {
     72            $job->release();
     73        } else {
     74            try {
     75                $command = $job->handle();
     76            } catch ( Exception $exception ) {
    6677                $job->release();
    67             } else {
    68                 $command = $job->handle();
    6978            }
    70         } catch ( Exception $exception ) {
    71             $job->release();
    7279        }
    7380
     
    7986        }
    8087
     88        // Record failed job and shortcut out.
    8189        if ( $job->failed() ) {
    8290            $this->connection->failure( $job, $exception );
    83         } else {
    84             if ( ! $job->released() ) {
    85                 if ( empty( $command ) ) {
    86                     /**
    87                      * We couldn't get the job's command.
    88                      * This shouldn't happen, so let's log an error and fire off the command pool just in case.
    89                      */
    90                     new Error(
    91                         Error::$cmd_construction_failure,
    92                         __( 'There was an error constructing the job while processing the queue.', 'wp-offload-ses' )
    93                     );
    9491
    95                     if ( 0 !== count( $this->command_pool->commands ) ) {
    96                         $this->command_pool->execute();
    97                     }
     92            return true;
     93        }
    9894
    99                     return false;
    100                 }
     95        // Record unhandled job and shortcut out.
     96        if ( $job->released() ) {
     97            $this->connection->release( $job );
    10198
    102                 $this->command_pool->add_command( $command );
    103             } else {
    104                 $this->connection->release( $job );
    105             }
     99            return true;
    106100        }
     101
     102        if ( empty( $command ) ) {
     103            /**
     104             * We couldn't get the job's command.
     105             * This shouldn't happen, so let's log an error and bail.
     106             */
     107            new Error(
     108                Error::$cmd_construction_failure,
     109                __( 'There was an error constructing the job while processing the queue.', 'wp-offload-ses' )
     110            );
     111
     112            return false;
     113        }
     114
     115        $this->command_pool->add_command( $command );
    107116
    108117        return true;
    109118    }
    110119
     120    /**
     121     * Execute any commands already retrieved.
     122     *
     123     * @return void
     124     */
     125    public function cleanup() {
     126        $this->command_pool->execute();
     127    }
    111128}
  • wp-ses/trunk/classes/SES-API.php

    r3228120 r3289955  
    121121     * Get the sending quota.
    122122     *
     123     * Returns an array in the form:
     124     *
     125     * [
     126     *   'used'  => float,  // Percentage of the quota used over the last 24 hours
     127     *   'limit' => string, // The maximum number of emails that can be sent in a 24 hour period
     128     *   'sent'  => string, // The number of emails sent in the last 24 hours
     129     *   'rate'  => string, // The maximum number of emails that can be sent per second
     130     * ]
     131     *
     132     * Returns an OSES Error object if the quotas could not be retrieved.
     133     *
    123134     * @return array|Error
    124135     */
  • wp-ses/trunk/languages/wp-ses-en.pot

    r3228120 r3289955  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WP Offload SES Lite 1.7.1\n"
     5"Project-Id-Version: WP Offload SES Lite 1.7.2\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-ses\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-01-24T15:02:36+00:00\n"
     12"POT-Creation-Date: 2025-05-08T14:43:38+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    116116msgstr ""
    117117
    118 #: classes/Command-Pool.php:132
    119 #: classes/Command-Pool.php:185
     118#: classes/Command-Pool.php:161
     119#: classes/Command-Pool.php:214
    120120msgid "Failed to retrieve the job while executing the command pool."
    121121msgstr ""
     
    313313msgstr ""
    314314
    315 #: classes/Queue/Email-Worker.php:53
     315#: classes/Queue/Email-Worker.php:63
    316316msgid "There was an error retrieving the job while processing the queue."
    317317msgstr ""
    318318
    319 #: classes/Queue/Email-Worker.php:92
     319#: classes/Queue/Email-Worker.php:109
    320320msgid "There was an error constructing the job while processing the queue."
    321321msgstr ""
     
    441441msgstr ""
    442442
    443 #: classes/SES-API.php:172
     443#: classes/SES-API.php:183
    444444msgid "There was an error attempting to receive your SES identities."
    445445msgstr ""
    446446
    447 #: classes/SES-API.php:220
     447#: classes/SES-API.php:231
    448448msgid "There was an error deleting the provided identity."
    449449msgstr ""
    450450
    451 #: classes/SES-API.php:240
     451#: classes/SES-API.php:251
    452452msgid "There was an error retrieving the details of your \"%s\" SES identity."
    453453msgstr ""
    454454
    455 #: classes/SES-API.php:266
     455#: classes/SES-API.php:277
    456456msgid "There was an error attempting to validate the domain."
    457457msgstr ""
    458458
    459 #: classes/SES-API.php:289
     459#: classes/SES-API.php:300
    460460msgid "There was an error attempting to validate the email address."
    461461msgstr ""
  • wp-ses/trunk/readme.txt

    r3272205 r3289955  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.7.1
     7Stable tag: 1.7.2
    88License: GPLv2
    99
     
    186186== Changelog ==
    187187
     188= 1.7.2 - 2025-05-08 =
     189* Bug fix: Detecting whether running as a must-use plugin is now more robust
     190* Bug fix: Clash with WP Offload SES (Pro) avoided if both are installed as must-use plugins
     191* Bug fix: AWS SES account rate limit exceeded failures no longer occur for high volume bulk sends
     192
    188193= 1.7.1 - 2024-10-04 =
    189194* Security: The plugin can now serve updates from WP Engine servers, however this update mechanism is not included when installed directly from WordPress.org
  • wp-ses/trunk/vendor/Carbon/AbstractTranslator.php

    r2914170 r3289955  
    137137            return \true;
    138138        }
     139        $this->assertValidLocale($locale);
    139140        foreach ($this->getDirectories() as $directory) {
    140141            $data = @(include \sprintf('%s/%s.php', \rtrim($directory, '\\/'), $locale));
  • wp-ses/trunk/wp-ses.php

    r3228120 r3289955  
    44Description: Automatically send WordPress mail through Amazon SES (Simple Email Service).
    55Author: Delicious Brains
    6 Version: 1.7.1
     6Version: 1.7.2
    77Author URI: https://deliciousbrains.com/
    88Plugin URI: https://deliciousbrains.com/
     
    3232}
    3333
    34 $GLOBALS['wposes_meta']['wp-ses']['version'] = '1.7.1';
     34// Avoid clash with WP Offload SES (Pro) if both installed as must-use plugins.
     35if ( defined( 'WPOSES_FILE' ) ) {
     36    return;
     37}
     38
     39$GLOBALS['wposes_meta']['wp-ses']['version'] = '1.7.2';
    3540
    3641if ( ! defined( 'WPOSESLITE_FILE' ) ) {
     
    105110 */
    106111function wposes_lite_get_plugin_dir_path() {
    107     $abspath = wp_normalize_path( dirname( WPOSESLITE_FILE ) );
    108     $mu_path = wp_normalize_path( WPMU_PLUGIN_DIR );
    109 
    110     if ( $mu_path === $abspath ) {
    111         $abspath = $abspath . '/wp-ses/';
     112    $abspath    = wp_normalize_path( dirname( WPOSESLITE_FILE ) );
     113    $mu_path    = $abspath . '/wp-ses';
     114    $core_class = '/classes/WP-Offload-SES.php';
     115
     116    // Is entry point file in directory above where plugin's files are?
     117    if ( file_exists( $mu_path . $core_class ) ) {
     118        $abspath = $mu_path;
    112119    }
    113120
Note: See TracChangeset for help on using the changeset viewer.