Rename FeatureController to CustomOrdersTableController.
Also fix priority-args count reversed in filter hookings in that class.
This commit is contained in:
parent
2565df378e
commit
7a9651ad30
|
@ -9,7 +9,7 @@
|
|||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\FeatureController as OrdersTableFeatureController;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
|
||||
use Automattic\WooCommerce\Internal\DownloadPermissionsAdjuster;
|
||||
use Automattic\WooCommerce\Internal\ProductAttributesLookup\DataRegenerator;
|
||||
use Automattic\WooCommerce\Internal\ProductAttributesLookup\LookupDataStore;
|
||||
|
@ -217,7 +217,7 @@ final class WooCommerce {
|
|||
wc_get_container()->get( DataRegenerator::class );
|
||||
wc_get_container()->get( LookupDataStore::class );
|
||||
wc_get_container()->get( RestockRefundedItemsAdjuster::class );
|
||||
wc_get_container()->get( OrdersTableFeatureController::class );
|
||||
wc_get_container()->get( CustomOrdersTableController::class );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* FeatureController class file.
|
||||
* CustomOrdersTableController class file.
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Internal\DataStores\Orders;
|
||||
|
@ -16,7 +16,7 @@ defined( 'ABSPATH' ) || exit;
|
|||
*
|
||||
* ...and in general, any functionality that doesn't imply database access.
|
||||
*/
|
||||
class FeatureController {
|
||||
class CustomOrdersTableController {
|
||||
|
||||
/**
|
||||
* The name of the option for enabling the usage of the custom orders table
|
||||
|
@ -33,7 +33,7 @@ class FeatureController {
|
|||
/**
|
||||
* The data synchronizer object to use.
|
||||
*
|
||||
* @var DataSyncrhonizer
|
||||
* @var DataSynchronizer
|
||||
*/
|
||||
private $data_synchronizer;
|
||||
|
||||
|
@ -62,8 +62,8 @@ class FeatureController {
|
|||
function ( $default_data_store ) {
|
||||
return $this->get_data_store_instance( $default_data_store );
|
||||
},
|
||||
10,
|
||||
999
|
||||
999,
|
||||
10
|
||||
);
|
||||
|
||||
add_filter(
|
||||
|
@ -71,8 +71,8 @@ class FeatureController {
|
|||
function( $tools ) {
|
||||
return $this->add_initiate_regeneration_entry_to_tools_array( $tools );
|
||||
},
|
||||
1,
|
||||
999
|
||||
999,
|
||||
1
|
||||
);
|
||||
|
||||
add_filter(
|
||||
|
@ -80,8 +80,8 @@ class FeatureController {
|
|||
function( $sections ) {
|
||||
return $this->get_settings_sections( $sections );
|
||||
},
|
||||
1,
|
||||
999
|
||||
999,
|
||||
1
|
||||
);
|
||||
|
||||
add_filter(
|
||||
|
@ -89,8 +89,8 @@ class FeatureController {
|
|||
function ( $settings, $section_id ) {
|
||||
return $this->get_settings( $settings, $section_id );
|
||||
},
|
||||
2,
|
||||
999
|
||||
999,
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ class FeatureController {
|
|||
* @throws \Exception The table regeneration can't be started.
|
||||
*/
|
||||
private function check_can_do_table_regeneration() {
|
||||
if ( ! $this->$this->is_feature_visible() ) {
|
||||
if ( ! $this->is_feature_visible() ) {
|
||||
throw new \Exception( "Can't do custom orders table regeneration: the feature isn't enabled" );
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ defined( 'ABSPATH' ) || exit;
|
|||
* This class handles the data migration/synchronization for the custom orders table. Its responsibilites are:
|
||||
*
|
||||
* - Performing the initial table creation and filling (triggered by initiate_regeneration)
|
||||
* - Syncrhonizing changes between the custom orders table and the posts table whenever changes in orders happen.
|
||||
* - Synchronizing changes between the custom orders table and the posts table whenever changes in orders happen.
|
||||
*/
|
||||
class DataSynchronizer {
|
||||
|
||||
|
@ -77,7 +77,7 @@ class DataSynchronizer {
|
|||
* @return int Number of orders already processed, 0 if no regeneration is in progress.
|
||||
*/
|
||||
public function get_regeneration_processed_orders_count(): int {
|
||||
return get_option( self::CUSTOM_ORDERS_TABLE_DATA_REGENERATION_DONE_COUNT, 0 );
|
||||
return (int)get_option( self::CUSTOM_ORDERS_TABLE_DATA_REGENERATION_DONE_COUNT, 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Automattic\WooCommerce\Internal\DependencyManagement\ServiceProviders;
|
|||
|
||||
use Automattic\WooCommerce\Internal\DependencyManagement\AbstractServiceProvider;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\FeatureController;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,7 @@ class OrdersDataStoreServiceProvider extends AbstractServiceProvider {
|
|||
*/
|
||||
protected $provides = array(
|
||||
DataSynchronizer::class,
|
||||
FeatureController::class,
|
||||
CustomOrdersTableController::class,
|
||||
OrdersTableDataStore::class,
|
||||
);
|
||||
|
||||
|
@ -31,7 +31,7 @@ class OrdersDataStoreServiceProvider extends AbstractServiceProvider {
|
|||
*/
|
||||
public function register() {
|
||||
$this->share( DataSynchronizer::class )->addArgument( OrdersTableDataStore::class );
|
||||
$this->share( FeatureController::class )->addArguments( array( OrdersTableDataStore::class, DataSynchronizer::class ) );
|
||||
$this->share( CustomOrdersTableController::class )->addArguments( array( OrdersTableDataStore::class, DataSynchronizer::class ) );
|
||||
$this->share( OrdersTableDataStore::class );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue