diff --git a/includes/iworks/class-iworks-omnibus.php b/includes/iworks/class-iworks-omnibus.php index c53d504..91c6d86 100644 --- a/includes/iworks/class-iworks-omnibus.php +++ b/includes/iworks/class-iworks-omnibus.php @@ -85,6 +85,8 @@ public function __construct() { if ( $this->is_migrated_v4() ) { include_once dirname( __FILE__ ) . '/omnibus/class-iworks-omnibus-logger-v4.php'; new iworks_omnibus_logger_v4(); + include_once dirname( __FILE__ ) . '/omnibus/integration/v4/class-iworks-omnibus-integration-commons.php'; + new iworks_omnibus_integration_commons(); } else { include_once dirname( __FILE__ ) . '/omnibus/migration/class-iworks-omnibus-migration-v4.php'; new iworks_omnibus_migration_v4(); @@ -530,4 +532,5 @@ public function register_deactivation_hook() { public function action_init_load_plugin_textdomain() { load_plugin_textdomain( 'omnibus', false, plugin_basename( $this->root ) . '/languages' ); } + } diff --git a/includes/iworks/omnibus/integration/v4/class-iworks-omnibus-integration-commons.php b/includes/iworks/omnibus/integration/v4/class-iworks-omnibus-integration-commons.php new file mode 100644 index 0000000..b453734 --- /dev/null +++ b/includes/iworks/omnibus/integration/v4/class-iworks-omnibus-integration-commons.php @@ -0,0 +1,78 @@ +get_name( 'allow_to_delete' ) ) ) { + return; + } + /** + * delete + */ + $query = $wpdb->prepare( + sprintf( + 'DELETE FROM %s WHERE created < ( CURRENT_DATE - INTERVAL %%d DAY )', + $wpdb->iworks_omnibus + ), + max( 31, intval( get_option( $this->get_name( 'days_delete' ) ) ) ) + ); + $wpdb->query( $query ); + /** + * do action after + */ + do_action( 'iworks/omnibus/action/after/delete_older_records' ); + } +} diff --git a/readme.txt b/readme.txt index d5bdedc..5850c4c 100644 --- a/readme.txt +++ b/readme.txt @@ -196,6 +196,7 @@ Project maintained on github at [iworks/omnibus](PLUGIN_GITHUB_WEBSITE). * The [iWorks Rate](https://github.com/iworks/iworks-rate) module has been updated to 2.2.0. * Display Omnibus with or without tax has been removed. * The `load_plugin_textdomain()` function call has been fixed. +* The ability to auto clear older prices has been added. [#23](https://github.com/iworks/omnibus/issues/23) = 3.0.3 (2024-08-09) = * The omnibus price for variant in admin panel has been fixed.