Plugin Directory

Changeset 2542211


Ignore:
Timestamp:
06/03/2021 07:03:38 PM (5 years ago)
Author:
shoppingfeed
Message:

Update to version 6.0.21 from GitHub

Location:
shopping-feed
Files:
12 added
46 edited
1 copied

Legend:

Unmodified
Added
Removed
  • shopping-feed/tags/6.0.21/languages/languages.pot

    r2462128 r2542211  
    429429msgid "Default Status for orders imported from from SF"
    430430msgstr ""
     431
     432msgid "The feed is update is running"
     433msgstr ""
     434
     435msgid "Refresh to check progress"
     436msgstr ""
     437
     438msgid "Batch size"
     439msgstr ""
     440
     441msgid "Batch size (default 200 to decrease in case of performance issues)"
     442msgstr ""
     443
     444msgid "If the feed is blocked and not generated"
     445msgstr ""
     446
     447msgid "click here"
     448msgstr ""
     449
     450msgid "to clean all running process"
     451msgstr ""
  • shopping-feed/tags/6.0.21/languages/shopping-feed-fr_FR.po

    r2462128 r2542211  
    88"Content-Transfer-Encoding: 8bit\n"
    99"POT-Creation-Date: 2020-04-20T12:04:03+00:00\n"
    10 "PO-Revision-Date: 2020-06-12 15:18+0200\n"
    11 "X-Generator: Poedit 2.3.1\n"
     10"PO-Revision-Date: 2021-04-26 19:16+0200\n"
     11"X-Generator: Poedit 2.4\n"
    1212"X-Domain: languages\n"
    1313"Last-Translator: \n"
     
    346346msgstr "Mettre à jour manuellement"
    347347
     348msgid "Refresh to check progress"
     349msgstr "Actualiser pour vérifier la progression"
     350
     351msgid "The feed is update is running"
     352msgstr "Mise à jour du flux en cours"
     353
    348354msgid "Methods"
    349355msgstr "Méthodes"
     
    420426msgid "Default Status for orders imported from from SF"
    421427msgstr "Statut par défaut avec lequel la commande sera créé"
     428
     429msgid "Batch size"
     430msgstr "Taille du lot"
     431
     432msgid "Batch size (default 200 to decrease in case of performance issues)"
     433msgstr "Taille du lot (200 par défaut a diminuer en cas de problèmes de performances)"
     434
     435msgid "If the feed is blocked and not generated"
     436msgstr "Si le flux est bloqué ou non généré"
     437
     438msgid "click here"
     439msgstr "cliquez ici"
     440
     441msgid "to clean all running process"
     442msgstr "pour nettoyer tous les processus en cours"
  • shopping-feed/tags/6.0.21/readme.txt

    r2540628 r2542211  
    22Contributors: ShoppingFeed, BeAPI
    33Tags: shoppingfeed, marketplace, woocommerce, woocommerce shoppingfeed, create woocommerce products shoppingfeed, products feed, generate shoppingfeed, amazon, Jet, Walmart, many marketplace, import orders
    4 Stable tag: 6.0.18
    5 Version: 6.0.18
     4Stable tag: 6.0.21
     5Version: 6.0.21
    66Requires PHP: 5.6
    77Requires at least: 5.2
     
    31316.0.16 sum quantity of all variations on parent
    32326.0.17 using generator for generating products list"
    33 6.0.18 consider only the published products
     336.0.18 add async generation for feed
     346.0.19 add compat to the plugin Chained Product
     356.0.20 add compat to the plugin ATS
     366.0.21 Set status as publish on product list
    3437
    3538== Description ==
  • shopping-feed/tags/6.0.21/shoppingfeed.php

    r2540628 r2542211  
    88 * Text Domain:     shopping-feed
    99 * Domain Path:     /languages
    10  * Version:         6.0.18
    11  * Requires at least WP: 5.2
    12  * Requires at least WooCommerce: 3.8 (3.9/4.0)
     10 * Version:         6.0.21
     11 * Requires at least WP: 5.7
     12 * Requires at least WooCommerce: 5.1.0
    1313 * Requires PHP:      5.6
    1414 * License:         GPLv3 or later
     
    2626}
    2727
    28 define( 'SF_VERSION', '6.0.18' );
     28define( 'SF_VERSION', '6.0.21' );
    2929define( 'SF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    3030define( 'SF_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    3131define( 'SF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
     32define( 'SF_FEED_DIR', wp_upload_dir()['basedir'] . '/shopping-feed' );
     33define( 'SF_FEED_PARTS_DIR', SF_FEED_DIR . '/parts' );
    3234
    3335// Plugin activate/deactivate hooks
  • shopping-feed/tags/6.0.21/src/Addons/Addons.php

    r2339808 r2542211  
    88use ShoppingFeed\ShoppingFeedWC\Addons\Inventory\Inventory;
    99use ShoppingFeed\ShoppingFeedWC\Addons\Marketplaces\Marketplaces;
     10use ShoppingFeed\ShoppingFeedWC\Addons\Plugins\ASTPlugin\ASTPlugin;
     11use ShoppingFeed\ShoppingFeedWC\Addons\Plugins\ChainedProductsPlugin\ChainedProducts;
    1012use ShoppingFeed\ShoppingFeedWC\Addons\Shipping\Shipping;
    1113
     
    3032    private $marketplaces;
    3133
     34    /**
     35     * Shipping class
     36     * @var ChainedProducts
     37     */
     38    private $chained_products_plugin;
     39
     40    /**
     41     * Shipping class
     42     * @var ASTPlugin
     43     */
     44    private $ast_plugin;
     45
    3246    public function __construct() {
    33         $this->shipping     = new Shipping();
    34         $this->inventory    = new Inventory();
    35         $this->marketplaces = new Marketplaces();
     47        $this->shipping                = new Shipping();
     48        $this->inventory               = new Inventory();
     49        $this->marketplaces            = new Marketplaces();
     50        $this->chained_products_plugin = new ChainedProducts();
     51        $this->ast_plugin              = new ASTPlugin();
    3652    }
    3753}
  • shopping-feed/tags/6.0.21/src/Admin/Options.php

    r2462128 r2542211  
    99use ShoppingFeed\ShoppingFeedWC\Feed\Generator;
    1010use ShoppingFeed\ShoppingFeedWC\Orders\Operations;
    11 use ShoppingFeed\ShoppingFeedWC\ShoppingFeed;
    1211use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper;
    1312
     
    3938    //Account options
    4039    const SF_ACCOUNT_OPTIONS = 'sf_account_options';
    41 
     40    const SF_FEED_OPTIONS    = 'sf_feed_options';
     41
     42    //Feed options
     43    const SF_SHIPPING_OPTIONS = 'sf_shipping_options';
     44    const SF_ORDERS_OPTIONS   = 'sf_orders_options';
     45
     46    //Shipping options
     47    const SF_CARRIERS = 'SF_CARRIERS';
    4248    /** @var array $sf_account_options */
    4349    private $sf_account_options;
    4450
    45     //Feed options
    46     const SF_FEED_OPTIONS = 'sf_feed_options';
     51    //Orders options
    4752    /** @var array $sf_feed_options */
    4853    private $sf_feed_options;
    49 
    50     //Shipping options
    51     const SF_SHIPPING_OPTIONS = 'sf_shipping_options';
    5254    /** @var array $sf_shipping_options */
    5355    private $sf_shipping_options;
    5456
    55     //Orders options
    56     const SF_ORDERS_OPTIONS = 'sf_orders_options';
     57    //SF Carriers
    5758    /** @var array $sf_orders_options */
    5859    private $sf_orders_options;
    59 
    60     //SF Carriers
    61     const SF_CARRIERS = 'SF_CARRIERS';
    6260    /** @var bool $connected */
    6361    private $connected = true;
     
    224222            $this->connected = ShoppingFeedHelper::is_authenticated();
    225223
     224            //check clean action
     225            $this->check_clean_action();
     226
    226227            //load assets
    227228            $this->load_assets();
     
    266267                __( 'Your source feed', 'shopping-feed' ),
    267268                function () {
    268                     printf(
    269                         '<a target="_blank" href="%1$s">%1$s</a><br><p>' . __( 'Last update', 'shopping-feed' ) . ': %3$s - <a target="_blank" href="%2$s">' . __( 'Refresh', 'shopping-feed' ) . '</a></p>',
    270                         esc_html( ShoppingFeedHelper::get_public_feed_url() ),
    271                         esc_html( ShoppingFeedHelper::get_public_feed_url_with_generation() ),
    272                         ! empty( get_option( Generator::SF_FEED_LAST_GENERATION_DATE ) ) ? esc_html( get_option( Generator::SF_FEED_LAST_GENERATION_DATE ) ) : esc_html( 'Never' )
    273                     );
     269                    $sf_feed_public_url = ShoppingFeedHelper::get_public_feed_url();
     270                    $sf_process_running = ShoppingFeedHelper::generation_process_running();
     271                    $sf_last_generation_date = get_option( Generator::SF_FEED_LAST_GENERATION_DATE );
     272                    ?>
     273                    <?php if ( ! $sf_process_running ) : ?>
     274                        <a href="<?php echo esc_html( $sf_feed_public_url ); ?>" target="_blank">
     275                            <?php
     276                            echo esc_url( $sf_feed_public_url );
     277                            ;
     278                            ?>
     279                        </a>
     280                    <?php endif; ?>
     281                    <br>
     282                    <p>
     283                        <?php if ( ! $sf_process_running ) : ?>
     284                            <?php esc_html_e( 'Last update', 'shopping-feed' ); ?> :
     285                            <?php
     286                            ! empty( $sf_last_generation_date ) ? esc_html( $sf_last_generation_date ) : esc_html_e( 'Never', 'shopping-feed' );
     287                            ?>
     288                            <a href="<?php echo esc_url( ShoppingFeedHelper::get_public_feed_url_with_generation() ); ?>" target="_blank">
     289                                <?php esc_html_e( 'Refresh', 'shopping-feed' ); ?>
     290                            </a>
     291                        <?php else : ?>
     292                            <strong>(<?php esc_html_e( 'The feed is update is running', 'shopping-feed' ); ?>) <a href="#" onClick="window.location.reload();"><?php esc_html_e( 'Refresh to check progress', 'shopping-feed' ); ?></a></strong>
     293                        <?php endif; ?>
     294                    </p>
     295                    <?php
    274296                },
    275297                self::SF_ACCOUNT_SETTINGS_PAGE,
     
    318340            echo wp_kses_post( $requirements->openssl_requirement() );
    319341            echo wp_kses_post( $requirements->account_requirement() );
     342            echo wp_kses_post( $requirements->uploads_directory_access_requirement() );
    320343        ?>
    321344                <!--        REQUIREMENTS     -->
     
    330353        </div>
    331354        <?php
     355    }
     356
     357    /**
     358     * Check clean action
     359     */
     360    private function check_clean_action() {
     361        if ( ! empty( $_GET['clean_process'] ) ) {
     362            ShoppingFeedHelper::clean_generation_process_running();
     363        }
     364    }
     365
     366    private function load_assets() {
     367        wp_enqueue_style(
     368            'sf_app',
     369            SF_PLUGIN_URL . 'assets/css/app.css',
     370            array(),
     371            true
     372        );
     373
     374        wp_enqueue_script(
     375            'multi_js',
     376            SF_PLUGIN_URL . 'assets/js/multi.min.js',
     377            array( 'jquery' ),
     378            true,
     379            true
     380        );
     381
     382        wp_enqueue_script( 'multi_js_init', SF_PLUGIN_URL . 'assets/js/init.js', array( 'multi_js' ), true );
     383        wp_localize_script(
     384            'multi_js_init',
     385            'sf_options',
     386            array(
     387                'selected_orders'            => __( 'Selected order status', 'shopping-feed' ),
     388                'unselected_orders' => __( 'Unselected order status', 'shopping-feed' ),
     389                'search' => __( 'Search', 'shopping-feed' ),
     390            )
     391        );
    332392    }
    333393
     
    479539                <p class="description"
    480540                   id="tagline-description"><?php echo esc_attr_e( 'Frequency to generate the feed (usually 6h)', 'shopping-feed' ); ?></p>
     541                <?php
     542            },
     543            self::SF_FEED_SETTINGS_PAGE,
     544            'sf_feed_settings_frequency'
     545        );
     546
     547        add_settings_field(
     548            'Batch size',
     549            __( 'Batch size', 'shopping-feed' ),
     550            function () {
     551                $running_process = ShoppingFeedHelper::get_running_generation_feed_process();
     552                $running_process = is_array( $running_process ) ? count( $running_process ) : 0;
     553                ?>
     554                <select name="<?php echo esc_html( sprintf( '%s[part_size]', self::SF_FEED_OPTIONS ) ); ?>">
     555                    <?php
     556                    foreach ( array( 10, 20, 50, 100, 200, 500, 1000 ) as $part_size_option ) {
     557                        ?>
     558                        <option
     559                                value="<?php echo esc_html( $part_size_option ); ?>"
     560                            <?php selected( $part_size_option, $this->sf_feed_options['part_size'] ? $this->sf_feed_options['part_size'] : false ); ?>
     561                        ><?php echo esc_html( $part_size_option ); ?></option>
     562                        <?php
     563                    }
     564                    ?>
     565                </select>
     566                <p class="description" id="tagline-description">
     567                   <?php esc_attr_e( 'Batch size (default 200 to decrease in case of performance issues)', 'shopping-feed' ); ?>
     568                </p>
     569                <p class="description">
     570                    <?php esc_attr_e( 'If the feed is blocked and not generated', 'shopping-feed' ); ?>
     571                    <a href="<?php echo sprintf( '%s&clean_process=true', esc_url( ShoppingFeedHelper::get_setting_link() ) ); ?>" class="button-link-delete"><?php esc_attr_e( 'click here', 'shopping-feed' ); ?></a>
     572                    <?php esc_attr_e( 'to clean all running process', 'shopping-feed' ); ?>
     573                    <?php echo esc_html( sprintf( '(%s)', $running_process ) ); ?>
     574                </p>
    481575                <?php
    482576            },
     
    555649        </div>
    556650        <?php
     651    }
     652
     653    /**
     654     * Check connection with SF platform with correct credentials
     655     * If not redirect to Account page
     656     */
     657    private function check_connection() {
     658        if ( ! ShoppingFeedHelper::is_authenticated() ) {
     659            wp_safe_redirect( sprintf( '%s&no_connected=%s', ShoppingFeedHelper::get_setting_link(), 'true' ) );
     660        }
    557661    }
    558662
     
    832936    }
    833937
    834     /**
    835      * Check connection with SF platform with correct credentials
    836      * If not redirect to Account page
    837      */
    838     private function check_connection() {
    839         if ( ! ShoppingFeedHelper::is_authenticated() ) {
    840             wp_safe_redirect( sprintf( '%s&no_connected=%s', ShoppingFeedHelper::get_setting_link(), 'true' ) );
    841         }
    842     }
    843 
    844     private function load_assets() {
    845         wp_enqueue_style(
    846             'sf_app',
    847             SF_PLUGIN_URL . 'assets/css/app.css',
    848             array(),
    849             true
    850         );
    851 
    852         wp_enqueue_script(
    853             'multi_js',
    854             SF_PLUGIN_URL . 'assets/js/multi.min.js',
    855             array( 'jquery' ),
    856             true,
    857             true
    858         );
    859 
    860         wp_enqueue_script( 'multi_js_init', SF_PLUGIN_URL . 'assets/js/init.js', array( 'multi_js' ), true );
    861         wp_localize_script(
    862             'multi_js_init',
    863             'sf_options',
    864             array(
    865                 'selected_orders'            => __( 'Selected order status', 'shopping-feed' ),
    866                 'unselected_orders' => __( 'Unselected order status', 'shopping-feed' ),
    867                 'search' => __( 'Search', 'shopping-feed' ),
    868             )
    869         );
    870     }
    871 
    872938}
  • shopping-feed/tags/6.0.21/src/Admin/Requirements.php

    r2417980 r2542211  
    77
    88use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper;
    9 use const OPENSSL_VERSION_TEXT;
    109use const PHP_VERSION;
    1110
     
    9089    }
    9190
     91
     92    /**
     93     * @return string
     94     */
     95    public function uploads_directory_access_requirement() {
     96        return ( $this->uploads_directory_writable() )
     97            ? '<p class="success">' . __( 'You have write access in uploads directory.', 'shopping-feed' ) . '</p>'
     98            : '<p class="failed">' . __( 'You must have write access in uploads directory.', 'shopping-feed' ) . '</p>';
     99    }
     100
    92101    /**
    93102     * Check if CURL is available and support SSL
     
    135144        return ShoppingFeedHelper::is_authenticated();
    136145    }
     146
     147    /**
     148     * Check if the uploads directory is writable
     149     *
     150     * @return bool
     151     */
     152    public function uploads_directory_writable() {
     153        return is_writable( wp_upload_dir()['basedir'] );
     154    }
    137155}
  • shopping-feed/tags/6.0.21/src/Admin/WoocommerceActions.php

    r2404199 r2542211  
    1010use ShoppingFeed\Sdk\Api\Catalog\PricingUpdate;
    1111use ShoppingFeed\Sdk\Api\Store\StoreResource;
     12use ShoppingFeed\ShoppingFeedWC\Feed\AsyncGenerator;
    1213use ShoppingFeed\ShoppingFeedWC\Feed\Generator;
    1314use ShoppingFeed\ShoppingFeedWC\Orders\Operations;
     
    3738
    3839    public function __construct() {
     40
     41        //Generate async feed
     42        add_action(
     43            'sf_feed_generation_process',
     44            [
     45                AsyncGenerator::get_instance(),
     46                'launch',
     47            ]
     48        );
     49
     50        //Generate feed part
     51        add_action(
     52            'sf_feed_generation_part',
     53            [
     54                AsyncGenerator::get_instance(),
     55
     56                'generate_feed_part',
     57            ],
     58            10,
     59            2
     60        );
     61
     62        //Combine feed's parts
     63        add_action(
     64            'sf_feed_generation_combine_feed_parts',
     65            [
     66                AsyncGenerator::get_instance(),
     67                'combine_feed_parts',
     68            ]
     69        );
    3970
    4071        //Product Update
  • shopping-feed/tags/6.0.21/src/Feed/Generator.php

    r2422339 r2542211  
    3232     * @var ProductGenerator
    3333     */
    34     private $generator;
     34    protected $generator;
    3535
    3636    /**
    3737     * Generator constructor.
    3838     */
    39     private function __construct() {
     39    public function __construct() {
    4040        $this->set_platform();
    4141        $this->set_uri();
     
    7979     * This can be achieved in mappers or in your dataset, but sometimes things have to be separated, so you can register processors that are executed before mappers, and prepare your data before the mapping process.
    8080     */
    81     private function set_processors() {
     81    protected function set_processors() {
    8282    }
    8383
     
    8686     * Filters are executed after processors, because item must be completely filled before to make the decision to keep it or not.
    8787     */
    88     private function set_filters() {
     88    protected function set_filters() {
    8989        # Ignore all items with undefined price
    9090        $this->generator->addFilter(
     
    103103     * As stated above, at least one mapper must be registered, this is where you populate the Product instance, which is later converted to XML by the library
    104104     */
    105     private function set_mappers() {
     105    protected function set_mappers() {
    106106        //Simple product mapping
    107107        $this->generator->addMapper(
     
    234234
    235235        if ( true === $no_cache || ! is_file( $file_path ) ) {
    236             $generate = $this->generate();
    237             if ( is_wp_error( $generate ) ) {
    238                 ShoppingFeedHelper::get_logger()->error(
    239                     sprintf(
    240                         __( 'Cant display feed', 'shopping-feed' )
    241                     ),
    242                     array(
    243                         'source' => 'shopping-feed',
    244                     )
    245                 );
    246             }
     236            if ( ShoppingFeedHelper::generation_process_running() ) {
     237                wp_die( 'Feed generation already launched' );
     238            }
     239            as_schedule_single_action(
     240                false,
     241                'sf_feed_generation_process',
     242                array(),
     243                'sf_feed_generation_process'
     244            );
     245            wp_die( 'Feed generation launched' );
    247246        }
    248247
  • shopping-feed/tags/6.0.21/src/Feed/Uri.php

    r2417980 r2542211  
    135135     */
    136136    public function set_file_path() {
    137         $this->file_path = $this->directory . $this->file_name;
     137        $this->file_path = $this->directory . '/' . $this->file_name;
    138138    }
    139139
  • shopping-feed/tags/6.0.21/src/Orders/Operations.php

    r2339808 r2542211  
    121121                $this->sf_channel_name,
    122122                ShoppingFeedHelper::get_sf_carrier_from_wc_shipping( $this->wc_order ),
    123                 (string) $this->wc_order->get_meta( ShoppingFeedHelper::wc_tracking_number() ),
    124                 (string) $this->wc_order->get_meta( ShoppingFeedHelper::wc_tracking_link() )
     123                ShoppingFeedHelper::wc_tracking_number( $this->wc_order ),
     124                ShoppingFeedHelper::wc_tracking_link( $this->wc_order )
    125125            );
    126126            $this->order_api->execute( $this->order_operation );
  • shopping-feed/tags/6.0.21/src/Orders/Order.php

    r2422339 r2542211  
    8080        //Addresses
    8181        $wc_order->set_address( $this->shipping_address, 'shipping' );
    82         $wc_order->set_address( $this->billing_address, 'billing' );
     82        $wc_order->set_address( $this->billing_address );
    8383
    8484        //Payment
     
    167167                $item->save();
    168168                $wc_order->add_item( $item );
     169                do_action( 'sf_after_order_add_item', $item, $wc_order );
    169170            }
    170171        }
     
    205206        $wc_order->save();
    206207
     208        do_action( 'sf_before_add_order', $wc_order );
     209
    207210        //Acknowledge the order so we will not get it next time
    208211        Operations::acknowledge_order( $wc_order->get_id(), $message );
  • shopping-feed/tags/6.0.21/src/Orders/Order/Products.php

    r2417980 r2542211  
    8383        }
    8484
    85         $default_args = array(
     85        $sf_product_quantity = $sf_product->getQuantity();
     86
     87        $args = array(
    8688            'name'         => $wc_product->get_name(),
    8789            'tax_class'    => $wc_product->get_tax_class(),
     
    8991            'variation_id' => $wc_product->is_type( 'variation' ) ? $wc_product->get_id() : 0,
    9092            'variation'    => $wc_product->is_type( 'variation' ) ? $wc_product->get_attributes() : array(),
    91         );
    92 
    93         $args = array(
    94             'subtotal' => $sf_product->getUnitPrice(),
    95             'total'    => $sf_product->getTotalPrice(),
    96             'quantity' => $sf_product->getQuantity(),
     93            'subtotal'     => $sf_product->getUnitPrice(),
     94            'total'        => $sf_product->getTotalPrice(),
     95            'quantity'     => $sf_product_quantity,
    9796        );
    9897
     
    10099
    101100        return array(
    102             'args'             => wp_parse_args( $args, $default_args ),
    103             'outofstock'       => ! $this->validate_product( $wc_product, $sf_product ),
     101            'args'             => $args,
     102            'outofstock'       => ! $this->validate_product( $wc_product, $sf_product_quantity ),
    104103            'product_quantity' => $wc_product_quantity,
    105             'quantity_needed'  => $sf_product->getQuantity() - $wc_product_quantity,
     104            'quantity_needed'  => $sf_product_quantity - $wc_product_quantity,
    106105        );
    107106    }
     
    109108    /**
    110109     * @param $wc_product WC_Product
    111      * @param $sf_product OrderItem
     110     * @param $ordered_quantity int
    112111     *
    113112     * @return bool
    114113     */
    115     private function validate_product( $wc_product, $sf_product ) {
    116         //automatically validate product if backorders or allowed and managin stock is disabled
     114    private function validate_product( $wc_product, $ordered_quantity ) {
     115        //automatically validate product if backorders or allowed and managing stock is disabled
    117116        if ( $wc_product->backorders_allowed() || ! $wc_product->managing_stock() ) {
    118117            return true;
    119118        }
    120119
    121         return $sf_product->getQuantity() <= $wc_product->get_stock_quantity();
     120        return $ordered_quantity <= $wc_product->get_stock_quantity();
    122121    }
    123122
  • shopping-feed/tags/6.0.21/src/Products/Products.php

    r2540628 r2542211  
    4242    }
    4343
    44     /**
    45      * Generate products list
    46      */
    47     public function get_list() {
     44    public function get_list_args() {
    4845        $default_args = array(
    4946            'limit'   => - 1,
     
    6663        }
    6764
    68         $args = wp_parse_args( ShoppingFeedHelper::wc_products_custom_query_args(), $default_args );
     65        return wp_parse_args( ShoppingFeedHelper::wc_products_custom_query_args(), $default_args );
     66    }
    6967
    70         $query = new \WC_Product_Query( $args );
     68    /**
     69     * Generate products list
     70     */
     71    public function get_list() {
     72        $products = $this->get_products();
    7173
    72         if ( ! empty( $query->get_products() ) ) {
    73             foreach ( $query->get_products() as $wc_product ) {
    74                 yield [ new Product( $wc_product ) ];
     74        if ( ! empty( $products ) ) {
     75            foreach ( $products as $wc_product ) {
     76                yield array( new Product( $wc_product ) );
    7577            }
    7678        }
    7779    }
     80
     81    public function get_products( $args = array() ) {
     82        $query = new \WC_Product_Query( wp_parse_args( $args, $this->get_list_args() ) );
     83
     84        return $query->get_products();
     85    }
     86
     87
     88    public function format_products( $wc_products ) {
     89        foreach ( $wc_products as $wc_product ) {
     90            yield array( new Product( $wc_product ) );
     91        }
     92    }
     93
    7894}
  • shopping-feed/tags/6.0.21/src/ShoppingFeed.php

    r2417980 r2542211  
    207207    public static function activate() {
    208208        if ( defined( 'WC_VERSION' ) ) {
     209            self::add_sf_directory();
    209210            Actions::register_feed_generation();
    210211            Actions::register_get_orders();
     
    241242        delete_option( Options::SF_CARRIERS );
    242243        delete_option( Generator::SF_FEED_LAST_GENERATION_DATE );
    243         ( new \WP_Filesystem_Direct( false ) )->rmdir( ShoppingFeedHelper::get_feed_directory(), true );
     244        self::remove_sf_directory();
     245    }
     246
     247    public static function remove_sf_directory() {
     248        rmdir( ShoppingFeedHelper::get_feed_directory() );
     249    }
     250
     251    public static function add_sf_directory() {
     252        $directory = ShoppingFeedHelper::get_feed_directory();
     253        if ( ! is_dir( $directory ) ) {
     254            wp_mkdir_p( $directory );
     255        }
     256        $part_directory = ShoppingFeedHelper::get_feed_parts_directory();
     257        if ( ! is_dir( $part_directory ) ) {
     258            wp_mkdir_p( $part_directory );
     259        }
    244260    }
    245261}
  • shopping-feed/tags/6.0.21/src/ShoppingFeedHelper.php

    r2430999 r2542211  
    2020
    2121    /**
     22     * @var ShoppingFeedHelper
     23     */
     24    private static $instance;
     25
     26    /**
     27     * Get the singleton instance.
     28     *
     29     * @return ShoppingFeedHelper
     30     */
     31    public static function get_instance() {
     32        if ( is_null( self::$instance ) ) {
     33            self::$instance = new self();
     34        }
     35
     36        return self::$instance;
     37    }
     38
     39    /**
     40     * Singleton instance can't be cloned.
     41     */
     42    private function __clone() {
     43    }
     44
     45    /**
     46     * Singleton instance can't be serialized.
     47     */
     48    private function __wakeup() {
     49    }
     50
     51    /**
    2252     * Check if current WooCommerce version is below 3.8.0
    2353     *
     
    5787     */
    5888    public static function get_feed_directory() {
    59         $directory = wp_upload_dir()['basedir'] . '/shopping-feed/';
    60         if ( ! is_dir( $directory ) ) {
    61             wp_mkdir_p( $directory );
    62         }
    63 
    64         return $directory;
     89        return SF_FEED_DIR;
     90    }
     91
     92    /**
     93     * Return the feed's parts directory
     94     * @return string
     95     */
     96    public static function get_feed_parts_directory() {
     97        return SF_FEED_PARTS_DIR;
     98    }
     99
     100    /**
     101     * @return string
     102     */
     103    public static function get_feed_skeleton() {
     104        return <<<XML
     105<?xml version="1.0" encoding="UTF-8"?>
     106<catalog>
     107    <metadata>
     108        <platform>WooCommerce:5.1.0</platform>
     109        <agent>shopping-feed-generator:1.0.0</agent>
     110        <startedAt/>
     111        <finishedAt/>
     112        <invalid/>
     113        <ignored/>
     114        <written/>
     115    </metadata>
     116</catalog>
     117XML;
    65118    }
    66119
     
    249302
    250303        return $frequency;
     304    }
     305
     306    /**
     307     * Return SF feed part size
     308     * default: 200 product per file
     309     * @return int
     310     */
     311    public static function get_sf_part_size() {
     312        $part_size = self::get_sf_feed_options( 'part_size' );
     313        if ( empty( $part_size ) ) {
     314            return 200;
     315        }
     316
     317        return $part_size;
    251318    }
    252319
     
    576643    /**
    577644     * Add filter for order tracking number meta key
    578      * @return string
    579      */
    580     public static function wc_tracking_number() {
    581         return apply_filters( 'shopping_feed_tracking_number', '' );
     645     *
     646     * @param \WC_Order $wc_order
     647     *
     648     * @return string
     649     */
     650    public static function wc_tracking_number( $wc_order ) {
     651        $tracking_number = apply_filters( 'shopping_feed_tracking_number', '', $wc_order );
     652        //COMPACT WITH OLD VERSION
     653        if ( '6.0.19' <= SF_VERSION ) {
     654            return (string) $wc_order->get_meta( $tracking_number );
     655        }
     656
     657        return $tracking_number;
    582658    }
    583659
    584660    /**
    585661     * Add filter for order tracking link meta key
    586      * @return string
    587      */
    588     public static function wc_tracking_link() {
    589         return apply_filters( 'shopping_feed_tracking_link', '' );
     662     *
     663     * @param \WC_Order $wc_order
     664     *
     665     * @return string
     666     */
     667    public static function wc_tracking_link( $wc_order ) {
     668        $tracking_link = apply_filters( 'shopping_feed_tracking_link', '', $wc_order );
     669        //COMPACT WITH OLD VERSION
     670        if ( '6.0.19' <= SF_VERSION ) {
     671            return (string) $wc_order->get_meta( $tracking_link );
     672        }
     673
     674        return $tracking_link;
    590675    }
    591676
     
    597682        return 100;
    598683    }
     684
     685    /**
     686     * Get running process list
     687     * @return array|int
     688     */
     689    public static function get_running_generation_feed_process() {
     690        $action_scheduler = \ActionScheduler::store();
     691
     692        return $action_scheduler->query_actions(
     693            array(
     694                'group'  => 'sf_feed_generation_process',
     695                'status' => $action_scheduler::STATUS_PENDING,
     696            )
     697        );
     698    }
     699
     700    /**
     701     * Check if a running generation process
     702     * @return bool
     703     */
     704    public static function generation_process_running() {
     705        $process = self::get_running_generation_feed_process();
     706
     707        return ! empty( $process );
     708    }
     709
     710    public static function clean_generation_process_running() {
     711        try {
     712            \ActionScheduler::store()->cancel_actions_by_group( 'sf_feed_generation_process' );
     713        } catch ( \Exception $exception ) {
     714            self::get_logger()->error(
     715                sprintf(
     716                    __( 'Cant remove running process', 'shopping-feed' ),
     717                    $exception->getMessage()
     718                ),
     719                array(
     720                    'source' => 'shopping-feed',
     721                )
     722            );
     723        }
     724        wp_safe_redirect( self::get_setting_link(), 302 );
     725    }
    599726}
  • shopping-feed/tags/6.0.21/vendor/autoload.php

    r2540628 r2542211  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit4ab3512180e161131ad7b070b1a1643c::getLoader();
     7return ComposerAutoloaderInit203372635d40bb0d59e0e62758357279::getLoader();
  • shopping-feed/tags/6.0.21/vendor/composer/InstalledVersions.php

    r2540628 r2542211  
    2828  'root' =>
    2929  array (
    30     'pretty_version' => '6.0.18',
    31     'version' => '6.0.18.0',
     30    'pretty_version' => '6.0.21',
     31    'version' => '6.0.21.0',
    3232    'aliases' =>
    3333    array (
    3434    ),
    35     'reference' => '5eee70b9b2b0801fb3bc9948e6ec7473eef31991',
     35    'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04',
    3636    'name' => 'shoppingfeed/shoppingfeed',
    3737  ),
     
    133133    'shoppingfeed/shoppingfeed' =>
    134134    array (
    135       'pretty_version' => '6.0.18',
    136       'version' => '6.0.18.0',
    137       'aliases' =>
    138       array (
    139       ),
    140       'reference' => '5eee70b9b2b0801fb3bc9948e6ec7473eef31991',
     135      'pretty_version' => '6.0.21',
     136      'version' => '6.0.21.0',
     137      'aliases' =>
     138      array (
     139      ),
     140      'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04',
    141141    ),
    142142    'symfony/polyfill-intl-idn' =>
  • shopping-feed/tags/6.0.21/vendor/composer/autoload_classmap.php

    r2417980 r2542211  
    303303    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonBusiness' => $baseDir . '/src/Addons/Marketplaces/Types/AmazonBusiness.php',
    304304    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonPrime' => $baseDir . '/src/Addons/Marketplaces/Types/AmazonPrime.php',
     305    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Plugins\\ChainedProductsPlugin\\ChainedProducts' => $baseDir . '/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php',
    305306    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Cdiscount' => $baseDir . '/src/Addons/Shipping/Marketplaces/Cdiscount.php',
    306307    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Rdc' => $baseDir . '/src/Addons/Shipping/Marketplaces/Rdc.php',
     
    314315    'ShoppingFeed\\ShoppingFeedWC\\Admin\\WoocommerceFilters' => $baseDir . '/src/Admin/WoocommerceFilters.php',
    315316    'ShoppingFeed\\ShoppingFeedWC\\Cli\\FeedGeneration' => $baseDir . '/src/Cli/FeedGeneration.php',
     317    'ShoppingFeed\\ShoppingFeedWC\\Feed\\AsyncGenerator' => $baseDir . '/src/Feed/AsyncGenerator.php',
    316318    'ShoppingFeed\\ShoppingFeedWC\\Feed\\Generator' => $baseDir . '/src/Feed/Generator.php',
    317319    'ShoppingFeed\\ShoppingFeedWC\\Feed\\Platform' => $baseDir . '/src/Feed/Platform.php',
  • shopping-feed/tags/6.0.21/vendor/composer/autoload_real.php

    r2540628 r2542211  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit4ab3512180e161131ad7b070b1a1643c
     5class ComposerAutoloaderInit203372635d40bb0d59e0e62758357279
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInit4ab3512180e161131ad7b070b1a1643c', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInit203372635d40bb0d59e0e62758357279', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    27         spl_autoload_unregister(array('ComposerAutoloaderInit4ab3512180e161131ad7b070b1a1643c', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInit203372635d40bb0d59e0e62758357279', 'loadClassLoader'));
    2828
    2929        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3131            require __DIR__ . '/autoload_static.php';
    3232
    33             call_user_func(\Composer\Autoload\ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::getInitializer($loader));
     33            call_user_func(\Composer\Autoload\ComposerStaticInit203372635d40bb0d59e0e62758357279::getInitializer($loader));
    3434        } else {
    3535            $map = require __DIR__ . '/autoload_namespaces.php';
     
    5252
    5353        if ($useStaticLoader) {
    54             $includeFiles = Composer\Autoload\ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::$files;
     54            $includeFiles = Composer\Autoload\ComposerStaticInit203372635d40bb0d59e0e62758357279::$files;
    5555        } else {
    5656            $includeFiles = require __DIR__ . '/autoload_files.php';
    5757        }
    5858        foreach ($includeFiles as $fileIdentifier => $file) {
    59             composerRequire4ab3512180e161131ad7b070b1a1643c($fileIdentifier, $file);
     59            composerRequire203372635d40bb0d59e0e62758357279($fileIdentifier, $file);
    6060        }
    6161
     
    6464}
    6565
    66 function composerRequire4ab3512180e161131ad7b070b1a1643c($fileIdentifier, $file)
     66function composerRequire203372635d40bb0d59e0e62758357279($fileIdentifier, $file)
    6767{
    6868    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • shopping-feed/tags/6.0.21/vendor/composer/autoload_static.php

    r2540628 r2542211  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit4ab3512180e161131ad7b070b1a1643c
     7class ComposerStaticInit203372635d40bb0d59e0e62758357279
    88{
    99    public static $files = array (
     
    393393        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonBusiness' => __DIR__ . '/../..' . '/src/Addons/Marketplaces/Types/AmazonBusiness.php',
    394394        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonPrime' => __DIR__ . '/../..' . '/src/Addons/Marketplaces/Types/AmazonPrime.php',
     395        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Plugins\\ChainedProductsPlugin\\ChainedProducts' => __DIR__ . '/../..' . '/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php',
    395396        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Cdiscount' => __DIR__ . '/../..' . '/src/Addons/Shipping/Marketplaces/Cdiscount.php',
    396397        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Rdc' => __DIR__ . '/../..' . '/src/Addons/Shipping/Marketplaces/Rdc.php',
     
    404405        'ShoppingFeed\\ShoppingFeedWC\\Admin\\WoocommerceFilters' => __DIR__ . '/../..' . '/src/Admin/WoocommerceFilters.php',
    405406        'ShoppingFeed\\ShoppingFeedWC\\Cli\\FeedGeneration' => __DIR__ . '/../..' . '/src/Cli/FeedGeneration.php',
     407        'ShoppingFeed\\ShoppingFeedWC\\Feed\\AsyncGenerator' => __DIR__ . '/../..' . '/src/Feed/AsyncGenerator.php',
    406408        'ShoppingFeed\\ShoppingFeedWC\\Feed\\Generator' => __DIR__ . '/../..' . '/src/Feed/Generator.php',
    407409        'ShoppingFeed\\ShoppingFeedWC\\Feed\\Platform' => __DIR__ . '/../..' . '/src/Feed/Platform.php',
     
    436438    {
    437439        return \Closure::bind(function () use ($loader) {
    438             $loader->prefixLengthsPsr4 = ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::$prefixLengthsPsr4;
    439             $loader->prefixDirsPsr4 = ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::$prefixDirsPsr4;
    440             $loader->classMap = ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::$classMap;
     440            $loader->prefixLengthsPsr4 = ComposerStaticInit203372635d40bb0d59e0e62758357279::$prefixLengthsPsr4;
     441            $loader->prefixDirsPsr4 = ComposerStaticInit203372635d40bb0d59e0e62758357279::$prefixDirsPsr4;
     442            $loader->classMap = ComposerStaticInit203372635d40bb0d59e0e62758357279::$classMap;
    441443
    442444        }, null, ClassLoader::class);
  • shopping-feed/tags/6.0.21/vendor/composer/installed.php

    r2540628 r2542211  
    22  'root' =>
    33  array (
    4     'pretty_version' => '6.0.18',
    5     'version' => '6.0.18.0',
     4    'pretty_version' => '6.0.21',
     5    'version' => '6.0.21.0',
    66    'aliases' =>
    77    array (
    88    ),
    9     'reference' => '5eee70b9b2b0801fb3bc9948e6ec7473eef31991',
     9    'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04',
    1010    'name' => 'shoppingfeed/shoppingfeed',
    1111  ),
     
    107107    'shoppingfeed/shoppingfeed' =>
    108108    array (
    109       'pretty_version' => '6.0.18',
    110       'version' => '6.0.18.0',
     109      'pretty_version' => '6.0.21',
     110      'version' => '6.0.21.0',
    111111      'aliases' =>
    112112      array (
    113113      ),
    114       'reference' => '5eee70b9b2b0801fb3bc9948e6ec7473eef31991',
     114      'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04',
    115115    ),
    116116    'symfony/polyfill-intl-idn' =>
  • shopping-feed/trunk/languages/languages.pot

    r2462128 r2542211  
    429429msgid "Default Status for orders imported from from SF"
    430430msgstr ""
     431
     432msgid "The feed is update is running"
     433msgstr ""
     434
     435msgid "Refresh to check progress"
     436msgstr ""
     437
     438msgid "Batch size"
     439msgstr ""
     440
     441msgid "Batch size (default 200 to decrease in case of performance issues)"
     442msgstr ""
     443
     444msgid "If the feed is blocked and not generated"
     445msgstr ""
     446
     447msgid "click here"
     448msgstr ""
     449
     450msgid "to clean all running process"
     451msgstr ""
  • shopping-feed/trunk/languages/shopping-feed-fr_FR.po

    r2462128 r2542211  
    88"Content-Transfer-Encoding: 8bit\n"
    99"POT-Creation-Date: 2020-04-20T12:04:03+00:00\n"
    10 "PO-Revision-Date: 2020-06-12 15:18+0200\n"
    11 "X-Generator: Poedit 2.3.1\n"
     10"PO-Revision-Date: 2021-04-26 19:16+0200\n"
     11"X-Generator: Poedit 2.4\n"
    1212"X-Domain: languages\n"
    1313"Last-Translator: \n"
     
    346346msgstr "Mettre à jour manuellement"
    347347
     348msgid "Refresh to check progress"
     349msgstr "Actualiser pour vérifier la progression"
     350
     351msgid "The feed is update is running"
     352msgstr "Mise à jour du flux en cours"
     353
    348354msgid "Methods"
    349355msgstr "Méthodes"
     
    420426msgid "Default Status for orders imported from from SF"
    421427msgstr "Statut par défaut avec lequel la commande sera créé"
     428
     429msgid "Batch size"
     430msgstr "Taille du lot"
     431
     432msgid "Batch size (default 200 to decrease in case of performance issues)"
     433msgstr "Taille du lot (200 par défaut a diminuer en cas de problèmes de performances)"
     434
     435msgid "If the feed is blocked and not generated"
     436msgstr "Si le flux est bloqué ou non généré"
     437
     438msgid "click here"
     439msgstr "cliquez ici"
     440
     441msgid "to clean all running process"
     442msgstr "pour nettoyer tous les processus en cours"
  • shopping-feed/trunk/readme.txt

    r2540628 r2542211  
    22Contributors: ShoppingFeed, BeAPI
    33Tags: shoppingfeed, marketplace, woocommerce, woocommerce shoppingfeed, create woocommerce products shoppingfeed, products feed, generate shoppingfeed, amazon, Jet, Walmart, many marketplace, import orders
    4 Stable tag: 6.0.18
    5 Version: 6.0.18
     4Stable tag: 6.0.21
     5Version: 6.0.21
    66Requires PHP: 5.6
    77Requires at least: 5.2
     
    31316.0.16 sum quantity of all variations on parent
    32326.0.17 using generator for generating products list"
    33 6.0.18 consider only the published products
     336.0.18 add async generation for feed
     346.0.19 add compat to the plugin Chained Product
     356.0.20 add compat to the plugin ATS
     366.0.21 Set status as publish on product list
    3437
    3538== Description ==
  • shopping-feed/trunk/shoppingfeed.php

    r2540628 r2542211  
    88 * Text Domain:     shopping-feed
    99 * Domain Path:     /languages
    10  * Version:         6.0.18
    11  * Requires at least WP: 5.2
    12  * Requires at least WooCommerce: 3.8 (3.9/4.0)
     10 * Version:         6.0.21
     11 * Requires at least WP: 5.7
     12 * Requires at least WooCommerce: 5.1.0
    1313 * Requires PHP:      5.6
    1414 * License:         GPLv3 or later
     
    2626}
    2727
    28 define( 'SF_VERSION', '6.0.18' );
     28define( 'SF_VERSION', '6.0.21' );
    2929define( 'SF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    3030define( 'SF_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    3131define( 'SF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
     32define( 'SF_FEED_DIR', wp_upload_dir()['basedir'] . '/shopping-feed' );
     33define( 'SF_FEED_PARTS_DIR', SF_FEED_DIR . '/parts' );
    3234
    3335// Plugin activate/deactivate hooks
  • shopping-feed/trunk/src/Addons/Addons.php

    r2339808 r2542211  
    88use ShoppingFeed\ShoppingFeedWC\Addons\Inventory\Inventory;
    99use ShoppingFeed\ShoppingFeedWC\Addons\Marketplaces\Marketplaces;
     10use ShoppingFeed\ShoppingFeedWC\Addons\Plugins\ASTPlugin\ASTPlugin;
     11use ShoppingFeed\ShoppingFeedWC\Addons\Plugins\ChainedProductsPlugin\ChainedProducts;
    1012use ShoppingFeed\ShoppingFeedWC\Addons\Shipping\Shipping;
    1113
     
    3032    private $marketplaces;
    3133
     34    /**
     35     * Shipping class
     36     * @var ChainedProducts
     37     */
     38    private $chained_products_plugin;
     39
     40    /**
     41     * Shipping class
     42     * @var ASTPlugin
     43     */
     44    private $ast_plugin;
     45
    3246    public function __construct() {
    33         $this->shipping     = new Shipping();
    34         $this->inventory    = new Inventory();
    35         $this->marketplaces = new Marketplaces();
     47        $this->shipping                = new Shipping();
     48        $this->inventory               = new Inventory();
     49        $this->marketplaces            = new Marketplaces();
     50        $this->chained_products_plugin = new ChainedProducts();
     51        $this->ast_plugin              = new ASTPlugin();
    3652    }
    3753}
  • shopping-feed/trunk/src/Admin/Options.php

    r2462128 r2542211  
    99use ShoppingFeed\ShoppingFeedWC\Feed\Generator;
    1010use ShoppingFeed\ShoppingFeedWC\Orders\Operations;
    11 use ShoppingFeed\ShoppingFeedWC\ShoppingFeed;
    1211use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper;
    1312
     
    3938    //Account options
    4039    const SF_ACCOUNT_OPTIONS = 'sf_account_options';
    41 
     40    const SF_FEED_OPTIONS    = 'sf_feed_options';
     41
     42    //Feed options
     43    const SF_SHIPPING_OPTIONS = 'sf_shipping_options';
     44    const SF_ORDERS_OPTIONS   = 'sf_orders_options';
     45
     46    //Shipping options
     47    const SF_CARRIERS = 'SF_CARRIERS';
    4248    /** @var array $sf_account_options */
    4349    private $sf_account_options;
    4450
    45     //Feed options
    46     const SF_FEED_OPTIONS = 'sf_feed_options';
     51    //Orders options
    4752    /** @var array $sf_feed_options */
    4853    private $sf_feed_options;
    49 
    50     //Shipping options
    51     const SF_SHIPPING_OPTIONS = 'sf_shipping_options';
    5254    /** @var array $sf_shipping_options */
    5355    private $sf_shipping_options;
    5456
    55     //Orders options
    56     const SF_ORDERS_OPTIONS = 'sf_orders_options';
     57    //SF Carriers
    5758    /** @var array $sf_orders_options */
    5859    private $sf_orders_options;
    59 
    60     //SF Carriers
    61     const SF_CARRIERS = 'SF_CARRIERS';
    6260    /** @var bool $connected */
    6361    private $connected = true;
     
    224222            $this->connected = ShoppingFeedHelper::is_authenticated();
    225223
     224            //check clean action
     225            $this->check_clean_action();
     226
    226227            //load assets
    227228            $this->load_assets();
     
    266267                __( 'Your source feed', 'shopping-feed' ),
    267268                function () {
    268                     printf(
    269                         '<a target="_blank" href="%1$s">%1$s</a><br><p>' . __( 'Last update', 'shopping-feed' ) . ': %3$s - <a target="_blank" href="%2$s">' . __( 'Refresh', 'shopping-feed' ) . '</a></p>',
    270                         esc_html( ShoppingFeedHelper::get_public_feed_url() ),
    271                         esc_html( ShoppingFeedHelper::get_public_feed_url_with_generation() ),
    272                         ! empty( get_option( Generator::SF_FEED_LAST_GENERATION_DATE ) ) ? esc_html( get_option( Generator::SF_FEED_LAST_GENERATION_DATE ) ) : esc_html( 'Never' )
    273                     );
     269                    $sf_feed_public_url = ShoppingFeedHelper::get_public_feed_url();
     270                    $sf_process_running = ShoppingFeedHelper::generation_process_running();
     271                    $sf_last_generation_date = get_option( Generator::SF_FEED_LAST_GENERATION_DATE );
     272                    ?>
     273                    <?php if ( ! $sf_process_running ) : ?>
     274                        <a href="<?php echo esc_html( $sf_feed_public_url ); ?>" target="_blank">
     275                            <?php
     276                            echo esc_url( $sf_feed_public_url );
     277                            ;
     278                            ?>
     279                        </a>
     280                    <?php endif; ?>
     281                    <br>
     282                    <p>
     283                        <?php if ( ! $sf_process_running ) : ?>
     284                            <?php esc_html_e( 'Last update', 'shopping-feed' ); ?> :
     285                            <?php
     286                            ! empty( $sf_last_generation_date ) ? esc_html( $sf_last_generation_date ) : esc_html_e( 'Never', 'shopping-feed' );
     287                            ?>
     288                            <a href="<?php echo esc_url( ShoppingFeedHelper::get_public_feed_url_with_generation() ); ?>" target="_blank">
     289                                <?php esc_html_e( 'Refresh', 'shopping-feed' ); ?>
     290                            </a>
     291                        <?php else : ?>
     292                            <strong>(<?php esc_html_e( 'The feed is update is running', 'shopping-feed' ); ?>) <a href="#" onClick="window.location.reload();"><?php esc_html_e( 'Refresh to check progress', 'shopping-feed' ); ?></a></strong>
     293                        <?php endif; ?>
     294                    </p>
     295                    <?php
    274296                },
    275297                self::SF_ACCOUNT_SETTINGS_PAGE,
     
    318340            echo wp_kses_post( $requirements->openssl_requirement() );
    319341            echo wp_kses_post( $requirements->account_requirement() );
     342            echo wp_kses_post( $requirements->uploads_directory_access_requirement() );
    320343        ?>
    321344                <!--        REQUIREMENTS     -->
     
    330353        </div>
    331354        <?php
     355    }
     356
     357    /**
     358     * Check clean action
     359     */
     360    private function check_clean_action() {
     361        if ( ! empty( $_GET['clean_process'] ) ) {
     362            ShoppingFeedHelper::clean_generation_process_running();
     363        }
     364    }
     365
     366    private function load_assets() {
     367        wp_enqueue_style(
     368            'sf_app',
     369            SF_PLUGIN_URL . 'assets/css/app.css',
     370            array(),
     371            true
     372        );
     373
     374        wp_enqueue_script(
     375            'multi_js',
     376            SF_PLUGIN_URL . 'assets/js/multi.min.js',
     377            array( 'jquery' ),
     378            true,
     379            true
     380        );
     381
     382        wp_enqueue_script( 'multi_js_init', SF_PLUGIN_URL . 'assets/js/init.js', array( 'multi_js' ), true );
     383        wp_localize_script(
     384            'multi_js_init',
     385            'sf_options',
     386            array(
     387                'selected_orders'            => __( 'Selected order status', 'shopping-feed' ),
     388                'unselected_orders' => __( 'Unselected order status', 'shopping-feed' ),
     389                'search' => __( 'Search', 'shopping-feed' ),
     390            )
     391        );
    332392    }
    333393
     
    479539                <p class="description"
    480540                   id="tagline-description"><?php echo esc_attr_e( 'Frequency to generate the feed (usually 6h)', 'shopping-feed' ); ?></p>
     541                <?php
     542            },
     543            self::SF_FEED_SETTINGS_PAGE,
     544            'sf_feed_settings_frequency'
     545        );
     546
     547        add_settings_field(
     548            'Batch size',
     549            __( 'Batch size', 'shopping-feed' ),
     550            function () {
     551                $running_process = ShoppingFeedHelper::get_running_generation_feed_process();
     552                $running_process = is_array( $running_process ) ? count( $running_process ) : 0;
     553                ?>
     554                <select name="<?php echo esc_html( sprintf( '%s[part_size]', self::SF_FEED_OPTIONS ) ); ?>">
     555                    <?php
     556                    foreach ( array( 10, 20, 50, 100, 200, 500, 1000 ) as $part_size_option ) {
     557                        ?>
     558                        <option
     559                                value="<?php echo esc_html( $part_size_option ); ?>"
     560                            <?php selected( $part_size_option, $this->sf_feed_options['part_size'] ? $this->sf_feed_options['part_size'] : false ); ?>
     561                        ><?php echo esc_html( $part_size_option ); ?></option>
     562                        <?php
     563                    }
     564                    ?>
     565                </select>
     566                <p class="description" id="tagline-description">
     567                   <?php esc_attr_e( 'Batch size (default 200 to decrease in case of performance issues)', 'shopping-feed' ); ?>
     568                </p>
     569                <p class="description">
     570                    <?php esc_attr_e( 'If the feed is blocked and not generated', 'shopping-feed' ); ?>
     571                    <a href="<?php echo sprintf( '%s&clean_process=true', esc_url( ShoppingFeedHelper::get_setting_link() ) ); ?>" class="button-link-delete"><?php esc_attr_e( 'click here', 'shopping-feed' ); ?></a>
     572                    <?php esc_attr_e( 'to clean all running process', 'shopping-feed' ); ?>
     573                    <?php echo esc_html( sprintf( '(%s)', $running_process ) ); ?>
     574                </p>
    481575                <?php
    482576            },
     
    555649        </div>
    556650        <?php
     651    }
     652
     653    /**
     654     * Check connection with SF platform with correct credentials
     655     * If not redirect to Account page
     656     */
     657    private function check_connection() {
     658        if ( ! ShoppingFeedHelper::is_authenticated() ) {
     659            wp_safe_redirect( sprintf( '%s&no_connected=%s', ShoppingFeedHelper::get_setting_link(), 'true' ) );
     660        }
    557661    }
    558662
     
    832936    }
    833937
    834     /**
    835      * Check connection with SF platform with correct credentials
    836      * If not redirect to Account page
    837      */
    838     private function check_connection() {
    839         if ( ! ShoppingFeedHelper::is_authenticated() ) {
    840             wp_safe_redirect( sprintf( '%s&no_connected=%s', ShoppingFeedHelper::get_setting_link(), 'true' ) );
    841         }
    842     }
    843 
    844     private function load_assets() {
    845         wp_enqueue_style(
    846             'sf_app',
    847             SF_PLUGIN_URL . 'assets/css/app.css',
    848             array(),
    849             true
    850         );
    851 
    852         wp_enqueue_script(
    853             'multi_js',
    854             SF_PLUGIN_URL . 'assets/js/multi.min.js',
    855             array( 'jquery' ),
    856             true,
    857             true
    858         );
    859 
    860         wp_enqueue_script( 'multi_js_init', SF_PLUGIN_URL . 'assets/js/init.js', array( 'multi_js' ), true );
    861         wp_localize_script(
    862             'multi_js_init',
    863             'sf_options',
    864             array(
    865                 'selected_orders'            => __( 'Selected order status', 'shopping-feed' ),
    866                 'unselected_orders' => __( 'Unselected order status', 'shopping-feed' ),
    867                 'search' => __( 'Search', 'shopping-feed' ),
    868             )
    869         );
    870     }
    871 
    872938}
  • shopping-feed/trunk/src/Admin/Requirements.php

    r2417980 r2542211  
    77
    88use ShoppingFeed\ShoppingFeedWC\ShoppingFeedHelper;
    9 use const OPENSSL_VERSION_TEXT;
    109use const PHP_VERSION;
    1110
     
    9089    }
    9190
     91
     92    /**
     93     * @return string
     94     */
     95    public function uploads_directory_access_requirement() {
     96        return ( $this->uploads_directory_writable() )
     97            ? '<p class="success">' . __( 'You have write access in uploads directory.', 'shopping-feed' ) . '</p>'
     98            : '<p class="failed">' . __( 'You must have write access in uploads directory.', 'shopping-feed' ) . '</p>';
     99    }
     100
    92101    /**
    93102     * Check if CURL is available and support SSL
     
    135144        return ShoppingFeedHelper::is_authenticated();
    136145    }
     146
     147    /**
     148     * Check if the uploads directory is writable
     149     *
     150     * @return bool
     151     */
     152    public function uploads_directory_writable() {
     153        return is_writable( wp_upload_dir()['basedir'] );
     154    }
    137155}
  • shopping-feed/trunk/src/Admin/WoocommerceActions.php

    r2404199 r2542211  
    1010use ShoppingFeed\Sdk\Api\Catalog\PricingUpdate;
    1111use ShoppingFeed\Sdk\Api\Store\StoreResource;
     12use ShoppingFeed\ShoppingFeedWC\Feed\AsyncGenerator;
    1213use ShoppingFeed\ShoppingFeedWC\Feed\Generator;
    1314use ShoppingFeed\ShoppingFeedWC\Orders\Operations;
     
    3738
    3839    public function __construct() {
     40
     41        //Generate async feed
     42        add_action(
     43            'sf_feed_generation_process',
     44            [
     45                AsyncGenerator::get_instance(),
     46                'launch',
     47            ]
     48        );
     49
     50        //Generate feed part
     51        add_action(
     52            'sf_feed_generation_part',
     53            [
     54                AsyncGenerator::get_instance(),
     55
     56                'generate_feed_part',
     57            ],
     58            10,
     59            2
     60        );
     61
     62        //Combine feed's parts
     63        add_action(
     64            'sf_feed_generation_combine_feed_parts',
     65            [
     66                AsyncGenerator::get_instance(),
     67                'combine_feed_parts',
     68            ]
     69        );
    3970
    4071        //Product Update
  • shopping-feed/trunk/src/Feed/Generator.php

    r2422339 r2542211  
    3232     * @var ProductGenerator
    3333     */
    34     private $generator;
     34    protected $generator;
    3535
    3636    /**
    3737     * Generator constructor.
    3838     */
    39     private function __construct() {
     39    public function __construct() {
    4040        $this->set_platform();
    4141        $this->set_uri();
     
    7979     * This can be achieved in mappers or in your dataset, but sometimes things have to be separated, so you can register processors that are executed before mappers, and prepare your data before the mapping process.
    8080     */
    81     private function set_processors() {
     81    protected function set_processors() {
    8282    }
    8383
     
    8686     * Filters are executed after processors, because item must be completely filled before to make the decision to keep it or not.
    8787     */
    88     private function set_filters() {
     88    protected function set_filters() {
    8989        # Ignore all items with undefined price
    9090        $this->generator->addFilter(
     
    103103     * As stated above, at least one mapper must be registered, this is where you populate the Product instance, which is later converted to XML by the library
    104104     */
    105     private function set_mappers() {
     105    protected function set_mappers() {
    106106        //Simple product mapping
    107107        $this->generator->addMapper(
     
    234234
    235235        if ( true === $no_cache || ! is_file( $file_path ) ) {
    236             $generate = $this->generate();
    237             if ( is_wp_error( $generate ) ) {
    238                 ShoppingFeedHelper::get_logger()->error(
    239                     sprintf(
    240                         __( 'Cant display feed', 'shopping-feed' )
    241                     ),
    242                     array(
    243                         'source' => 'shopping-feed',
    244                     )
    245                 );
    246             }
     236            if ( ShoppingFeedHelper::generation_process_running() ) {
     237                wp_die( 'Feed generation already launched' );
     238            }
     239            as_schedule_single_action(
     240                false,
     241                'sf_feed_generation_process',
     242                array(),
     243                'sf_feed_generation_process'
     244            );
     245            wp_die( 'Feed generation launched' );
    247246        }
    248247
  • shopping-feed/trunk/src/Feed/Uri.php

    r2417980 r2542211  
    135135     */
    136136    public function set_file_path() {
    137         $this->file_path = $this->directory . $this->file_name;
     137        $this->file_path = $this->directory . '/' . $this->file_name;
    138138    }
    139139
  • shopping-feed/trunk/src/Orders/Operations.php

    r2339808 r2542211  
    121121                $this->sf_channel_name,
    122122                ShoppingFeedHelper::get_sf_carrier_from_wc_shipping( $this->wc_order ),
    123                 (string) $this->wc_order->get_meta( ShoppingFeedHelper::wc_tracking_number() ),
    124                 (string) $this->wc_order->get_meta( ShoppingFeedHelper::wc_tracking_link() )
     123                ShoppingFeedHelper::wc_tracking_number( $this->wc_order ),
     124                ShoppingFeedHelper::wc_tracking_link( $this->wc_order )
    125125            );
    126126            $this->order_api->execute( $this->order_operation );
  • shopping-feed/trunk/src/Orders/Order.php

    r2422339 r2542211  
    8080        //Addresses
    8181        $wc_order->set_address( $this->shipping_address, 'shipping' );
    82         $wc_order->set_address( $this->billing_address, 'billing' );
     82        $wc_order->set_address( $this->billing_address );
    8383
    8484        //Payment
     
    167167                $item->save();
    168168                $wc_order->add_item( $item );
     169                do_action( 'sf_after_order_add_item', $item, $wc_order );
    169170            }
    170171        }
     
    205206        $wc_order->save();
    206207
     208        do_action( 'sf_before_add_order', $wc_order );
     209
    207210        //Acknowledge the order so we will not get it next time
    208211        Operations::acknowledge_order( $wc_order->get_id(), $message );
  • shopping-feed/trunk/src/Orders/Order/Products.php

    r2417980 r2542211  
    8383        }
    8484
    85         $default_args = array(
     85        $sf_product_quantity = $sf_product->getQuantity();
     86
     87        $args = array(
    8688            'name'         => $wc_product->get_name(),
    8789            'tax_class'    => $wc_product->get_tax_class(),
     
    8991            'variation_id' => $wc_product->is_type( 'variation' ) ? $wc_product->get_id() : 0,
    9092            'variation'    => $wc_product->is_type( 'variation' ) ? $wc_product->get_attributes() : array(),
    91         );
    92 
    93         $args = array(
    94             'subtotal' => $sf_product->getUnitPrice(),
    95             'total'    => $sf_product->getTotalPrice(),
    96             'quantity' => $sf_product->getQuantity(),
     93            'subtotal'     => $sf_product->getUnitPrice(),
     94            'total'        => $sf_product->getTotalPrice(),
     95            'quantity'     => $sf_product_quantity,
    9796        );
    9897
     
    10099
    101100        return array(
    102             'args'             => wp_parse_args( $args, $default_args ),
    103             'outofstock'       => ! $this->validate_product( $wc_product, $sf_product ),
     101            'args'             => $args,
     102            'outofstock'       => ! $this->validate_product( $wc_product, $sf_product_quantity ),
    104103            'product_quantity' => $wc_product_quantity,
    105             'quantity_needed'  => $sf_product->getQuantity() - $wc_product_quantity,
     104            'quantity_needed'  => $sf_product_quantity - $wc_product_quantity,
    106105        );
    107106    }
     
    109108    /**
    110109     * @param $wc_product WC_Product
    111      * @param $sf_product OrderItem
     110     * @param $ordered_quantity int
    112111     *
    113112     * @return bool
    114113     */
    115     private function validate_product( $wc_product, $sf_product ) {
    116         //automatically validate product if backorders or allowed and managin stock is disabled
     114    private function validate_product( $wc_product, $ordered_quantity ) {
     115        //automatically validate product if backorders or allowed and managing stock is disabled
    117116        if ( $wc_product->backorders_allowed() || ! $wc_product->managing_stock() ) {
    118117            return true;
    119118        }
    120119
    121         return $sf_product->getQuantity() <= $wc_product->get_stock_quantity();
     120        return $ordered_quantity <= $wc_product->get_stock_quantity();
    122121    }
    123122
  • shopping-feed/trunk/src/Products/Products.php

    r2540628 r2542211  
    4242    }
    4343
    44     /**
    45      * Generate products list
    46      */
    47     public function get_list() {
     44    public function get_list_args() {
    4845        $default_args = array(
    4946            'limit'   => - 1,
     
    6663        }
    6764
    68         $args = wp_parse_args( ShoppingFeedHelper::wc_products_custom_query_args(), $default_args );
     65        return wp_parse_args( ShoppingFeedHelper::wc_products_custom_query_args(), $default_args );
     66    }
    6967
    70         $query = new \WC_Product_Query( $args );
     68    /**
     69     * Generate products list
     70     */
     71    public function get_list() {
     72        $products = $this->get_products();
    7173
    72         if ( ! empty( $query->get_products() ) ) {
    73             foreach ( $query->get_products() as $wc_product ) {
    74                 yield [ new Product( $wc_product ) ];
     74        if ( ! empty( $products ) ) {
     75            foreach ( $products as $wc_product ) {
     76                yield array( new Product( $wc_product ) );
    7577            }
    7678        }
    7779    }
     80
     81    public function get_products( $args = array() ) {
     82        $query = new \WC_Product_Query( wp_parse_args( $args, $this->get_list_args() ) );
     83
     84        return $query->get_products();
     85    }
     86
     87
     88    public function format_products( $wc_products ) {
     89        foreach ( $wc_products as $wc_product ) {
     90            yield array( new Product( $wc_product ) );
     91        }
     92    }
     93
    7894}
  • shopping-feed/trunk/src/ShoppingFeed.php

    r2417980 r2542211  
    207207    public static function activate() {
    208208        if ( defined( 'WC_VERSION' ) ) {
     209            self::add_sf_directory();
    209210            Actions::register_feed_generation();
    210211            Actions::register_get_orders();
     
    241242        delete_option( Options::SF_CARRIERS );
    242243        delete_option( Generator::SF_FEED_LAST_GENERATION_DATE );
    243         ( new \WP_Filesystem_Direct( false ) )->rmdir( ShoppingFeedHelper::get_feed_directory(), true );
     244        self::remove_sf_directory();
     245    }
     246
     247    public static function remove_sf_directory() {
     248        rmdir( ShoppingFeedHelper::get_feed_directory() );
     249    }
     250
     251    public static function add_sf_directory() {
     252        $directory = ShoppingFeedHelper::get_feed_directory();
     253        if ( ! is_dir( $directory ) ) {
     254            wp_mkdir_p( $directory );
     255        }
     256        $part_directory = ShoppingFeedHelper::get_feed_parts_directory();
     257        if ( ! is_dir( $part_directory ) ) {
     258            wp_mkdir_p( $part_directory );
     259        }
    244260    }
    245261}
  • shopping-feed/trunk/src/ShoppingFeedHelper.php

    r2430999 r2542211  
    2020
    2121    /**
     22     * @var ShoppingFeedHelper
     23     */
     24    private static $instance;
     25
     26    /**
     27     * Get the singleton instance.
     28     *
     29     * @return ShoppingFeedHelper
     30     */
     31    public static function get_instance() {
     32        if ( is_null( self::$instance ) ) {
     33            self::$instance = new self();
     34        }
     35
     36        return self::$instance;
     37    }
     38
     39    /**
     40     * Singleton instance can't be cloned.
     41     */
     42    private function __clone() {
     43    }
     44
     45    /**
     46     * Singleton instance can't be serialized.
     47     */
     48    private function __wakeup() {
     49    }
     50
     51    /**
    2252     * Check if current WooCommerce version is below 3.8.0
    2353     *
     
    5787     */
    5888    public static function get_feed_directory() {
    59         $directory = wp_upload_dir()['basedir'] . '/shopping-feed/';
    60         if ( ! is_dir( $directory ) ) {
    61             wp_mkdir_p( $directory );
    62         }
    63 
    64         return $directory;
     89        return SF_FEED_DIR;
     90    }
     91
     92    /**
     93     * Return the feed's parts directory
     94     * @return string
     95     */
     96    public static function get_feed_parts_directory() {
     97        return SF_FEED_PARTS_DIR;
     98    }
     99
     100    /**
     101     * @return string
     102     */
     103    public static function get_feed_skeleton() {
     104        return <<<XML
     105<?xml version="1.0" encoding="UTF-8"?>
     106<catalog>
     107    <metadata>
     108        <platform>WooCommerce:5.1.0</platform>
     109        <agent>shopping-feed-generator:1.0.0</agent>
     110        <startedAt/>
     111        <finishedAt/>
     112        <invalid/>
     113        <ignored/>
     114        <written/>
     115    </metadata>
     116</catalog>
     117XML;
    65118    }
    66119
     
    249302
    250303        return $frequency;
     304    }
     305
     306    /**
     307     * Return SF feed part size
     308     * default: 200 product per file
     309     * @return int
     310     */
     311    public static function get_sf_part_size() {
     312        $part_size = self::get_sf_feed_options( 'part_size' );
     313        if ( empty( $part_size ) ) {
     314            return 200;
     315        }
     316
     317        return $part_size;
    251318    }
    252319
     
    576643    /**
    577644     * Add filter for order tracking number meta key
    578      * @return string
    579      */
    580     public static function wc_tracking_number() {
    581         return apply_filters( 'shopping_feed_tracking_number', '' );
     645     *
     646     * @param \WC_Order $wc_order
     647     *
     648     * @return string
     649     */
     650    public static function wc_tracking_number( $wc_order ) {
     651        $tracking_number = apply_filters( 'shopping_feed_tracking_number', '', $wc_order );
     652        //COMPACT WITH OLD VERSION
     653        if ( '6.0.19' <= SF_VERSION ) {
     654            return (string) $wc_order->get_meta( $tracking_number );
     655        }
     656
     657        return $tracking_number;
    582658    }
    583659
    584660    /**
    585661     * Add filter for order tracking link meta key
    586      * @return string
    587      */
    588     public static function wc_tracking_link() {
    589         return apply_filters( 'shopping_feed_tracking_link', '' );
     662     *
     663     * @param \WC_Order $wc_order
     664     *
     665     * @return string
     666     */
     667    public static function wc_tracking_link( $wc_order ) {
     668        $tracking_link = apply_filters( 'shopping_feed_tracking_link', '', $wc_order );
     669        //COMPACT WITH OLD VERSION
     670        if ( '6.0.19' <= SF_VERSION ) {
     671            return (string) $wc_order->get_meta( $tracking_link );
     672        }
     673
     674        return $tracking_link;
    590675    }
    591676
     
    597682        return 100;
    598683    }
     684
     685    /**
     686     * Get running process list
     687     * @return array|int
     688     */
     689    public static function get_running_generation_feed_process() {
     690        $action_scheduler = \ActionScheduler::store();
     691
     692        return $action_scheduler->query_actions(
     693            array(
     694                'group'  => 'sf_feed_generation_process',
     695                'status' => $action_scheduler::STATUS_PENDING,
     696            )
     697        );
     698    }
     699
     700    /**
     701     * Check if a running generation process
     702     * @return bool
     703     */
     704    public static function generation_process_running() {
     705        $process = self::get_running_generation_feed_process();
     706
     707        return ! empty( $process );
     708    }
     709
     710    public static function clean_generation_process_running() {
     711        try {
     712            \ActionScheduler::store()->cancel_actions_by_group( 'sf_feed_generation_process' );
     713        } catch ( \Exception $exception ) {
     714            self::get_logger()->error(
     715                sprintf(
     716                    __( 'Cant remove running process', 'shopping-feed' ),
     717                    $exception->getMessage()
     718                ),
     719                array(
     720                    'source' => 'shopping-feed',
     721                )
     722            );
     723        }
     724        wp_safe_redirect( self::get_setting_link(), 302 );
     725    }
    599726}
  • shopping-feed/trunk/vendor/autoload.php

    r2540628 r2542211  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit4ab3512180e161131ad7b070b1a1643c::getLoader();
     7return ComposerAutoloaderInit203372635d40bb0d59e0e62758357279::getLoader();
  • shopping-feed/trunk/vendor/composer/InstalledVersions.php

    r2540628 r2542211  
    2828  'root' =>
    2929  array (
    30     'pretty_version' => '6.0.18',
    31     'version' => '6.0.18.0',
     30    'pretty_version' => '6.0.21',
     31    'version' => '6.0.21.0',
    3232    'aliases' =>
    3333    array (
    3434    ),
    35     'reference' => '5eee70b9b2b0801fb3bc9948e6ec7473eef31991',
     35    'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04',
    3636    'name' => 'shoppingfeed/shoppingfeed',
    3737  ),
     
    133133    'shoppingfeed/shoppingfeed' =>
    134134    array (
    135       'pretty_version' => '6.0.18',
    136       'version' => '6.0.18.0',
    137       'aliases' =>
    138       array (
    139       ),
    140       'reference' => '5eee70b9b2b0801fb3bc9948e6ec7473eef31991',
     135      'pretty_version' => '6.0.21',
     136      'version' => '6.0.21.0',
     137      'aliases' =>
     138      array (
     139      ),
     140      'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04',
    141141    ),
    142142    'symfony/polyfill-intl-idn' =>
  • shopping-feed/trunk/vendor/composer/autoload_classmap.php

    r2417980 r2542211  
    303303    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonBusiness' => $baseDir . '/src/Addons/Marketplaces/Types/AmazonBusiness.php',
    304304    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonPrime' => $baseDir . '/src/Addons/Marketplaces/Types/AmazonPrime.php',
     305    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Plugins\\ChainedProductsPlugin\\ChainedProducts' => $baseDir . '/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php',
    305306    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Cdiscount' => $baseDir . '/src/Addons/Shipping/Marketplaces/Cdiscount.php',
    306307    'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Rdc' => $baseDir . '/src/Addons/Shipping/Marketplaces/Rdc.php',
     
    314315    'ShoppingFeed\\ShoppingFeedWC\\Admin\\WoocommerceFilters' => $baseDir . '/src/Admin/WoocommerceFilters.php',
    315316    'ShoppingFeed\\ShoppingFeedWC\\Cli\\FeedGeneration' => $baseDir . '/src/Cli/FeedGeneration.php',
     317    'ShoppingFeed\\ShoppingFeedWC\\Feed\\AsyncGenerator' => $baseDir . '/src/Feed/AsyncGenerator.php',
    316318    'ShoppingFeed\\ShoppingFeedWC\\Feed\\Generator' => $baseDir . '/src/Feed/Generator.php',
    317319    'ShoppingFeed\\ShoppingFeedWC\\Feed\\Platform' => $baseDir . '/src/Feed/Platform.php',
  • shopping-feed/trunk/vendor/composer/autoload_real.php

    r2540628 r2542211  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit4ab3512180e161131ad7b070b1a1643c
     5class ComposerAutoloaderInit203372635d40bb0d59e0e62758357279
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInit4ab3512180e161131ad7b070b1a1643c', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInit203372635d40bb0d59e0e62758357279', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    27         spl_autoload_unregister(array('ComposerAutoloaderInit4ab3512180e161131ad7b070b1a1643c', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInit203372635d40bb0d59e0e62758357279', 'loadClassLoader'));
    2828
    2929        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3131            require __DIR__ . '/autoload_static.php';
    3232
    33             call_user_func(\Composer\Autoload\ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::getInitializer($loader));
     33            call_user_func(\Composer\Autoload\ComposerStaticInit203372635d40bb0d59e0e62758357279::getInitializer($loader));
    3434        } else {
    3535            $map = require __DIR__ . '/autoload_namespaces.php';
     
    5252
    5353        if ($useStaticLoader) {
    54             $includeFiles = Composer\Autoload\ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::$files;
     54            $includeFiles = Composer\Autoload\ComposerStaticInit203372635d40bb0d59e0e62758357279::$files;
    5555        } else {
    5656            $includeFiles = require __DIR__ . '/autoload_files.php';
    5757        }
    5858        foreach ($includeFiles as $fileIdentifier => $file) {
    59             composerRequire4ab3512180e161131ad7b070b1a1643c($fileIdentifier, $file);
     59            composerRequire203372635d40bb0d59e0e62758357279($fileIdentifier, $file);
    6060        }
    6161
     
    6464}
    6565
    66 function composerRequire4ab3512180e161131ad7b070b1a1643c($fileIdentifier, $file)
     66function composerRequire203372635d40bb0d59e0e62758357279($fileIdentifier, $file)
    6767{
    6868    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • shopping-feed/trunk/vendor/composer/autoload_static.php

    r2540628 r2542211  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit4ab3512180e161131ad7b070b1a1643c
     7class ComposerStaticInit203372635d40bb0d59e0e62758357279
    88{
    99    public static $files = array (
     
    393393        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonBusiness' => __DIR__ . '/../..' . '/src/Addons/Marketplaces/Types/AmazonBusiness.php',
    394394        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Marketplaces\\Types\\AmazonPrime' => __DIR__ . '/../..' . '/src/Addons/Marketplaces/Types/AmazonPrime.php',
     395        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Plugins\\ChainedProductsPlugin\\ChainedProducts' => __DIR__ . '/../..' . '/src/Addons/Plugins/ChainedProductsPlugin/ChainedProducts.php',
    395396        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Cdiscount' => __DIR__ . '/../..' . '/src/Addons/Shipping/Marketplaces/Cdiscount.php',
    396397        'ShoppingFeed\\ShoppingFeedWC\\Addons\\Shipping\\Marketplaces\\Rdc' => __DIR__ . '/../..' . '/src/Addons/Shipping/Marketplaces/Rdc.php',
     
    404405        'ShoppingFeed\\ShoppingFeedWC\\Admin\\WoocommerceFilters' => __DIR__ . '/../..' . '/src/Admin/WoocommerceFilters.php',
    405406        'ShoppingFeed\\ShoppingFeedWC\\Cli\\FeedGeneration' => __DIR__ . '/../..' . '/src/Cli/FeedGeneration.php',
     407        'ShoppingFeed\\ShoppingFeedWC\\Feed\\AsyncGenerator' => __DIR__ . '/../..' . '/src/Feed/AsyncGenerator.php',
    406408        'ShoppingFeed\\ShoppingFeedWC\\Feed\\Generator' => __DIR__ . '/../..' . '/src/Feed/Generator.php',
    407409        'ShoppingFeed\\ShoppingFeedWC\\Feed\\Platform' => __DIR__ . '/../..' . '/src/Feed/Platform.php',
     
    436438    {
    437439        return \Closure::bind(function () use ($loader) {
    438             $loader->prefixLengthsPsr4 = ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::$prefixLengthsPsr4;
    439             $loader->prefixDirsPsr4 = ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::$prefixDirsPsr4;
    440             $loader->classMap = ComposerStaticInit4ab3512180e161131ad7b070b1a1643c::$classMap;
     440            $loader->prefixLengthsPsr4 = ComposerStaticInit203372635d40bb0d59e0e62758357279::$prefixLengthsPsr4;
     441            $loader->prefixDirsPsr4 = ComposerStaticInit203372635d40bb0d59e0e62758357279::$prefixDirsPsr4;
     442            $loader->classMap = ComposerStaticInit203372635d40bb0d59e0e62758357279::$classMap;
    441443
    442444        }, null, ClassLoader::class);
  • shopping-feed/trunk/vendor/composer/installed.php

    r2540628 r2542211  
    22  'root' =>
    33  array (
    4     'pretty_version' => '6.0.18',
    5     'version' => '6.0.18.0',
     4    'pretty_version' => '6.0.21',
     5    'version' => '6.0.21.0',
    66    'aliases' =>
    77    array (
    88    ),
    9     'reference' => '5eee70b9b2b0801fb3bc9948e6ec7473eef31991',
     9    'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04',
    1010    'name' => 'shoppingfeed/shoppingfeed',
    1111  ),
     
    107107    'shoppingfeed/shoppingfeed' =>
    108108    array (
    109       'pretty_version' => '6.0.18',
    110       'version' => '6.0.18.0',
     109      'pretty_version' => '6.0.21',
     110      'version' => '6.0.21.0',
    111111      'aliases' =>
    112112      array (
    113113      ),
    114       'reference' => '5eee70b9b2b0801fb3bc9948e6ec7473eef31991',
     114      'reference' => 'd9351f54d26569ee01a6f81113857ada372a9a04',
    115115    ),
    116116    'symfony/polyfill-intl-idn' =>
Note: See TracChangeset for help on using the changeset viewer.