Plugin Directory

Changeset 2825667

Timestamp:
11/29/2022 07:28:25 AM (20 months ago)
Author:
wokamoto
Message:

[c3-cloudfront-clear-cache] Update 6.1.4

Location:
c3-cloudfront-clear-cache
Files:
21 edited
14 copied

Legend:

Unmodified
Added
Removed
  • c3-cloudfront-clear-cache/tags/6.1.4/c3-cloudfront-clear-cache.php

    r2728981 r2825667  
    22/**
    33 * Plugin Name: C3 Cloudfront Cache Controller
    4  * Version: 6.1.3
     4 * Version: 6.1.
    55 * Plugin URI:https://github.com/amimoto-ami/c3-cloudfront-clear-cache
    66 * Description: Manage CloudFront Cache and provide some fixtures.
    77 * Author: hideokamoto
    88 * Author URI: https://wp-kyoto.net/
    9  * Requires PHP: 7.0
     9 * Requires PHP: 7.
    1010 * Text Domain: c3-cloudfront-clear-cache
    1111 *
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/AWS/CloudFront_Service.php

    r2726571 r2825667  
    1313}
    1414
     15
    1516use C3_CloudFront_Cache_Controller\WP;
    1617use Aws\CloudFront\CloudFrontClient;
     
    5657                } elseif ( $value instanceof WP\Hooks ) {
    5758                    $this->hook_service = $value;
    58                 } elseif ( $value instanceof Environment ) {
     59                } elseif ( $value instanceof Environment ) {
    5960                    $this->env = $value;
    6061                }
     
    9495     * @param string $access_key AWS access key id.
    9596     * @param string $secret_key AWS secret access key id.
    96      * @throws \WP_Error|\Exception  If AWS API returns any error, should throw it.
     97     * @.
    9798     */
    9899    public function try_to_call_aws_api( string $distribution_id, string $access_key = null, string $secret_key = null ) {
     
    112113                )
    113114            );
    114             return true;
     115            return ;
    115116        } catch ( \Exception $e ) {
    116             if ( 'NoSuchDistribution' === $e->getAwsErrorCode() ) {
     117            if ( 'NoSuchDistribution' === $e->getAwsErrorCode() ) {
    117118                $e = new \WP_Error( 'C3 Auth Error', "Can not find CloudFront Distribution ID: {$distribution_id} is not found." );
    118             } elseif ( 'InvalidClientTokenId' === $e->getAwsErrorCode() ) {
     119            } elseif ( 'InvalidClientTokenId' === $e->getAwsErrorCode() ) {
    119120                $e = new \WP_Error( 'C3 Auth Error', 'AWS AWS Access Key or AWS Secret Key is invalid.' );
    120121            } else {
    121122                $e = new \WP_Error( 'C3 Auth Error', $e->getMessage() );
    122123            }
    123             error_log( $e->get_error_messages(), 0 );
    124             throw $e;
     124            error_log( ), 0 );
     125            $e;
    125126        }
    126127    }
     
    209210            $result = $client->createInvalidation( $params );
    210211            return $result;
    211         } catch ( \Aws\CloudFront\Exception\TooManyInvalidationsInProgressException $e ) {
    212             error_log( $e->__toString(), 0 );
    213             $e = new \WP_Error( 'C3 Invalidation Error', $e->__toString() );
    214             return $e;
    215         } catch ( \Aws\CloudFront\Exception $e ) {
     212        } catch ( \Aws\CloudFront\Exception\CloudFrontException $e ) {
    216213            error_log( $e->__toString(), 0 );
    217214            $e = new \WP_Error( 'C3 Invalidation Error', $e->__toString() );
     
    244241            }
    245242            return array();
    246         } catch ( \Aws\CloudFront\Exception\NoSuchDistributionException $e ) {
    247             error_log( $options['distribution_id'] . 'not found' );
     243        } catch ( \Aws\CloudFront\Exception\CloudFrontException $e ) {
     244            if ( isset( $distribution_id ) && 'NoSuchDistribution' === $e->getAwsErrorCode() ) {
     245                error_log( $distribution_id . ' not found' );
     246            }
    248247            error_log( $e->__toString(), 0 );
    249248        } catch ( \Exception $e ) {
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/AWS/Invalidation_Batch_Service.php

    r2728981 r2825667  
    9191            $invalidation_batch->put_invalidation_path( $url );
    9292        }
     93
     94
     95
     96
    9397        $invalidation_batch->apply_invalidation_item_filter( $post );
    9498        return $invalidation_batch;
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/Invalidation_Service.php

    r2558516 r2825667  
    2424     * Hook service
    2525     *
    26      * @var WP\Hook_Service
     26     * @var WP\Hook
    2727     */
    2828    private $hook_service;
     
    3838     * Transient service.
    3939     *
    40      * @var AWS\Transient_Service
     40     * @var \Transient_Service
    4141     */
    4242    private $transient_service;
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/Settings_Service.php

    r2558516 r2825667  
    8484     * @param string $access_key AWS access key id.
    8585     * @param string $secret_key AWS secret access key id.
    86      * @throws \WP_Error If no distribution id provided, should throw error.
     86     * @
    8787     */
    8888    public function update_options( string $distribution_id, string $access_key = null, string $secret_key = null ) {
    89         // Null check.
    90         if ( ! $distribution_id ) {
    91             throw new \WP_Error( 'distribution id is required' );
     89        // CloudFront API call.
     90        $error = $this->cf_service->try_to_call_aws_api( $distribution_id, $access_key, $secret_key );
     91        if ( is_wp_error( $error ) ) {
     92            return $error;
    9293        }
    9394
    94         // CloudFront API call.
    95         $this->cf_service->try_to_call_aws_api( $distribution_id, $access_key, $secret_key );
     95        // .
     96        $this->( $distribution_id, $access_key, $secret_key );
    9697
    97         // Save.
    98         $result = $this->options_service->update_options( $distribution_id, $access_key, $secret_key );
    99         return $result;
     98        return null;
    10099    }
    101100
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/Views/Settings.php

    r2728981 r2825667  
    9292     *
    9393     * @access public
    94      * @param none
    9594     * @since 4.0.0
    9695     */
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/WP/Fixtures.php

    r2559100 r2825667  
    100100     * @param string $key Cookie key name.
    101101     * @param mixed  $value Cookie value.
    102      * @param init   $expires Cookie expiration.
     102     * @param in   $expires Cookie expiration.
    103103     */
    104104    private function set_cookie( $key, $value, $expires = 0 ) {
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/WP/Options_Service.php

    r2558516 r2825667  
    8282     * @param string $access_key AWS access key id.
    8383     * @param string $secret_key AWS secret access key id.
    84      * @throws \WP_Error If no distribution id provided, should throw error.
     84     * @
    8585     */
    8686    public function update_options( string $distribution_id, string $access_key = null, string $secret_key = null ) {
    87         if ( ! $distribution_id ) {
    88             throw new \WP_Error( 'distribution id is required' );
    89         }
    90 
    9187        $options = array(
    9288            'distribution_id' => $distribution_id,
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/WP/Post.php

    r2558516 r2825667  
    3939     * Get the post permalink
    4040     *
    41      * @throws \WP_Error If no post provided, should throw it.
     41     * @.
    4242     */
    4343    public function get_permalink() {
    4444        if ( ! $this->post ) {
    45             throw new \WP_Error( 'Post is required' );
     45            new \WP_Error( 'Post is required' );
    4646        }
    4747        return get_permalink( $this->post );
     
    6565     * Load the post's term links
    6666     *
    67      * @throws \WP_Error If no post provided, should throw it.
     67     * @.
    6868     */
    6969    public function get_the_post_term_links() {
    7070        if ( ! $this->post ) {
    71             throw new \WP_Error( 'Post is required' );
     71            new \WP_Error( 'Post is required' );
    7272        }
    7373        $post       = $this->post;
     
    9494    }
    9595
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
    96119}
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/WP/Transient_Service.php

    r2558516 r2825667  
    7979     * Normalize invalidation query
    8080     *
    81      * @param midex $query Invalidation query.
     81     * @param mi $query Invalidation query.
    8282     * @since 5.3.4
    8383     * @return array
  • c3-cloudfront-clear-cache/tags/6.1.4/classes/WP/WP_CLI_Command.php

    r2558516 r2825667  
    3939     *
    4040     * @param string $args WP-CLI Command Name.
    41      * @param string $assoc_args WP-CLI Command Option.
     41     * @param $assoc_args WP-CLI Command Option.
    4242     * @since 2.3.0
    4343     */
     
    103103     *
    104104     * @param string $args WP-CLI Command Name.
    105      * @param string $assoc_args WP-CLI Command Option.
     105     * @param $assoc_args WP-CLI Command Option.
    106106     * @since 2.4.0
    107107     */
  • c3-cloudfront-clear-cache/tags/6.1.4/composer.json

    r2728981 r2825667  
    44  "type": "wordpress-plugin",
    55  "require": {
    6     "php": ">=5.5"
     6    "php": ">="
    77  },
    88  "require-dev": {
     
    1212        "wp-coding-standards/wpcs": "*",
    1313        "wp-phpunit/wp-phpunit": "5.7.2",
    14         "phpunit/phpunit": "7.5.20"
    15   },
     14        "phpunit/phpunit": "7.5.20",
     15        "yoast/phpunit-polyfills": "^1.0"
     16      },
    1617    "autoload": {
    1718        "psr-4": {
     
    2627        "lint": "phpcs --standard=./.phpcs.xml.dist",
    2728        "phpcs": "phpcs --standard=./.phpcs.xml.dist"
    28     }
     29    },
     30  "config": {
     31    "allow-plugins": {
     32      "dealerdirect/phpcodesniffer-composer-installer": true
     33    }
     34  }
    2935}
  • c3-cloudfront-clear-cache/tags/6.1.4/package.json

    r2728981 r2825667  
    44  },
    55  "name": "trunk",
    6   "version": "6.1.3",
     6  "version": "6.1.",
    77  "main": "index.js",
    88  "directories": {
  • c3-cloudfront-clear-cache/tags/6.1.4/readme.txt

    r2728981 r2825667  
    44Tags: AWS,CDN,CloudFront
    55Requires at least: 4.9.0
    6 Tested up to: 5.9.3
    7 Stable tag: 6.1.3
     6Tested up to:
     7Stable tag: 6.1.
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    111111== Changelog ==
    112112
     113
     114
     115
    113116== 6.1.3 ==
    114117* [Fix] Lost filter c3_invalidation_items From v6.0.0
  • c3-cloudfront-clear-cache/trunk/c3-cloudfront-clear-cache.php

    r2728981 r2825667  
    22/**
    33 * Plugin Name: C3 Cloudfront Cache Controller
    4  * Version: 6.1.3
     4 * Version: 6.1.
    55 * Plugin URI:https://github.com/amimoto-ami/c3-cloudfront-clear-cache
    66 * Description: Manage CloudFront Cache and provide some fixtures.
    77 * Author: hideokamoto
    88 * Author URI: https://wp-kyoto.net/
    9  * Requires PHP: 7.0
     9 * Requires PHP: 7.
    1010 * Text Domain: c3-cloudfront-clear-cache
    1111 *
  • c3-cloudfront-clear-cache/trunk/classes/AWS/CloudFront_Service.php

    r2558516 r2825667  
    1313}
    1414
     15
    1516use C3_CloudFront_Cache_Controller\WP;
    1617use Aws\CloudFront\CloudFrontClient;
     
    5657                } elseif ( $value instanceof WP\Hooks ) {
    5758                    $this->hook_service = $value;
    58                 } elseif ( $value instanceof Environment ) {
     59                } elseif ( $value instanceof Environment ) {
    5960                    $this->env = $value;
    6061                }
     
    9495     * @param string $access_key AWS access key id.
    9596     * @param string $secret_key AWS secret access key id.
    96      * @throws \WP_Error|\Exception  If AWS API returns any error, should throw it.
     97     * @.
    9798     */
    9899    public function try_to_call_aws_api( string $distribution_id, string $access_key = null, string $secret_key = null ) {
     
    112113                )
    113114            );
    114             return true;
     115            return ;
    115116        } catch ( \Exception $e ) {
    116             if ( 'NoSuchDistribution' === $e->getAwsErrorCode() ) {
     117            if ( 'NoSuchDistribution' === $e->getAwsErrorCode() ) {
    117118                $e = new \WP_Error( 'C3 Auth Error', "Can not find CloudFront Distribution ID: {$distribution_id} is not found." );
    118             } elseif ( 'InvalidClientTokenId' === $e->getAwsErrorCode() ) {
     119            } elseif ( 'InvalidClientTokenId' === $e->getAwsErrorCode() ) {
    119120                $e = new \WP_Error( 'C3 Auth Error', 'AWS AWS Access Key or AWS Secret Key is invalid.' );
    120121            } else {
    121122                $e = new \WP_Error( 'C3 Auth Error', $e->getMessage() );
    122123            }
    123             error_log( $e->get_error_messages(), 0 );
    124             throw $e;
     124            error_log( ), 0 );
     125            $e;
    125126        }
    126127    }
     
    209210            $result = $client->createInvalidation( $params );
    210211            return $result;
    211         } catch ( \Aws\CloudFront\Exception\TooManyInvalidationsInProgressException $e ) {
    212             error_log( $e->__toString(), 0 );
    213             $e = new \WP_Error( 'C3 Invalidation Error', $e->__toString() );
    214             return $e;
    215         } catch ( \Aws\CloudFront\Exception $e ) {
     212        } catch ( \Aws\CloudFront\Exception\CloudFrontException $e ) {
    216213            error_log( $e->__toString(), 0 );
    217214            $e = new \WP_Error( 'C3 Invalidation Error', $e->__toString() );
     
    244241            }
    245242            return array();
    246         } catch ( \Aws\CloudFront\Exception\NoSuchDistributionException $e ) {
    247             error_log( $options['distribution_id'] . 'not found' );
     243        } catch ( \Aws\CloudFront\Exception\CloudFrontException $e ) {
     244            if ( isset( $distribution_id ) && 'NoSuchDistribution' === $e->getAwsErrorCode() ) {
     245                error_log( $distribution_id . ' not found' );
     246            }
    248247            error_log( $e->__toString(), 0 );
    249248        } catch ( \Exception $e ) {
  • c3-cloudfront-clear-cache/trunk/classes/AWS/Invalidation_Batch_Service.php

    r2728981 r2825667  
    9191            $invalidation_batch->put_invalidation_path( $url );
    9292        }
     93
     94
     95
     96
    9397        $invalidation_batch->apply_invalidation_item_filter( $post );
    9498        return $invalidation_batch;
  • c3-cloudfront-clear-cache/trunk/classes/Invalidation_Service.php

    r2558516 r2825667  
    2424     * Hook service
    2525     *
    26      * @var WP\Hook_Service
     26     * @var WP\Hook
    2727     */
    2828    private $hook_service;
     
    3838     * Transient service.
    3939     *
    40      * @var AWS\Transient_Service
     40     * @var \Transient_Service
    4141     */
    4242    private $transient_service;
  • c3-cloudfront-clear-cache/trunk/classes/Settings_Service.php

    r2558516 r2825667  
    8484     * @param string $access_key AWS access key id.
    8585     * @param string $secret_key AWS secret access key id.
    86      * @throws \WP_Error If no distribution id provided, should throw error.
     86     * @
    8787     */
    8888    public function update_options( string $distribution_id, string $access_key = null, string $secret_key = null ) {
    89         // Null check.
    90         if ( ! $distribution_id ) {
    91             throw new \WP_Error( 'distribution id is required' );
     89        // CloudFront API call.
     90        $error = $this->cf_service->try_to_call_aws_api( $distribution_id, $access_key, $secret_key );
     91        if ( is_wp_error( $error ) ) {
     92            return $error;
    9293        }
    9394
    94         // CloudFront API call.
    95         $this->cf_service->try_to_call_aws_api( $distribution_id, $access_key, $secret_key );
     95        // .
     96        $this->( $distribution_id, $access_key, $secret_key );
    9697
    97         // Save.
    98         $result = $this->options_service->update_options( $distribution_id, $access_key, $secret_key );
    99         return $result;
     98        return null;
    10099    }
    101100
  • c3-cloudfront-clear-cache/trunk/classes/Views/Settings.php

    r2728981 r2825667  
    9292     *
    9393     * @access public
    94      * @param none
    9594     * @since 4.0.0
    9695     */
  • c3-cloudfront-clear-cache/trunk/classes/WP/Fixtures.php

    r2559100 r2825667  
    100100     * @param string $key Cookie key name.
    101101     * @param mixed  $value Cookie value.
    102      * @param init   $expires Cookie expiration.
     102     * @param in   $expires Cookie expiration.
    103103     */
    104104    private function set_cookie( $key, $value, $expires = 0 ) {
  • c3-cloudfront-clear-cache/trunk/classes/WP/Options_Service.php

    r2558516 r2825667  
    8282     * @param string $access_key AWS access key id.
    8383     * @param string $secret_key AWS secret access key id.
    84      * @throws \WP_Error If no distribution id provided, should throw error.
     84     * @
    8585     */
    8686    public function update_options( string $distribution_id, string $access_key = null, string $secret_key = null ) {
    87         if ( ! $distribution_id ) {
    88             throw new \WP_Error( 'distribution id is required' );
    89         }
    90 
    9187        $options = array(
    9288            'distribution_id' => $distribution_id,
  • c3-cloudfront-clear-cache/trunk/classes/WP/Post.php

    r2558516 r2825667  
    3939     * Get the post permalink
    4040     *
    41      * @throws \WP_Error If no post provided, should throw it.
     41     * @.
    4242     */
    4343    public function get_permalink() {
    4444        if ( ! $this->post ) {
    45             throw new \WP_Error( 'Post is required' );
     45            new \WP_Error( 'Post is required' );
    4646        }
    4747        return get_permalink( $this->post );
     
    6565     * Load the post's term links
    6666     *
    67      * @throws \WP_Error If no post provided, should throw it.
     67     * @.
    6868     */
    6969    public function get_the_post_term_links() {
    7070        if ( ! $this->post ) {
    71             throw new \WP_Error( 'Post is required' );
     71            new \WP_Error( 'Post is required' );
    7272        }
    7373        $post       = $this->post;
     
    9494    }
    9595
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
    96119}
  • c3-cloudfront-clear-cache/trunk/classes/WP/Transient_Service.php

    r2558516 r2825667  
    7979     * Normalize invalidation query
    8080     *
    81      * @param midex $query Invalidation query.
     81     * @param mi $query Invalidation query.
    8282     * @since 5.3.4
    8383     * @return array
  • c3-cloudfront-clear-cache/trunk/classes/WP/WP_CLI_Command.php

    r2558516 r2825667  
    3939     *
    4040     * @param string $args WP-CLI Command Name.
    41      * @param string $assoc_args WP-CLI Command Option.
     41     * @param $assoc_args WP-CLI Command Option.
    4242     * @since 2.3.0
    4343     */
     
    103103     *
    104104     * @param string $args WP-CLI Command Name.
    105      * @param string $assoc_args WP-CLI Command Option.
     105     * @param $assoc_args WP-CLI Command Option.
    106106     * @since 2.4.0
    107107     */
  • c3-cloudfront-clear-cache/trunk/composer.json

    r2728981 r2825667  
    44  "type": "wordpress-plugin",
    55  "require": {
    6     "php": ">=5.5"
     6    "php": ">="
    77  },
    88  "require-dev": {
     
    1212        "wp-coding-standards/wpcs": "*",
    1313        "wp-phpunit/wp-phpunit": "5.7.2",
    14         "phpunit/phpunit": "7.5.20"
    15   },
     14        "phpunit/phpunit": "7.5.20",
     15        "yoast/phpunit-polyfills": "^1.0"
     16      },
    1617    "autoload": {
    1718        "psr-4": {
     
    2627        "lint": "phpcs --standard=./.phpcs.xml.dist",
    2728        "phpcs": "phpcs --standard=./.phpcs.xml.dist"
    28     }
     29    },
     30  "config": {
     31    "allow-plugins": {
     32      "dealerdirect/phpcodesniffer-composer-installer": true
     33    }
     34  }
    2935}
  • c3-cloudfront-clear-cache/trunk/package.json

    r2728981 r2825667  
    44  },
    55  "name": "trunk",
    6   "version": "6.1.3",
     6  "version": "6.1.",
    77  "main": "index.js",
    88  "directories": {
  • c3-cloudfront-clear-cache/trunk/readme.txt

    r2728981 r2825667  
    44Tags: AWS,CDN,CloudFront
    55Requires at least: 4.9.0
    6 Tested up to: 5.9.3
    7 Stable tag: 6.1.3
     6Tested up to:
     7Stable tag: 6.1.
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    111111== Changelog ==
    112112
     113
     114
     115
    113116== 6.1.3 ==
    114117* [Fix] Lost filter c3_invalidation_items From v6.0.0
Note: See TracChangeset for help on using the changeset viewer.