From 3e3d15e6ccf5d5884d33b294a70d6aa59a763474 Mon Sep 17 00:00:00 2001 From: Brent Shepherd Date: Thu, 28 Mar 2019 15:30:35 +1000 Subject: [PATCH 1/3] Remove non-subtree'd /action-scheduler/ --- .../libraries/action-scheduler/.gitignore | 3 - .../libraries/action-scheduler/.travis.yml | 37 - includes/libraries/action-scheduler/README.md | 41 - .../action-scheduler/action-scheduler.php | 47 - .../classes/ActionScheduler.php | 133 - .../ActionScheduler_Abstract_ListTable.php | 656 ---- .../ActionScheduler_Abstract_QueueRunner.php | 219 -- .../classes/ActionScheduler_Action.php | 75 - .../classes/ActionScheduler_ActionClaim.php | 23 - .../classes/ActionScheduler_ActionFactory.php | 111 - .../classes/ActionScheduler_AdminView.php | 83 - .../ActionScheduler_CanceledAction.php | 21 - .../classes/ActionScheduler_Compatibility.php | 99 - .../classes/ActionScheduler_CronSchedule.php | 57 - .../classes/ActionScheduler_DateTime.php | 76 - .../classes/ActionScheduler_Exception.php | 11 - .../ActionScheduler_FatalErrorMonitor.php | 55 - .../ActionScheduler_FinishedAction.php | 16 - .../ActionScheduler_IntervalSchedule.php | 60 - ...ActionScheduler_InvalidActionException.php | 28 - .../classes/ActionScheduler_ListTable.php | 533 --- .../classes/ActionScheduler_LogEntry.php | 67 - .../classes/ActionScheduler_Logger.php | 98 - .../classes/ActionScheduler_NullAction.php | 16 - .../classes/ActionScheduler_NullLogEntry.php | 11 - .../classes/ActionScheduler_NullSchedule.php | 19 - .../classes/ActionScheduler_QueueCleaner.php | 155 - .../classes/ActionScheduler_QueueRunner.php | 115 - .../classes/ActionScheduler_Schedule.php | 18 - .../ActionScheduler_SimpleSchedule.php | 44 - .../classes/ActionScheduler_Store.php | 212 -- .../ActionScheduler_TimezoneHelper.php | 152 - .../classes/ActionScheduler_Versions.php | 62 - .../ActionScheduler_WPCLI_QueueRunner.php | 210 -- ...ctionScheduler_WPCLI_Scheduler_command.php | 145 - .../ActionScheduler_wcSystemStatus.php | 129 - .../ActionScheduler_wpCommentLogger.php | 240 -- .../classes/ActionScheduler_wpPostStore.php | 807 ----- ...eduler_wpPostStore_PostStatusRegistrar.php | 57 - ...cheduler_wpPostStore_PostTypeRegistrar.php | 50 - ...cheduler_wpPostStore_TaxonomyRegistrar.php | 26 - .../libraries/action-scheduler/codecov.yml | 13 - .../libraries/action-scheduler/composer.json | 11 - .../libraries/action-scheduler/composer.lock | 2909 ----------------- ...eduler_Abstract_QueueRunner_Deprecated.php | 27 - .../ActionScheduler_AdminView_Deprecated.php | 147 - .../action-scheduler/deprecated/functions.php | 126 - .../libraries/action-scheduler/functions.php | 209 -- .../lib/cron-expression/CronExpression.php | 318 -- .../CronExpression_AbstractField.php | 100 - .../CronExpression_DayOfMonthField.php | 110 - .../CronExpression_DayOfWeekField.php | 124 - .../CronExpression_FieldFactory.php | 55 - .../CronExpression_FieldInterface.php | 39 - .../CronExpression_HoursField.php | 47 - .../CronExpression_MinutesField.php | 39 - .../CronExpression_MonthField.php | 55 - .../CronExpression_YearField.php | 43 - .../lib/cron-expression/LICENSE | 19 - .../lib/cron-expression/README.md | 92 - .../libraries/action-scheduler/license.txt | 674 ---- .../tests/ActionScheduler_UnitTestCase.php | 44 - .../action-scheduler/tests/bootstrap.php | 31 - .../action-scheduler/tests/phpunit.xml.dist | 32 - .../ActionScheduler_UnitTestCase.php | 44 - .../ActionScheduler_TimezoneHelper_Test.php | 100 - .../jobs/ActionScheduler_Action_Test.php | 55 - .../jobs/ActionScheduler_NullAction_Test.php | 16 - .../ActionScheduler_wpPostStore_Test.php | 375 --- .../ActionScheduler_wpCommentLogger_Test.php | 185 -- .../procedural_api/procedural_api_Test.php | 222 -- .../wc_get_scheduled_actions_Test.php | 100 - .../ActionScheduler_QueueCleaner_Test.php | 151 - .../ActionScheduler_QueueRunner_Test.php | 262 -- .../ActionScheduler_CronSchedule_Test.php | 45 - .../ActionScheduler_IntervalSchedule_Test.php | 28 - .../ActionScheduler_NullSchedule_Test.php | 18 - .../ActionScheduler_SimpleSchedule_Test.php | 37 - .../ActionScheduler_Versions_Test.php | 43 - .../action-scheduler/tests/travis/setup.sh | 38 - .../tests/travis/wp-tests-config.php | 38 - 81 files changed, 12038 deletions(-) delete mode 100644 includes/libraries/action-scheduler/.gitignore delete mode 100644 includes/libraries/action-scheduler/.travis.yml delete mode 100644 includes/libraries/action-scheduler/README.md delete mode 100644 includes/libraries/action-scheduler/action-scheduler.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_ListTable.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_QueueRunner.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Action.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_ActionClaim.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_ActionFactory.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_AdminView.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_CanceledAction.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Compatibility.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_CronSchedule.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_DateTime.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Exception.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_FinishedAction.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_IntervalSchedule.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_InvalidActionException.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_ListTable.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_LogEntry.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Logger.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_NullAction.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_NullLogEntry.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_NullSchedule.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_QueueCleaner.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_QueueRunner.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Schedule.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_SimpleSchedule.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Store.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_TimezoneHelper.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_Versions.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_QueueRunner.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_Scheduler_command.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_wcSystemStatus.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_wpCommentLogger.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php delete mode 100644 includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php delete mode 100644 includes/libraries/action-scheduler/codecov.yml delete mode 100644 includes/libraries/action-scheduler/composer.json delete mode 100644 includes/libraries/action-scheduler/composer.lock delete mode 100644 includes/libraries/action-scheduler/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php delete mode 100644 includes/libraries/action-scheduler/deprecated/ActionScheduler_AdminView_Deprecated.php delete mode 100644 includes/libraries/action-scheduler/deprecated/functions.php delete mode 100644 includes/libraries/action-scheduler/functions.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_HoursField.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_MonthField.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/LICENSE delete mode 100755 includes/libraries/action-scheduler/lib/cron-expression/README.md delete mode 100644 includes/libraries/action-scheduler/license.txt delete mode 100644 includes/libraries/action-scheduler/tests/ActionScheduler_UnitTestCase.php delete mode 100644 includes/libraries/action-scheduler/tests/bootstrap.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit.xml.dist delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php delete mode 100755 includes/libraries/action-scheduler/tests/travis/setup.sh delete mode 100644 includes/libraries/action-scheduler/tests/travis/wp-tests-config.php diff --git a/includes/libraries/action-scheduler/.gitignore b/includes/libraries/action-scheduler/.gitignore deleted file mode 100644 index e779da84a38..00000000000 --- a/includes/libraries/action-scheduler/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -phpunit.xml -vendor -.idea diff --git a/includes/libraries/action-scheduler/.travis.yml b/includes/libraries/action-scheduler/.travis.yml deleted file mode 100644 index 675301bc543..00000000000 --- a/includes/libraries/action-scheduler/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Travis CI Configuration File - -# Tell Travis CI we're using PHP -language: php - -# We nee to use Precise, not Trusty, to test against PHP 5.3, see https://github.com/travis-ci/travis-ci/issues/8219 -dist: precise - -# Versions of PHP to test against -php: - - "5.3" - - "5.4" - - "5.5" - - "5.6" - - "7.0" - - "7.1" - -# Specify versions of WordPress to test against -# WP_VERSION = WordPress version number (use "master" for SVN trunk) -# WP_MULTISITE = whether to test multisite (use either "0" or "1") -env: - - WP_VERSION=4.8 WP_MULTISITE=0 - - WP_VERSION=4.7 WP_MULTISITE=0 - - WP_VERSION=4.6 WP_MULTISITE=0 - - WP_VERSION=4.8 WP_MULTISITE=1 - - WP_VERSION=4.7 WP_MULTISITE=1 - - WP_VERSION=4.6 WP_MULTISITE=1 - -# Grab the setup script and execute -before_script: - - source tests/travis/setup.sh $TRAVIS_PHP_VERSION - -script: - - if [[ "$TRAVIS_PHP_VERSION" == "7.1" ]] && [[ "$WP_VERSION" == "4.8" ]] && [[ "$WP_MULTISITE" == "0" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then phpunit --configuration tests/phpunit.xml.dist --coverage-clover clover.xml; else phpunit --configuration tests/phpunit.xml.dist; fi - -after_script: - - bash <(curl -s https://codecov.io/bash) diff --git a/includes/libraries/action-scheduler/README.md b/includes/libraries/action-scheduler/README.md deleted file mode 100644 index e2ea559ebdb..00000000000 --- a/includes/libraries/action-scheduler/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Action Scheduler - Job Queue for WordPress [![Build Status](https://travis-ci.org/Prospress/action-scheduler.png?branch=master)](https://travis-ci.org/Prospress/action-scheduler) [![codecov](https://codecov.io/gh/Prospress/action-scheduler/branch/master/graph/badge.svg)](https://codecov.io/gh/Prospress/action-scheduler) - -Action Scheduler is a scalable, traceable job queue for background processing large sets of actions in WordPress. It's specially designed to be distributed in WordPress plugins. - -Action Scheduler works by triggering an action hook to run at some time in the future. Each hook can be scheduled with unique data, to allow callbacks to perform operations on that data. The hook can also be scheduled to run on one or more occassions. - -Think of it like an extension to `do_action()` which adds the ability to delay and repeat a hook. - -## Battle-Tested Background Processing - -Every month, Action Scheduler processes millions of payments for [Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/), webhooks for [WooCommerce](https://wordpress.org/plugins/woocommerce/), as well as emails and other events for a range of other plugins. - -It's been seen on live sites processing queues in excess of 50,000 jobs and doing resource intensive operations, like processing payments and creating orders, at a sustained rate of over 10,000 / hour without negatively impacting normal site operations. - -This is all on infrastructure and WordPress sites outside the control of the plugin author. - -If your plugin needs background processing, especially of large sets of tasks, Action Scheduler can help. - -## Learn More - -To learn more about how to Action Scheduler works, and how to use it in your plugin, check out the docs on [ActionScheduler.org](https://actionscheduler.org). - -There you will find: - -* [Usage guide](https://actionscheduler.org/usage/): instructions on installing and using Action Scheduler -* [WP CLI guide](https://actionscheduler.org/wp-cli/): instructions on running Action Scheduler at scale via WP CLI -* [API Reference](https://actionscheduler.org/api/): complete reference guide for all API functions -* [Administration Guide](https://actionscheduler.org/admin/): guide to managing scheduled actions via the administration screen -* [Guide to Background Processing at Scale](https://actionscheduler.org/perf/): instructions for running Action Scheduler at scale via the default WP Cron queue runner - -## Credits - -Action Scheduler is developed and maintained by [Prospress](http://prospress.com/) in collaboration with [Flightless](https://flightless.us/). - -Collaboration is cool. We'd love to work with you to improve Action Scheduler. [Pull Requests](https://github.com/prospress/action-scheduler/pulls) welcome. - ---- - -

- -

diff --git a/includes/libraries/action-scheduler/action-scheduler.php b/includes/libraries/action-scheduler/action-scheduler.php deleted file mode 100644 index ce8fee4710a..00000000000 --- a/includes/libraries/action-scheduler/action-scheduler.php +++ /dev/null @@ -1,47 +0,0 @@ -. - * - */ - -if ( ! function_exists( 'action_scheduler_register_2_dot_2_dot_1' ) ) { - - if ( ! class_exists( 'ActionScheduler_Versions' ) ) { - require_once( 'classes/ActionScheduler_Versions.php' ); - add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 ); - } - - add_action( 'plugins_loaded', 'action_scheduler_register_2_dot_2_dot_1', 0, 0 ); - - function action_scheduler_register_2_dot_2_dot_1() { - $versions = ActionScheduler_Versions::instance(); - $versions->register( '2.2.1', 'action_scheduler_initialize_2_dot_2_dot_1' ); - } - - function action_scheduler_initialize_2_dot_2_dot_1() { - require_once( 'classes/ActionScheduler.php' ); - ActionScheduler::init( __FILE__ ); - } - -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler.php b/includes/libraries/action-scheduler/classes/ActionScheduler.php deleted file mode 100644 index 2c5d0315ebb..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler.php +++ /dev/null @@ -1,133 +0,0 @@ - value pair. The - * key must much the table column name and the value is the label, which is - * automatically translated. - */ - protected $columns = array(); - - /** - * Defines the row-actions. It expects an array where the key - * is the column name and the value is an array of actions. - * - * The array of actions are key => value, where key is the method name - * (with the prefix row_action_) and the value is the label - * and title. - */ - protected $row_actions = array(); - - /** - * The Primary key of our table - */ - protected $ID = 'ID'; - - /** - * Enables sorting, it expects an array - * of columns (the column names are the values) - */ - protected $sort_by = array(); - - protected $filter_by = array(); - - /** - * @var array The status name => count combinations for this table's items. Used to display status filters. - */ - protected $status_counts = array(); - - /** - * @var array Notices to display when loading the table. Array of arrays of form array( 'class' => {updated|error}, 'message' => 'This is the notice text display.' ). - */ - protected $admin_notices = array(); - - /** - * @var string Localised string displayed in the

element above the able. - */ - protected $table_header; - - /** - * Enables bulk actions. It must be an array where the key is the action name - * and the value is the label (which is translated automatically). It is important - * to notice that it will check that the method exists (`bulk_$name`) and will throw - * an exception if it does not exists. - * - * This class will automatically check if the current request has a bulk action, will do the - * validations and afterwards will execute the bulk method, with two arguments. The first argument - * is the array with primary keys, the second argument is a string with a list of the primary keys, - * escaped and ready to use (with `IN`). - */ - protected $bulk_actions = array(); - - /** - * Makes translation easier, it basically just wraps - * `_x` with some default (the package name) - */ - protected function translate( $text, $context = '' ) { - return _x( $text, $context, $this->package ); - } - - /** - * Reads `$this->bulk_actions` and returns an array that WP_List_Table understands. It - * also validates that the bulk method handler exists. It throws an exception because - * this is a library meant for developers and missing a bulk method is a development-time error. - */ - protected function get_bulk_actions() { - $actions = array(); - - foreach ( $this->bulk_actions as $action => $label ) { - if ( ! is_callable( array( $this, 'bulk_' . $action ) ) ) { - throw new RuntimeException( "The bulk action $action does not have a callback method" ); - } - - $actions[ $action ] = $this->translate( $label ); - } - - return $actions; - } - - /** - * Checks if the current request has a bulk action. If that is the case it will validate and will - * execute the bulk method handler. Regardless if the action is valid or not it will redirect to - * the previous page removing the current arguments that makes this request a bulk action. - */ - protected function process_bulk_action() { - global $wpdb; - // Detect when a bulk action is being triggered. - $action = $this->current_action(); - - if ( ! $action ) { - return; - } - - check_admin_referer( 'bulk-' . $this->_args['plural'] ); - - $method = 'bulk_' . $action; - if ( array_key_exists( $action, $this->bulk_actions ) && is_callable( array( $this, $method ) ) && ! empty( $_GET['ID'] ) && is_array( $_GET['ID'] ) ) { - $ids_sql = '(' . implode( ',', array_fill( 0, count( $_GET['ID'] ), '%s' ) ) . ')'; - $this->$method( $_GET['ID'], $wpdb->prepare( $ids_sql, $_GET['ID'] ) ); - } - - wp_redirect( remove_query_arg( - array( '_wp_http_referer', '_wpnonce', 'ID', 'action', 'action2' ), - wp_unslash( $_SERVER['REQUEST_URI'] ) - ) ); - exit; - } - - /** - * Default code for deleting entries. We trust ids_sql because it is - * validated already by process_bulk_action() - */ - protected function bulk_delete( array $ids, $ids_sql ) { - global $wpdb; - - $wpdb->query( "DELETE FROM {$this->table_name} WHERE {$this->ID} IN $ids_sql" ); - } - - /** - * Prepares the _column_headers property which is used by WP_Table_List at rendering. - * It merges the columns and the sortable columns. - */ - protected function prepare_column_headers() { - $this->_column_headers = array( - $this->get_columns(), - array(), - $this->get_sortable_columns(), - ); - } - - /** - * Reads $this->sort_by and returns the columns name in a format that WP_Table_List - * expects - */ - public function get_sortable_columns() { - $sort_by = array(); - foreach ( $this->sort_by as $column ) { - $sort_by[ $column ] = array( $column, true ); - } - return $sort_by; - } - - /** - * Returns the columns names for rendering. It adds a checkbox for selecting everything - * as the first column - */ - public function get_columns() { - $columns = array_merge( - array( 'cb' => '' ), - array_map( array( $this, 'translate' ), $this->columns ) - ); - - return $columns; - } - - /** - * Get prepared LIMIT clause for items query - * - * @global wpdb $wpdb - * - * @return string Prepared LIMIT clause for items query. - */ - protected function get_items_query_limit() { - global $wpdb; - - $per_page = $this->get_items_per_page( $this->package . '_items_per_page', $this->items_per_page ); - return $wpdb->prepare( 'LIMIT %d', $per_page ); - } - - /** - * Returns the number of items to offset/skip for this current view. - * - * @return int - */ - protected function get_items_offset() { - $per_page = $this->get_items_per_page( $this->package . '_items_per_page', $this->items_per_page ); - $current_page = $this->get_pagenum(); - if ( 1 < $current_page ) { - $offset = $per_page * ( $current_page - 1 ); - } else { - $offset = 0; - } - - return $offset; - } - - /** - * Get prepared OFFSET clause for items query - * - * @global wpdb $wpdb - * - * @return string Prepared OFFSET clause for items query. - */ - protected function get_items_query_offset() { - global $wpdb; - - return $wpdb->prepare( 'OFFSET %d', $this->get_items_offset() ); - } - - /** - * Prepares the ORDER BY sql statement. It uses `$this->sort_by` to know which - * columns are sortable. This requests validates the orderby $_GET parameter is a valid - * column and sortable. It will also use order (ASC|DESC) using DESC by default. - */ - protected function get_items_query_order() { - if ( empty( $this->sort_by ) ) { - return ''; - } - - $orderby = esc_sql( $this->get_request_orderby() ); - $order = esc_sql( $this->get_request_order() ); - - return "ORDER BY {$orderby} {$order}"; - } - - /** - * Return the sortable column specified for this request to order the results by, if any. - * - * @return string - */ - protected function get_request_orderby() { - - $valid_sortable_columns = array_values( $this->sort_by ); - - if ( ! empty( $_GET['orderby'] ) && in_array( $_GET['orderby'], $valid_sortable_columns ) ) { - $orderby = sanitize_text_field( $_GET['orderby'] ); - } else { - $orderby = $valid_sortable_columns[0]; - } - - return $orderby; - } - - /** - * Return the sortable column order specified for this request. - * - * @return string - */ - protected function get_request_order() { - - if ( ! empty( $_GET['order'] ) && 'desc' === strtolower( $_GET['order'] ) ) { - $order = 'DESC'; - } else { - $order = 'ASC'; - } - - return $order; - } - - /** - * Return the status filter for this request, if any. - * - * @return string - */ - protected function get_request_status() { - $status = ( ! empty( $_GET['status'] ) ) ? $_GET['status'] : ''; - return $status; - } - - /** - * Return the search filter for this request, if any. - * - * @return string - */ - protected function get_request_search_query() { - $search_query = ( ! empty( $_GET['s'] ) ) ? $_GET['s'] : ''; - return $search_query; - } - - /** - * Process and return the columns name. This is meant for using with SQL, this means it - * always includes the primary key. - * - * @return array - */ - protected function get_table_columns() { - $columns = array_keys( $this->columns ); - if ( ! in_array( $this->ID, $columns ) ) { - $columns[] = $this->ID; - } - - return $columns; - } - - /** - * Check if the current request is doing a "full text" search. If that is the case - * prepares the SQL to search texts using LIKE. - * - * If the current request does not have any search or if this list table does not support - * that feature it will return an empty string. - * - * TODO: - * - Improve search doing LIKE by word rather than by phrases. - * - * @return string - */ - protected function get_items_query_search() { - global $wpdb; - - if ( empty( $_GET['s'] ) || empty( $this->search_by ) ) { - return ''; - } - - $filter = array(); - foreach ( $this->search_by as $column ) { - $filter[] = '`' . $column . '` like "%' . $wpdb->esc_like( $_GET['s'] ) . '%"'; - } - return implode( ' OR ', $filter ); - } - - /** - * Prepares the SQL to filter rows by the options defined at `$this->filter_by`. Before trusting - * any data sent by the user it validates that it is a valid option. - */ - protected function get_items_query_filters() { - global $wpdb; - - if ( ! $this->filter_by || empty( $_GET['filter_by'] ) || ! is_array( $_GET['filter_by'] ) ) { - return ''; - } - - $filter = array(); - - foreach ( $this->filter_by as $column => $options ) { - if ( empty( $_GET['filter_by'][ $column ] ) || empty( $options[ $_GET['filter_by'][ $column ] ] ) ) { - continue; - } - - $filter[] = $wpdb->prepare( "`$column` = %s", $_GET['filter_by'][ $column ] ); - } - - return implode( ' AND ', $filter ); - - } - - /** - * Prepares the data to feed WP_Table_List. - * - * This has the core for selecting, sorting and filting data. To keep the code simple - * its logic is split among many methods (get_items_query_*). - * - * Beside populating the items this function will also count all the records that matches - * the filtering criteria and will do fill the pagination variables. - */ - public function prepare_items() { - global $wpdb; - - $this->process_bulk_action(); - - $this->process_row_actions(); - - if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { - // _wp_http_referer is used only on bulk actions, we remove it to keep the $_GET shorter - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); - exit; - } - - $this->prepare_column_headers(); - - $limit = $this->get_items_query_limit(); - $offset = $this->get_items_query_offset(); - $order = $this->get_items_query_order(); - $where = array_filter(array( - $this->get_items_query_search(), - $this->get_items_query_filters(), - )); - $columns = '`' . implode( '`, `', $this->get_table_columns() ) . '`'; - - if ( ! empty( $where ) ) { - $where = 'WHERE ('. implode( ') AND (', $where ) . ')'; - } else { - $where = ''; - } - - $sql = "SELECT $columns FROM {$this->table_name} {$where} {$order} {$limit} {$offset}"; - - $this->set_items( $wpdb->get_results( $sql, ARRAY_A ) ); - - $query_count = "SELECT COUNT({$this->ID}) FROM {$this->table_name} {$where}"; - $total_items = $wpdb->get_var( $query_count ); - $per_page = $this->get_items_per_page( $this->package . '_items_per_page', $this->items_per_page ); - $this->set_pagination_args( array( - 'total_items' => $total_items, - 'per_page' => $per_page, - 'total_pages' => ceil( $total_items / $per_page ), - ) ); - } - - public function extra_tablenav( $which ) { - if ( ! $this->filter_by || 'top' !== $which ) { - return; - } - - echo '
'; - - foreach ( $this->filter_by as $id => $options ) { - $default = ! empty( $_GET['filter_by'][ $id ] ) ? $_GET['filter_by'][ $id ] : ''; - if ( empty( $options[ $default ] ) ) { - $default = ''; - } - - echo ''; - } - - submit_button( $this->translate( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); - echo '
'; - } - - /** - * Set the data for displaying. It will attempt to unserialize (There is a chance that some columns - * are serialized). This can be override in child classes for futher data transformation. - */ - protected function set_items( array $items ) { - $this->items = array(); - foreach ( $items as $item ) { - $this->items[ $item[ $this->ID ] ] = array_map( 'maybe_unserialize', $item ); - } - } - - /** - * Renders the checkbox for each row, this is the first column and it is named ID regardless - * of how the primary key is named (to keep the code simpler). The bulk actions will do the proper - * name transformation though using `$this->ID`. - */ - public function column_cb( $row ) { - return ''; - } - - /** - * Renders the row-actions. - * - * This method renders the action menu, it reads the definition from the $row_actions property, - * and it checks that the row action method exists before rendering it. - * - * @param array $row Row to render - * @param $column_name Current row - * @return - */ - protected function maybe_render_actions( $row, $column_name ) { - if ( empty( $this->row_actions[ $column_name ] ) ) { - return; - } - - $row_id = $row[ $this->ID ]; - - $actions = '
'; - $action_count = 0; - foreach ( $this->row_actions[ $column_name ] as $action_key => $action ) { - - $action_count++; - - if ( ! method_exists( $this, 'row_action_' . $action_key ) ) { - continue; - } - - $action_link = ! empty( $action['link'] ) ? $action['link'] : add_query_arg( array( 'row_action' => $action_key, 'row_id' => $row_id, 'nonce' => wp_create_nonce( $action_key . '::' . $row_id ) ) ); - $span_class = ! empty( $action['class'] ) ? $action['class'] : $action_key; - $separator = ( $action_count < count( $this->row_actions[ $column_name ] ) ) ? ' | ' : ''; - - $actions .= sprintf( '', esc_attr( $span_class ) ); - $actions .= sprintf( '%3$s', esc_url( $action_link ), esc_attr( $action['desc'] ), esc_html( $action['name'] ) ); - $actions .= sprintf( '%s', $separator ); - } - $actions .= '
'; - return $actions; - } - - protected function process_row_actions() { - $parameters = array( 'row_action', 'row_id', 'nonce' ); - foreach ( $parameters as $parameter ) { - if ( empty( $_REQUEST[ $parameter ] ) ) { - return; - } - } - - $method = 'row_action_' . $_REQUEST['row_action']; - - if ( $_REQUEST['nonce'] === wp_create_nonce( $_REQUEST[ 'row_action' ] . '::' . $_REQUEST[ 'row_id' ] ) && method_exists( $this, $method ) ) { - $this->$method( $_REQUEST['row_id'] ); - } - - wp_redirect( remove_query_arg( - array( 'row_id', 'row_action', 'nonce' ), - wp_unslash( $_SERVER['REQUEST_URI'] ) - ) ); - exit; - } - - /** - * Default column formatting, it will escape everythig for security. - */ - public function column_default( $item, $column_name ) { - $column_html = esc_html( $item[ $column_name ] ); - $column_html .= $this->maybe_render_actions( $item, $column_name ); - return $column_html; - } - - /** - * Display the table heading and search query, if any - */ - protected function display_header() { - echo '

' . esc_attr( $this->table_header ) . '

'; - if ( $this->get_request_search_query() ) { - echo '' . esc_attr( $this->translate( sprintf( 'Search results for "%s"', $this->get_request_search_query() ) ) ) . ''; - } - echo '
'; - } - - /** - * Display the table heading and search query, if any - */ - protected function display_admin_notices() { - foreach ( $this->admin_notices as $notice ) { - echo '
'; - echo '

' . wp_kses_post( $notice['message'] ) . '

'; - echo '
'; - } - } - - /** - * Prints the available statuses so the user can click to filter. - */ - protected function display_filter_by_status() { - - $status_list_items = array(); - $request_status = $this->get_request_status(); - - // Helper to set 'all' filter when not set on status counts passed in - if ( ! isset( $this->status_counts['all'] ) ) { - $this->status_counts = array( 'all' => array_sum( $this->status_counts ) ) + $this->status_counts; - } - - foreach ( $this->status_counts as $status_name => $count ) { - - if ( 0 === $count ) { - continue; - } - - if ( $status_name === $request_status || ( empty( $request_status ) && 'all' === $status_name ) ) { - $status_list_item = '
  • %3$s (%4$d)
  • '; - } else { - $status_list_item = '
  • %3$s (%4$d)
  • '; - } - - $status_filter_url = ( 'all' === $status_name ) ? remove_query_arg( 'status' ) : add_query_arg( 'status', $status_name ); - $status_list_items[] = sprintf( $status_list_item, esc_attr( $status_name ), esc_url( $status_filter_url ), esc_html( ucfirst( $status_name ) ), absint( $count ) ); - } - - if ( $status_list_items ) { - echo ''; - } - } - - /** - * Renders the table list, we override the original class to render the table inside a form - * and to render any needed HTML (like the search box). By doing so the callee of a function can simple - * forget about any extra HTML. - */ - protected function display_table() { - echo '
    '; - foreach ( $_GET as $key => $value ) { - if ( '_' === $key[0] || 'paged' === $key ) { - continue; - } - echo ''; - } - if ( ! empty( $this->search_by ) ) { - echo $this->search_box( $this->get_search_box_button_text(), 'plugin' ); // WPCS: XSS OK - } - parent::display(); - echo '
    '; - } - - /** - * Render the list table page, including header, notices, status filters and table. - */ - public function display_page() { - $this->prepare_items(); - - echo '
    '; - $this->display_header(); - $this->display_admin_notices(); - $this->display_filter_by_status(); - $this->display_table(); - echo '
    '; - } - - /** - * Get the text to display in the search box on the list table. - */ - protected function get_search_box_placeholder() { - return $this->translate( 'Search' ); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_QueueRunner.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_QueueRunner.php deleted file mode 100644 index e34fb8752f9..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_Abstract_QueueRunner.php +++ /dev/null @@ -1,219 +0,0 @@ -created_time = microtime( true ); - - $this->store = $store ? $store : ActionScheduler_Store::instance(); - $this->monitor = $monitor ? $monitor : new ActionScheduler_FatalErrorMonitor( $this->store ); - $this->cleaner = $cleaner ? $cleaner : new ActionScheduler_QueueCleaner( $this->store ); - } - - /** - * Process an individual action. - * - * @param int $action_id The action ID to process. - */ - public function process_action( $action_id ) { - try { - do_action( 'action_scheduler_before_execute', $action_id ); - - if ( ActionScheduler_Store::STATUS_PENDING !== $this->store->get_status( $action_id ) ) { - do_action( 'action_scheduler_execution_ignored', $action_id ); - return; - } - - $action = $this->store->fetch_action( $action_id ); - $this->store->log_execution( $action_id ); - $action->execute(); - do_action( 'action_scheduler_after_execute', $action_id, $action ); - $this->store->mark_complete( $action_id ); - } catch ( Exception $e ) { - $this->store->mark_failure( $action_id ); - do_action( 'action_scheduler_failed_execution', $action_id, $e ); - } - - if ( isset( $action ) && is_a( $action, 'ActionScheduler_Action' ) ) { - $this->schedule_next_instance( $action ); - } - } - - /** - * Schedule the next instance of the action if necessary. - * - * @param ActionScheduler_Action $action - */ - protected function schedule_next_instance( ActionScheduler_Action $action ) { - $schedule = $action->get_schedule(); - $next = $schedule->next( as_get_datetime_object() ); - - if ( ! is_null( $next ) && $schedule->is_recurring() ) { - $this->store->save_action( $action, $next ); - } - } - - /** - * Run the queue cleaner. - * - * @author Jeremy Pry - */ - protected function run_cleanup() { - $this->cleaner->clean( 10 * $this->get_time_limit() ); - } - - /** - * Get the number of concurrent batches a runner allows. - * - * @return int - */ - public function get_allowed_concurrent_batches() { - return apply_filters( 'action_scheduler_queue_runner_concurrent_batches', 5 ); - } - - /** - * Get the maximum number of seconds a batch can run for. - * - * @return int The number of seconds. - */ - protected function get_time_limit() { - - $time_limit = 30; - - // Apply deprecated filter from deprecated get_maximum_execution_time() method - if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) { - _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' ); - $time_limit = apply_filters( 'action_scheduler_maximum_execution_time', $time_limit ); - } - - return absint( apply_filters( 'action_scheduler_queue_runner_time_limit', $time_limit ) ); - } - - /** - * Get the number of seconds the process has been running. - * - * @return int The number of seconds. - */ - protected function get_execution_time() { - $execution_time = microtime( true ) - $this->created_time; - - // Get the CPU time if the hosting environment uses it rather than wall-clock time to calculate a process's execution time. - if ( function_exists( 'getrusage' ) && apply_filters( 'action_scheduler_use_cpu_execution_time', defined( 'PANTHEON_ENVIRONMENT' ) ) ) { - $resource_usages = getrusage(); - - if ( isset( $resource_usages['ru_stime.tv_usec'], $resource_usages['ru_stime.tv_usec'] ) ) { - $execution_time = $resource_usages['ru_stime.tv_sec'] + ( $resource_usages['ru_stime.tv_usec'] / 1000000 ); - } - } - - return $execution_time; - } - - /** - * Check if the host's max execution time is (likely) to be exceeded if processing more actions. - * - * @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action - * @return bool - */ - protected function time_likely_to_be_exceeded( $processed_actions ) { - - $execution_time = $this->get_execution_time(); - $max_execution_time = $this->get_time_limit(); - $time_per_action = $execution_time / $processed_actions; - $estimated_time = $execution_time + ( $time_per_action * 3 ); - $likely_to_be_exceeded = $estimated_time > $max_execution_time; - - return apply_filters( 'action_scheduler_maximum_execution_time_likely_to_be_exceeded', $likely_to_be_exceeded, $this, $processed_actions, $execution_time, $max_execution_time ); - } - - /** - * Get memory limit - * - * Based on WP_Background_Process::get_memory_limit() - * - * @return int - */ - protected function get_memory_limit() { - if ( function_exists( 'ini_get' ) ) { - $memory_limit = ini_get( 'memory_limit' ); - } else { - $memory_limit = '128M'; // Sensible default, and minimum required by WooCommerce - } - - if ( ! $memory_limit || -1 === $memory_limit || '-1' === $memory_limit ) { - // Unlimited, set to 32GB. - $memory_limit = '32G'; - } - - return ActionScheduler_Compatibility::convert_hr_to_bytes( $memory_limit ); - } - - /** - * Memory exceeded - * - * Ensures the batch process never exceeds 90% of the maximum WordPress memory. - * - * Based on WP_Background_Process::memory_exceeded() - * - * @return bool - */ - protected function memory_exceeded() { - - $memory_limit = $this->get_memory_limit() * 0.90; - $current_memory = memory_get_usage( true ); - $memory_exceeded = $current_memory >= $memory_limit; - - return apply_filters( 'action_scheduler_memory_exceeded', $memory_exceeded, $this ); - } - - /** - * See if the batch limits have been exceeded, which is when memory usage is almost at - * the maximum limit, or the time to process more actions will exceed the max time limit. - * - * Based on WC_Background_Process::batch_limits_exceeded() - * - * @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action - * @return bool - */ - protected function batch_limits_exceeded( $processed_actions ) { - return $this->memory_exceeded() || $this->time_likely_to_be_exceeded( $processed_actions ); - } - - /** - * Process actions in the queue. - * - * @author Jeremy Pry - * @return int The number of actions processed. - */ - abstract public function run(); -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Action.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Action.php deleted file mode 100644 index 6258ba1637a..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_Action.php +++ /dev/null @@ -1,75 +0,0 @@ -set_hook($hook); - $this->set_schedule($schedule); - $this->set_args($args); - $this->set_group($group); - } - - public function execute() { - return do_action_ref_array($this->get_hook(), $this->get_args()); - } - - /** - * @param string $hook - */ - protected function set_hook( $hook ) { - $this->hook = $hook; - } - - public function get_hook() { - return $this->hook; - } - - protected function set_schedule( ActionScheduler_Schedule $schedule ) { - $this->schedule = $schedule; - } - - /** - * @return ActionScheduler_Schedule - */ - public function get_schedule() { - return $this->schedule; - } - - protected function set_args( array $args ) { - $this->args = $args; - } - - public function get_args() { - return $this->args; - } - - /** - * @param string $group - */ - protected function set_group( $group ) { - $this->group = $group; - } - - /** - * @return string - */ - public function get_group() { - return $this->group; - } - - /** - * @return bool If the action has been finished - */ - public function is_finished() { - return FALSE; - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_ActionClaim.php b/includes/libraries/action-scheduler/classes/ActionScheduler_ActionClaim.php deleted file mode 100644 index 8b5681620e3..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_ActionClaim.php +++ /dev/null @@ -1,23 +0,0 @@ -id = $id; - $this->action_ids = $action_ids; - } - - public function get_id() { - return $this->id; - } - - public function get_actions() { - return $this->action_ids; - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_ActionFactory.php b/includes/libraries/action-scheduler/classes/ActionScheduler_ActionFactory.php deleted file mode 100644 index 8d97417c5f2..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_ActionFactory.php +++ /dev/null @@ -1,111 +0,0 @@ -store( $action ); - } - - /** - * @param string $hook The hook to trigger when this action runs - * @param array $args Args to pass when the hook is triggered - * @param int $first Unix timestamp for the first run - * @param int $interval Seconds between runs - * @param string $group A group to put the action in - * - * @return string The ID of the stored action - */ - public function recurring( $hook, $args = array(), $first = null, $interval = null, $group = '' ) { - if ( empty($interval) ) { - return $this->single( $hook, $args, $first, $group ); - } - $date = as_get_datetime_object( $first ); - $schedule = new ActionScheduler_IntervalSchedule( $date, $interval ); - $action = new ActionScheduler_Action( $hook, $args, $schedule, $group ); - return $this->store( $action ); - } - - - /** - * @param string $hook The hook to trigger when this action runs - * @param array $args Args to pass when the hook is triggered - * @param int $first Unix timestamp for the first run - * @param int $schedule A cron definition string - * @param string $group A group to put the action in - * - * @return string The ID of the stored action - */ - public function cron( $hook, $args = array(), $first = null, $schedule = null, $group = '' ) { - if ( empty($schedule) ) { - return $this->single( $hook, $args, $first, $group ); - } - $date = as_get_datetime_object( $first ); - $cron = CronExpression::factory( $schedule ); - $schedule = new ActionScheduler_CronSchedule( $date, $cron ); - $action = new ActionScheduler_Action( $hook, $args, $schedule, $group ); - return $this->store( $action ); - } - - /** - * @param ActionScheduler_Action $action - * - * @return string The ID of the stored action - */ - protected function store( ActionScheduler_Action $action ) { - $store = ActionScheduler_Store::instance(); - return $store->save_action( $action ); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_AdminView.php b/includes/libraries/action-scheduler/classes/ActionScheduler_AdminView.php deleted file mode 100644 index 91d8b189279..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_AdminView.php +++ /dev/null @@ -1,83 +0,0 @@ -print(); - } - - /** - * Registers action-scheduler into WooCommerce > System status. - * - * @param array $tabs An associative array of tab key => label. - * @return array $tabs An associative array of tab key => label, including Action Scheduler's tabs - */ - public function register_system_status_tab( array $tabs ) { - $tabs['action-scheduler'] = __( 'Scheduled Actions', 'action-scheduler' ); - - return $tabs; - } - - /** - * Include Action Scheduler's administration under the Tools menu. - * - * A menu under the Tools menu is important for backward compatibility (as that's - * where it started), and also provides more convenient access than the WooCommerce - * System Status page, and for sites where WooCommerce isn't active. - */ - public function register_menu() { - add_submenu_page( - 'tools.php', - __( 'Scheduled Actions', 'action-scheduler' ), - __( 'Scheduled Actions', 'action-scheduler' ), - 'manage_options', - 'action-scheduler', - array( $this, 'render_admin_ui' ) - ); - } - - /** - * Renders the Admin UI - */ - public function render_admin_ui() { - $table = new ActionScheduler_ListTable( ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner() ); - $table->display_page(); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_CanceledAction.php b/includes/libraries/action-scheduler/classes/ActionScheduler_CanceledAction.php deleted file mode 100644 index b1db531143f..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_CanceledAction.php +++ /dev/null @@ -1,21 +0,0 @@ -set_schedule( new ActionScheduler_NullSchedule() ); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Compatibility.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Compatibility.php deleted file mode 100644 index c06e5a44d00..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_Compatibility.php +++ /dev/null @@ -1,99 +0,0 @@ - $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) { - if ( false !== @ini_set( 'memory_limit', $filtered_limit ) ) { - return $filtered_limit; - } else { - return false; - } - } elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) { - if ( false !== @ini_set( 'memory_limit', $wp_max_limit ) ) { - return $wp_max_limit; - } else { - return false; - } - } - return false; - } - - /** - * Attempts to raise the PHP timeout for time intensive processes. - * - * Only allows raising the existing limit and prevents lowering it. Wrapper for wc_set_time_limit(), when available. - * - * @param int The time limit in seconds. - */ - public static function raise_time_limit( $limit = 0 ) { - if ( $limit < ini_get( 'max_execution_time' ) ) { - return; - } - - if ( function_exists( 'wc_set_time_limit' ) ) { - wc_set_time_limit( $limit ); - } elseif ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { - @set_time_limit( $limit ); - } - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_CronSchedule.php b/includes/libraries/action-scheduler/classes/ActionScheduler_CronSchedule.php deleted file mode 100644 index 0441e40a5db..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_CronSchedule.php +++ /dev/null @@ -1,57 +0,0 @@ -start = $start; - $this->cron = $cron; - } - - /** - * @param DateTime $after - * @return DateTime|null - */ - public function next( DateTime $after = NULL ) { - $after = empty($after) ? clone $this->start : clone $after; - return $this->cron->getNextRunDate($after, 0, false); - } - - /** - * @return bool - */ - public function is_recurring() { - return true; - } - - /** - * @return string - */ - public function get_recurrence() { - return strval($this->cron); - } - - /** - * For PHP 5.2 compat, since DateTime objects can't be serialized - * @return array - */ - public function __sleep() { - $this->start_timestamp = $this->start->getTimestamp(); - return array( - 'start_timestamp', - 'cron' - ); - } - - public function __wakeup() { - $this->start = as_get_datetime_object($this->start_timestamp); - } -} - diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_DateTime.php b/includes/libraries/action-scheduler/classes/ActionScheduler_DateTime.php deleted file mode 100644 index 5e8743cae74..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_DateTime.php +++ /dev/null @@ -1,76 +0,0 @@ -format( 'U' ); - } - - /** - * Set the UTC offset. - * - * This represents a fixed offset instead of a timezone setting. - * - * @param $offset - */ - public function setUtcOffset( $offset ) { - $this->utcOffset = intval( $offset ); - } - - /** - * Returns the timezone offset. - * - * @return int - * @link http://php.net/manual/en/datetime.getoffset.php - */ - public function getOffset() { - return $this->utcOffset ? $this->utcOffset : parent::getOffset(); - } - - /** - * Set the TimeZone associated with the DateTime - * - * @param DateTimeZone $timezone - * - * @return static - * @link http://php.net/manual/en/datetime.settimezone.php - */ - public function setTimezone( $timezone ) { - $this->utcOffset = 0; - parent::setTimezone( $timezone ); - - return $this; - } - - /** - * Get the timestamp with the WordPress timezone offset added or subtracted. - * - * @since 3.0.0 - * @return int - */ - public function getOffsetTimestamp() { - return $this->getTimestamp() + $this->getOffset(); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Exception.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Exception.php deleted file mode 100644 index 9ec713f67ad..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_Exception.php +++ /dev/null @@ -1,11 +0,0 @@ -store = $store; - } - - public function attach( ActionScheduler_ActionClaim $claim ) { - $this->claim = $claim; - add_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) ); - add_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0, 1 ); - add_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0, 0 ); - add_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0, 0 ); - add_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0, 0 ); - } - - public function detach() { - $this->claim = NULL; - $this->untrack_action(); - remove_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) ); - remove_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0 ); - remove_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0 ); - remove_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0 ); - remove_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0 ); - } - - public function track_current_action( $action_id ) { - $this->action_id = $action_id; - } - - public function untrack_action() { - $this->action_id = 0; - } - - public function handle_unexpected_shutdown() { - if ( $error = error_get_last() ) { - if ( in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ) ) ) { - if ( !empty($this->action_id) ) { - $this->store->mark_failure( $this->action_id ); - do_action( 'action_scheduler_unexpected_shutdown', $this->action_id, $error ); - } - } - $this->store->release_claim( $this->claim ); - } - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_FinishedAction.php b/includes/libraries/action-scheduler/classes/ActionScheduler_FinishedAction.php deleted file mode 100644 index b23a56c66b7..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_FinishedAction.php +++ /dev/null @@ -1,16 +0,0 @@ -start = $start; - $this->interval_in_seconds = (int)$interval; - } - - /** - * @param DateTime $after - * - * @return DateTime|null - */ - public function next( DateTime $after = NULL ) { - $after = empty($after) ? as_get_datetime_object('@0') : clone $after; - if ( $after > $this->start ) { - $after->modify('+'.$this->interval_in_seconds.' seconds'); - return $after; - } - return clone $this->start; - } - - /** - * @return bool - */ - public function is_recurring() { - return true; - } - - /** - * @return int - */ - public function interval_in_seconds() { - return $this->interval_in_seconds; - } - - /** - * For PHP 5.2 compat, since DateTime objects can't be serialized - * @return array - */ - public function __sleep() { - $this->start_timestamp = $this->start->getTimestamp(); - return array( - 'start_timestamp', - 'interval_in_seconds' - ); - } - - public function __wakeup() { - $this->start = as_get_datetime_object($this->start_timestamp); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_InvalidActionException.php b/includes/libraries/action-scheduler/classes/ActionScheduler_InvalidActionException.php deleted file mode 100644 index a7decdcac6e..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_InvalidActionException.php +++ /dev/null @@ -1,28 +0,0 @@ - label). - * - * @var array - */ - protected $columns = array(); - - /** - * Actions (name => label). - * - * @var array - */ - protected $row_actions = array(); - - /** - * The active data stores - * - * @var ActionScheduler_Store - */ - protected $store; - - /** - * A logger to use for getting action logs to display - * - * @var ActionScheduler_Logger - */ - protected $logger; - - /** - * A ActionScheduler_QueueRunner runner instance (or child class) - * - * @var ActionScheduler_QueueRunner - */ - protected $runner; - - /** - * Bulk actions. The key of the array is the method name of the implementation: - * - * bulk_(array $ids, string $sql_in). - * - * See the comments in the parent class for further details - * - * @var array - */ - protected $bulk_actions = array(); - - /** - * Flag variable to render our notifications, if any, once. - * - * @var bool - */ - protected static $did_notification = false; - - /** - * Array of seconds for common time periods, like week or month, alongside an internationalised string representation, i.e. "Day" or "Days" - * - * @var array - */ - private static $time_periods; - - /** - * Sets the current data store object into `store->action` and initialises the object. - * - * @param ActionScheduler_Store $store - * @param ActionScheduler_Logger $logger - * @param ActionScheduler_QueueRunner $runner - */ - public function __construct( ActionScheduler_Store $store, ActionScheduler_Logger $logger, ActionScheduler_QueueRunner $runner ) { - - $this->store = $store; - $this->logger = $logger; - $this->runner = $runner; - - $this->table_header = __( 'Scheduled Actions', 'action-scheduler' ); - - $this->bulk_actions = array( - 'delete' => __( 'Delete', 'action-scheduler' ), - ); - - $this->columns = array( - 'hook' => __( 'Hook', 'action-scheduler' ), - 'status' => __( 'Status', 'action-scheduler' ), - 'args' => __( 'Arguments', 'action-scheduler' ), - 'group' => __( 'Group', 'action-scheduler' ), - 'recurrence' => __( 'Recurrence', 'action-scheduler' ), - 'schedule' => __( 'Scheduled Date', 'action-scheduler' ), - 'log_entries' => __( 'Log', 'action-scheduler' ), - ); - - $this->sort_by = array( - 'schedule', - 'hook', - 'group', - ); - - $this->search_by = array( - 'hook', - 'args', - 'claim_id', - ); - - $request_status = $this->get_request_status(); - - if ( empty( $request_status ) ) { - $this->sort_by[] = 'status'; - } elseif ( in_array( $request_status, array( 'in-progress', 'failed' ) ) ) { - $this->columns += array( 'claim_id' => __( 'Claim ID', 'action-scheduler' ) ); - $this->sort_by[] = 'claim_id'; - } - - $this->row_actions = array( - 'hook' => array( - 'run' => array( - 'name' => __( 'Run', 'action-scheduler' ), - 'desc' => __( 'Process the action now as if it were run as part of a queue', 'action-scheduler' ), - ), - 'cancel' => array( - 'name' => __( 'Cancel', 'action-scheduler' ), - 'desc' => __( 'Cancel the action now to avoid it being run in future', 'action-scheduler' ), - 'class' => 'cancel trash', - ), - ), - ); - - self::$time_periods = array( - array( - 'seconds' => YEAR_IN_SECONDS, - 'names' => _n_noop( '%s year', '%s years', 'action-scheduler' ), - ), - array( - 'seconds' => MONTH_IN_SECONDS, - 'names' => _n_noop( '%s month', '%s months', 'action-scheduler' ), - ), - array( - 'seconds' => WEEK_IN_SECONDS, - 'names' => _n_noop( '%s week', '%s weeks', 'action-scheduler' ), - ), - array( - 'seconds' => DAY_IN_SECONDS, - 'names' => _n_noop( '%s day', '%s days', 'action-scheduler' ), - ), - array( - 'seconds' => HOUR_IN_SECONDS, - 'names' => _n_noop( '%s hour', '%s hours', 'action-scheduler' ), - ), - array( - 'seconds' => MINUTE_IN_SECONDS, - 'names' => _n_noop( '%s minute', '%s minutes', 'action-scheduler' ), - ), - array( - 'seconds' => 1, - 'names' => _n_noop( '%s second', '%s seconds', 'action-scheduler' ), - ), - ); - - parent::__construct( array( - 'singular' => 'action-scheduler', - 'plural' => 'action-scheduler', - 'ajax' => false, - ) ); - } - - /** - * Convert an interval of seconds into a two part human friendly string. - * - * The WordPress human_time_diff() function only calculates the time difference to one degree, meaning - * even if an action is 1 day and 11 hours away, it will display "1 day". This function goes one step - * further to display two degrees of accuracy. - * - * Inspired by the Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/ - * - * @param int $interval A interval in seconds. - * @param int $periods_to_include Depth of time periods to include, e.g. for an interval of 70, and $periods_to_include of 2, both minutes and seconds would be included. With a value of 1, only minutes would be included. - * @return string A human friendly string representation of the interval. - */ - private static function human_interval( $interval, $periods_to_include = 2 ) { - - if ( $interval <= 0 ) { - return __( 'Now!', 'action-scheduler' ); - } - - $output = ''; - - for ( $time_period_index = 0, $periods_included = 0, $seconds_remaining = $interval; $time_period_index < count( self::$time_periods ) && $seconds_remaining > 0 && $periods_included < $periods_to_include; $time_period_index++ ) { - - $periods_in_interval = floor( $seconds_remaining / self::$time_periods[ $time_period_index ]['seconds'] ); - - if ( $periods_in_interval > 0 ) { - if ( ! empty( $output ) ) { - $output .= ' '; - } - $output .= sprintf( _n( self::$time_periods[ $time_period_index ]['names'][0], self::$time_periods[ $time_period_index ]['names'][1], $periods_in_interval, 'action-scheduler' ), $periods_in_interval ); - $seconds_remaining -= $periods_in_interval * self::$time_periods[ $time_period_index ]['seconds']; - $periods_included++; - } - } - - return $output; - } - - /** - * Returns the recurrence of an action or 'Non-repeating'. The output is human readable. - * - * @param ActionScheduler_Action $action - * - * @return string - */ - protected function get_recurrence( $action ) { - $recurrence = $action->get_schedule(); - if ( $recurrence->is_recurring() ) { - if ( method_exists( $recurrence, 'interval_in_seconds' ) ) { - return sprintf( __( 'Every %s', 'action-scheduler' ), self::human_interval( $recurrence->interval_in_seconds() ) ); - } - - if ( method_exists( $recurrence, 'get_recurrence' ) ) { - return sprintf( __( 'Cron %s', 'action-scheduler' ), $recurrence->get_recurrence() ); - } - } - - return __( 'Non-repeating', 'action-scheduler' ); - } - - /** - * Serializes the argument of an action to render it in a human friendly format. - * - * @param array $row The array representation of the current row of the table - * - * @return string - */ - public function column_args( array $row ) { - if ( empty( $row['args'] ) ) { - return ''; - } - - $row_html = '
      '; - foreach ( $row['args'] as $key => $value ) { - $row_html .= sprintf( '
    • %s => %s
    • ', esc_html( var_export( $key, true ) ), esc_html( var_export( $value, true ) ) ); - } - $row_html .= '
    '; - - return apply_filters( 'action_scheduler_list_table_column_args', $row_html, $row ); - } - - /** - * Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal. - * - * @param array $row Action array. - * @return string - */ - public function column_log_entries( array $row ) { - - $log_entries_html = '
      '; - - $timezone = new DateTimezone( 'UTC' ); - - foreach ( $row['log_entries'] as $log_entry ) { - $log_entries_html .= $this->get_log_entry_html( $log_entry, $timezone ); - } - - $log_entries_html .= '
    '; - - return $log_entries_html; - } - - /** - * Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal. - * - * @param ActionScheduler_LogEntry $log_entry - * @param DateTimezone $timezone - * @return string - */ - protected function get_log_entry_html( ActionScheduler_LogEntry $log_entry, DateTimezone $timezone ) { - $date = $log_entry->get_date(); - $date->setTimezone( $timezone ); - return sprintf( '
  • %s
    %s
  • ', esc_html( $date->format( 'Y-m-d H:i:s O' ) ), esc_html( $log_entry->get_message() ) ); - } - - /** - * Only display row actions for pending actions. - * - * @param array $row Row to render - * @param string $column_name Current row - * - * @return string - */ - protected function maybe_render_actions( $row, $column_name ) { - if ( 'pending' === strtolower( $row['status'] ) ) { - return parent::maybe_render_actions( $row, $column_name ); - } - - return ''; - } - - /** - * Renders admin notifications - * - * Notifications: - * 1. When the maximum number of tasks are being executed simultaneously - * 2. Notifications when a task us manually executed - */ - public function display_admin_notices() { - - if ( $this->store->get_claim_count() >= $this->runner->get_allowed_concurrent_batches() ) { - $this->admin_notices[] = array( - 'class' => 'updated', - 'message' => sprintf( __( 'Maximum simultaneous batches already in progress (%s queues). No actions will be processed until the current batches are complete.', 'action-scheduler' ), $this->store->get_claim_count() ), - ); - } - - $notification = get_transient( 'action_scheduler_admin_notice' ); - - if ( is_array( $notification ) ) { - delete_transient( 'action_scheduler_admin_notice' ); - - $action = $this->store->fetch_action( $notification['action_id'] ); - $action_hook_html = '' . $action->get_hook() . ''; - if ( 1 == $notification['success'] ) { - $class = 'updated'; - switch ( $notification['row_action_type'] ) { - case 'run' : - $action_message_html = sprintf( __( 'Successfully executed action: %s', 'action-scheduler' ), $action_hook_html ); - break; - case 'cancel' : - $action_message_html = sprintf( __( 'Successfully canceled action: %s', 'action-scheduler' ), $action_hook_html ); - break; - default : - $action_message_html = sprintf( __( 'Successfully processed change for action: %s', 'action-scheduler' ), $action_hook_html ); - break; - } - } else { - $class = 'error'; - $action_message_html = sprintf( __( 'Could not process change for action: "%s" (ID: %d). Error: %s', 'action-scheduler' ), $action_hook_html, esc_html( $notification['action_id'] ), esc_html( $notification['error_message'] ) ); - } - - $action_message_html = apply_filters( 'action_scheduler_admin_notice_html', $action_message_html, $action, $notification ); - - $this->admin_notices[] = array( - 'class' => $class, - 'message' => $action_message_html, - ); - } - - parent::display_admin_notices(); - } - - /** - * Prints the scheduled date in a human friendly format. - * - * @param array $row The array representation of the current row of the table - * - * @return string - */ - public function column_schedule( $row ) { - return $this->get_schedule_display_string( $row['schedule'] ); - } - - /** - * Get the scheduled date in a human friendly format. - * - * @param ActionScheduler_Schedule $schedule - * @return string - */ - protected function get_schedule_display_string( ActionScheduler_Schedule $schedule ) { - - $schedule_display_string = ''; - - if ( ! $schedule->next() ) { - return $schedule_display_string; - } - - $next_timestamp = $schedule->next()->getTimestamp(); - - $schedule_display_string .= $schedule->next()->format( 'Y-m-d H:i:s O' ); - $schedule_display_string .= '
    '; - - if ( gmdate( 'U' ) > $next_timestamp ) { - $schedule_display_string .= sprintf( __( ' (%s ago)', 'action-scheduler' ), self::human_interval( gmdate( 'U' ) - $next_timestamp ) ); - } else { - $schedule_display_string .= sprintf( __( ' (%s)', 'action-scheduler' ), self::human_interval( $next_timestamp - gmdate( 'U' ) ) ); - } - - return $schedule_display_string; - } - - /** - * Bulk delete - * - * Deletes actions based on their ID. This is the handler for the bulk delete. It assumes the data - * properly validated by the callee and it will delete the actions without any extra validation. - * - * @param array $ids - * @param string $ids_sql Inherited and unused - */ - protected function bulk_delete( array $ids, $ids_sql ) { - foreach ( $ids as $id ) { - $this->store->delete_action( $id ); - } - } - - /** - * Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their - * parameters are valid. - * - * @param int $action_id - */ - protected function row_action_cancel( $action_id ) { - $this->process_row_action( $action_id, 'cancel' ); - } - - /** - * Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their - * parameters are valid. - * - * @param int $action_id - */ - protected function row_action_run( $action_id ) { - $this->process_row_action( $action_id, 'run' ); - } - - /** - * Implements the logic behind processing an action once an action link is clicked on the list table. - * - * @param int $action_id - * @param string $row_action_type The type of action to perform on the action. - */ - protected function process_row_action( $action_id, $row_action_type ) { - try { - switch ( $row_action_type ) { - case 'run' : - $this->runner->process_action( $action_id ); - break; - case 'cancel' : - $this->store->cancel_action( $action_id ); - break; - } - $success = 1; - $error_message = ''; - } catch ( Exception $e ) { - $success = 0; - $error_message = $e->getMessage(); - } - - set_transient( 'action_scheduler_admin_notice', compact( 'action_id', 'success', 'error_message', 'row_action_type' ), 30 ); - } - - /** - * {@inheritDoc} - */ - public function prepare_items() { - $this->process_bulk_action(); - - $this->process_row_actions(); - - if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { - // _wp_http_referer is used only on bulk actions, we remove it to keep the $_GET shorter - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); - exit; - } - - $this->prepare_column_headers(); - - $per_page = $this->get_items_per_page( $this->package . '_items_per_page', $this->items_per_page ); - $query = array( - 'per_page' => $per_page, - 'offset' => $this->get_items_offset(), - 'status' => $this->get_request_status(), - 'orderby' => $this->get_request_orderby(), - 'order' => $this->get_request_order(), - 'search' => $this->get_request_search_query(), - ); - - $this->items = array(); - - $total_items = $this->store->query_actions( $query, 'count' ); - - $status_labels = $this->store->get_status_labels(); - - foreach ( $this->store->query_actions( $query ) as $action_id ) { - try { - $action = $this->store->fetch_action( $action_id ); - } catch ( Exception $e ) { - continue; - } - $this->items[ $action_id ] = array( - 'ID' => $action_id, - 'hook' => $action->get_hook(), - 'status' => $status_labels[ $this->store->get_status( $action_id ) ], - 'args' => $action->get_args(), - 'group' => $action->get_group(), - 'log_entries' => $this->logger->get_logs( $action_id ), - 'claim_id' => $this->store->get_claim_id( $action_id ), - 'recurrence' => $this->get_recurrence( $action ), - 'schedule' => $action->get_schedule(), - ); - } - - $this->set_pagination_args( array( - 'total_items' => $total_items, - 'per_page' => $per_page, - 'total_pages' => ceil( $total_items / $per_page ), - ) ); - } - - /** - * Prints the available statuses so the user can click to filter. - */ - protected function display_filter_by_status() { - $this->status_counts = $this->store->action_counts(); - parent::display_filter_by_status(); - } - - /** - * Get the text to display in the search box on the list table. - */ - protected function get_search_box_button_text() { - return __( 'Search hook, args and claim ID', 'action-scheduler' ); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_LogEntry.php b/includes/libraries/action-scheduler/classes/ActionScheduler_LogEntry.php deleted file mode 100644 index 649636debf7..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_LogEntry.php +++ /dev/null @@ -1,67 +0,0 @@ -comment_type - * to ActionScheduler_LogEntry::__construct(), goodness knows why, and the Follow-up Emails plugin - * hard-codes loading its own version of ActionScheduler_wpCommentLogger with that out-dated method, - * goodness knows why, so we need to guard against that here instead of using a DateTime type declaration - * for the constructor's 3rd param of $date and causing a fatal error with older versions of FUE. - */ - if ( null !== $date && ! is_a( $date, 'DateTime' ) ) { - _doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' ); - $date = null; - } - - $this->action_id = $action_id; - $this->message = $message; - $this->date = $date ? $date : new Datetime; - } - - /** - * Returns the date when this log entry was created - * - * @return Datetime - */ - public function get_date() { - return $this->date; - } - - public function get_action_id() { - return $this->action_id; - } - - public function get_message() { - return $this->message; - } -} - diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Logger.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Logger.php deleted file mode 100644 index 3da06ab48de..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_Logger.php +++ /dev/null @@ -1,98 +0,0 @@ -log( $action_id, __( 'action created', 'action-scheduler' ) ); - } - - public function log_canceled_action( $action_id ) { - $this->log( $action_id, __( 'action canceled', 'action-scheduler' ) ); - } - - public function log_started_action( $action_id ) { - $this->log( $action_id, __( 'action started', 'action-scheduler' ) ); - } - - public function log_completed_action( $action_id ) { - $this->log( $action_id, __( 'action complete', 'action-scheduler' ) ); - } - - public function log_failed_action( $action_id, Exception $exception ) { - $this->log( $action_id, sprintf( __( 'action failed: %s', 'action-scheduler' ), $exception->getMessage() ) ); - } - - public function log_timed_out_action( $action_id, $timeout ) { - $this->log( $action_id, sprintf( __( 'action timed out after %s seconds', 'action-scheduler' ), $timeout ) ); - } - - public function log_unexpected_shutdown( $action_id, $error ) { - if ( ! empty( $error ) ) { - $this->log( $action_id, sprintf( __( 'unexpected shutdown: PHP Fatal error %s in %s on line %s', 'action-scheduler' ), $error['message'], $error['file'], $error['line'] ) ); - } - } - - public function log_reset_action( $action_id ) { - $this->log( $action_id, __( 'action reset', 'action_scheduler' ) ); - } - - public function log_ignored_action( $action_id ) { - $this->log( $action_id, __( 'action ignored', 'action-scheduler' ) ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_NullAction.php b/includes/libraries/action-scheduler/classes/ActionScheduler_NullAction.php deleted file mode 100644 index cd5dc3b0f98..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_NullAction.php +++ /dev/null @@ -1,16 +0,0 @@ -set_schedule( new ActionScheduler_NullSchedule() ); - } - - public function execute() { - // don't execute - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_NullLogEntry.php b/includes/libraries/action-scheduler/classes/ActionScheduler_NullLogEntry.php deleted file mode 100644 index 6f8f218aab4..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_NullLogEntry.php +++ /dev/null @@ -1,11 +0,0 @@ -store = $store ? $store : ActionScheduler_Store::instance(); - $this->batch_size = $batch_size; - } - - public function delete_old_actions() { - $lifespan = apply_filters( 'action_scheduler_retention_period', $this->month_in_seconds ); - $cutoff = as_get_datetime_object($lifespan.' seconds ago'); - - $statuses_to_purge = array( - ActionScheduler_Store::STATUS_COMPLETE, - ActionScheduler_Store::STATUS_CANCELED, - ); - - foreach ( $statuses_to_purge as $status ) { - $actions_to_delete = $this->store->query_actions( array( - 'status' => $status, - 'modified' => $cutoff, - 'modified_compare' => '<=', - 'per_page' => $this->get_batch_size(), - ) ); - - foreach ( $actions_to_delete as $action_id ) { - try { - $this->store->delete_action( $action_id ); - } catch ( Exception $e ) { - - /** - * Notify 3rd party code of exceptions when deleting a completed action older than the retention period - * - * This hook provides a way for 3rd party code to log or otherwise handle exceptions relating to their - * actions. - * - * @since 2.0.0 - * - * @param int $action_id The scheduled actions ID in the data store - * @param Exception $e The exception thrown when attempting to delete the action from the data store - * @param int $lifespan The retention period, in seconds, for old actions - * @param int $count_of_actions_to_delete The number of old actions being deleted in this batch - */ - do_action( 'action_scheduler_failed_old_action_deletion', $action_id, $e, $lifespan, count( $actions_to_delete ) ); - } - } - } - } - - /** - * Unclaim pending actions that have not been run within a given time limit. - * - * When called by ActionScheduler_Abstract_QueueRunner::run_cleanup(), the time limit passed - * as a parameter is 10x the time limit used for queue processing. - * - * @param int $time_limit The number of seconds to allow a queue to run before unclaiming its pending actions. Default 300 (5 minutes). - */ - public function reset_timeouts( $time_limit = 300 ) { - $timeout = apply_filters( 'action_scheduler_timeout_period', $time_limit ); - if ( $timeout < 0 ) { - return; - } - $cutoff = as_get_datetime_object($timeout.' seconds ago'); - $actions_to_reset = $this->store->query_actions( array( - 'status' => ActionScheduler_Store::STATUS_PENDING, - 'modified' => $cutoff, - 'modified_compare' => '<=', - 'claimed' => true, - 'per_page' => $this->get_batch_size(), - ) ); - - foreach ( $actions_to_reset as $action_id ) { - $this->store->unclaim_action( $action_id ); - do_action( 'action_scheduler_reset_action', $action_id ); - } - } - - /** - * Mark actions that have been running for more than a given time limit as failed, based on - * the assumption some uncatachable and unloggable fatal error occurred during processing. - * - * When called by ActionScheduler_Abstract_QueueRunner::run_cleanup(), the time limit passed - * as a parameter is 10x the time limit used for queue processing. - * - * @param int $time_limit The number of seconds to allow an action to run before it is considered to have failed. Default 300 (5 minutes). - */ - public function mark_failures( $time_limit = 300 ) { - $timeout = apply_filters( 'action_scheduler_failure_period', $time_limit ); - if ( $timeout < 0 ) { - return; - } - $cutoff = as_get_datetime_object($timeout.' seconds ago'); - $actions_to_reset = $this->store->query_actions( array( - 'status' => ActionScheduler_Store::STATUS_RUNNING, - 'modified' => $cutoff, - 'modified_compare' => '<=', - 'per_page' => $this->get_batch_size(), - ) ); - - foreach ( $actions_to_reset as $action_id ) { - $this->store->mark_failure( $action_id ); - do_action( 'action_scheduler_failed_action', $action_id, $timeout ); - } - } - - /** - * Do all of the cleaning actions. - * - * @param int $time_limit The number of seconds to use as the timeout and failure period. Default 300 (5 minutes). - * @author Jeremy Pry - */ - public function clean( $time_limit = 300 ) { - $this->delete_old_actions(); - $this->reset_timeouts( $time_limit ); - $this->mark_failures( $time_limit ); - } - - /** - * Get the batch size for cleaning the queue. - * - * @author Jeremy Pry - * @return int - */ - protected function get_batch_size() { - /** - * Filter the batch size when cleaning the queue. - * - * @param int $batch_size The number of actions to clean in one batch. - */ - return absint( apply_filters( 'action_scheduler_cleanup_batch_size', $this->batch_size ) ); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_QueueRunner.php b/includes/libraries/action-scheduler/classes/ActionScheduler_QueueRunner.php deleted file mode 100644 index f1e5b83b372..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_QueueRunner.php +++ /dev/null @@ -1,115 +0,0 @@ -get_time_limit() ); - do_action( 'action_scheduler_before_process_queue' ); - $this->run_cleanup(); - $processed_actions = 0; - if ( $this->store->get_claim_count() < $this->get_allowed_concurrent_batches() ) { - $batch_size = apply_filters( 'action_scheduler_queue_runner_batch_size', 25 ); - do { - $processed_actions_in_batch = $this->do_batch( $batch_size ); - $processed_actions += $processed_actions_in_batch; - } while ( $processed_actions_in_batch > 0 && ! $this->batch_limits_exceeded( $processed_actions ) ); // keep going until we run out of actions, time, or memory - } - - do_action( 'action_scheduler_after_process_queue' ); - return $processed_actions; - } - - protected function do_batch( $size = 100 ) { - $claim = $this->store->stake_claim($size); - $this->monitor->attach($claim); - $processed_actions = 0; - - foreach ( $claim->get_actions() as $action_id ) { - // bail if we lost the claim - if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $claim->get_id() ) ) ) { - break; - } - $this->process_action( $action_id ); - $processed_actions++; - - if ( $this->batch_limits_exceeded( $processed_actions ) ) { - break; - } - } - $this->store->release_claim($claim); - $this->monitor->detach(); - $this->clear_caches(); - return $processed_actions; - } - - /** - * Running large batches can eat up memory, as WP adds data to its object cache. - * - * If using a persistent object store, this has the side effect of flushing that - * as well, so this is disabled by default. To enable: - * - * add_filter( 'action_scheduler_queue_runner_flush_cache', '__return_true' ); - */ - protected function clear_caches() { - if ( ! wp_using_ext_object_cache() || apply_filters( 'action_scheduler_queue_runner_flush_cache', false ) ) { - wp_cache_flush(); - } - } - - public function add_wp_cron_schedule( $schedules ) { - $schedules['every_minute'] = array( - 'interval' => 60, // in seconds - 'display' => __( 'Every minute' ), - ); - - return $schedules; - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Schedule.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Schedule.php deleted file mode 100644 index d61a9f7c920..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_Schedule.php +++ /dev/null @@ -1,18 +0,0 @@ -date = clone $date; - } - - /** - * @param DateTime $after - * - * @return DateTime|null - */ - public function next( DateTime $after = NULL ) { - $after = empty($after) ? as_get_datetime_object('@0') : $after; - return ( $after > $this->date ) ? NULL : clone $this->date; - } - - /** - * @return bool - */ - public function is_recurring() { - return false; - } - - /** - * For PHP 5.2 compat, since DateTime objects can't be serialized - * @return array - */ - public function __sleep() { - $this->timestamp = $this->date->getTimestamp(); - return array( - 'timestamp', - ); - } - - public function __wakeup() { - $this->date = as_get_datetime_object($this->timestamp); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Store.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Store.php deleted file mode 100644 index 59ac236af9a..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_Store.php +++ /dev/null @@ -1,212 +0,0 @@ -', '>=', '<', '<=', '=') ) ) { - return $comparison_operator; - } - return '='; - } - - /** - * Get the time MySQL formated date/time string for an action's (next) scheduled date. - * - * @param ActionScheduler_Action $action - * @param DateTime $scheduled_date (optional) - * @return string - */ - protected function get_scheduled_date_string( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) { - $next = null === $scheduled_date ? $action->get_schedule()->next() : $scheduled_date; - if ( ! $next ) { - throw new InvalidArgumentException( __( 'Invalid schedule. Cannot save action.', 'action-scheduler' ) ); - } - $next->setTimezone( new DateTimeZone( 'UTC' ) ); - - return $next->format( 'Y-m-d H:i:s' ); - } - - /** - * Get the time MySQL formated date/time string for an action's (next) scheduled date. - * - * @param ActionScheduler_Action $action - * @param DateTime $scheduled_date (optional) - * @return string - */ - protected function get_scheduled_date_string_local( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) { - $next = null === $scheduled_date ? $action->get_schedule()->next() : $scheduled_date; - if ( ! $next ) { - throw new InvalidArgumentException( __( 'Invalid schedule. Cannot save action.', 'action-scheduler' ) ); - } - - ActionScheduler_TimezoneHelper::set_local_timezone( $next ); - return $next->format( 'Y-m-d H:i:s' ); - } - - /** - * @return array - */ - public function get_status_labels() { - return array( - self::STATUS_COMPLETE => __( 'Complete', 'action-scheduler' ), - self::STATUS_PENDING => __( 'Pending', 'action-scheduler' ), - self::STATUS_RUNNING => __( 'In-progress', 'action-scheduler' ), - self::STATUS_FAILED => __( 'Failed', 'action-scheduler' ), - self::STATUS_CANCELED => __( 'Canceled', 'action-scheduler' ), - ); - } - - public function init() {} - - /** - * @return ActionScheduler_Store - */ - public static function instance() { - if ( empty(self::$store) ) { - $class = apply_filters('action_scheduler_store_class', 'ActionScheduler_wpPostStore'); - self::$store = new $class(); - } - return self::$store; - } - - /** - * Get the site's local time. - * - * @deprecated 2.1.0 - * @return DateTimeZone - */ - protected function get_local_timezone() { - _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); - return ActionScheduler_TimezoneHelper::get_local_timezone(); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_TimezoneHelper.php b/includes/libraries/action-scheduler/classes/ActionScheduler_TimezoneHelper.php deleted file mode 100644 index fd01449412e..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_TimezoneHelper.php +++ /dev/null @@ -1,152 +0,0 @@ -format( 'U' ) ); - } - - if ( get_option( 'timezone_string' ) ) { - $date->setTimezone( new DateTimeZone( self::get_local_timezone_string() ) ); - } else { - $date->setUtcOffset( self::get_local_timezone_offset() ); - } - - return $date; - } - - /** - * Helper to retrieve the timezone string for a site until a WP core method exists - * (see https://core.trac.wordpress.org/ticket/24730). - * - * Adapted from wc_timezone_string() and https://secure.php.net/manual/en/function.timezone-name-from-abbr.php#89155. - * - * If no timezone string is set, and its not possible to match the UTC offset set for the site to a timezone - * string, then an empty string will be returned, and the UTC offset should be used to set a DateTime's - * timezone. - * - * @since 2.1.0 - * @return string PHP timezone string for the site or empty if no timezone string is available. - */ - protected static function get_local_timezone_string( $reset = false ) { - // If site timezone string exists, return it. - $timezone = get_option( 'timezone_string' ); - if ( $timezone ) { - return $timezone; - } - - // Get UTC offset, if it isn't set then return UTC. - $utc_offset = intval( get_option( 'gmt_offset', 0 ) ); - if ( 0 === $utc_offset ) { - return 'UTC'; - } - - // Adjust UTC offset from hours to seconds. - $utc_offset *= 3600; - - // Attempt to guess the timezone string from the UTC offset. - $timezone = timezone_name_from_abbr( '', $utc_offset ); - if ( $timezone ) { - return $timezone; - } - - // Last try, guess timezone string manually. - foreach ( timezone_abbreviations_list() as $abbr ) { - foreach ( $abbr as $city ) { - if ( (bool) date( 'I' ) === (bool) $city['dst'] && $city['timezone_id'] && intval( $city['offset'] ) === $utc_offset ) { - return $city['timezone_id']; - } - } - } - - // No timezone string - return ''; - } - - /** - * Get timezone offset in seconds. - * - * @since 2.1.0 - * @return float - */ - protected static function get_local_timezone_offset() { - $timezone = get_option( 'timezone_string' ); - - if ( $timezone ) { - $timezone_object = new DateTimeZone( $timezone ); - return $timezone_object->getOffset( new DateTime( 'now' ) ); - } else { - return floatval( get_option( 'gmt_offset', 0 ) ) * HOUR_IN_SECONDS; - } - } - - /** - * @deprecated 2.1.0 - */ - public static function get_local_timezone( $reset = FALSE ) { - _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); - if ( $reset ) { - self::$local_timezone = NULL; - } - if ( !isset(self::$local_timezone) ) { - $tzstring = get_option('timezone_string'); - - if ( empty($tzstring) ) { - $gmt_offset = get_option('gmt_offset'); - if ( $gmt_offset == 0 ) { - $tzstring = 'UTC'; - } else { - $gmt_offset *= HOUR_IN_SECONDS; - $tzstring = timezone_name_from_abbr( '', $gmt_offset, 1 ); - - // If there's no timezone string, try again with no DST. - if ( false === $tzstring ) { - $tzstring = timezone_name_from_abbr( '', $gmt_offset, 0 ); - } - - // Try mapping to the first abbreviation we can find. - if ( false === $tzstring ) { - $is_dst = date( 'I' ); - foreach ( timezone_abbreviations_list() as $abbr ) { - foreach ( $abbr as $city ) { - if ( $city['dst'] == $is_dst && $city['offset'] == $gmt_offset ) { - // If there's no valid timezone ID, keep looking. - if ( null === $city['timezone_id'] ) { - continue; - } - - $tzstring = $city['timezone_id']; - break 2; - } - } - } - } - - // If we still have no valid string, then fall back to UTC. - if ( false === $tzstring ) { - $tzstring = 'UTC'; - } - } - } - - self::$local_timezone = new DateTimeZone($tzstring); - } - return self::$local_timezone; - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_Versions.php b/includes/libraries/action-scheduler/classes/ActionScheduler_Versions.php deleted file mode 100644 index 915c2e63297..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_Versions.php +++ /dev/null @@ -1,62 +0,0 @@ -versions[$version_string]) ) { - return FALSE; - } - $this->versions[$version_string] = $initialization_callback; - return TRUE; - } - - public function get_versions() { - return $this->versions; - } - - public function latest_version() { - $keys = array_keys($this->versions); - if ( empty($keys) ) { - return false; - } - uasort( $keys, 'version_compare' ); - return end($keys); - } - - public function latest_version_callback() { - $latest = $this->latest_version(); - if ( empty($latest) || !isset($this->versions[$latest]) ) { - return '__return_null'; - } - return $this->versions[$latest]; - } - - /** - * @return ActionScheduler_Versions - * @codeCoverageIgnore - */ - public static function instance() { - if ( empty(self::$instance) ) { - self::$instance = new self(); - } - return self::$instance; - } - - /** - * @codeCoverageIgnore - */ - public static function initialize_latest_version() { - $self = self::instance(); - call_user_func($self->latest_version_callback()); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_QueueRunner.php b/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_QueueRunner.php deleted file mode 100644 index f58b718b03a..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_QueueRunner.php +++ /dev/null @@ -1,210 +0,0 @@ -run_cleanup(); - $this->add_hooks(); - - // Check to make sure there aren't too many concurrent processes running. - $claim_count = $this->store->get_claim_count(); - $too_many = $claim_count >= $this->get_allowed_concurrent_batches(); - if ( $too_many ) { - if ( $force ) { - WP_CLI::warning( __( 'There are too many concurrent batches, but the run is forced to continue.', 'action-scheduler' ) ); - } else { - WP_CLI::error( __( 'There are too many concurrent batches.', 'action-scheduler' ) ); - } - } - - // Stake a claim and store it. - $this->claim = $this->store->stake_claim( $batch_size, null, $hooks, $group ); - $this->monitor->attach( $this->claim ); - $this->actions = $this->claim->get_actions(); - - return count( $this->actions ); - } - - /** - * Add our hooks to the appropriate actions. - * - * @author Jeremy Pry - */ - protected function add_hooks() { - add_action( 'action_scheduler_before_execute', array( $this, 'before_execute' ) ); - add_action( 'action_scheduler_after_execute', array( $this, 'after_execute' ), 10, 2 ); - add_action( 'action_scheduler_failed_execution', array( $this, 'action_failed' ), 10, 2 ); - } - - /** - * Set up the WP CLI progress bar. - * - * @author Jeremy Pry - */ - protected function setup_progress_bar() { - $count = count( $this->actions ); - $this->progress_bar = \WP_CLI\Utils\make_progress_bar( - sprintf( _n( 'Running %d action', 'Running %d actions', $count, 'action-scheduler' ), number_format_i18n( $count ) ), - $count - ); - } - - /** - * Process actions in the queue. - * - * @author Jeremy Pry - * @return int The number of actions processed. - */ - public function run() { - do_action( 'action_scheduler_before_process_queue' ); - $this->setup_progress_bar(); - foreach ( $this->actions as $action_id ) { - // Error if we lost the claim. - if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $this->claim->get_id() ) ) ) { - WP_CLI::warning( __( 'The claim has been lost. Aborting current batch.', 'action-scheduler' ) ); - break; - } - - $this->process_action( $action_id ); - $this->progress_bar->tick(); - - // Free up memory after every 50 items - if ( 0 === $this->progress_bar->current() % 50 ) { - $this->stop_the_insanity(); - } - } - - $completed = $this->progress_bar->current(); - $this->progress_bar->finish(); - $this->store->release_claim( $this->claim ); - do_action( 'action_scheduler_after_process_queue' ); - - return $completed; - } - - /** - * Handle WP CLI message when the action is starting. - * - * @author Jeremy Pry - * - * @param $action_id - */ - public function before_execute( $action_id ) { - /* translators: %s refers to the action ID */ - WP_CLI::log( sprintf( __( 'Started processing action %s', 'action-scheduler' ), $action_id ) ); - } - - /** - * Handle WP CLI message when the action has completed. - * - * @author Jeremy Pry - * - * @param int $action_id - * @param null|ActionScheduler_Action $action The instance of the action. Default to null for backward compatibility. - */ - public function after_execute( $action_id, $action = null ) { - // backward compatibility - if ( null === $action ) { - $action = $this->store->fetch_action( $action_id ); - } - /* translators: %s refers to the action ID */ - WP_CLI::log( sprintf( __( 'Completed processing action %s with hook: %s', 'action-scheduler' ), $action_id, $action->get_hook() ) ); - } - - /** - * Handle WP CLI message when the action has failed. - * - * @author Jeremy Pry - * - * @param int $action_id - * @param Exception $exception - * @throws \WP_CLI\ExitException With failure message. - */ - public function action_failed( $action_id, $exception ) { - WP_CLI::error( - /* translators: %1$s refers to the action ID, %2$s refers to the Exception message */ - sprintf( __( 'Error processing action %1$s: %2$s', 'action-scheduler' ), $action_id, $exception->getMessage() ), - false - ); - } - - /** - * Sleep and help avoid hitting memory limit - * - * @param int $sleep_time Amount of seconds to sleep - */ - protected function stop_the_insanity( $sleep_time = 0 ) { - if ( 0 < $sleep_time ) { - WP_CLI::warning( sprintf( 'Stopped the insanity for %d %s', $sleep_time, _n( 'second', 'seconds', $sleep_time ) ) ); - sleep( $sleep_time ); - } - - WP_CLI::warning( __( 'Attempting to reduce used memory...', 'action-scheduler' ) ); - - /** - * @var $wpdb \wpdb - * @var $wp_object_cache \WP_Object_Cache - */ - global $wpdb, $wp_object_cache; - - $wpdb->queries = array(); - - if ( ! is_object( $wp_object_cache ) ) { - return; - } - - $wp_object_cache->group_ops = array(); - $wp_object_cache->stats = array(); - $wp_object_cache->memcache_debug = array(); - $wp_object_cache->cache = array(); - - if ( is_callable( array( $wp_object_cache, '__remoteset' ) ) ) { - call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important - } - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_Scheduler_command.php b/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_Scheduler_command.php deleted file mode 100644 index 30d0974510d..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_WPCLI_Scheduler_command.php +++ /dev/null @@ -1,145 +0,0 @@ -] - * : The maximum number of actions to run. Defaults to 100. - * - * [--batches=] - * : Limit execution to a number of batches. Defaults to 0, meaning batches will continue being executed until all actions are complete. - * - * [--cleanup-batch-size=] - * : The maximum number of actions to clean up. Defaults to the value of --batch-size. - * - * [--hooks=] - * : Only run actions with the specified hook. Omitting this option runs actions with any hook. Define multiple hooks as a comma separated string (without spaces), e.g. `--hooks=hook_one,hook_two,hook_three` - * - * [--group=] - * : Only run actions from the specified group. Omitting this option runs actions from all groups. - * - * [--force] - * : Whether to force execution despite the maximum number of concurrent processes being exceeded. - * - * @param array $args Positional arguments. - * @param array $assoc_args Keyed arguments. - * @throws \WP_CLI\ExitException When an error occurs. - */ - public function run( $args, $assoc_args ) { - // Handle passed arguments. - $batch = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'batch-size', 100 ) ); - $batches = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'batches', 0 ) ); - $clean = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'cleanup-batch-size', $batch ) ); - $hooks = explode( ',', WP_CLI\Utils\get_flag_value( $assoc_args, 'hooks', '' ) ); - $hooks = array_filter( array_map( 'trim', $hooks ) ); - $group = \WP_CLI\Utils\get_flag_value( $assoc_args, 'group', '' ); - $force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force', false ); - - $batches_completed = 0; - $actions_completed = 0; - $unlimited = $batches === 0; - - try { - // Custom queue cleaner instance. - $cleaner = new ActionScheduler_QueueCleaner( null, $clean ); - - // Get the queue runner instance - $runner = new ActionScheduler_WPCLI_QueueRunner( null, null, $cleaner ); - - // Determine how many tasks will be run in the first batch. - $total = $runner->setup( $batch, $hooks, $group, $force ); - - // Run actions for as long as possible. - while ( $total > 0 ) { - $this->print_total_actions( $total ); - $actions_completed += $runner->run(); - $batches_completed++; - - // Maybe set up tasks for the next batch. - $total = ( $unlimited || $batches_completed < $batches ) ? $runner->setup( $batch, $hooks, $group, $force ) : 0; - } - } catch ( Exception $e ) { - $this->print_error( $e ); - } - - $this->print_total_batches( $batches_completed ); - $this->print_success( $actions_completed ); - } - - /** - * Print WP CLI message about how many actions are about to be processed. - * - * @author Jeremy Pry - * - * @param int $total - */ - protected function print_total_actions( $total ) { - WP_CLI::log( - sprintf( - /* translators: %d refers to how many scheduled taks were found to run */ - _n( 'Found %d scheduled task', 'Found %d scheduled tasks', $total, 'action-scheduler' ), - number_format_i18n( $total ) - ) - ); - } - - /** - * Print WP CLI message about how many batches of actions were processed. - * - * @author Jeremy Pry - * - * @param int $batches_completed - */ - protected function print_total_batches( $batches_completed ) { - WP_CLI::log( - sprintf( - /* translators: %d refers to the total number of batches executed */ - _n( '%d batch executed.', '%d batches executed.', $batches_completed, 'action-scheduler' ), - number_format_i18n( $batches_completed ) - ) - ); - } - - /** - * Convert an exception into a WP CLI error. - * - * @author Jeremy Pry - * - * @param Exception $e The error object. - * - * @throws \WP_CLI\ExitException - */ - protected function print_error( Exception $e ) { - WP_CLI::error( - sprintf( - /* translators: %s refers to the exception error message. */ - __( 'There was an error running the action scheduler: %s', 'action-scheduler' ), - $e->getMessage() - ) - ); - } - - /** - * Print a success message with the number of completed actions. - * - * @author Jeremy Pry - * - * @param int $actions_completed - */ - protected function print_success( $actions_completed ) { - WP_CLI::success( - sprintf( - /* translators: %d refers to the total number of taskes completed */ - _n( '%d scheduled task completed.', '%d scheduled tasks completed.', $actions_completed, 'action-scheduler' ), - number_format_i18n( $actions_completed ) - ) - ); - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wcSystemStatus.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wcSystemStatus.php deleted file mode 100644 index ec7f5a44661..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_wcSystemStatus.php +++ /dev/null @@ -1,129 +0,0 @@ -store = $store; - } - - /** - * Display action data, including number of actions grouped by status and the oldest & newest action in each status. - * - * Helpful to identify issues, like a clogged queue. - */ - public function print() { - $action_counts = $this->store->action_counts(); - $status_labels = $this->store->get_status_labels(); - $oldest_and_newest = $this->get_oldest_and_newest( array_keys( $status_labels ) ); - - $this->get_template( $status_labels, $action_counts, $oldest_and_newest ); - } - - /** - * Get oldest and newest scheduled dates for a given set of statuses. - * - * @param array $status_keys Set of statuses to find oldest & newest action for. - * @return array - */ - protected function get_oldest_and_newest( $status_keys ) { - - $oldest_and_newest = array(); - - foreach ( $status_keys as $status ) { - $oldest_and_newest[ $status ] = array( - 'oldest' => '–', - 'newest' => '–', - ); - - if ( 'in-progress' === $status ) { - continue; - } - - $oldest_and_newest[ $status ]['oldest'] = $this->get_action_status_date( $status, 'oldest' ); - $oldest_and_newest[ $status ]['newest'] = $this->get_action_status_date( $status, 'newest' ); - } - - return $oldest_and_newest; - } - - /** - * Get oldest or newest scheduled date for a given status. - * - * @param string $status Action status label/name string. - * @param string $date_type Oldest or Newest. - * @return DateTime - */ - protected function get_action_status_date( $status, $date_type = 'oldest' ) { - - $order = 'oldest' === $date_type ? 'ASC' : 'DESC'; - - $action = $this->store->query_actions( array( - 'claimed' => false, - 'status' => $status, - 'per_page' => 1, - 'order' => $order, - ) ); - - if ( ! empty( $action ) ) { - $date_object = $this->store->get_date( $action[0] ); - $action_date = $date_object->format( 'Y-m-d H:i:s O' ); - } else { - $action_date = '–'; - } - - return $action_date; - } - - /** - * Get oldest or newest scheduled date for a given status. - * - * @param array $status_labels Set of statuses to find oldest & newest action for. - * @param array $action_counts Number of actions grouped by status. - * @param array $oldest_and_newest Date of the oldest and newest action with each status. - */ - protected function get_template( $status_labels, $action_counts, $oldest_and_newest ) { - ?> - - - - - - - - - - - - - - - - $count ) { - // WC uses the 3rd column for export, so we need to display more data in that (hidden when viewed as part of the table) and add an empty 2nd column. - printf( - '', - esc_html( $status_labels[ $status ] ), - number_format_i18n( $count ), - $oldest_and_newest[ $status ]['oldest'], - $oldest_and_newest[ $status ]['newest'] - ); - } - ?> - -

     
    %1$s %2$s, Oldest: %3$s, Newest: %4$s%3$s%4$s
    - - create_wp_comment( $action_id, $message, $date ); - return $comment_id; - } - - protected function create_wp_comment( $action_id, $message, DateTime $date ) { - - $comment_date_gmt = $date->format('Y-m-d H:i:s'); - ActionScheduler_TimezoneHelper::set_local_timezone( $date ); - $comment_data = array( - 'comment_post_ID' => $action_id, - 'comment_date' => $date->format('Y-m-d H:i:s'), - 'comment_date_gmt' => $comment_date_gmt, - 'comment_author' => self::AGENT, - 'comment_content' => $message, - 'comment_agent' => self::AGENT, - 'comment_type' => self::TYPE, - ); - return wp_insert_comment($comment_data); - } - - /** - * @param string $entry_id - * - * @return ActionScheduler_LogEntry - */ - public function get_entry( $entry_id ) { - $comment = $this->get_comment( $entry_id ); - if ( empty($comment) || $comment->comment_type != self::TYPE ) { - return new ActionScheduler_NullLogEntry(); - } - - $date = as_get_datetime_object( $comment->comment_date_gmt ); - ActionScheduler_TimezoneHelper::set_local_timezone( $date ); - return new ActionScheduler_LogEntry( $comment->comment_post_ID, $comment->comment_content, $date ); - } - - /** - * @param string $action_id - * - * @return ActionScheduler_LogEntry[] - */ - public function get_logs( $action_id ) { - $status = 'all'; - if ( get_post_status($action_id) == 'trash' ) { - $status = 'post-trashed'; - } - $comments = get_comments(array( - 'post_id' => $action_id, - 'orderby' => 'comment_date_gmt', - 'order' => 'ASC', - 'type' => self::TYPE, - 'status' => $status, - )); - $logs = array(); - foreach ( $comments as $c ) { - $entry = $this->get_entry( $c ); - if ( !empty($entry) ) { - $logs[] = $entry; - } - } - return $logs; - } - - protected function get_comment( $comment_id ) { - return get_comment( $comment_id ); - } - - - - /** - * @param WP_Comment_Query $query - */ - public function filter_comment_queries( $query ) { - foreach ( array('ID', 'parent', 'post_author', 'post_name', 'post_parent', 'type', 'post_type', 'post_id', 'post_ID') as $key ) { - if ( !empty($query->query_vars[$key]) ) { - return; // don't slow down queries that wouldn't include action_log comments anyway - } - } - $query->query_vars['action_log_filter'] = TRUE; - add_filter( 'comments_clauses', array( $this, 'filter_comment_query_clauses' ), 10, 2 ); - } - - /** - * @param array $clauses - * @param WP_Comment_Query $query - * - * @return array - */ - public function filter_comment_query_clauses( $clauses, $query ) { - if ( !empty($query->query_vars['action_log_filter']) ) { - $clauses['where'] .= $this->get_where_clause(); - } - return $clauses; - } - - /** - * Make sure Action Scheduler logs are excluded from comment feeds, which use WP_Query, not - * the WP_Comment_Query class handled by @see self::filter_comment_queries(). - * - * @param string $where - * @param WP_Query $query - * - * @return string - */ - public function filter_comment_feed( $where, $query ) { - if ( is_comment_feed() ) { - $where .= $this->get_where_clause(); - } - return $where; - } - - /** - * Return a SQL clause to exclude Action Scheduler comments. - * - * @return string - */ - protected function get_where_clause() { - global $wpdb; - return sprintf( " AND {$wpdb->comments}.comment_type != '%s'", self::TYPE ); - } - - /** - * Remove action log entries from wp_count_comments() - * - * @param array $stats - * @param int $post_id - * - * @return object - */ - public function filter_comment_count( $stats, $post_id ) { - global $wpdb; - - if ( 0 === $post_id ) { - $stats = $this->get_comment_count(); - } - - return $stats; - } - - /** - * Retrieve the comment counts from our cache, or the database if the cached version isn't set. - * - * @return object - */ - protected function get_comment_count() { - global $wpdb; - - $stats = get_transient( 'as_comment_count' ); - - if ( ! $stats ) { - $stats = array(); - - $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN('order_note','action_log') GROUP BY comment_approved", ARRAY_A ); - - $total = 0; - $stats = array(); - $approved = array( '0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed' ); - - foreach ( (array) $count as $row ) { - // Don't count post-trashed toward totals - if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) { - $total += $row['num_comments']; - } - if ( isset( $approved[ $row['comment_approved'] ] ) ) { - $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments']; - } - } - - $stats['total_comments'] = $total; - $stats['all'] = $total; - - foreach ( $approved as $key ) { - if ( empty( $stats[ $key ] ) ) { - $stats[ $key ] = 0; - } - } - - $stats = (object) $stats; - set_transient( 'as_comment_count', $stats ); - } - - return $stats; - } - - /** - * Delete comment count cache whenever there is new comment or the status of a comment changes. Cache - * will be regenerated next time ActionScheduler_wpCommentLogger::filter_comment_count() is called. - */ - public function delete_comment_count_cache() { - delete_transient( 'as_comment_count' ); - } - - /** - * @codeCoverageIgnore - */ - public function init() { - add_action( 'action_scheduler_before_process_queue', array( $this, 'disable_comment_counting' ), 10, 0 ); - add_action( 'action_scheduler_after_process_queue', array( $this, 'enable_comment_counting' ), 10, 0 ); - - parent::init(); - - add_action( 'pre_get_comments', array( $this, 'filter_comment_queries' ), 10, 1 ); - add_action( 'wp_count_comments', array( $this, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs - add_action( 'comment_feed_where', array( $this, 'filter_comment_feed' ), 10, 2 ); - - // Delete comments count cache whenever there is a new comment or a comment status changes - add_action( 'wp_insert_comment', array( $this, 'delete_comment_count_cache' ) ); - add_action( 'wp_set_comment_status', array( $this, 'delete_comment_count_cache' ) ); - } - - public function disable_comment_counting() { - wp_defer_comment_counting(true); - } - public function enable_comment_counting() { - wp_defer_comment_counting(false); - } - -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore.php deleted file mode 100644 index 59ee651522e..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore.php +++ /dev/null @@ -1,807 +0,0 @@ -validate_action( $action ); - $post_array = $this->create_post_array( $action, $scheduled_date ); - $post_id = $this->save_post_array( $post_array ); - $this->save_post_schedule( $post_id, $action->get_schedule() ); - $this->save_action_group( $post_id, $action->get_group() ); - do_action( 'action_scheduler_stored_action', $post_id ); - return $post_id; - } catch ( Exception $e ) { - throw new RuntimeException( sprintf( __('Error saving action: %s', 'action-scheduler'), $e->getMessage() ), 0 ); - } - } - - protected function create_post_array( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) { - $post = array( - 'post_type' => self::POST_TYPE, - 'post_title' => $action->get_hook(), - 'post_content' => json_encode($action->get_args()), - 'post_status' => ( $action->is_finished() ? 'publish' : 'pending' ), - 'post_date_gmt' => $this->get_scheduled_date_string( $action, $scheduled_date ), - 'post_date' => $this->get_scheduled_date_string_local( $action, $scheduled_date ), - ); - return $post; - } - - protected function save_post_array( $post_array ) { - add_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10, 1 ); - add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 ); - $post_id = wp_insert_post($post_array); - remove_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10 ); - remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 ); - - if ( is_wp_error($post_id) || empty($post_id) ) { - throw new RuntimeException(__('Unable to save action.', 'action-scheduler')); - } - return $post_id; - } - - public function filter_insert_post_data( $postdata ) { - if ( $postdata['post_type'] == self::POST_TYPE ) { - $postdata['post_author'] = 0; - if ( $postdata['post_status'] == 'future' ) { - $postdata['post_status'] = 'publish'; - } - } - return $postdata; - } - - /** - * Create a (probably unique) post name for scheduled actions in a more performant manner than wp_unique_post_slug(). - * - * When an action's post status is transitioned to something other than 'draft', 'pending' or 'auto-draft, like 'publish' - * or 'failed' or 'trash', WordPress will find a unique slug (stored in post_name column) using the wp_unique_post_slug() - * function. This is done to ensure URL uniqueness. The approach taken by wp_unique_post_slug() is to iterate over existing - * post_name values that match, and append a number 1 greater than the largest. This makes sense when manually creating a - * post from the Edit Post screen. It becomes a bottleneck when automatically processing thousands of actions, with a - * database containing thousands of related post_name values. - * - * WordPress 5.1 introduces the 'pre_wp_unique_post_slug' filter for plugins to address this issue. - * - * We can short-circuit WordPress's wp_unique_post_slug() approach using the 'pre_wp_unique_post_slug' filter. This - * method is available to be used as a callback on that filter. It provides a more scalable approach to generating a - * post_name/slug that is probably unique. Because Action Scheduler never actually uses the post_name field, or an - * action's slug, being probably unique is good enough. - * - * For more backstory on this issue, see: - * - https://github.com/Prospress/action-scheduler/issues/44 and - * - https://core.trac.wordpress.org/ticket/21112 - * - * @param string $override_slug Short-circuit return value. - * @param string $slug The desired slug (post_name). - * @param int $post_ID Post ID. - * @param string $post_status The post status. - * @param string $post_type Post type. - * @return string - */ - public function set_unique_post_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) { - if ( self::POST_TYPE == $post_type ) { - $override_slug = uniqid( self::POST_TYPE . '-', true ) . '-' . wp_generate_password( 32, false ); - } - return $override_slug; - } - - protected function save_post_schedule( $post_id, $schedule ) { - update_post_meta( $post_id, self::SCHEDULE_META_KEY, $schedule ); - } - - protected function save_action_group( $post_id, $group ) { - if ( empty($group) ) { - wp_set_object_terms( $post_id, array(), self::GROUP_TAXONOMY, FALSE ); - } else { - wp_set_object_terms( $post_id, array($group), self::GROUP_TAXONOMY, FALSE ); - } - } - - public function fetch_action( $action_id ) { - $post = $this->get_post( $action_id ); - if ( empty($post) || $post->post_type != self::POST_TYPE ) { - return $this->get_null_action(); - } - return $this->make_action_from_post($post); - } - - protected function get_post( $action_id ) { - if ( empty($action_id) ) { - return NULL; - } - return get_post($action_id); - } - - protected function get_null_action() { - return new ActionScheduler_NullAction(); - } - - protected function make_action_from_post( $post ) { - $hook = $post->post_title; - $args = json_decode( $post->post_content, true ); - $this->validate_args( $args, $post->ID ); - - $schedule = get_post_meta( $post->ID, self::SCHEDULE_META_KEY, true ); - if ( empty( $schedule ) || ! is_a( $schedule, 'ActionScheduler_Schedule' ) ) { - $schedule = new ActionScheduler_NullSchedule(); - } - $group = wp_get_object_terms( $post->ID, self::GROUP_TAXONOMY, array('fields' => 'names') ); - $group = empty( $group ) ? '' : reset($group); - - return ActionScheduler::factory()->get_stored_action( $this->get_action_status_by_post_status( $post->post_status ), $hook, $args, $schedule, $group ); - } - - /** - * @param string $post_status - * - * @throws InvalidArgumentException if $post_status not in known status fields returned by $this->get_status_labels() - * @return string - */ - protected function get_action_status_by_post_status( $post_status ) { - - switch ( $post_status ) { - case 'publish' : - $action_status = self::STATUS_COMPLETE; - break; - case 'trash' : - $action_status = self::STATUS_CANCELED; - break; - default : - if ( ! array_key_exists( $post_status, $this->get_status_labels() ) ) { - throw new InvalidArgumentException( sprintf( 'Invalid post status: "%s". No matching action status available.', $post_status ) ); - } - $action_status = $post_status; - break; - } - - return $action_status; - } - - /** - * @param string $action_status - * @throws InvalidArgumentException if $post_status not in known status fields returned by $this->get_status_labels() - * @return string - */ - protected function get_post_status_by_action_status( $action_status ) { - - switch ( $action_status ) { - case self::STATUS_COMPLETE : - $post_status = 'publish'; - break; - case self::STATUS_CANCELED : - $post_status = 'trash'; - break; - default : - if ( ! array_key_exists( $action_status, $this->get_status_labels() ) ) { - throw new InvalidArgumentException( sprintf( 'Invalid action status: "%s".', $action_status ) ); - } - $post_status = $action_status; - break; - } - - return $post_status; - } - - /** - * @param string $hook - * @param array $params - * - * @return string ID of the next action matching the criteria or NULL if not found - */ - public function find_action( $hook, $params = array() ) { - $params = wp_parse_args( $params, array( - 'args' => NULL, - 'status' => ActionScheduler_Store::STATUS_PENDING, - 'group' => '', - )); - /** @var wpdb $wpdb */ - global $wpdb; - $query = "SELECT p.ID FROM {$wpdb->posts} p"; - $args = array(); - if ( !empty($params['group']) ) { - $query .= " INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id=p.ID"; - $query .= " INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id=tt.term_taxonomy_id"; - $query .= " INNER JOIN {$wpdb->terms} t ON tt.term_id=t.term_id AND t.slug=%s"; - $args[] = $params['group']; - } - $query .= " WHERE p.post_title=%s"; - $args[] = $hook; - $query .= " AND p.post_type=%s"; - $args[] = self::POST_TYPE; - if ( !is_null($params['args']) ) { - $query .= " AND p.post_content=%s"; - $args[] = json_encode($params['args']); - } - - if ( ! empty( $params['status'] ) ) { - $query .= " AND p.post_status=%s"; - $args[] = $this->get_post_status_by_action_status( $params['status'] ); - } - - switch ( $params['status'] ) { - case self::STATUS_COMPLETE: - case self::STATUS_RUNNING: - case self::STATUS_FAILED: - $order = 'DESC'; // Find the most recent action that matches - break; - case self::STATUS_PENDING: - default: - $order = 'ASC'; // Find the next action that matches - break; - } - $query .= " ORDER BY post_date_gmt $order LIMIT 1"; - - $query = $wpdb->prepare( $query, $args ); - - $id = $wpdb->get_var($query); - return $id; - } - - /** - * Returns the SQL statement to query (or count) actions. - * - * @param array $query Filtering options - * @param string $select_or_count Whether the SQL should select and return the IDs or just the row count - * @throws InvalidArgumentException if $select_or_count not count or select - * @return string SQL statement. The returned SQL is already properly escaped. - */ - protected function get_query_actions_sql( array $query, $select_or_count = 'select' ) { - - if ( ! in_array( $select_or_count, array( 'select', 'count' ) ) ) { - throw new InvalidArgumentException(__('Invalid schedule. Cannot save action.', 'action-scheduler')); - } - - $query = wp_parse_args( $query, array( - 'hook' => '', - 'args' => NULL, - 'date' => NULL, - 'date_compare' => '<=', - 'modified' => NULL, - 'modified_compare' => '<=', - 'group' => '', - 'status' => '', - 'claimed' => NULL, - 'per_page' => 5, - 'offset' => 0, - 'orderby' => 'date', - 'order' => 'ASC', - 'search' => '', - ) ); - - /** @var wpdb $wpdb */ - global $wpdb; - $sql = ( 'count' === $select_or_count ) ? 'SELECT count(p.ID)' : 'SELECT p.ID '; - $sql .= "FROM {$wpdb->posts} p"; - $sql_params = array(); - if ( ! empty( $query['group'] ) || 'group' === $query['orderby'] ) { - $sql .= " INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id=p.ID"; - $sql .= " INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id=tt.term_taxonomy_id"; - $sql .= " INNER JOIN {$wpdb->terms} t ON tt.term_id=t.term_id"; - - if ( ! empty( $query['group'] ) ) { - $sql .= " AND t.slug=%s"; - $sql_params[] = $query['group']; - } - } - $sql .= " WHERE post_type=%s"; - $sql_params[] = self::POST_TYPE; - if ( $query['hook'] ) { - $sql .= " AND p.post_title=%s"; - $sql_params[] = $query['hook']; - } - if ( !is_null($query['args']) ) { - $sql .= " AND p.post_content=%s"; - $sql_params[] = json_encode($query['args']); - } - - if ( ! empty( $query['status'] ) ) { - $sql .= " AND p.post_status=%s"; - $sql_params[] = $this->get_post_status_by_action_status( $query['status'] ); - } - - if ( $query['date'] instanceof DateTime ) { - $date = clone $query['date']; - $date->setTimezone( new DateTimeZone('UTC') ); - $date_string = $date->format('Y-m-d H:i:s'); - $comparator = $this->validate_sql_comparator($query['date_compare']); - $sql .= " AND p.post_date_gmt $comparator %s"; - $sql_params[] = $date_string; - } - - if ( $query['modified'] instanceof DateTime ) { - $modified = clone $query['modified']; - $modified->setTimezone( new DateTimeZone('UTC') ); - $date_string = $modified->format('Y-m-d H:i:s'); - $comparator = $this->validate_sql_comparator($query['modified_compare']); - $sql .= " AND p.post_modified_gmt $comparator %s"; - $sql_params[] = $date_string; - } - - if ( $query['claimed'] === TRUE ) { - $sql .= " AND p.post_password != ''"; - } elseif ( $query['claimed'] === FALSE ) { - $sql .= " AND p.post_password = ''"; - } elseif ( !is_null($query['claimed']) ) { - $sql .= " AND p.post_password = %s"; - $sql_params[] = $query['claimed']; - } - - if ( ! empty( $query['search'] ) ) { - $sql .= " AND (p.post_title LIKE %s OR p.post_content LIKE %s OR p.post_password LIKE %s)"; - for( $i = 0; $i < 3; $i++ ) { - $sql_params[] = sprintf( '%%%s%%', $query['search'] ); - } - } - - if ( 'select' === $select_or_count ) { - switch ( $query['orderby'] ) { - case 'hook': - $orderby = 'p.post_title'; - break; - case 'group': - $orderby = 't.name'; - break; - case 'status': - $orderby = 'p.post_status'; - break; - case 'modified': - $orderby = 'p.post_modified'; - break; - case 'claim_id': - $orderby = 'p.post_password'; - break; - case 'schedule': - case 'date': - default: - $orderby = 'p.post_date_gmt'; - break; - } - if ( 'ASC' === strtoupper( $query['order'] ) ) { - $order = 'ASC'; - } else { - $order = 'DESC'; - } - $sql .= " ORDER BY $orderby $order"; - if ( $query['per_page'] > 0 ) { - $sql .= " LIMIT %d, %d"; - $sql_params[] = $query['offset']; - $sql_params[] = $query['per_page']; - } - } - - return $wpdb->prepare( $sql, $sql_params ); - } - - /** - * @param array $query - * @param string $query_type Whether to select or count the results. Default, select. - * @return string|array The IDs of actions matching the query - */ - public function query_actions( $query = array(), $query_type = 'select' ) { - /** @var wpdb $wpdb */ - global $wpdb; - - $sql = $this->get_query_actions_sql( $query, $query_type ); - - return ( 'count' === $query_type ) ? $wpdb->get_var( $sql ) : $wpdb->get_col( $sql ); - } - - /** - * Get a count of all actions in the store, grouped by status - * - * @return array - */ - public function action_counts() { - - $action_counts_by_status = array(); - $action_stati_and_labels = $this->get_status_labels(); - $posts_count_by_status = (array) wp_count_posts( self::POST_TYPE, 'readable' ); - - foreach ( $posts_count_by_status as $post_status_name => $count ) { - - try { - $action_status_name = $this->get_action_status_by_post_status( $post_status_name ); - } catch ( Exception $e ) { - // Ignore any post statuses that aren't for actions - continue; - } - if ( array_key_exists( $action_status_name, $action_stati_and_labels ) ) { - $action_counts_by_status[ $action_status_name ] = $count; - } - } - - return $action_counts_by_status; - } - - /** - * @param string $action_id - * - * @throws InvalidArgumentException - */ - public function cancel_action( $action_id ) { - $post = get_post($action_id); - if ( empty($post) || ($post->post_type != self::POST_TYPE) ) { - throw new InvalidArgumentException(sprintf(__('Unidentified action %s', 'action-scheduler'), $action_id)); - } - do_action( 'action_scheduler_canceled_action', $action_id ); - add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 ); - wp_trash_post($action_id); - remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 ); - } - - public function delete_action( $action_id ) { - $post = get_post($action_id); - if ( empty($post) || ($post->post_type != self::POST_TYPE) ) { - throw new InvalidArgumentException(sprintf(__('Unidentified action %s', 'action-scheduler'), $action_id)); - } - do_action( 'action_scheduler_deleted_action', $action_id ); - wp_delete_post($action_id, TRUE); - } - - /** - * @param string $action_id - * - * @throws InvalidArgumentException - * @return ActionScheduler_DateTime The date the action is schedule to run, or the date that it ran. - */ - public function get_date( $action_id ) { - $next = $this->get_date_gmt( $action_id ); - return ActionScheduler_TimezoneHelper::set_local_timezone( $next ); - } - - /** - * @param string $action_id - * - * @throws InvalidArgumentException - * @return ActionScheduler_DateTime The date the action is schedule to run, or the date that it ran. - */ - public function get_date_gmt( $action_id ) { - $post = get_post($action_id); - if ( empty($post) || ($post->post_type != self::POST_TYPE) ) { - throw new InvalidArgumentException(sprintf(__('Unidentified action %s', 'action-scheduler'), $action_id)); - } - if ( $post->post_status == 'publish' ) { - return as_get_datetime_object($post->post_modified_gmt); - } else { - return as_get_datetime_object($post->post_date_gmt); - } - } - - /** - * @param int $max_actions - * @param DateTime $before_date Jobs must be schedule before this date. Defaults to now. - * @param array $hooks Claim only actions with a hook or hooks. - * @param string $group Claim only actions in the given group. - * - * @return ActionScheduler_ActionClaim - * @throws RuntimeException When there is an error staking a claim. - * @throws InvalidArgumentException When the given group is not valid. - */ - public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' ) { - $claim_id = $this->generate_claim_id(); - $this->claim_actions( $claim_id, $max_actions, $before_date, $hooks, $group ); - $action_ids = $this->find_actions_by_claim_id( $claim_id ); - - return new ActionScheduler_ActionClaim( $claim_id, $action_ids ); - } - - /** - * @return int - */ - public function get_claim_count(){ - global $wpdb; - - $sql = "SELECT COUNT(DISTINCT post_password) FROM {$wpdb->posts} WHERE post_password != '' AND post_type = %s AND post_status IN ('in-progress','pending')"; - $sql = $wpdb->prepare( $sql, array( self::POST_TYPE ) ); - - return $wpdb->get_var( $sql ); - } - - protected function generate_claim_id() { - $claim_id = md5(microtime(true) . rand(0,1000)); - return substr($claim_id, 0, 20); // to fit in db field with 20 char limit - } - - /** - * @param string $claim_id - * @param int $limit - * @param DateTime $before_date Should use UTC timezone. - * @param array $hooks Claim only actions with a hook or hooks. - * @param string $group Claim only actions in the given group. - * - * @return int The number of actions that were claimed - * @throws RuntimeException When there is a database error. - * @throws InvalidArgumentException When the group is invalid. - */ - protected function claim_actions( $claim_id, $limit, DateTime $before_date = null, $hooks = array(), $group = '' ) { - // Set up initial variables. - $date = null === $before_date ? as_get_datetime_object() : clone $before_date; - $limit_ids = ! empty( $group ); - $ids = $limit_ids ? $this->get_actions_by_group( $group, $limit, $date ) : array(); - - // If limiting by IDs and no posts found, then return early since we have nothing to update. - if ( $limit_ids && 0 === count( $ids ) ) { - return 0; - } - - /** @var wpdb $wpdb */ - global $wpdb; - - /* - * Build up custom query to update the affected posts. Parameters are built as a separate array - * to make it easier to identify where they are in the query. - * - * We can't use $wpdb->update() here because of the "ID IN ..." clause. - */ - $update = "UPDATE {$wpdb->posts} SET post_password = %s, post_modified_gmt = %s, post_modified = %s"; - $params = array( - $claim_id, - current_time( 'mysql', true ), - current_time( 'mysql' ), - ); - - // Build initial WHERE clause. - $where = "WHERE post_type = %s AND post_status = %s AND post_password = ''"; - $params[] = self::POST_TYPE; - $params[] = ActionScheduler_Store::STATUS_PENDING; - - if ( ! empty( $hooks ) ) { - $placeholders = array_fill( 0, count( $hooks ), '%s' ); - $where .= ' AND post_title IN (' . join( ', ', $placeholders ) . ')'; - $params = array_merge( $params, array_values( $hooks ) ); - } - - /* - * Add the IDs to the WHERE clause. IDs not escaped because they came directly from a prior DB query. - * - * If we're not limiting by IDs, then include the post_date_gmt clause. - */ - if ( $limit_ids ) { - $where .= ' AND ID IN (' . join( ',', $ids ) . ')'; - } else { - $where .= ' AND post_date_gmt <= %s'; - $params[] = $date->format( 'Y-m-d H:i:s' ); - } - - // Add the ORDER BY clause and,ms limit. - $order = 'ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC LIMIT %d'; - $params[] = $limit; - - // Run the query and gather results. - $rows_affected = $wpdb->query( $wpdb->prepare( "{$update} {$where} {$order}", $params ) ); - if ( $rows_affected === false ) { - throw new RuntimeException( __( 'Unable to claim actions. Database error.', 'action-scheduler' ) ); - } - - return (int) $rows_affected; - } - - /** - * Get IDs of actions within a certain group and up to a certain date/time. - * - * @param string $group The group to use in finding actions. - * @param int $limit The number of actions to retrieve. - * @param DateTime $date DateTime object representing cutoff time for actions. Actions retrieved will be - * up to and including this DateTime. - * - * @return array IDs of actions in the appropriate group and before the appropriate time. - * @throws InvalidArgumentException When the group does not exist. - */ - protected function get_actions_by_group( $group, $limit, DateTime $date ) { - // Ensure the group exists before continuing. - if ( ! term_exists( $group, self::GROUP_TAXONOMY )) { - throw new InvalidArgumentException( sprintf( __( 'The group "%s" does not exist.', 'action-scheduler' ), $group ) ); - } - - // Set up a query for post IDs to use later. - $query = new WP_Query(); - $query_args = array( - 'fields' => 'ids', - 'post_type' => self::POST_TYPE, - 'post_status' => ActionScheduler_Store::STATUS_PENDING, - 'has_password' => false, - 'posts_per_page' => $limit * 3, - 'suppress_filters' => true, - 'no_found_rows' => true, - 'orderby' => array( - 'menu_order' => 'ASC', - 'date' => 'ASC', - 'ID' => 'ASC', - ), - 'date_query' => array( - 'column' => 'post_date_gmt', - 'before' => $date->format( 'Y-m-d H:i' ), - 'inclusive' => true, - ), - 'tax_query' => array( - array( - 'taxonomy' => self::GROUP_TAXONOMY, - 'field' => 'slug', - 'terms' => $group, - 'include_children' => false, - ), - ), - ); - - return $query->query( $query_args ); - } - - /** - * @param string $claim_id - * @return array - */ - public function find_actions_by_claim_id( $claim_id ) { - /** @var wpdb $wpdb */ - global $wpdb; - $sql = "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_password = %s"; - $sql = $wpdb->prepare( $sql, array( self::POST_TYPE, $claim_id ) ); - $action_ids = $wpdb->get_col( $sql ); - return $action_ids; - } - - public function release_claim( ActionScheduler_ActionClaim $claim ) { - $action_ids = $this->find_actions_by_claim_id( $claim->get_id() ); - if ( empty($action_ids) ) { - return; // nothing to do - } - $action_id_string = implode(',', array_map('intval', $action_ids)); - /** @var wpdb $wpdb */ - global $wpdb; - $sql = "UPDATE {$wpdb->posts} SET post_password = '' WHERE ID IN ($action_id_string) AND post_password = %s"; - $sql = $wpdb->prepare( $sql, array( $claim->get_id() ) ); - $result = $wpdb->query($sql); - if ( $result === false ) { - throw new RuntimeException( sprintf( __('Unable to unlock claim %s. Database error.', 'action-scheduler'), $claim->get_id() ) ); - } - } - - /** - * @param string $action_id - */ - public function unclaim_action( $action_id ) { - /** @var wpdb $wpdb */ - global $wpdb; - $sql = "UPDATE {$wpdb->posts} SET post_password = '' WHERE ID = %d AND post_type = %s"; - $sql = $wpdb->prepare( $sql, $action_id, self::POST_TYPE ); - $result = $wpdb->query($sql); - if ( $result === false ) { - throw new RuntimeException( sprintf( __('Unable to unlock claim on action %s. Database error.', 'action-scheduler'), $action_id ) ); - } - } - - public function mark_failure( $action_id ) { - /** @var wpdb $wpdb */ - global $wpdb; - $sql = "UPDATE {$wpdb->posts} SET post_status = %s WHERE ID = %d AND post_type = %s"; - $sql = $wpdb->prepare( $sql, self::STATUS_FAILED, $action_id, self::POST_TYPE ); - $result = $wpdb->query($sql); - if ( $result === false ) { - throw new RuntimeException( sprintf( __('Unable to mark failure on action %s. Database error.', 'action-scheduler'), $action_id ) ); - } - } - - /** - * Return an action's claim ID, as stored in the post password column - * - * @param string $action_id - * @return mixed - */ - public function get_claim_id( $action_id ) { - return $this->get_post_column( $action_id, 'post_password' ); - } - - /** - * Return an action's status, as stored in the post status column - * - * @param string $action_id - * @return mixed - */ - public function get_status( $action_id ) { - $status = $this->get_post_column( $action_id, 'post_status' ); - - if ( $status === null ) { - throw new InvalidArgumentException( __( 'Invalid action ID. No status found.', 'action-scheduler' ) ); - } - - return $this->get_action_status_by_post_status( $status ); - } - - private function get_post_column( $action_id, $column_name ) { - /** @var \wpdb $wpdb */ - global $wpdb; - return $wpdb->get_var( $wpdb->prepare( "SELECT {$column_name} FROM {$wpdb->posts} WHERE ID=%d AND post_type=%s", $action_id, self::POST_TYPE ) ); - } - - /** - * @param string $action_id - */ - public function log_execution( $action_id ) { - /** @var wpdb $wpdb */ - global $wpdb; - - $sql = "UPDATE {$wpdb->posts} SET menu_order = menu_order+1, post_status=%s, post_modified_gmt = %s, post_modified = %s WHERE ID = %d AND post_type = %s"; - $sql = $wpdb->prepare( $sql, self::STATUS_RUNNING, current_time('mysql', true), current_time('mysql'), $action_id, self::POST_TYPE ); - $wpdb->query($sql); - } - - - public function mark_complete( $action_id ) { - $post = get_post($action_id); - if ( empty($post) || ($post->post_type != self::POST_TYPE) ) { - throw new InvalidArgumentException(sprintf(__('Unidentified action %s', 'action-scheduler'), $action_id)); - } - add_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10, 1 ); - add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 ); - $result = wp_update_post(array( - 'ID' => $action_id, - 'post_status' => 'publish', - ), TRUE); - remove_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10 ); - remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 ); - if ( is_wp_error($result) ) { - throw new RuntimeException($result->get_error_message()); - } - } - - /** - * InnoDB indexes have a maximum size of 767 bytes by default, which is only 191 characters with utf8mb4. - * - * Previously, AS wasn't concerned about args length, as we used the (unindex) post_content column. However, - * as we prepare to move to custom tables, and can use an indexed VARCHAR column instead, we want to warn - * developers of this impending requirement. - * - * @param ActionScheduler_Action $action - */ - protected function validate_action( ActionScheduler_Action $action ) { - if ( strlen( json_encode( $action->get_args() ) ) > self::$max_index_length ) { - _doing_it_wrong( 'ActionScheduler_Action::$args', sprintf( 'To ensure the action args column can be indexed, action args should not be more than %d characters when encoded as JSON. Support for strings longer than this will be removed in a future version.', self::$max_index_length ), '2.1.0' ); - } - } - - /** - * @codeCoverageIgnore - */ - public function init() { - $post_type_registrar = new ActionScheduler_wpPostStore_PostTypeRegistrar(); - $post_type_registrar->register(); - - $post_status_registrar = new ActionScheduler_wpPostStore_PostStatusRegistrar(); - $post_status_registrar->register(); - - $taxonomy_registrar = new ActionScheduler_wpPostStore_TaxonomyRegistrar(); - $taxonomy_registrar->register(); - } - - /** - * Validate that we could decode action arguments. - * - * @param mixed $args The decoded arguments. - * @param int $action_id The action ID. - * - * @throws ActionScheduler_InvalidActionException When the decoded arguments are invalid. - */ - private function validate_args( $args, $action_id ) { - // Ensure we have an array of args. - if ( ! is_array( $args ) ) { - throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id ); - } - - // Validate JSON decoding if possible. - if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) { - throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id ); - } - } -} diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php deleted file mode 100644 index a85b154f3a3..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php +++ /dev/null @@ -1,57 +0,0 @@ -post_status_args(), $this->post_status_running_labels() ) ); - register_post_status( ActionScheduler_Store::STATUS_FAILED, array_merge( $this->post_status_args(), $this->post_status_failed_labels() ) ); - } - - /** - * Build the args array for the post type definition - * - * @return array - */ - protected function post_status_args() { - $args = array( - 'public' => false, - 'exclude_from_search' => false, - 'show_in_admin_all_list' => true, - 'show_in_admin_status_list' => true, - ); - - return apply_filters( 'action_scheduler_post_status_args', $args ); - } - - /** - * Build the args array for the post type definition - * - * @return array - */ - protected function post_status_failed_labels() { - $labels = array( - 'label' => _x( 'Failed', 'post' ), - 'label_count' => _n_noop( 'Failed (%s)', 'Failed (%s)' ), - ); - - return apply_filters( 'action_scheduler_post_status_failed_labels', $labels ); - } - - /** - * Build the args array for the post type definition - * - * @return array - */ - protected function post_status_running_labels() { - $labels = array( - 'label' => _x( 'In-Progress', 'post' ), - 'label_count' => _n_noop( 'In-Progress (%s)', 'In-Progress (%s)' ), - ); - - return apply_filters( 'action_scheduler_post_status_running_labels', $labels ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php deleted file mode 100644 index 8c63bd0f7ab..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php +++ /dev/null @@ -1,50 +0,0 @@ -post_type_args() ); - } - - /** - * Build the args array for the post type definition - * - * @return array - */ - protected function post_type_args() { - $args = array( - 'label' => __( 'Scheduled Actions', 'action-scheduler' ), - 'description' => __( 'Scheduled actions are hooks triggered on a cetain date and time.', 'action-scheduler' ), - 'public' => false, - 'map_meta_cap' => true, - 'hierarchical' => false, - 'supports' => array('title', 'editor','comments'), - 'rewrite' => false, - 'query_var' => false, - 'can_export' => true, - 'ep_mask' => EP_NONE, - 'labels' => array( - 'name' => __( 'Scheduled Actions', 'action-scheduler' ), - 'singular_name' => __( 'Scheduled Action', 'action-scheduler' ), - 'menu_name' => _x( 'Scheduled Actions', 'Admin menu name', 'action-scheduler' ), - 'add_new' => __( 'Add', 'action-scheduler' ), - 'add_new_item' => __( 'Add New Scheduled Action', 'action-scheduler' ), - 'edit' => __( 'Edit', 'action-scheduler' ), - 'edit_item' => __( 'Edit Scheduled Action', 'action-scheduler' ), - 'new_item' => __( 'New Scheduled Action', 'action-scheduler' ), - 'view' => __( 'View Action', 'action-scheduler' ), - 'view_item' => __( 'View Action', 'action-scheduler' ), - 'search_items' => __( 'Search Scheduled Actions', 'action-scheduler' ), - 'not_found' => __( 'No actions found', 'action-scheduler' ), - 'not_found_in_trash' => __( 'No actions found in trash', 'action-scheduler' ), - ), - ); - - $args = apply_filters('action_scheduler_post_type_args', $args); - return $args; - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php b/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php deleted file mode 100644 index 026d6257e81..00000000000 --- a/includes/libraries/action-scheduler/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php +++ /dev/null @@ -1,26 +0,0 @@ -taxonomy_args() ); - } - - protected function taxonomy_args() { - $args = array( - 'label' => __('Action Group', 'action-scheduler'), - 'public' => false, - 'hierarchical' => false, - 'show_admin_column' => true, - 'query_var' => false, - 'rewrite' => false, - ); - - $args = apply_filters('action_scheduler_taxonomy_args', $args); - return $args; - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/codecov.yml b/includes/libraries/action-scheduler/codecov.yml deleted file mode 100644 index fe69f966954..00000000000 --- a/includes/libraries/action-scheduler/codecov.yml +++ /dev/null @@ -1,13 +0,0 @@ -codecov: - branch: master - -coverage: - ignore: - - tests/.* - - lib/.* - status: - project: false - patch: false - changes: false - -comment: false diff --git a/includes/libraries/action-scheduler/composer.json b/includes/libraries/action-scheduler/composer.json deleted file mode 100644 index a3b2c4af462..00000000000 --- a/includes/libraries/action-scheduler/composer.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "prospress/action-scheduler", - "description": "Action Scheduler for WordPress and WooCommerce", - "type": "wordpress-plugin", - "license": "GPL-3.0", - "minimum-stability": "dev", - "require": {}, - "require-dev": { - "wp-cli/wp-cli": "1.5.1" - } -} diff --git a/includes/libraries/action-scheduler/composer.lock b/includes/libraries/action-scheduler/composer.lock deleted file mode 100644 index de44d8153ec..00000000000 --- a/includes/libraries/action-scheduler/composer.lock +++ /dev/null @@ -1,2909 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "f4556531e7b95173d1b769b3d7350926", - "packages": [], - "packages-dev": [ - { - "name": "composer/ca-bundle", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12", - "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5", - "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0" - }, - "suggest": { - "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\CaBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "time": "2017-03-06T11:59:08+00:00" - }, - { - "name": "composer/composer", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/composer.git", - "reference": "82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff", - "reference": "82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff", - "shasum": "" - }, - "require": { - "composer/ca-bundle": "^1.0", - "composer/semver": "^1.0", - "composer/spdx-licenses": "^1.0", - "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", - "php": "^5.3.2 || ^7.0", - "psr/log": "^1.0", - "seld/cli-prompt": "^1.0", - "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.7 || ^3.0", - "symfony/filesystem": "^2.7 || ^3.0", - "symfony/finder": "^2.7 || ^3.0", - "symfony/process": "^2.7 || ^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" - }, - "suggest": { - "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", - "ext-zip": "Enabling the zip extension allows you to unzip archives", - "ext-zlib": "Allow gzip compression of HTTP requests" - }, - "bin": [ - "bin/composer" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\": "src/Composer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", - "homepage": "https://getcomposer.org/", - "keywords": [ - "autoload", - "dependency", - "package" - ], - "time": "2017-08-09T14:23:46+00:00" - }, - { - "name": "composer/semver", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "7ea669582e6396857cf6d1c0a6cd2728f4e7e383" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/7ea669582e6396857cf6d1c0a6cd2728f4e7e383", - "reference": "7ea669582e6396857cf6d1c0a6cd2728f4e7e383", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "time": "2017-05-15T12:49:06+00:00" - }, - { - "name": "composer/spdx-licenses", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/spdx-licenses.git", - "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/2603a0d7ddc00a015deb576fa5297ca43dee6b1c", - "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Spdx\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "SPDX licenses list and validation library.", - "keywords": [ - "license", - "spdx", - "validator" - ], - "time": "2017-04-03T19:08:52+00:00" - }, - { - "name": "justinrainbow/json-schema", - "version": "5.x-dev", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d", - "reference": "36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.1", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.22" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2017-06-23T11:43:36+00:00" - }, - { - "name": "mustache/mustache", - "version": "v2.12.0", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/mustache.php.git", - "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/fe8fe72e9d580591854de404cc59a1b83ca4d19e", - "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e", - "shasum": "" - }, - "require": { - "php": ">=5.2.4" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~1.11", - "phpunit/phpunit": "~3.7|~4.0|~5.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Mustache": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "A Mustache implementation in PHP.", - "homepage": "https://github.com/bobthecow/mustache.php", - "keywords": [ - "mustache", - "templating" - ], - "time": "2017-07-11T12:54:05+00:00" - }, - { - "name": "nb/oxymel", - "version": "v0.1.0", - "source": { - "type": "git", - "url": "https://github.com/nb/oxymel.git", - "reference": "cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nb/oxymel/zipball/cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c", - "reference": "cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c", - "shasum": "" - }, - "require": { - "php": ">=5.2.4" - }, - "type": "library", - "autoload": { - "psr-0": { - "Oxymel": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nikolay Bachiyski", - "email": "nb@nikolay.bg", - "homepage": "http://extrapolate.me/" - } - ], - "description": "A sweet XML builder", - "homepage": "https://github.com/nb/oxymel", - "keywords": [ - "xml" - ], - "time": "2013-02-24T15:01:54+00:00" - }, - { - "name": "psr/container", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "2cc4a01788191489dc7459446ba832fa79a216a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/2cc4a01788191489dc7459446ba832fa79a216a7", - "reference": "2cc4a01788191489dc7459446ba832fa79a216a7", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-06-28T15:35:32+00:00" - }, - { - "name": "psr/log", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "ramsey/array_column", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/ramsey/array_column.git", - "reference": "f8e52eb28e67eb50e613b451dd916abcf783c1db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/array_column/zipball/f8e52eb28e67eb50e613b451dd916abcf783c1db", - "reference": "f8e52eb28e67eb50e613b451dd916abcf783c1db", - "shasum": "" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.8.*", - "phpunit/phpunit": "~4.5", - "satooshi/php-coveralls": "0.6.*", - "squizlabs/php_codesniffer": "~2.2" - }, - "type": "library", - "autoload": { - "files": [ - "src/array_column.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "homepage": "http://benramsey.com" - } - ], - "description": "Provides functionality for array_column() to projects using PHP earlier than version 5.5.", - "homepage": "https://github.com/ramsey/array_column", - "keywords": [ - "array", - "array_column", - "column" - ], - "time": "2015-03-20T22:07:39+00:00" - }, - { - "name": "rmccue/requests", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/rmccue/Requests.git", - "reference": "87932f52ffad70504d93f04f15690cf16a089546" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/rmccue/Requests/zipball/87932f52ffad70504d93f04f15690cf16a089546", - "reference": "87932f52ffad70504d93f04f15690cf16a089546", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "require-dev": { - "requests/test-server": "dev-master" - }, - "type": "library", - "autoload": { - "psr-0": { - "Requests": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Ryan McCue", - "homepage": "http://ryanmccue.info" - } - ], - "description": "A HTTP library written in PHP, for human beings.", - "homepage": "http://github.com/rmccue/Requests", - "keywords": [ - "curl", - "fsockopen", - "http", - "idna", - "ipv6", - "iri", - "sockets" - ], - "time": "2016-10-13T00:11:37+00:00" - }, - { - "name": "seld/cli-prompt", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/cli-prompt.git", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\CliPrompt\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", - "keywords": [ - "cli", - "console", - "hidden", - "input", - "prompt" - ], - "time": "2017-03-18T11:32:45+00:00" - }, - { - "name": "seld/jsonlint", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", - "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", - "shasum": "" - }, - "require": { - "php": "^5.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5" - }, - "bin": [ - "bin/jsonlint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Seld\\JsonLint\\": "src/Seld/JsonLint/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "JSON Linter", - "keywords": [ - "json", - "linter", - "parser", - "validator" - ], - "time": "2017-06-18T15:11:04+00:00" - }, - { - "name": "seld/phar-utils", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\PharUtils\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "PHAR file format utilities, for when PHP phars you up", - "keywords": [ - "phra" - ], - "time": "2015-10-13T18:44:15+00:00" - }, - { - "name": "symfony/config", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "d668d8c0502d2b485c00d107db65fdbc56c26282" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/d668d8c0502d2b485c00d107db65fdbc56c26282", - "reference": "d668d8c0502d2b485c00d107db65fdbc56c26282", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2017-08-05T17:34:46+00:00" - }, - { - "name": "symfony/console", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "0e283478c2d68c9bf9cc52592ad1ef1834083a85" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0e283478c2d68c9bf9cc52592ad1ef1834083a85", - "reference": "0e283478c2d68c9bf9cc52592ad1ef1834083a85", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2017-08-10T07:07:17+00:00" - }, - { - "name": "symfony/debug", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "50bda5b4b8641616d45254c6855bcd45f2f64187" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/50bda5b4b8641616d45254c6855bcd45f2f64187", - "reference": "50bda5b4b8641616d45254c6855bcd45f2f64187", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2017-08-10T07:07:17+00:00" - }, - { - "name": "symfony/dependency-injection", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "aaee88765cb21a838e8da26d6acda4ca2ae3a2ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/aaee88765cb21a838e8da26d6acda4ca2ae3a2ea", - "reference": "aaee88765cb21a838e8da26d6acda4ca2ae3a2ea", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.3.1", - "symfony/finder": "<3.3", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "require-dev": { - "symfony/config": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2017-08-10T19:43:00+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "cd8b015f859e6b60933324db00067c2f060b4d18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/cd8b015f859e6b60933324db00067c2f060b4d18", - "reference": "cd8b015f859e6b60933324db00067c2f060b4d18", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T09:34:20+00:00" - }, - { - "name": "symfony/filesystem", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "e4d366b620c8b6e2d4977c154f6a1d5b416db4dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e4d366b620c8b6e2d4977c154f6a1d5b416db4dd", - "reference": "e4d366b620c8b6e2d4977c154f6a1d5b416db4dd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T09:34:20+00:00" - }, - { - "name": "symfony/finder", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "bf0450cfe7282c5f06539c4733ba64273e91e918" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/bf0450cfe7282c5f06539c4733ba64273e91e918", - "reference": "bf0450cfe7282c5f06539c4733ba64273e91e918", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T09:34:20+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-06-14T15:44:48+00:00" - }, - { - "name": "symfony/process", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "9794f948d9af3be0157185051275d78b24d68b92" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/9794f948d9af3be0157185051275d78b24d68b92", - "reference": "9794f948d9af3be0157185051275d78b24d68b92", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T09:34:20+00:00" - }, - { - "name": "symfony/translation", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "62bb068e004874bbe39624101e1aae70ca7c05cd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/62bb068e004874bbe39624101e1aae70ca7c05cd", - "reference": "62bb068e004874bbe39624101e1aae70ca7c05cd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/yaml": "~3.3|~4.0" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T12:04:31+00:00" - }, - { - "name": "symfony/yaml", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc", - "reference": "1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-08-04T13:29:48+00:00" - }, - { - "name": "wp-cli/autoload-splitter", - "version": "v0.1.5", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/autoload-splitter.git", - "reference": "fb4302da26390811d2631c62b42b75976d224bb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/autoload-splitter/zipball/fb4302da26390811d2631c62b42b75976d224bb8", - "reference": "fb4302da26390811d2631c62b42b75976d224bb8", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1" - }, - "type": "composer-plugin", - "extra": { - "class": "WP_CLI\\AutoloadSplitter\\ComposerPlugin" - }, - "autoload": { - "psr-4": { - "WP_CLI\\AutoloadSplitter\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alain Schlesser", - "email": "alain.schlesser@gmail.com", - "homepage": "https://www.alainschlesser.com" - } - ], - "description": "Composer plugin for splitting a generated autoloader into two distinct parts.", - "homepage": "https://wp-cli.org", - "time": "2017-08-03T08:40:16+00:00" - }, - { - "name": "wp-cli/cache-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/cache-command.git", - "reference": "485f7cc6630ecabe22bbf9fa9e827958e95a2d21" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/cache-command/zipball/485f7cc6630ecabe22bbf9fa9e827958e95a2d21", - "reference": "485f7cc6630ecabe22bbf9fa9e827958e95a2d21", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "cache", - "transient" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "cache-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage object and transient caches.", - "homepage": "https://github.com/wp-cli/cache-command", - "time": "2017-08-04T11:37:19+00:00" - }, - { - "name": "wp-cli/checksum-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/checksum-command.git", - "reference": "88ccde2e82de5c2232842a9fccc2e6ade232dec6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/checksum-command/zipball/88ccde2e82de5c2232842a9fccc2e6ade232dec6", - "reference": "88ccde2e82de5c2232842a9fccc2e6ade232dec6", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "checksum core" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "checksum-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Verify WordPress core checksums.", - "homepage": "https://github.com/wp-cli/checksum-command", - "time": "2017-08-09T23:34:29+00:00" - }, - { - "name": "wp-cli/config-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/config-command.git", - "reference": "ca83ade8fb2d059b561744610947e38123b10c22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/config-command/zipball/ca83ade8fb2d059b561744610947e38123b10c22", - "reference": "ca83ade8fb2d059b561744610947e38123b10c22", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "config", - "config create", - "config get", - "config path" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "config-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage the wp-config.php file.", - "homepage": "https://github.com/wp-cli/config-command", - "time": "2017-08-04T23:41:35+00:00" - }, - { - "name": "wp-cli/core-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/core-command.git", - "reference": "fb743dab792e21b57163c5c0f563987d1471c152" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/core-command/zipball/fb743dab792e21b57163c5c0f563987d1471c152", - "reference": "fb743dab792e21b57163c5c0f563987d1471c152", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "core check-update", - "core download", - "core install", - "core is-installed", - "core multisite-convert", - "core multisite-install", - "core update", - "core update-db", - "core version" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "core-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Download, install, update and manage a WordPress install.", - "homepage": "https://github.com/wp-cli/core-command", - "time": "2017-08-04T12:31:18+00:00" - }, - { - "name": "wp-cli/cron-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/cron-command.git", - "reference": "92114b695ab0253bb705d9bd3e6d2fb47b51fad2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/cron-command/zipball/92114b695ab0253bb705d9bd3e6d2fb47b51fad2", - "reference": "92114b695ab0253bb705d9bd3e6d2fb47b51fad2", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "cron test", - "cron event delete", - "cron event list", - "cron event run", - "cron event schedule", - "cron schedule list" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "cron-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage WP-Cron events and schedules.", - "homepage": "https://github.com/wp-cli/cron-command", - "time": "2017-08-04T12:45:50+00:00" - }, - { - "name": "wp-cli/db-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/db-command.git", - "reference": "5c597abb642bcaf329e7da0801c69f4405d41c23" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/db-command/zipball/5c597abb642bcaf329e7da0801c69f4405d41c23", - "reference": "5c597abb642bcaf329e7da0801c69f4405d41c23", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "db create", - "db drop", - "db reset", - "db check", - "db optimize", - "db prefix", - "db repair", - "db cli", - "db query", - "db export", - "db import", - "db search", - "db tables", - "db size" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "db-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Perform basic database operations using credentials stored in wp-config.php.", - "homepage": "https://github.com/wp-cli/db-command", - "time": "2017-08-04T23:21:46+00:00" - }, - { - "name": "wp-cli/entity-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/entity-command.git", - "reference": "d0cd99c14e4d01aad368328da97231df0c01f9dc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/d0cd99c14e4d01aad368328da97231df0c01f9dc", - "reference": "d0cd99c14e4d01aad368328da97231df0c01f9dc", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "phpunit/phpunit": "^4.8", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "comment", - "comment meta", - "menu", - "menu item", - "menu location", - "network meta", - "option", - "option add", - "option delete", - "option get", - "option list", - "option update", - "post", - "post meta", - "post term", - "post-type", - "site", - "taxonomy", - "term", - "term meta", - "user", - "user meta", - "user term" - ] - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "entity-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage WordPress core entities.", - "homepage": "https://github.com/wp-cli/entity-command", - "time": "2017-08-11T11:53:04+00:00" - }, - { - "name": "wp-cli/eval-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/eval-command.git", - "reference": "e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/eval-command/zipball/e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4", - "reference": "e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "eval", - "eval-file" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "eval-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Execute arbitrary PHP code.", - "homepage": "https://github.com/wp-cli/eval-command", - "time": "2017-08-04T12:46:58+00:00" - }, - { - "name": "wp-cli/export-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/export-command.git", - "reference": "f5647155830d1275de4cb69cfb79748b9449b8ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/export-command/zipball/f5647155830d1275de4cb69cfb79748b9449b8ab", - "reference": "f5647155830d1275de4cb69cfb79748b9449b8ab", - "shasum": "" - }, - "require": { - "nb/oxymel": "~0.1.0", - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "export" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "export-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Export WordPress content to a WXR file.", - "homepage": "https://github.com/wp-cli/export-command", - "time": "2017-08-04T13:13:08+00:00" - }, - { - "name": "wp-cli/extension-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/extension-command.git", - "reference": "08bf48e842b9e1cb579b50cec1b6897cebf65bda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/08bf48e842b9e1cb579b50cec1b6897cebf65bda", - "reference": "08bf48e842b9e1cb579b50cec1b6897cebf65bda", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "plugin activate", - "plugin deactivate", - "plugin delete", - "plugin get", - "plugin install", - "plugin is-installed", - "plugin list", - "plugin path", - "plugin search", - "plugin status", - "plugin toggle", - "plugin uninstall", - "plugin update", - "theme activate", - "theme delete", - "theme disable", - "theme enable", - "theme get", - "theme install", - "theme is-installed", - "theme list", - "theme mod get", - "theme mod set", - "theme mod remove", - "theme path", - "theme search", - "theme status", - "theme update" - ] - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "extension-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage WordPress plugins and themes.", - "homepage": "https://github.com/wp-cli/extension-command", - "time": "2017-08-04T13:43:53+00:00" - }, - { - "name": "wp-cli/import-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/import-command.git", - "reference": "89d14aa4b8b621effbe7f9bacad2ea8a096598a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/import-command/zipball/89d14aa4b8b621effbe7f9bacad2ea8a096598a7", - "reference": "89d14aa4b8b621effbe7f9bacad2ea8a096598a7", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "import" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "import-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Import content from a WXR file.", - "homepage": "https://github.com/wp-cli/import-command", - "time": "2017-08-04T13:45:57+00:00" - }, - { - "name": "wp-cli/language-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/language-command.git", - "reference": "aff3fb6c6d7698008c7e5d33a97b25457091ae1b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/language-command/zipball/aff3fb6c6d7698008c7e5d33a97b25457091ae1b", - "reference": "aff3fb6c6d7698008c7e5d33a97b25457091ae1b", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "language core activate", - "language core install", - "language core list", - "language core uninstall", - "language core update" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "language-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage language packs.", - "homepage": "https://github.com/wp-cli/language-command", - "time": "2017-08-04T23:23:03+00:00" - }, - { - "name": "wp-cli/media-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/media-command.git", - "reference": "4a19de54a11c96b21c10719e2b7f9dd131c4261e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/media-command/zipball/4a19de54a11c96b21c10719e2b7f9dd131c4261e", - "reference": "4a19de54a11c96b21c10719e2b7f9dd131c4261e", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "media import", - "media regenerate" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "media-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Import new attachments or regenerate existing ones.", - "homepage": "https://github.com/wp-cli/media-command", - "time": "2017-08-05T04:54:48+00:00" - }, - { - "name": "wp-cli/mustangostang-spyc", - "version": "0.6.3", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/spyc.git", - "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/spyc/zipball/6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", - "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", - "shasum": "" - }, - "require": { - "php": ">=5.3.1" - }, - "require-dev": { - "phpunit/phpunit": "4.3.*@dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.5.x-dev" - } - }, - "autoload": { - "psr-4": { - "Mustangostang\\": "src/" - }, - "files": [ - "includes/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "mustangostang", - "email": "vlad.andersen@gmail.com" - } - ], - "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", - "homepage": "https://github.com/mustangostang/spyc/", - "time": "2017-04-25T11:26:20+00:00" - }, - { - "name": "wp-cli/package-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/package-command.git", - "reference": "744692180a4240ddc75a3196934cafe396dd9178" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/package-command/zipball/744692180a4240ddc75a3196934cafe396dd9178", - "reference": "744692180a4240ddc75a3196934cafe396dd9178", - "shasum": "" - }, - "require": { - "composer/composer": "^1.2.0", - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "package browse", - "package install", - "package list", - "package update", - "package uninstall" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "package-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage WP-CLI packages.", - "homepage": "https://github.com/wp-cli/package-command", - "time": "2017-08-07T12:21:11+00:00" - }, - { - "name": "wp-cli/php-cli-tools", - "version": "v0.11.6", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05", - "reference": "d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05", - "shasum": "" - }, - "require": { - "php": ">= 5.3.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "cli": "lib/" - }, - "files": [ - "lib/cli/cli.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "James Logsdon", - "email": "jlogsdon@php.net", - "role": "Developer" - }, - { - "name": "Daniel Bachhuber", - "email": "daniel@handbuilt.co", - "role": "Maintainer" - } - ], - "description": "Console utilities for PHP", - "homepage": "http://github.com/wp-cli/php-cli-tools", - "keywords": [ - "cli", - "console" - ], - "time": "2017-08-04T10:42:04+00:00" - }, - { - "name": "wp-cli/rewrite-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/rewrite-command.git", - "reference": "e858feac8d3fe053e052d8af43c090ff0b2a4e8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/rewrite-command/zipball/e858feac8d3fe053e052d8af43c090ff0b2a4e8a", - "reference": "e858feac8d3fe053e052d8af43c090ff0b2a4e8a", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "rewrite flush", - "rewrite list", - "rewrite structure" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "rewrite-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage rewrite rules.", - "homepage": "https://github.com/wp-cli/rewrite-command", - "time": "2017-08-04T15:15:53+00:00" - }, - { - "name": "wp-cli/role-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/role-command.git", - "reference": "85ddf53525b14ab040830f385710f4493058d295" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/role-command/zipball/85ddf53525b14ab040830f385710f4493058d295", - "reference": "85ddf53525b14ab040830f385710f4493058d295", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "role create", - "role delete", - "role exists", - "role list", - "role reset", - "cap add", - "cap list", - "cap remove" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "role-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage user roles and capabilities.", - "homepage": "https://github.com/wp-cli/role-command", - "time": "2017-08-04T15:17:29+00:00" - }, - { - "name": "wp-cli/scaffold-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/scaffold-command.git", - "reference": "41f1e1aa41af76b70d6cf3d21d52995e854acf4c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/scaffold-command/zipball/41f1e1aa41af76b70d6cf3d21d52995e854acf4c", - "reference": "41f1e1aa41af76b70d6cf3d21d52995e854acf4c", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "scaffold", - "scaffold _s", - "scaffold child-theme", - "scaffold plugin", - "scaffold plugin-tests", - "scaffold post-type", - "scaffold taxonomy", - "scaffold theme-tests" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "scaffold-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Generate code for post types, taxonomies, plugins, child themes, etc.", - "homepage": "https://github.com/wp-cli/scaffold-command", - "time": "2017-08-11T08:07:10+00:00" - }, - { - "name": "wp-cli/search-replace-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/search-replace-command.git", - "reference": "3e7499a65354e3a322d4d1043123b3fa55ef4f12" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/search-replace-command/zipball/3e7499a65354e3a322d4d1043123b3fa55ef4f12", - "reference": "3e7499a65354e3a322d4d1043123b3fa55ef4f12", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "search-replace" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "search-replace-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Search/replace strings in the database.", - "homepage": "https://github.com/wp-cli/search-replace-command", - "time": "2017-08-08T16:41:49+00:00" - }, - { - "name": "wp-cli/server-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/server-command.git", - "reference": "ce93df07c33e716adbbd2d329c311a3c1dd3a0b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/server-command/zipball/ce93df07c33e716adbbd2d329c311a3c1dd3a0b0", - "reference": "ce93df07c33e716adbbd2d329c311a3c1dd3a0b0", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "server" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "server-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Launch PHP's built-in web server for this specific WordPress installation.", - "homepage": "https://github.com/wp-cli/server-command", - "time": "2017-08-04T15:19:26+00:00" - }, - { - "name": "wp-cli/shell-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/shell-command.git", - "reference": "70681666302cc193a1bd41bade9ecc61e74a8c83" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/shell-command/zipball/70681666302cc193a1bd41bade9ecc61e74a8c83", - "reference": "70681666302cc193a1bd41bade9ecc61e74a8c83", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "shell" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "shell-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Interactive PHP console.", - "homepage": "https://github.com/wp-cli/shell-command", - "time": "2017-08-04T15:21:52+00:00" - }, - { - "name": "wp-cli/super-admin-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/super-admin-command.git", - "reference": "b650836d13762c764df2bbe70ad34212c0b773cd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/super-admin-command/zipball/b650836d13762c764df2bbe70ad34212c0b773cd", - "reference": "b650836d13762c764df2bbe70ad34212c0b773cd", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "super-admin add", - "super-admin list", - "super-admin remove" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "super-admin-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage super admins on WordPress multisite.", - "homepage": "https://github.com/wp-cli/super-admin-command", - "time": "2017-08-04T15:45:41+00:00" - }, - { - "name": "wp-cli/widget-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/widget-command.git", - "reference": "727af7c7b661031bc8c04ad176d4f24b862e3402" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/widget-command/zipball/727af7c7b661031bc8c04ad176d4f24b862e3402", - "reference": "727af7c7b661031bc8c04ad176d4f24b862e3402", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "widget add", - "widget deactivate", - "widget delete", - "widget list", - "widget move", - "widget reset", - "widget update", - "sidebar list" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "widget-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage widgets and sidebars.", - "homepage": "https://github.com/wp-cli/widget-command", - "time": "2017-08-04T15:24:29+00:00" - }, - { - "name": "wp-cli/wp-cli", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086", - "reference": "4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086", - "shasum": "" - }, - "require": { - "composer/composer": "^1.2.0", - "composer/semver": "~1.0", - "mustache/mustache": "~2.4", - "php": ">=5.3.29", - "ramsey/array_column": "~1.1", - "rmccue/requests": "~1.6", - "symfony/config": "^2.7|^3.0", - "symfony/console": "^2.7|^3.0", - "symfony/debug": "^2.7|^3.0", - "symfony/dependency-injection": "^2.7|^3.0", - "symfony/event-dispatcher": "^2.7|^3.0", - "symfony/filesystem": "^2.7|^3.0", - "symfony/finder": "^2.7|^3.0", - "symfony/process": "^2.1|^3.0", - "symfony/translation": "^2.7|^3.0", - "symfony/yaml": "^2.7|^3.0", - "wp-cli/autoload-splitter": "^0.1.5", - "wp-cli/cache-command": "^1.0", - "wp-cli/checksum-command": "^1.0", - "wp-cli/config-command": "^1.0", - "wp-cli/core-command": "^1.0", - "wp-cli/cron-command": "^1.0", - "wp-cli/db-command": "^1.0", - "wp-cli/entity-command": "^1.0", - "wp-cli/eval-command": "^1.0", - "wp-cli/export-command": "^1.0", - "wp-cli/extension-command": "^1.0", - "wp-cli/import-command": "^1.0", - "wp-cli/language-command": "^1.0", - "wp-cli/media-command": "^1.0", - "wp-cli/mustangostang-spyc": "^0.6.3", - "wp-cli/package-command": "^1.0", - "wp-cli/php-cli-tools": "~0.11.2", - "wp-cli/rewrite-command": "^1.0", - "wp-cli/role-command": "^1.0", - "wp-cli/scaffold-command": "^1.0", - "wp-cli/search-replace-command": "^1.0", - "wp-cli/server-command": "^1.0", - "wp-cli/shell-command": "^1.0", - "wp-cli/super-admin-command": "^1.0", - "wp-cli/widget-command": "^1.0" - }, - "require-dev": { - "behat/behat": "2.5.*", - "phpunit/phpunit": "3.7.*", - "roave/security-advisories": "dev-master" - }, - "suggest": { - "psy/psysh": "Enhanced `wp shell` functionality" - }, - "bin": [ - "bin/wp.bat", - "bin/wp" - ], - "type": "library", - "extra": { - "autoload-splitter": { - "splitter-logic": "WP_CLI\\AutoloadSplitter", - "splitter-location": "php/WP_CLI/AutoloadSplitter.php", - "split-target-prefix-true": "autoload_commands", - "split-target-prefix-false": "autoload_framework" - } - }, - "autoload": { - "psr-0": { - "WP_CLI": "php" - }, - "psr-4": { - "": "php/commands/src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A command line interface for WordPress", - "homepage": "http://wp-cli.org", - "keywords": [ - "cli", - "wordpress" - ], - "time": "2017-08-08T14:28:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "dev", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/includes/libraries/action-scheduler/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php b/includes/libraries/action-scheduler/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php deleted file mode 100644 index dac17aa42eb..00000000000 --- a/includes/libraries/action-scheduler/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php +++ /dev/null @@ -1,27 +0,0 @@ - '' - the name of the action that will be triggered - * 'args' => NULL - the args array that will be passed with the action - * 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. - * 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' - * 'modified' => NULL - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. - * 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' - * 'group' => '' - the group the action belongs to - * 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING - * 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID - * 'per_page' => 5 - Number of results to return - * 'offset' => 0 - * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date' - * 'order' => 'ASC' - * @param string $return_format OBJECT, ARRAY_A, or ids - * - * @deprecated 2.1.0 - * - * @return array - */ -function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { - _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); - return as_get_scheduled_actions( $args, $return_format ); -} diff --git a/includes/libraries/action-scheduler/functions.php b/includes/libraries/action-scheduler/functions.php deleted file mode 100644 index 2f27d7e7e34..00000000000 --- a/includes/libraries/action-scheduler/functions.php +++ /dev/null @@ -1,209 +0,0 @@ -single( $hook, $args, $timestamp, $group ); -} - -/** - * Schedule a recurring action - * - * @param int $timestamp When the first instance of the job will run - * @param int $interval_in_seconds How long to wait between runs - * @param string $hook The hook to trigger - * @param array $args Arguments to pass when the hook triggers - * @param string $group The group to assign this job to - * - * @return string The job ID - */ -function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { - return ActionScheduler::factory()->recurring( $hook, $args, $timestamp, $interval_in_seconds, $group ); -} - -/** - * Schedule an action that recurs on a cron-like schedule. - * - * @param int $timestamp The schedule will start on or after this time - * @param string $schedule A cron-link schedule string - * @see http://en.wikipedia.org/wiki/Cron - * * * * * * * - * ┬ ┬ ┬ ┬ ┬ ┬ - * | | | | | | - * | | | | | + year [optional] - * | | | | +----- day of week (0 - 7) (Sunday=0 or 7) - * | | | +---------- month (1 - 12) - * | | +--------------- day of month (1 - 31) - * | +-------------------- hour (0 - 23) - * +------------------------- min (0 - 59) - * @param string $hook The hook to trigger - * @param array $args Arguments to pass when the hook triggers - * @param string $group The group to assign this job to - * - * @return string The job ID - */ -function as_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { - return ActionScheduler::factory()->cron( $hook, $args, $timestamp, $schedule, $group ); -} - -/** - * Cancel the next occurrence of a scheduled action. - * - * While only the next instance of a recurring or cron action is unscheduled by this method, that will also prevent - * all future instances of that recurring or cron action from being run. Recurring and cron actions are scheduled in - * a sequence instead of all being scheduled at once. Each successive occurrence of a recurring action is scheduled - * only after the former action is run. If the next instance is never run, because it's unscheduled by this function, - * then the following instance will never be scheduled (or exist), which is effectively the same as being unscheduled - * by this method also. - * - * @param string $hook The hook that the job will trigger - * @param array $args Args that would have been passed to the job - * @param string $group - * - * @return string The scheduled action ID if a scheduled action was found, or empty string if no matching action found. - */ -function as_unschedule_action( $hook, $args = array(), $group = '' ) { - $params = array(); - if ( is_array($args) ) { - $params['args'] = $args; - } - if ( !empty($group) ) { - $params['group'] = $group; - } - $job_id = ActionScheduler::store()->find_action( $hook, $params ); - - if ( ! empty( $job_id ) ) { - ActionScheduler::store()->cancel_action( $job_id ); - } - - return $job_id; -} - -/** - * Cancel all occurrences of a scheduled action. - * - * @param string $hook The hook that the job will trigger - * @param array $args Args that would have been passed to the job - * @param string $group - */ -function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) { - do { - $unscheduled_action = as_unschedule_action( $hook, $args, $group ); - } while ( ! empty( $unscheduled_action ) ); -} - -/** - * @param string $hook - * @param array $args - * @param string $group - * - * @return int|bool The timestamp for the next occurrence, or false if nothing was found - */ -function as_next_scheduled_action( $hook, $args = NULL, $group = '' ) { - $params = array(); - if ( is_array($args) ) { - $params['args'] = $args; - } - if ( !empty($group) ) { - $params['group'] = $group; - } - $job_id = ActionScheduler::store()->find_action( $hook, $params ); - if ( empty($job_id) ) { - return false; - } - $job = ActionScheduler::store()->fetch_action( $job_id ); - $next = $job->get_schedule()->next(); - if ( $next ) { - return (int)($next->format('U')); - } - return false; -} - -/** - * Find scheduled actions - * - * @param array $args Possible arguments, with their default values: - * 'hook' => '' - the name of the action that will be triggered - * 'args' => NULL - the args array that will be passed with the action - * 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. - * 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' - * 'modified' => NULL - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. - * 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' - * 'group' => '' - the group the action belongs to - * 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING - * 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID - * 'per_page' => 5 - Number of results to return - * 'offset' => 0 - * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date' - * 'order' => 'ASC' - * - * @param string $return_format OBJECT, ARRAY_A, or ids - * - * @return array - */ -function as_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { - $store = ActionScheduler::store(); - foreach ( array('date', 'modified') as $key ) { - if ( isset($args[$key]) ) { - $args[$key] = as_get_datetime_object($args[$key]); - } - } - $ids = $store->query_actions( $args ); - - if ( $return_format == 'ids' || $return_format == 'int' ) { - return $ids; - } - - $actions = array(); - foreach ( $ids as $action_id ) { - $actions[$action_id] = $store->fetch_action( $action_id ); - } - - if ( $return_format == ARRAY_A ) { - foreach ( $actions as $action_id => $action_object ) { - $actions[$action_id] = get_object_vars($action_object); - } - } - - return $actions; -} - -/** - * Helper function to create an instance of DateTime based on a given - * string and timezone. By default, will return the current date/time - * in the UTC timezone. - * - * Needed because new DateTime() called without an explicit timezone - * will create a date/time in PHP's timezone, but we need to have - * assurance that a date/time uses the right timezone (which we almost - * always want to be UTC), which means we need to always include the - * timezone when instantiating datetimes rather than leaving it up to - * the PHP default. - * - * @param mixed $date_string A date/time string. Valid formats are explained in http://php.net/manual/en/datetime.formats.php - * @param string $timezone A timezone identifier, like UTC or Europe/Lisbon. The list of valid identifiers is available http://php.net/manual/en/timezones.php - * - * @return ActionScheduler_DateTime - */ -function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) { - if ( is_object( $date_string ) && $date_string instanceof DateTime ) { - $date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) ); - } elseif ( is_numeric( $date_string ) ) { - $date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) ); - } else { - $date = new ActionScheduler_DateTime( $date_string, new DateTimeZone( $timezone ) ); - } - return $date; -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression.php deleted file mode 100755 index 7f33c378f9e..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression.php +++ /dev/null @@ -1,318 +0,0 @@ - - * @link http://en.wikipedia.org/wiki/Cron - */ -class CronExpression -{ - const MINUTE = 0; - const HOUR = 1; - const DAY = 2; - const MONTH = 3; - const WEEKDAY = 4; - const YEAR = 5; - - /** - * @var array CRON expression parts - */ - private $cronParts; - - /** - * @var CronExpression_FieldFactory CRON field factory - */ - private $fieldFactory; - - /** - * @var array Order in which to test of cron parts - */ - private static $order = array(self::YEAR, self::MONTH, self::DAY, self::WEEKDAY, self::HOUR, self::MINUTE); - - /** - * Factory method to create a new CronExpression. - * - * @param string $expression The CRON expression to create. There are - * several special predefined values which can be used to substitute the - * CRON expression: - * - * @yearly, @annually) - Run once a year, midnight, Jan. 1 - 0 0 1 1 * - * @monthly - Run once a month, midnight, first of month - 0 0 1 * * - * @weekly - Run once a week, midnight on Sun - 0 0 * * 0 - * @daily - Run once a day, midnight - 0 0 * * * - * @hourly - Run once an hour, first minute - 0 * * * * - * -*@param CronExpression_FieldFactory $fieldFactory (optional) Field factory to use - * - * @return CronExpression - */ - public static function factory($expression, CronExpression_FieldFactory $fieldFactory = null) - { - $mappings = array( - '@yearly' => '0 0 1 1 *', - '@annually' => '0 0 1 1 *', - '@monthly' => '0 0 1 * *', - '@weekly' => '0 0 * * 0', - '@daily' => '0 0 * * *', - '@hourly' => '0 * * * *' - ); - - if (isset($mappings[$expression])) { - $expression = $mappings[$expression]; - } - - return new self($expression, $fieldFactory ? $fieldFactory : new CronExpression_FieldFactory()); - } - - /** - * Parse a CRON expression - * - * @param string $expression CRON expression (e.g. '8 * * * *') - * @param CronExpression_FieldFactory $fieldFactory Factory to create cron fields - */ - public function __construct($expression, CronExpression_FieldFactory $fieldFactory) - { - $this->fieldFactory = $fieldFactory; - $this->setExpression($expression); - } - - /** - * Set or change the CRON expression - * - * @param string $value CRON expression (e.g. 8 * * * *) - * - * @return CronExpression - * @throws InvalidArgumentException if not a valid CRON expression - */ - public function setExpression($value) - { - $this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); - if (count($this->cronParts) < 5) { - throw new InvalidArgumentException( - $value . ' is not a valid CRON expression' - ); - } - - foreach ($this->cronParts as $position => $part) { - $this->setPart($position, $part); - } - - return $this; - } - - /** - * Set part of the CRON expression - * - * @param int $position The position of the CRON expression to set - * @param string $value The value to set - * - * @return CronExpression - * @throws InvalidArgumentException if the value is not valid for the part - */ - public function setPart($position, $value) - { - if (!$this->fieldFactory->getField($position)->validate($value)) { - throw new InvalidArgumentException( - 'Invalid CRON field value ' . $value . ' as position ' . $position - ); - } - - $this->cronParts[$position] = $value; - - return $this; - } - - /** - * Get a next run date relative to the current date or a specific date - * - * @param string|DateTime $currentTime (optional) Relative calculation date - * @param int $nth (optional) Number of matches to skip before returning a - * matching next run date. 0, the default, will return the current - * date and time if the next run date falls on the current date and - * time. Setting this value to 1 will skip the first match and go to - * the second match. Setting this value to 2 will skip the first 2 - * matches and so on. - * @param bool $allowCurrentDate (optional) Set to TRUE to return the - * current date if it matches the cron expression - * - * @return DateTime - * @throws RuntimeException on too many iterations - */ - public function getNextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) - { - return $this->getRunDate($currentTime, $nth, false, $allowCurrentDate); - } - - /** - * Get a previous run date relative to the current date or a specific date - * - * @param string|DateTime $currentTime (optional) Relative calculation date - * @param int $nth (optional) Number of matches to skip before returning - * @param bool $allowCurrentDate (optional) Set to TRUE to return the - * current date if it matches the cron expression - * - * @return DateTime - * @throws RuntimeException on too many iterations - * @see CronExpression::getNextRunDate - */ - public function getPreviousRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) - { - return $this->getRunDate($currentTime, $nth, true, $allowCurrentDate); - } - - /** - * Get multiple run dates starting at the current date or a specific date - * - * @param int $total Set the total number of dates to calculate - * @param string|DateTime $currentTime (optional) Relative calculation date - * @param bool $invert (optional) Set to TRUE to retrieve previous dates - * @param bool $allowCurrentDate (optional) Set to TRUE to return the - * current date if it matches the cron expression - * - * @return array Returns an array of run dates - */ - public function getMultipleRunDates($total, $currentTime = 'now', $invert = false, $allowCurrentDate = false) - { - $matches = array(); - for ($i = 0; $i < max(0, $total); $i++) { - $matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate); - } - - return $matches; - } - - /** - * Get all or part of the CRON expression - * - * @param string $part (optional) Specify the part to retrieve or NULL to - * get the full cron schedule string. - * - * @return string|null Returns the CRON expression, a part of the - * CRON expression, or NULL if the part was specified but not found - */ - public function getExpression($part = null) - { - if (null === $part) { - return implode(' ', $this->cronParts); - } elseif (array_key_exists($part, $this->cronParts)) { - return $this->cronParts[$part]; - } - - return null; - } - - /** - * Helper method to output the full expression. - * - * @return string Full CRON expression - */ - public function __toString() - { - return $this->getExpression(); - } - - /** - * Determine if the cron is due to run based on the current date or a - * specific date. This method assumes that the current number of - * seconds are irrelevant, and should be called once per minute. - * - * @param string|DateTime $currentTime (optional) Relative calculation date - * - * @return bool Returns TRUE if the cron is due to run or FALSE if not - */ - public function isDue($currentTime = 'now') - { - if ('now' === $currentTime) { - $currentDate = date('Y-m-d H:i'); - $currentTime = strtotime($currentDate); - } elseif ($currentTime instanceof DateTime) { - $currentDate = $currentTime->format('Y-m-d H:i'); - $currentTime = strtotime($currentDate); - } else { - $currentTime = new DateTime($currentTime); - $currentTime->setTime($currentTime->format('H'), $currentTime->format('i'), 0); - $currentDate = $currentTime->format('Y-m-d H:i'); - $currentTime = (int)($currentTime->getTimestamp()); - } - - return $this->getNextRunDate($currentDate, 0, true)->getTimestamp() == $currentTime; - } - - /** - * Get the next or previous run date of the expression relative to a date - * - * @param string|DateTime $currentTime (optional) Relative calculation date - * @param int $nth (optional) Number of matches to skip before returning - * @param bool $invert (optional) Set to TRUE to go backwards in time - * @param bool $allowCurrentDate (optional) Set to TRUE to return the - * current date if it matches the cron expression - * - * @return DateTime - * @throws RuntimeException on too many iterations - */ - protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false) - { - if ($currentTime instanceof DateTime) { - $currentDate = $currentTime; - } else { - $currentDate = new DateTime($currentTime ? $currentTime : 'now'); - $currentDate->setTimezone(new DateTimeZone(date_default_timezone_get())); - } - - $currentDate->setTime($currentDate->format('H'), $currentDate->format('i'), 0); - $nextRun = clone $currentDate; - $nth = (int) $nth; - - // Set a hard limit to bail on an impossible date - for ($i = 0; $i < 1000; $i++) { - - foreach (self::$order as $position) { - $part = $this->getExpression($position); - if (null === $part) { - continue; - } - - $satisfied = false; - // Get the field object used to validate this part - $field = $this->fieldFactory->getField($position); - // Check if this is singular or a list - if (strpos($part, ',') === false) { - $satisfied = $field->isSatisfiedBy($nextRun, $part); - } else { - foreach (array_map('trim', explode(',', $part)) as $listPart) { - if ($field->isSatisfiedBy($nextRun, $listPart)) { - $satisfied = true; - break; - } - } - } - - // If the field is not satisfied, then start over - if (!$satisfied) { - $field->increment($nextRun, $invert); - continue 2; - } - } - - // Skip this match if needed - if ((!$allowCurrentDate && $nextRun == $currentDate) || --$nth > -1) { - $this->fieldFactory->getField(0)->increment($nextRun, $invert); - continue; - } - - return $nextRun; - } - - // @codeCoverageIgnoreStart - throw new RuntimeException('Impossible CRON expression'); - // @codeCoverageIgnoreEnd - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php deleted file mode 100755 index f8d5c00ae79..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php +++ /dev/null @@ -1,100 +0,0 @@ - - */ -abstract class CronExpression_AbstractField implements CronExpression_FieldInterface -{ - /** - * Check to see if a field is satisfied by a value - * - * @param string $dateValue Date value to check - * @param string $value Value to test - * - * @return bool - */ - public function isSatisfied($dateValue, $value) - { - if ($this->isIncrementsOfRanges($value)) { - return $this->isInIncrementsOfRanges($dateValue, $value); - } elseif ($this->isRange($value)) { - return $this->isInRange($dateValue, $value); - } - - return $value == '*' || $dateValue == $value; - } - - /** - * Check if a value is a range - * - * @param string $value Value to test - * - * @return bool - */ - public function isRange($value) - { - return strpos($value, '-') !== false; - } - - /** - * Check if a value is an increments of ranges - * - * @param string $value Value to test - * - * @return bool - */ - public function isIncrementsOfRanges($value) - { - return strpos($value, '/') !== false; - } - - /** - * Test if a value is within a range - * - * @param string $dateValue Set date value - * @param string $value Value to test - * - * @return bool - */ - public function isInRange($dateValue, $value) - { - $parts = array_map('trim', explode('-', $value, 2)); - - return $dateValue >= $parts[0] && $dateValue <= $parts[1]; - } - - /** - * Test if a value is within an increments of ranges (offset[-to]/step size) - * - * @param string $dateValue Set date value - * @param string $value Value to test - * - * @return bool - */ - public function isInIncrementsOfRanges($dateValue, $value) - { - $parts = array_map('trim', explode('/', $value, 2)); - $stepSize = isset($parts[1]) ? $parts[1] : 0; - if ($parts[0] == '*' || $parts[0] === '0') { - return (int) $dateValue % $stepSize == 0; - } - - $range = explode('-', $parts[0], 2); - $offset = $range[0]; - $to = isset($range[1]) ? $range[1] : $dateValue; - // Ensure that the date value is within the range - if ($dateValue < $offset || $dateValue > $to) { - return false; - } - - for ($i = $offset; $i <= $to; $i+= $stepSize) { - if ($i == $dateValue) { - return true; - } - } - - return false; - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php deleted file mode 100755 index 40c1d6c6e78..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php +++ /dev/null @@ -1,110 +0,0 @@ - - */ -class CronExpression_DayOfMonthField extends CronExpression_AbstractField -{ - /** - * Get the nearest day of the week for a given day in a month - * - * @param int $currentYear Current year - * @param int $currentMonth Current month - * @param int $targetDay Target day of the month - * - * @return DateTime Returns the nearest date - */ - private static function getNearestWeekday($currentYear, $currentMonth, $targetDay) - { - $tday = str_pad($targetDay, 2, '0', STR_PAD_LEFT); - $target = new DateTime("$currentYear-$currentMonth-$tday"); - $currentWeekday = (int) $target->format('N'); - - if ($currentWeekday < 6) { - return $target; - } - - $lastDayOfMonth = $target->format('t'); - - foreach (array(-1, 1, -2, 2) as $i) { - $adjusted = $targetDay + $i; - if ($adjusted > 0 && $adjusted <= $lastDayOfMonth) { - $target->setDate($currentYear, $currentMonth, $adjusted); - if ($target->format('N') < 6 && $target->format('m') == $currentMonth) { - return $target; - } - } - } - } - - /** - * {@inheritdoc} - */ - public function isSatisfiedBy(DateTime $date, $value) - { - // ? states that the field value is to be skipped - if ($value == '?') { - return true; - } - - $fieldValue = $date->format('d'); - - // Check to see if this is the last day of the month - if ($value == 'L') { - return $fieldValue == $date->format('t'); - } - - // Check to see if this is the nearest weekday to a particular value - if (strpos($value, 'W')) { - // Parse the target day - $targetDay = substr($value, 0, strpos($value, 'W')); - // Find out if the current day is the nearest day of the week - return $date->format('j') == self::getNearestWeekday( - $date->format('Y'), - $date->format('m'), - $targetDay - )->format('j'); - } - - return $this->isSatisfied($date->format('d'), $value); - } - - /** - * {@inheritdoc} - */ - public function increment(DateTime $date, $invert = false) - { - if ($invert) { - $date->modify('previous day'); - $date->setTime(23, 59); - } else { - $date->modify('next day'); - $date->setTime(0, 0); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function validate($value) - { - return (bool) preg_match('/[\*,\/\-\?LW0-9A-Za-z]+/', $value); - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php deleted file mode 100755 index e9f68a7cd6f..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php +++ /dev/null @@ -1,124 +0,0 @@ - - */ -class CronExpression_DayOfWeekField extends CronExpression_AbstractField -{ - /** - * {@inheritdoc} - */ - public function isSatisfiedBy(DateTime $date, $value) - { - if ($value == '?') { - return true; - } - - // Convert text day of the week values to integers - $value = str_ireplace( - array('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'), - range(0, 6), - $value - ); - - $currentYear = $date->format('Y'); - $currentMonth = $date->format('m'); - $lastDayOfMonth = $date->format('t'); - - // Find out if this is the last specific weekday of the month - if (strpos($value, 'L')) { - $weekday = str_replace('7', '0', substr($value, 0, strpos($value, 'L'))); - $tdate = clone $date; - $tdate->setDate($currentYear, $currentMonth, $lastDayOfMonth); - while ($tdate->format('w') != $weekday) { - $tdate->setDate($currentYear, $currentMonth, --$lastDayOfMonth); - } - - return $date->format('j') == $lastDayOfMonth; - } - - // Handle # hash tokens - if (strpos($value, '#')) { - list($weekday, $nth) = explode('#', $value); - // Validate the hash fields - if ($weekday < 1 || $weekday > 5) { - throw new InvalidArgumentException("Weekday must be a value between 1 and 5. {$weekday} given"); - } - if ($nth > 5) { - throw new InvalidArgumentException('There are never more than 5 of a given weekday in a month'); - } - // The current weekday must match the targeted weekday to proceed - if ($date->format('N') != $weekday) { - return false; - } - - $tdate = clone $date; - $tdate->setDate($currentYear, $currentMonth, 1); - $dayCount = 0; - $currentDay = 1; - while ($currentDay < $lastDayOfMonth + 1) { - if ($tdate->format('N') == $weekday) { - if (++$dayCount >= $nth) { - break; - } - } - $tdate->setDate($currentYear, $currentMonth, ++$currentDay); - } - - return $date->format('j') == $currentDay; - } - - // Handle day of the week values - if (strpos($value, '-')) { - $parts = explode('-', $value); - if ($parts[0] == '7') { - $parts[0] = '0'; - } elseif ($parts[1] == '0') { - $parts[1] = '7'; - } - $value = implode('-', $parts); - } - - // Test to see which Sunday to use -- 0 == 7 == Sunday - $format = in_array(7, str_split($value)) ? 'N' : 'w'; - $fieldValue = $date->format($format); - - return $this->isSatisfied($fieldValue, $value); - } - - /** - * {@inheritdoc} - */ - public function increment(DateTime $date, $invert = false) - { - if ($invert) { - $date->modify('-1 day'); - $date->setTime(23, 59, 0); - } else { - $date->modify('+1 day'); - $date->setTime(0, 0, 0); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function validate($value) - { - return (bool) preg_match('/[\*,\/\-0-9A-Z]+/', $value); - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php deleted file mode 100755 index 556ba1a3e31..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @link http://en.wikipedia.org/wiki/Cron - */ -class CronExpression_FieldFactory -{ - /** - * @var array Cache of instantiated fields - */ - private $fields = array(); - - /** - * Get an instance of a field object for a cron expression position - * - * @param int $position CRON expression position value to retrieve - * - * @return CronExpression_FieldInterface - * @throws InvalidArgumentException if a position is not valid - */ - public function getField($position) - { - if (!isset($this->fields[$position])) { - switch ($position) { - case 0: - $this->fields[$position] = new CronExpression_MinutesField(); - break; - case 1: - $this->fields[$position] = new CronExpression_HoursField(); - break; - case 2: - $this->fields[$position] = new CronExpression_DayOfMonthField(); - break; - case 3: - $this->fields[$position] = new CronExpression_MonthField(); - break; - case 4: - $this->fields[$position] = new CronExpression_DayOfWeekField(); - break; - case 5: - $this->fields[$position] = new CronExpression_YearField(); - break; - default: - throw new InvalidArgumentException( - $position . ' is not a valid position' - ); - } - } - - return $this->fields[$position]; - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php deleted file mode 100755 index 5d5109b70d4..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -interface CronExpression_FieldInterface -{ - /** - * Check if the respective value of a DateTime field satisfies a CRON exp - * - * @param DateTime $date DateTime object to check - * @param string $value CRON expression to test against - * - * @return bool Returns TRUE if satisfied, FALSE otherwise - */ - public function isSatisfiedBy(DateTime $date, $value); - - /** - * When a CRON expression is not satisfied, this method is used to increment - * or decrement a DateTime object by the unit of the cron field - * - * @param DateTime $date DateTime object to change - * @param bool $invert (optional) Set to TRUE to decrement - * - * @return CronExpression_FieldInterface - */ - public function increment(DateTime $date, $invert = false); - - /** - * Validates a CRON expression for a given field - * - * @param string $value CRON expression value to validate - * - * @return bool Returns TRUE if valid, FALSE otherwise - */ - public function validate($value); -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_HoursField.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_HoursField.php deleted file mode 100755 index 088ca73c719..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_HoursField.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ -class CronExpression_HoursField extends CronExpression_AbstractField -{ - /** - * {@inheritdoc} - */ - public function isSatisfiedBy(DateTime $date, $value) - { - return $this->isSatisfied($date->format('H'), $value); - } - - /** - * {@inheritdoc} - */ - public function increment(DateTime $date, $invert = false) - { - // Change timezone to UTC temporarily. This will - // allow us to go back or forwards and hour even - // if DST will be changed between the hours. - $timezone = $date->getTimezone(); - $date->setTimezone(new DateTimeZone('UTC')); - if ($invert) { - $date->modify('-1 hour'); - $date->setTime($date->format('H'), 59); - } else { - $date->modify('+1 hour'); - $date->setTime($date->format('H'), 0); - } - $date->setTimezone($timezone); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function validate($value) - { - return (bool) preg_match('/[\*,\/\-0-9]+/', $value); - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php deleted file mode 100755 index 436acf2f560..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -class CronExpression_MinutesField extends CronExpression_AbstractField -{ - /** - * {@inheritdoc} - */ - public function isSatisfiedBy(DateTime $date, $value) - { - return $this->isSatisfied($date->format('i'), $value); - } - - /** - * {@inheritdoc} - */ - public function increment(DateTime $date, $invert = false) - { - if ($invert) { - $date->modify('-1 minute'); - } else { - $date->modify('+1 minute'); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function validate($value) - { - return (bool) preg_match('/[\*,\/\-0-9]+/', $value); - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_MonthField.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_MonthField.php deleted file mode 100755 index d3deb129f46..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_MonthField.php +++ /dev/null @@ -1,55 +0,0 @@ - - */ -class CronExpression_MonthField extends CronExpression_AbstractField -{ - /** - * {@inheritdoc} - */ - public function isSatisfiedBy(DateTime $date, $value) - { - // Convert text month values to integers - $value = str_ireplace( - array( - 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', - 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC' - ), - range(1, 12), - $value - ); - - return $this->isSatisfied($date->format('m'), $value); - } - - /** - * {@inheritdoc} - */ - public function increment(DateTime $date, $invert = false) - { - if ($invert) { - // $date->modify('last day of previous month'); // remove for php 5.2 compat - $date->modify('previous month'); - $date->modify($date->format('Y-m-t')); - $date->setTime(23, 59); - } else { - //$date->modify('first day of next month'); // remove for php 5.2 compat - $date->modify('next month'); - $date->modify($date->format('Y-m-01')); - $date->setTime(0, 0); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function validate($value) - { - return (bool) preg_match('/[\*,\/\-0-9A-Z]+/', $value); - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php b/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php deleted file mode 100755 index f11562e4513..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_YearField.php +++ /dev/null @@ -1,43 +0,0 @@ - - */ -class CronExpression_YearField extends CronExpression_AbstractField -{ - /** - * {@inheritdoc} - */ - public function isSatisfiedBy(DateTime $date, $value) - { - return $this->isSatisfied($date->format('Y'), $value); - } - - /** - * {@inheritdoc} - */ - public function increment(DateTime $date, $invert = false) - { - if ($invert) { - $date->modify('-1 year'); - $date->setDate($date->format('Y'), 12, 31); - $date->setTime(23, 59, 0); - } else { - $date->modify('+1 year'); - $date->setDate($date->format('Y'), 1, 1); - $date->setTime(0, 0, 0); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function validate($value) - { - return (bool) preg_match('/[\*,\/\-0-9]+/', $value); - } -} diff --git a/includes/libraries/action-scheduler/lib/cron-expression/LICENSE b/includes/libraries/action-scheduler/lib/cron-expression/LICENSE deleted file mode 100755 index c6d88ac6c2f..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Michael Dowling and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/includes/libraries/action-scheduler/lib/cron-expression/README.md b/includes/libraries/action-scheduler/lib/cron-expression/README.md deleted file mode 100755 index d4d9d5add19..00000000000 --- a/includes/libraries/action-scheduler/lib/cron-expression/README.md +++ /dev/null @@ -1,92 +0,0 @@ -PHP Cron Expression Parser -========================== - -[![Latest Stable Version](https://poser.pugx.org/mtdowling/cron-expression/v/stable.png)](https://packagist.org/packages/mtdowling/cron-expression) [![Total Downloads](https://poser.pugx.org/mtdowling/cron-expression/downloads.png)](https://packagist.org/packages/mtdowling/cron-expression) [![Build Status](https://secure.travis-ci.org/mtdowling/cron-expression.png)](http://travis-ci.org/mtdowling/cron-expression) - -The PHP cron expression parser can parse a CRON expression, determine if it is -due to run, calculate the next run date of the expression, and calculate the previous -run date of the expression. You can calculate dates far into the future or past by -skipping n number of matching dates. - -The parser can handle increments of ranges (e.g. */12, 2-59/3), intervals (e.g. 0-9), -lists (e.g. 1,2,3), W to find the nearest weekday for a given day of the month, L to -find the last day of the month, L to find the last given weekday of a month, and hash -(#) to find the nth weekday of a given month. - -Credits -========== - -Created by Micheal Dowling. Ported to PHP 5.2 by Flightless, Inc. -Based on version 1.0.3: https://github.com/mtdowling/cron-expression/tree/v1.0.3 - -Installing -========== - -Add the following to your project's composer.json: - -```javascript -{ - "require": { - "mtdowling/cron-expression": "1.0.*" - } -} -``` - -Usage -===== -```php -isDue(); -echo $cron->getNextRunDate()->format('Y-m-d H:i:s'); -echo $cron->getPreviousRunDate()->format('Y-m-d H:i:s'); - -// Works with complex expressions -$cron = Cron\CronExpression::factory('3-59/15 2,6-12 */15 1 2-5'); -echo $cron->getNextRunDate()->format('Y-m-d H:i:s'); - -// Calculate a run date two iterations into the future -$cron = Cron\CronExpression::factory('@daily'); -echo $cron->getNextRunDate(null, 2)->format('Y-m-d H:i:s'); - -// Calculate a run date relative to a specific time -$cron = Cron\CronExpression::factory('@monthly'); -echo $cron->getNextRunDate('2010-01-12 00:00:00')->format('Y-m-d H:i:s'); -``` - -CRON Expressions -================ - -A CRON expression is a string representing the schedule for a particular command to execute. The parts of a CRON schedule are as follows: - - * * * * * * - - - - - - - - | | | | | | - | | | | | + year [optional] - | | | | +----- day of week (0 - 7) (Sunday=0 or 7) - | | | +---------- month (1 - 12) - | | +--------------- day of month (1 - 31) - | +-------------------- hour (0 - 23) - +------------------------- min (0 - 59) - -Requirements -============ - -- PHP 5.3+ -- PHPUnit is required to run the unit tests -- Composer is required to run the unit tests - -CHANGELOG -========= - -1.0.3 (2013-11-23) ------------------- - -* Only set default timezone if the given $currentTime is not a DateTime instance (#34) -* Fixes issue #28 where PHP increments of ranges were failing due to PHP casting hyphens to 0 -* Now supports expressions with any number of extra spaces, tabs, or newlines -* Using static instead of self in `CronExpression::factory` diff --git a/includes/libraries/action-scheduler/license.txt b/includes/libraries/action-scheduler/license.txt deleted file mode 100644 index 20d40b6bcec..00000000000 --- a/includes/libraries/action-scheduler/license.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/ActionScheduler_UnitTestCase.php b/includes/libraries/action-scheduler/tests/ActionScheduler_UnitTestCase.php deleted file mode 100644 index f51e6ccdc7b..00000000000 --- a/includes/libraries/action-scheduler/tests/ActionScheduler_UnitTestCase.php +++ /dev/null @@ -1,44 +0,0 @@ -createResult(); - } - - if ( 'UTC' != ( $this->existing_timezone = date_default_timezone_get() ) ) { - date_default_timezone_set( 'UTC' ); - $result->run( $this ); - } - - date_default_timezone_set( 'Pacific/Fiji' ); // UTC+12 - $result->run( $this ); - - date_default_timezone_set( 'Pacific/Tahiti' ); // UTC-10: it's a magical place - $result->run( $this ); - - date_default_timezone_set( $this->existing_timezone ); - - return $result; - } -} diff --git a/includes/libraries/action-scheduler/tests/bootstrap.php b/includes/libraries/action-scheduler/tests/bootstrap.php deleted file mode 100644 index f7096db473c..00000000000 --- a/includes/libraries/action-scheduler/tests/bootstrap.php +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - ./phpunit - - - - - ignore - - - - - .. - - . - - - - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php b/includes/libraries/action-scheduler/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php deleted file mode 100644 index 03901155715..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php +++ /dev/null @@ -1,44 +0,0 @@ -createResult(); - } - - if ( 'UTC' != ( $this->existing_timezone = date_default_timezone_get() ) ) { - date_default_timezone_set( 'UTC' ); - $result->run( $this ); - } - - date_default_timezone_set( 'Pacific/Fiji' ); // UTC+12 - $result->run( $this ); - - date_default_timezone_set( 'Pacific/Tahiti' ); // UTC-10: it's a magical place - $result->run( $this ); - - date_default_timezone_set( $this->existing_timezone ); - - return $result; - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php b/includes/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php deleted file mode 100644 index 03d8195eb6d..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php +++ /dev/null @@ -1,100 +0,0 @@ -getTimezone(); - $this->assertInstanceOf( 'DateTimeZone', $timezone ); - $this->assertEquals( $timezone_string, $timezone->getName() ); - - remove_filter( 'option_timezone_string', $timezone_filter ); - } - - public function local_timezone_provider() { - return array( - array( 'America/New_York' ), - array( 'Australia/Melbourne' ), - array( 'UTC' ), - ); - } - - /** - * Ensure that most GMT offsets don't return UTC as the timezone. - * - * @dataProvider local_timezone_offsets_provider - * - * @param $gmt_offset - */ - public function test_local_timezone_offsets( $gmt_offset ) { - $gmt_filter = function ( $gmt ) use ( $gmt_offset ) { - return $gmt_offset; - }; - - $date = new ActionScheduler_DateTime(); - - add_filter( 'option_gmt_offset', $gmt_filter ); - ActionScheduler_TimezoneHelper::set_local_timezone( $date ); - remove_filter( 'option_gmt_offset', $gmt_filter ); - - $offset_in_seconds = $gmt_offset * HOUR_IN_SECONDS; - - $this->assertEquals( $offset_in_seconds, $date->getOffset() ); - $this->assertEquals( $offset_in_seconds, $date->getOffsetTimestamp() - $date->getTimestamp() ); - } - - public function local_timezone_offsets_provider() { - return array( - array( '-11' ), - array( '-10.5' ), - array( '-10' ), - array( '-9' ), - array( '-8' ), - array( '-7' ), - array( '-6' ), - array( '-5' ), - array( '-4.5' ), - array( '-4' ), - array( '-3.5' ), - array( '-3' ), - array( '-2' ), - array( '-1' ), - array( '1' ), - array( '1.5' ), - array( '2' ), - array( '3' ), - array( '4' ), - array( '5' ), - array( '5.5' ), - array( '5.75' ), - array( '6' ), - array( '7' ), - array( '8' ), - array( '8.5' ), - array( '9' ), - array( '9.5' ), - array( '10' ), - array( '10.5' ), - array( '11' ), - array( '11.5' ), - array( '12' ), - array( '13' ), - ); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php b/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php deleted file mode 100644 index 629f97f7c1d..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php +++ /dev/null @@ -1,55 +0,0 @@ -assertEquals( $schedule, $action->get_schedule() ); - } - - public function test_null_schedule() { - $action = new ActionScheduler_Action('my_hook'); - $this->assertInstanceOf( 'ActionScheduler_NullSchedule', $action->get_schedule() ); - } - - public function test_set_hook() { - $action = new ActionScheduler_Action('my_hook'); - $this->assertEquals( 'my_hook', $action->get_hook() ); - } - - public function test_args() { - $action = new ActionScheduler_Action('my_hook'); - $this->assertEmpty($action->get_args()); - - $action = new ActionScheduler_Action('my_hook', array(5,10,15)); - $this->assertEqualSets(array(5,10,15), $action->get_args()); - } - - public function test_set_group() { - $action = new ActionScheduler_Action('my_hook', array(), NULL, 'my_group'); - $this->assertEquals('my_group', $action->get_group()); - } - - public function test_execute() { - $mock = new MockAction(); - - $random = md5(rand()); - add_action( $random, array( $mock, 'action' ) ); - - $action = new ActionScheduler_Action( $random, array($random) ); - $action->execute(); - - remove_action( $random, array( $mock, 'action' ) ); - - $this->assertEquals( 1, $mock->get_call_count() ); - $events = $mock->get_events(); - $event = reset($events); - $this->assertEquals( $random, reset($event['args']) ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php b/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php deleted file mode 100644 index d144e88e21c..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php +++ /dev/null @@ -1,16 +0,0 @@ -assertEmpty($action->get_hook()); - $this->assertEmpty($action->get_args()); - $this->assertNull($action->get_schedule()->next()); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php b/includes/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php deleted file mode 100644 index 4cbd8485065..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php +++ /dev/null @@ -1,375 +0,0 @@ -save_action($action); - - $this->assertNotEmpty($action_id); - } - - public function test_create_action_with_scheduled_date() { - $time = as_get_datetime_object( strtotime( '-1 week' ) ); - $action = new ActionScheduler_Action( 'my_hook', array(), new ActionScheduler_SimpleSchedule( $time ) ); - $store = new ActionScheduler_wpPostStore(); - - $action_id = $store->save_action( $action, $time ); - $action_date = $store->get_date( $action_id ); - - $this->assertEquals( $time->getTimestamp(), $action_date->getTimestamp() ); - } - - public function test_retrieve_action() { - $time = as_get_datetime_object(); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array(), $schedule, 'my_group'); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $retrieved = $store->fetch_action($action_id); - $this->assertEquals($action->get_hook(), $retrieved->get_hook()); - $this->assertEqualSets($action->get_args(), $retrieved->get_args()); - $this->assertEquals($action->get_schedule()->next()->getTimestamp(), $retrieved->get_schedule()->next()->getTimestamp()); - $this->assertEquals($action->get_group(), $retrieved->get_group()); - } - - /** - * @expectedException ActionScheduler_InvalidActionException - * @dataProvider provide_bad_args - * - * @param string $content - */ - public function test_action_bad_args( $content ) { - $store = new ActionScheduler_wpPostStore(); - $post_id = wp_insert_post( array( - 'post_type' => ActionScheduler_wpPostStore::POST_TYPE, - 'post_status' => ActionScheduler_Store::STATUS_PENDING, - 'post_content' => $content, - ) ); - - $store->fetch_action( $post_id ); - } - - public function provide_bad_args() { - return array( - array( '{"bad_json":true}}' ), - ); - } - - public function test_cancel_action() { - $time = as_get_datetime_object(); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array(), $schedule, 'my_group'); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - $store->cancel_action( $action_id ); - - $fetched = $store->fetch_action( $action_id ); - $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); - } - - public function test_claim_actions() { - $created_actions = array(); - $store = new ActionScheduler_wpPostStore(); - for ( $i = 3 ; $i > -3 ; $i-- ) { - $time = as_get_datetime_object($i.' hours'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); - $created_actions[] = $store->save_action($action); - } - - $claim = $store->stake_claim(); - $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); - - $this->assertCount( 3, $claim->get_actions() ); - $this->assertEqualSets( array_slice( $created_actions, 3, 3 ), $claim->get_actions() ); - } - - public function test_claim_actions_order() { - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); - $created_actions = array( - $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), - $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), - ); - - $claim = $store->stake_claim(); - $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); - - // Verify uniqueness of action IDs. - $this->assertEquals( 2, count( array_unique( $created_actions ) ) ); - - // Verify the count and order of the actions. - $claimed_actions = $claim->get_actions(); - $this->assertCount( 2, $claimed_actions ); - $this->assertEquals( $created_actions, $claimed_actions ); - - // Verify the reversed order doesn't pass. - $reversed_actions = array_reverse( $created_actions ); - $this->assertNotEquals( $reversed_actions, $claimed_actions ); - } - - public function test_duplicate_claim() { - $created_actions = array(); - $store = new ActionScheduler_wpPostStore(); - for ( $i = 0 ; $i > -3 ; $i-- ) { - $time = as_get_datetime_object($i.' hours'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); - $created_actions[] = $store->save_action($action); - } - - $claim1 = $store->stake_claim(); - $claim2 = $store->stake_claim(); - $this->assertCount( 3, $claim1->get_actions() ); - $this->assertCount( 0, $claim2->get_actions() ); - } - - public function test_release_claim() { - $created_actions = array(); - $store = new ActionScheduler_wpPostStore(); - for ( $i = 0 ; $i > -3 ; $i-- ) { - $time = as_get_datetime_object($i.' hours'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); - $created_actions[] = $store->save_action($action); - } - - $claim1 = $store->stake_claim(); - - $store->release_claim( $claim1 ); - - $claim2 = $store->stake_claim(); - $this->assertCount( 3, $claim2->get_actions() ); - } - - public function test_search() { - $created_actions = array(); - $store = new ActionScheduler_wpPostStore(); - for ( $i = -3 ; $i <= 3 ; $i++ ) { - $time = as_get_datetime_object($i.' hours'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); - $created_actions[] = $store->save_action($action); - } - - $next_no_args = $store->find_action( 'my_hook' ); - $this->assertEquals( $created_actions[0], $next_no_args ); - - $next_with_args = $store->find_action( 'my_hook', array( 'args' => array( 1 ) ) ); - $this->assertEquals( $created_actions[4], $next_with_args ); - - $non_existent = $store->find_action( 'my_hook', array( 'args' => array( 17 ) ) ); - $this->assertNull( $non_existent ); - } - - public function test_search_by_group() { - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('tomorrow')); - $abc = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'abc')); - $def = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'def')); - $ghi = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'ghi')); - - $this->assertEquals( $abc, $store->find_action('my_hook', array('group' => 'abc'))); - $this->assertEquals( $def, $store->find_action('my_hook', array('group' => 'def'))); - $this->assertEquals( $ghi, $store->find_action('my_hook', array('group' => 'ghi'))); - } - - public function test_post_author() { - $current_user = get_current_user_id(); - - $time = as_get_datetime_object(); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $post = get_post($action_id); - $this->assertEquals(0, $post->post_author); - - $new_user = $this->factory->user->create_object(array( - 'user_login' => __FUNCTION__, - 'user_pass' => md5(rand()), - )); - wp_set_current_user( $new_user ); - - - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $action_id = $store->save_action($action); - $post = get_post($action_id); - $this->assertEquals(0, $post->post_author); - - wp_set_current_user($current_user); - } - - /** - * @issue 13 - */ - public function test_post_status_for_recurring_action() { - $time = as_get_datetime_object('10 minutes'); - $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $action = $store->fetch_action($action_id); - $action->execute(); - $store->mark_complete( $action_id ); - - $next = $action->get_schedule()->next( as_get_datetime_object() ); - $new_action_id = $store->save_action( $action, $next ); - - $this->assertEquals('publish', get_post_status($action_id)); - $this->assertEquals('pending', get_post_status($new_action_id)); - } - - public function test_get_run_date() { - $time = as_get_datetime_object('-10 minutes'); - $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $this->assertEquals( $store->get_date($action_id)->getTimestamp(), $time->getTimestamp() ); - - $action = $store->fetch_action($action_id); - $action->execute(); - $now = as_get_datetime_object(); - $store->mark_complete( $action_id ); - - $this->assertEquals( $store->get_date($action_id)->getTimestamp(), $now->getTimestamp() ); - - $next = $action->get_schedule()->next( $now ); - $new_action_id = $store->save_action( $action, $next ); - - $this->assertEquals( (int)($now->getTimestamp()) + HOUR_IN_SECONDS, $store->get_date($new_action_id)->getTimestamp() ); - } - - public function test_get_status() { - $time = as_get_datetime_object('-10 minutes'); - $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $this->assertEquals( ActionScheduler_Store::STATUS_PENDING, $store->get_status( $action_id ) ); - - $store->mark_complete( $action_id ); - $this->assertEquals( ActionScheduler_Store::STATUS_COMPLETE, $store->get_status( $action_id ) ); - - $store->mark_failure( $action_id ); - $this->assertEquals( ActionScheduler_Store::STATUS_FAILED, $store->get_status( $action_id ) ); - } - - public function test_claim_actions_by_hooks() { - $hook1 = __FUNCTION__ . '_hook_1'; - $hook2 = __FUNCTION__ . '_hook_2'; - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); - - $action1 = $store->save_action( new ActionScheduler_Action( $hook1, array(), $schedule ) ); - $action2 = $store->save_action( new ActionScheduler_Action( $hook2, array(), $schedule ) ); - - // Claiming no hooks should include all actions. - $claim = $store->stake_claim( 10 ); - $this->assertEquals( 2, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a hook should claim only actions with that hook - $claim = $store->stake_claim( 10, null, array( $hook1 ) ); - $this->assertEquals( 1, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming two hooks should claim actions with either of those hooks - $claim = $store->stake_claim( 10, null, array( $hook1, $hook2 ) ); - $this->assertEquals( 2, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming two hooks should claim actions with either of those hooks - $claim = $store->stake_claim( 10, null, array( __METHOD__ . '_hook_3' ) ); - $this->assertEquals( 0, count( $claim->get_actions() ) ); - $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); - $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - } - - /** - * @issue 121 - */ - public function test_claim_actions_by_group() { - $group1 = md5( rand() ); - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); - - $action1 = $store->save_action( new ActionScheduler_Action( __METHOD__, array(), $schedule, $group1 ) ); - $action2 = $store->save_action( new ActionScheduler_Action( __METHOD__, array(), $schedule ) ); - - // Claiming no group should include all actions. - $claim = $store->stake_claim( 10 ); - $this->assertEquals( 2, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a group should claim only actions in that group. - $claim = $store->stake_claim( 10, null, array(), $group1 ); - $this->assertEquals( 1, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $store->release_claim( $claim ); - } - - public function test_claim_actions_by_hook_and_group() { - $hook1 = __FUNCTION__ . '_hook_1'; - $hook2 = __FUNCTION__ . '_hook_2'; - $hook3 = __FUNCTION__ . '_hook_3'; - $group1 = 'group_' . md5( rand() ); - $group2 = 'group_' . md5( rand() ); - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); - - $action1 = $store->save_action( new ActionScheduler_Action( $hook1, array(), $schedule, $group1 ) ); - $action2 = $store->save_action( new ActionScheduler_Action( $hook2, array(), $schedule ) ); - $action3 = $store->save_action( new ActionScheduler_Action( $hook3, array(), $schedule, $group2 ) ); - - // Claiming no hooks or group should include all actions. - $claim = $store->stake_claim( 10 ); - $this->assertEquals( 3, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a group and hook should claim only actions in that group. - $claim = $store->stake_claim( 10, null, array( $hook1 ), $group1 ); - $this->assertEquals( 1, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a group and hook should claim only actions with that hook in that group. - $claim = $store->stake_claim( 10, null, array( $hook2 ), $group1 ); - $this->assertEquals( 0, count( $claim->get_actions() ) ); - $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); - $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a group and hook should claim only actions with that hook in that group. - $claim = $store->stake_claim( 10, null, array( $hook1, $hook2 ), $group2 ); - $this->assertEquals( 0, count( $claim->get_actions() ) ); - $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); - $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php b/includes/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php deleted file mode 100644 index 154b822a896..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php +++ /dev/null @@ -1,185 +0,0 @@ -assertInstanceOf( 'ActionScheduler_Logger', $logger ); - $this->assertInstanceOf( 'ActionScheduler_wpCommentLogger', $logger ); - } - - public function test_add_log_entry() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $message = 'Logging that something happened'; - $log_id = $logger->log( $action_id, $message ); - $entry = $logger->get_entry( $log_id ); - - $this->assertEquals( $action_id, $entry->get_action_id() ); - $this->assertEquals( $message, $entry->get_message() ); - } - - public function test_add_log_datetime() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $message = 'Logging that something happened'; - $date = new DateTime( 'now', new DateTimeZone( 'UTC' ) ); - $log_id = $logger->log( $action_id, $message, $date ); - $entry = $logger->get_entry( $log_id ); - - $this->assertEquals( $action_id, $entry->get_action_id() ); - $this->assertEquals( $message, $entry->get_message() ); - - $date = new ActionScheduler_DateTime( 'now', new DateTimeZone( 'UTC' ) ); - $log_id = $logger->log( $action_id, $message, $date ); - $entry = $logger->get_entry( $log_id ); - - $this->assertEquals( $action_id, $entry->get_action_id() ); - $this->assertEquals( $message, $entry->get_message() ); - } - - public function test_null_log_entry() { - $logger = ActionScheduler::logger(); - $entry = $logger->get_entry( 1 ); - $this->assertEquals( '', $entry->get_action_id() ); - $this->assertEquals( '', $entry->get_message() ); - } - - public function test_erroneous_entry_id() { - $comment = wp_insert_comment(array( - 'comment_post_ID' => 1, - 'comment_author' => 'test', - 'comment_content' => 'this is not a log entry', - )); - $logger = ActionScheduler::logger(); - $entry = $logger->get_entry( $comment ); - $this->assertEquals( '', $entry->get_action_id() ); - $this->assertEquals( '', $entry->get_message() ); - } - - public function test_storage_comments() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $logs = $logger->get_logs( $action_id ); - $expected = new ActionScheduler_LogEntry( $action_id, 'action created' ); - $this->assertTrue( in_array( $this->log_entry_to_array( $expected ) , $this->log_entry_to_array( $logs ) ) ); - } - - protected function log_entry_to_array( $logs ) { - if ( $logs instanceof ActionScheduler_LogEntry ) { - return array( 'action_id' => $logs->get_action_id(), 'message' => $logs->get_message() ); - } - - foreach ( $logs as $id => $log) { - $logs[ $id ] = array( 'action_id' => $log->get_action_id(), 'message' => $log->get_message() ); - } - - return $logs; - } - - public function test_execution_comments() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $started = new ActionScheduler_LogEntry( $action_id, 'action started' ); - $finished = new ActionScheduler_LogEntry( $action_id, 'action complete' ); - - $runner = new ActionScheduler_QueueRunner(); - $runner->run(); - - $logs = $logger->get_logs( $action_id ); - $this->assertTrue( in_array( $this->log_entry_to_array( $started ), $this->log_entry_to_array( $logs ) ) ); - $this->assertTrue( in_array( $this->log_entry_to_array( $finished ), $this->log_entry_to_array( $logs ) ) ); - } - - public function test_failed_execution_comments() { - $hook = md5(rand()); - add_action( $hook, array( $this, '_a_hook_callback_that_throws_an_exception' ) ); - $action_id = as_schedule_single_action( time(), $hook ); - $logger = ActionScheduler::logger(); - $started = new ActionScheduler_LogEntry( $action_id, 'action started' ); - $finished = new ActionScheduler_LogEntry( $action_id, 'action complete' ); - $failed = new ActionScheduler_LogEntry( $action_id, 'action failed: Execution failed' ); - - $runner = new ActionScheduler_QueueRunner(); - $runner->run(); - - $logs = $logger->get_logs( $action_id ); - $this->assertTrue( in_array( $this->log_entry_to_array( $started ), $this->log_entry_to_array( $logs ) ) ); - $this->assertFalse( in_array( $this->log_entry_to_array( $finished ), $this->log_entry_to_array( $logs ) ) ); - $this->assertTrue( in_array( $this->log_entry_to_array( $failed ), $this->log_entry_to_array( $logs ) ) ); - } - - public function test_fatal_error_comments() { - $hook = md5(rand()); - $action_id = as_schedule_single_action( time(), $hook ); - $logger = ActionScheduler::logger(); - do_action( 'action_scheduler_unexpected_shutdown', $action_id, array( - 'type' => E_ERROR, - 'message' => 'Test error', - 'file' => __FILE__, - 'line' => __LINE__, - )); - - $logs = $logger->get_logs( $action_id ); - $found_log = FALSE; - foreach ( $logs as $l ) { - if ( strpos( $l->get_message(), 'unexpected shutdown' ) === 0 ) { - $found_log = TRUE; - } - } - $this->assertTrue( $found_log, 'Unexpected shutdown log not found' ); - } - - public function test_canceled_action_comments() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - as_unschedule_action( 'a hook' ); - $logger = ActionScheduler::logger(); - $logs = $logger->get_logs( $action_id ); - $expected = new ActionScheduler_LogEntry( $action_id, 'action canceled' ); - $this->assertTrue( in_array( $this->log_entry_to_array( $expected ), $this->log_entry_to_array( $logs ) ) ); - } - - public function _a_hook_callback_that_throws_an_exception() { - throw new RuntimeException('Execution failed'); - } - - public function test_filtering_of_get_comments() { - $post_id = $this->factory->post->create_object(array( - 'post_title' => __FUNCTION__, - )); - $comment_id = $this->factory->comment->create_object(array( - 'comment_post_ID' => $post_id, - 'comment_author' => __CLASS__, - 'comment_content' => __FUNCTION__, - )); - - // Verify that we're getting the expected comment before we add logging comments - $comments = get_comments(); - $this->assertCount( 1, $comments ); - $this->assertEquals( $comment_id, $comments[0]->comment_ID ); - - - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $message = 'Logging that something happened'; - $log_id = $logger->log( $action_id, $message ); - - - // Verify that logging comments are excluded from general comment queries - $comments = get_comments(); - $this->assertCount( 1, $comments ); - $this->assertEquals( $comment_id, $comments[0]->comment_ID ); - - // Verify that logging comments are returned when asking for them specifically - $comments = get_comments(array( - 'type' => ActionScheduler_wpCommentLogger::TYPE, - )); - // Expecting two: one when the action is created, another when we added our custom log - $this->assertCount( 2, $comments ); - $this->assertContains( $log_id, wp_list_pluck($comments, 'comment_ID')); - } -} - diff --git a/includes/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php b/includes/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php deleted file mode 100644 index 543add798b1..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php +++ /dev/null @@ -1,222 +0,0 @@ -fetch_action($action_id); - $this->assertEquals( $time, $action->get_schedule()->next()->getTimestamp() ); - $this->assertEquals( $hook, $action->get_hook() ); - } - - public function test_recurring_action() { - $time = time(); - $hook = md5(rand()); - $action_id = as_schedule_recurring_action( $time, HOUR_IN_SECONDS, $hook ); - - $store = ActionScheduler::store(); - $action = $store->fetch_action($action_id); - $this->assertEquals( $time, $action->get_schedule()->next()->getTimestamp() ); - $this->assertEquals( $time + HOUR_IN_SECONDS + 2, $action->get_schedule()->next(as_get_datetime_object($time + 2))->getTimestamp()); - $this->assertEquals( $hook, $action->get_hook() ); - } - - public function test_cron_schedule() { - $time = as_get_datetime_object('2014-01-01'); - $hook = md5(rand()); - $action_id = as_schedule_cron_action( $time->getTimestamp(), '0 0 10 10 *', $hook ); - - $store = ActionScheduler::store(); - $action = $store->fetch_action($action_id); - $expected_date = as_get_datetime_object('2014-10-10'); - $this->assertEquals( $expected_date->getTimestamp(), $action->get_schedule()->next()->getTimestamp() ); - $this->assertEquals( $hook, $action->get_hook() ); - } - - public function test_get_next() { - $time = as_get_datetime_object('tomorrow'); - $hook = md5(rand()); - as_schedule_recurring_action( $time->getTimestamp(), HOUR_IN_SECONDS, $hook ); - - $next = as_next_scheduled_action( $hook ); - - $this->assertEquals( $time->getTimestamp(), $next ); - } - - public function provider_time_hook_args_group() { - $time = time() + 60 * 2; - $hook = md5( rand() ); - $args = array( rand(), rand() ); - $group = 'test_group'; - - return array( - - // Test with no args or group - array( - 'time' => $time, - 'hook' => $hook, - 'args' => array(), - 'group' => '', - ), - - // Test with args but no group - array( - 'time' => $time, - 'hook' => $hook, - 'args' => $args, - 'group' => '', - ), - - // Test with group but no args - array( - 'time' => $time, - 'hook' => $hook, - 'args' => array(), - 'group' => $group, - ), - - // Test with args & group - array( - 'time' => $time, - 'hook' => $hook, - 'args' => $args, - 'group' => $group, - ), - ); - } - - /** - * @dataProvider provider_time_hook_args_group - */ - public function test_unschedule( $time, $hook, $args, $group ) { - - $action_id_unscheduled = as_schedule_single_action( $time, $hook, $args, $group ); - $action_scheduled_time = $time + 1; - $action_id_scheduled = as_schedule_single_action( $action_scheduled_time, $hook, $args, $group ); - - as_unschedule_action( $hook, $args, $group ); - - $next = as_next_scheduled_action( $hook, $args, $group ); - $this->assertEquals( $action_scheduled_time, $next ); - - $store = ActionScheduler::store(); - $unscheduled_action = $store->fetch_action( $action_id_unscheduled ); - - // Make sure the next scheduled action is unscheduled - $this->assertEquals( $hook, $unscheduled_action->get_hook() ); - $this->assertNull( $unscheduled_action->get_schedule()->next() ); - - // Make sure other scheduled actions are not unscheduled - $scheduled_action = $store->fetch_action( $action_id_scheduled ); - - $this->assertEquals( $hook, $scheduled_action->get_hook() ); - $this->assertEquals( $action_scheduled_time, $scheduled_action->get_schedule()->next()->getTimestamp() ); - } - - /** - * @dataProvider provider_time_hook_args_group - */ - public function test_unschedule_all( $time, $hook, $args, $group ) { - - $hook = md5( $hook ); - $action_ids = array(); - - for ( $i = 0; $i < 3; $i++ ) { - $action_ids[] = as_schedule_single_action( $time, $hook, $args, $group ); - } - - as_unschedule_all_actions( $hook, $args, $group ); - - $next = as_next_scheduled_action( $hook ); - $this->assertFalse($next); - - $store = ActionScheduler::store(); - - foreach ( $action_ids as $action_id ) { - $action = $store->fetch_action($action_id); - - $this->assertNull($action->get_schedule()->next()); - $this->assertEquals($hook, $action->get_hook() ); - } - } - - public function test_as_get_datetime_object_default() { - - $utc_now = new ActionScheduler_DateTime(null, new DateTimeZone('UTC')); - $as_now = as_get_datetime_object(); - - // Don't want to use 'U' as timestamps will always be in UTC - $this->assertEquals($utc_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); - } - - public function test_as_get_datetime_object_relative() { - - $utc_tomorrow = new ActionScheduler_DateTime('tomorrow', new DateTimeZone('UTC')); - $as_tomorrow = as_get_datetime_object('tomorrow'); - - $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); - - $utc_tomorrow = new ActionScheduler_DateTime('yesterday', new DateTimeZone('UTC')); - $as_tomorrow = as_get_datetime_object('yesterday'); - - $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); - } - - public function test_as_get_datetime_object_fixed() { - - $utc_tomorrow = new ActionScheduler_DateTime('29 February 2016', new DateTimeZone('UTC')); - $as_tomorrow = as_get_datetime_object('29 February 2016'); - - $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); - - $utc_tomorrow = new ActionScheduler_DateTime('1st January 2024', new DateTimeZone('UTC')); - $as_tomorrow = as_get_datetime_object('1st January 2024'); - - $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); - } - - public function test_as_get_datetime_object_timezone() { - - $timezone_au = 'Australia/Brisbane'; - $timezone_default = date_default_timezone_get(); - - date_default_timezone_set( $timezone_au ); - - $au_now = new ActionScheduler_DateTime(null); - $as_now = as_get_datetime_object(); - - // Make sure they're for the same time - $this->assertEquals($au_now->getTimestamp(),$as_now->getTimestamp()); - - // But not in the same timezone, as $as_now should be using UTC - $this->assertNotEquals($au_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); - - $au_now = new ActionScheduler_DateTime(null); - $as_au_now = as_get_datetime_object(); - - $this->assertEquals($au_now->getTimestamp(),$as_now->getTimestamp()); - - // But not in the same timezone, as $as_now should be using UTC - $this->assertNotEquals($au_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); - - // Just in cases - date_default_timezone_set( $timezone_default ); - } - - public function test_as_get_datetime_object_type() { - $f = 'Y-m-d H:i:s'; - $now = as_get_datetime_object(); - $this->assertInstanceOf( 'ActionScheduler_DateTime', $now ); - - $dateTime = new DateTime( 'now', new DateTimeZone( 'UTC' ) ); - $asDateTime = as_get_datetime_object( $dateTime ); - $this->assertEquals( $dateTime->format( $f ), $asDateTime->format( $f ) ); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php b/includes/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php deleted file mode 100644 index af839d9195a..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php +++ /dev/null @@ -1,100 +0,0 @@ -hooks[$i] = md5(rand()); - $this->args[$i] = md5(rand()); - $this->groups[$i] = md5(rand()); - } - - for ( $i = 0 ; $i < 10 ; $i++ ) { - for ( $j = 0 ; $j < 10 ; $j++ ) { - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( $j - 3 . 'days') ); - $group = $this->groups[ ( $i + $j ) % 10 ]; - $action = new ActionScheduler_Action( $this->hooks[$i], array($this->args[$j]), $schedule, $group ); - $store->save_action( $action ); - } - } - } - - public function test_date_queries() { - $actions = as_get_scheduled_actions(array( - 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), - 'per_page' => -1, - ), 'ids'); - $this->assertCount(30, $actions); - - $actions = as_get_scheduled_actions(array( - 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), - 'date_compare' => '>=', - 'per_page' => -1, - ), 'ids'); - $this->assertCount(70, $actions); - } - - public function test_hook_queries() { - $actions = as_get_scheduled_actions(array( - 'hook' => $this->hooks[2], - 'per_page' => -1, - ), 'ids'); - $this->assertCount(10, $actions); - - $actions = as_get_scheduled_actions(array( - 'hook' => $this->hooks[2], - 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), - 'per_page' => -1, - ), 'ids'); - $this->assertCount(3, $actions); - } - - public function test_args_queries() { - $actions = as_get_scheduled_actions(array( - 'args' => array($this->args[5]), - 'per_page' => -1, - ), 'ids'); - $this->assertCount(10, $actions); - - $actions = as_get_scheduled_actions(array( - 'args' => array($this->args[5]), - 'hook' => $this->hooks[3], - 'per_page' => -1, - ), 'ids'); - $this->assertCount(1, $actions); - - $actions = as_get_scheduled_actions(array( - 'args' => array($this->args[5]), - 'hook' => $this->hooks[3], - 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), - 'per_page' => -1, - ), 'ids'); - $this->assertCount(0, $actions); - } - - public function test_group_queries() { - $actions = as_get_scheduled_actions(array( - 'group' => $this->groups[1], - 'per_page' => -1, - ), 'ids'); - $this->assertCount(10, $actions); - - $actions = as_get_scheduled_actions(array( - 'group' => $this->groups[1], - 'hook' => $this->hooks[9], - 'per_page' => -1, - ), 'ids'); - $this->assertCount(1, $actions); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php b/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php deleted file mode 100644 index 401a1d676e1..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php +++ /dev/null @@ -1,151 +0,0 @@ -save_action( $action ); - } - - $runner->run(); - - add_filter( 'action_scheduler_retention_period', '__return_zero' ); // delete any finished job - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->delete_old_actions(); - remove_filter( 'action_scheduler_retention_period', '__return_zero' ); - - foreach ( $created_actions as $action_id ) { - $action = $store->fetch_action($action_id); - $this->assertFalse($action->is_finished()); // it's a NullAction - } - } - - public function test_delete_canceled_actions() { - $store = ActionScheduler::store(); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - $created_actions = array(); - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $action_id = $store->save_action( $action ); - $store->cancel_action( $action_id ); - $created_actions[] = $action_id; - } - - // track the actions that are deleted - $mock_action = new MockAction(); - add_action( 'action_scheduler_deleted_action', array( $mock_action, 'action' ), 10, 1 ); - add_filter( 'action_scheduler_retention_period', '__return_zero' ); // delete any finished job - - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->delete_old_actions(); - - remove_filter( 'action_scheduler_retention_period', '__return_zero' ); - remove_action( 'action_scheduler_deleted_action', array( $mock_action, 'action' ), 10 ); - - $deleted_actions = array_map( 'reset', $mock_action->get_args() ); - $this->assertEqualSets( $created_actions, $deleted_actions ); - } - - public function test_do_not_delete_recent_actions() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - $created_actions = array(); - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $created_actions[] = $store->save_action( $action ); - } - - $runner->run(); - - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->delete_old_actions(); - - foreach ( $created_actions as $action_id ) { - $action = $store->fetch_action($action_id); - $this->assertTrue($action->is_finished()); // It's a FinishedAction - } - } - - public function test_reset_unrun_actions() { - $store = ActionScheduler::store(); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - $created_actions = array(); - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $created_actions[] = $store->save_action( $action ); - } - - $store->stake_claim(10); - - // don't actually process the jobs, to simulate a request that timed out - - add_filter( 'action_scheduler_timeout_period', '__return_zero' ); // delete any finished job - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->reset_timeouts(); - - remove_filter( 'action_scheduler_timeout_period', '__return_zero' ); - - $claim = $store->stake_claim(10); - $this->assertEqualSets($created_actions, $claim->get_actions()); - } - - public function test_do_not_reset_failed_action() { - $store = ActionScheduler::store(); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - $created_actions = array(); - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $created_actions[] = $store->save_action( $action ); - } - - $claim = $store->stake_claim(10); - foreach ( $claim->get_actions() as $action_id ) { - // simulate the first action interrupted by an uncatchable fatal error - $store->log_execution( $action_id ); - break; - } - - add_filter( 'action_scheduler_timeout_period', '__return_zero' ); // delete any finished job - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->reset_timeouts(); - remove_filter( 'action_scheduler_timeout_period', '__return_zero' ); - - $new_claim = $store->stake_claim(10); - $this->assertCount( 4, $new_claim->get_actions() ); - - add_filter( 'action_scheduler_failure_period', '__return_zero' ); - $cleaner->mark_failures(); - remove_filter( 'action_scheduler_failure_period', '__return_zero' ); - - $failed = $store->query_actions(array('status' => ActionScheduler_Store::STATUS_FAILED)); - $this->assertEquals( $created_actions[0], $failed[0] ); - $this->assertCount( 1, $failed ); - - - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php b/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php deleted file mode 100644 index e68b3e06fb9..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php +++ /dev/null @@ -1,262 +0,0 @@ -run(); - - $this->assertEquals( 0, $actions_run ); - } - - public function test_run() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $mock = new MockAction(); - $random = md5(rand()); - add_action( $random, array( $mock, 'action' ) ); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $actions_run = $runner->run(); - - remove_action( $random, array( $mock, 'action' ) ); - - $this->assertEquals( 5, $mock->get_call_count() ); - $this->assertEquals( 5, $actions_run ); - } - - public function test_run_with_future_actions() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $mock = new MockAction(); - $random = md5(rand()); - add_action( $random, array( $mock, 'action' ) ); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - for ( $i = 0 ; $i < 3 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('tomorrow')); - for ( $i = 0 ; $i < 3 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $actions_run = $runner->run(); - - remove_action( $random, array( $mock, 'action' ) ); - - $this->assertEquals( 3, $mock->get_call_count() ); - $this->assertEquals( 3, $actions_run ); - } - - public function test_completed_action_status() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('12 hours ago')); - - $action = new ActionScheduler_Action( $random, array(), $schedule ); - $action_id = $store->save_action( $action ); - - $runner->run(); - - $finished_action = $store->fetch_action( $action_id ); - - $this->assertTrue( $finished_action->is_finished() ); - } - - public function test_next_instance_of_action() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $random = md5(rand()); - $schedule = new ActionScheduler_IntervalSchedule(as_get_datetime_object('12 hours ago'), DAY_IN_SECONDS); - - $action = new ActionScheduler_Action( $random, array(), $schedule ); - $store->save_action( $action ); - - $runner->run(); - - $claim = $store->stake_claim(10, as_get_datetime_object((DAY_IN_SECONDS - 60).' seconds')); - $this->assertCount(0, $claim->get_actions()); - - $claim = $store->stake_claim(10, as_get_datetime_object(DAY_IN_SECONDS.' seconds')); - $actions = $claim->get_actions(); - $this->assertCount(1, $actions); - - $action_id = reset($actions); - $new_action = $store->fetch_action($action_id); - - - $this->assertEquals( $random, $new_action->get_hook() ); - $this->assertEquals( $schedule->next(as_get_datetime_object())->getTimestamp(), $new_action->get_schedule()->next(as_get_datetime_object())->getTimestamp() ); - } - - public function test_hooked_into_wp_cron() { - $next = wp_next_scheduled( ActionScheduler_QueueRunner::WP_CRON_HOOK ); - $this->assertNotEmpty($next); - } - - public function test_batch_count_limit() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $mock = new MockAction(); - $random = md5(rand()); - add_action( $random, array( $mock, 'action' ) ); - $schedule = new ActionScheduler_SimpleSchedule(new ActionScheduler_DateTime('1 day ago')); - - for ( $i = 0 ; $i < 30 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $claims = array(); - - for ( $i = 0 ; $i < 5 ; $i++ ) { - $claims[] = $store->stake_claim( 5 ); - } - - $actions_run = $runner->run(); - - - $this->assertEquals( 0, $mock->get_call_count() ); - $this->assertEquals( 0, $actions_run ); - - $first = reset($claims); - $store->release_claim( $first ); - - $actions_run = $runner->run(); - $this->assertEquals( 10, $mock->get_call_count() ); - $this->assertEquals( 10, $actions_run ); - - remove_action( $random, array( $mock, 'action' ) ); - } - - public function test_changing_batch_count_limit() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(new ActionScheduler_DateTime('1 day ago')); - - for ( $i = 0 ; $i < 30 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $claims = array(); - - for ( $i = 0 ; $i < 5 ; $i++ ) { - $claims[] = $store->stake_claim( 5 ); - } - - $mock1 = new MockAction(); - add_action( $random, array( $mock1, 'action' ) ); - $actions_run = $runner->run(); - remove_action( $random, array( $mock1, 'action' ) ); - - $this->assertEquals( 0, $mock1->get_call_count() ); - $this->assertEquals( 0, $actions_run ); - - - add_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); - - $mock2 = new MockAction(); - add_action( $random, array( $mock2, 'action' ) ); - $actions_run = $runner->run(); - remove_action( $random, array( $mock2, 'action' ) ); - - $this->assertEquals( 5, $mock2->get_call_count() ); - $this->assertEquals( 5, $actions_run ); - - remove_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); - - for ( $i = 0 ; $i < 5 ; $i++ ) { // to make up for the actions we just processed - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $mock3 = new MockAction(); - add_action( $random, array( $mock3, 'action' ) ); - $actions_run = $runner->run(); - remove_action( $random, array( $mock3, 'action' ) ); - - $this->assertEquals( 0, $mock3->get_call_count() ); - $this->assertEquals( 0, $actions_run ); - - remove_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); - } - - public function return_6() { - return 6; - } - - public function test_store_fetch_action_failure_schedule_next_instance() { - $random = md5( rand() ); - $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object( '12 hours ago' ), DAY_IN_SECONDS ); - $action = new ActionScheduler_Action( $random, array(), $schedule ); - $action_id = ActionScheduler::store()->save_action( $action ); - - // Set up a mock store that will throw an exception when fetching actions. - $store = $this - ->getMockBuilder( 'ActionScheduler_wpPostStore' ) - ->setMethods( array( 'fetch_action' ) ) - ->getMock(); - $store - ->method( 'fetch_action' ) - ->with( $action_id ) - ->will( $this->throwException( new Exception() ) ); - - // Set up a mock queue runner to verify that schedule_next_instance() - // isn't called for an undefined $action. - $runner = $this - ->getMockBuilder( 'ActionScheduler_QueueRunner' ) - ->setConstructorArgs( array( $store ) ) - ->setMethods( array( 'schedule_next_instance' ) ) - ->getMock(); - $runner - ->expects( $this->never() ) - ->method( 'schedule_next_instance' ); - - $runner->run(); - - // Set up a mock store that will throw an exception when fetching actions. - $store2 = $this - ->getMockBuilder( 'ActionScheduler_wpPostStore' ) - ->setMethods( array( 'fetch_action' ) ) - ->getMock(); - $store2 - ->method( 'fetch_action' ) - ->with( $action_id ) - ->willReturn( null ); - - // Set up a mock queue runner to verify that schedule_next_instance() - // isn't called for an undefined $action. - $runner2 = $this - ->getMockBuilder( 'ActionScheduler_QueueRunner' ) - ->setConstructorArgs( array( $store ) ) - ->setMethods( array( 'schedule_next_instance' ) ) - ->getMock(); - $runner2 - ->expects( $this->never() ) - ->method( 'schedule_next_instance' ); - - $runner2->run(); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php b/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php deleted file mode 100644 index 4d1ee9a7991..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php +++ /dev/null @@ -1,45 +0,0 @@ -assertEquals( $time, $schedule->next() ); - } - - public function test_next() { - $time = as_get_datetime_object('2013-06-14'); - $cron = CronExpression::factory('@daily'); - $schedule = new ActionScheduler_CronSchedule($time, $cron); - $this->assertEquals( as_get_datetime_object('tomorrow'), $schedule->next( as_get_datetime_object() ) ); - } - - public function test_is_recurring() { - $schedule = new ActionScheduler_CronSchedule(as_get_datetime_object('2013-06-14'), CronExpression::factory('@daily')); - $this->assertTrue( $schedule->is_recurring() ); - } - - public function test_cron_format() { - $time = as_get_datetime_object('2014-01-01'); - $cron = CronExpression::factory('0 0 10 10 *'); - $schedule = new ActionScheduler_CronSchedule($time, $cron); - $this->assertEquals( as_get_datetime_object('2014-10-10'), $schedule->next() ); - - $cron = CronExpression::factory('0 0 L 1/2 *'); - $schedule = new ActionScheduler_CronSchedule($time, $cron); - $this->assertEquals( as_get_datetime_object('2014-01-31'), $schedule->next() ); - $this->assertEquals( as_get_datetime_object('2014-07-31'), $schedule->next( as_get_datetime_object('2014-06-01') ) ); - $this->assertEquals( as_get_datetime_object('2028-11-30'), $schedule->next( as_get_datetime_object('2028-11-01') ) ); - - $cron = CronExpression::factory('30 14 * * MON#3 *'); - $schedule = new ActionScheduler_CronSchedule($time, $cron); - $this->assertEquals( as_get_datetime_object('2014-01-20 14:30:00'), $schedule->next() ); - $this->assertEquals( as_get_datetime_object('2014-05-19 14:30:00'), $schedule->next( as_get_datetime_object('2014-05-01') ) ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php b/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php deleted file mode 100644 index 2f68ccb2023..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php +++ /dev/null @@ -1,28 +0,0 @@ -assertEquals( $time, $schedule->next() ); - } - - public function test_next() { - $now = time(); - $start = $now - 30; - $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS ); - $this->assertEquals( $start, $schedule->next()->getTimestamp() ); - $this->assertEquals( $now + MINUTE_IN_SECONDS, $schedule->next(as_get_datetime_object())->getTimestamp() ); - $this->assertEquals( $start, $schedule->next(as_get_datetime_object("@$start"))->getTimestamp() ); - } - - public function test_is_recurring() { - $start = time() - 30; - $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS ); - $this->assertTrue( $schedule->is_recurring() ); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php b/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php deleted file mode 100644 index cd2c601061b..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php +++ /dev/null @@ -1,18 +0,0 @@ -assertNull( $schedule->next() ); - } - - public function test_is_recurring() { - $schedule = new ActionScheduler_NullSchedule(); - $this->assertFalse( $schedule->is_recurring() ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php b/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php deleted file mode 100644 index 022dd66aadc..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php +++ /dev/null @@ -1,37 +0,0 @@ -assertEquals( $time, $schedule->next() ); - } - - public function test_past_date() { - $time = as_get_datetime_object('-1 day'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $this->assertEquals( $time, $schedule->next() ); - } - - public function test_future_date() { - $time = as_get_datetime_object('+1 day'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $this->assertEquals( $time, $schedule->next() ); - } - - public function test_grace_period_for_next() { - $time = as_get_datetime_object('3 seconds ago'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $this->assertEquals( $time, $schedule->next() ); - } - - public function test_is_recurring() { - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('+1 day')); - $this->assertFalse( $schedule->is_recurring() ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php b/includes/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php deleted file mode 100644 index 9e79e024595..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php +++ /dev/null @@ -1,43 +0,0 @@ -register('1.0-dev', 'callback_1_dot_0_dev'); - $versions->register('1.0', 'callback_1_dot_0'); - - $registered = $versions->get_versions(); - - $this->assertArrayHasKey( '1.0-dev', $registered ); - $this->assertArrayHasKey( '1.0', $registered ); - $this->assertCount( 2, $registered ); - - $this->assertEquals( 'callback_1_dot_0_dev', $registered['1.0-dev'] ); - } - - public function test_duplicate_version() { - $versions = new ActionScheduler_Versions(); - $versions->register('1.0', 'callback_1_dot_0_a'); - $versions->register('1.0', 'callback_1_dot_0_b'); - - $registered = $versions->get_versions(); - - $this->assertArrayHasKey( '1.0', $registered ); - $this->assertCount( 1, $registered ); - } - - public function test_latest_version() { - $versions = new ActionScheduler_Versions(); - $this->assertEquals('__return_null', $versions->latest_version_callback() ); - $versions->register('1.2', 'callback_1_dot_2'); - $versions->register('1.3', 'callback_1_dot_3'); - $versions->register('1.0', 'callback_1_dot_0'); - - $this->assertEquals( '1.3', $versions->latest_version() ); - $this->assertEquals( 'callback_1_dot_3', $versions->latest_version_callback() ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/travis/setup.sh b/includes/libraries/action-scheduler/tests/travis/setup.sh deleted file mode 100755 index 068198af5f5..00000000000 --- a/includes/libraries/action-scheduler/tests/travis/setup.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -# WordPress test setup script for Travis CI -# -# Author: Benjamin J. Balter ( ben@balter.com | ben.balter.com ) -# License: GPL3 - -export WP_CORE_DIR=/tmp/wordpress -export WP_TESTS_DIR=/tmp/wordpress-tests/tests/phpunit - -if [[ "$1" = "5.6" || "$1" > "5.6" ]] -then - wget -c https://phar.phpunit.de/phpunit-5.7.phar - chmod +x phpunit-5.7.phar - mv phpunit-5.7.phar `which phpunit` -fi - -plugin_slug=$(basename $(pwd)) -plugin_dir=$WP_CORE_DIR/wp-content/plugins/$plugin_slug - -# Init database -mysql -e 'CREATE DATABASE wordpress_test;' -uroot - -# Grab specified version of WordPress from github -wget -nv -O /tmp/wordpress.tar.gz https://github.com/WordPress/WordPress/tarball/$WP_VERSION -mkdir -p $WP_CORE_DIR -tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR - -# Grab testing framework -svn co --quiet https://develop.svn.wordpress.org/tags/$WP_VERSION/ /tmp/wordpress-tests - -# Put various components in proper folders -cp tests/travis/wp-tests-config.php $WP_TESTS_DIR/wp-tests-config.php - -cd .. -mv $plugin_slug $plugin_dir - -cd $plugin_dir diff --git a/includes/libraries/action-scheduler/tests/travis/wp-tests-config.php b/includes/libraries/action-scheduler/tests/travis/wp-tests-config.php deleted file mode 100644 index f626da090a2..00000000000 --- a/includes/libraries/action-scheduler/tests/travis/wp-tests-config.php +++ /dev/null @@ -1,38 +0,0 @@ - Date: Thu, 28 Mar 2019 15:31:13 +1000 Subject: [PATCH 2/3] Squashed 'includes/libraries/action-scheduler/' content from commit 5f943d9 git-subtree-dir: includes/libraries/action-scheduler git-subtree-split: 5f943d9de5f25f5a107ea21b8d42eff9ed9bf94e --- .gitattributes | 9 + .github/release-drafter.yml | 15 + .gitignore | 3 + .travis.yml | 37 + README.md | 41 + action-scheduler.php | 47 + classes/ActionScheduler.php | 133 + .../ActionScheduler_Abstract_ListTable.php | 656 ++++ .../ActionScheduler_Abstract_QueueRunner.php | 219 ++ classes/ActionScheduler_Action.php | 75 + classes/ActionScheduler_ActionClaim.php | 23 + classes/ActionScheduler_ActionFactory.php | 111 + classes/ActionScheduler_AdminView.php | 83 + classes/ActionScheduler_CanceledAction.php | 21 + classes/ActionScheduler_Compatibility.php | 99 + classes/ActionScheduler_CronSchedule.php | 57 + classes/ActionScheduler_DateTime.php | 76 + classes/ActionScheduler_Exception.php | 11 + classes/ActionScheduler_FatalErrorMonitor.php | 55 + classes/ActionScheduler_FinishedAction.php | 16 + classes/ActionScheduler_IntervalSchedule.php | 60 + ...ActionScheduler_InvalidActionException.php | 28 + classes/ActionScheduler_ListTable.php | 533 +++ classes/ActionScheduler_LogEntry.php | 67 + classes/ActionScheduler_Logger.php | 98 + classes/ActionScheduler_NullAction.php | 16 + classes/ActionScheduler_NullLogEntry.php | 11 + classes/ActionScheduler_NullSchedule.php | 19 + classes/ActionScheduler_QueueCleaner.php | 155 + classes/ActionScheduler_QueueRunner.php | 115 + classes/ActionScheduler_Schedule.php | 18 + classes/ActionScheduler_SimpleSchedule.php | 44 + classes/ActionScheduler_Store.php | 212 ++ classes/ActionScheduler_TimezoneHelper.php | 152 + classes/ActionScheduler_Versions.php | 62 + classes/ActionScheduler_WPCLI_QueueRunner.php | 217 ++ ...ctionScheduler_WPCLI_Scheduler_command.php | 145 + classes/ActionScheduler_wcSystemStatus.php | 129 + classes/ActionScheduler_wpCommentLogger.php | 240 ++ classes/ActionScheduler_wpPostStore.php | 807 +++++ ...eduler_wpPostStore_PostStatusRegistrar.php | 57 + ...cheduler_wpPostStore_PostTypeRegistrar.php | 50 + ...cheduler_wpPostStore_TaxonomyRegistrar.php | 26 + codecov.yml | 13 + composer.json | 11 + composer.lock | 2909 +++++++++++++++++ ...eduler_Abstract_QueueRunner_Deprecated.php | 27 + .../ActionScheduler_AdminView_Deprecated.php | 147 + deprecated/functions.php | 126 + docs/CNAME | 1 + docs/_config.yml | 7 + docs/_layouts/default.html | 62 + docs/admin.md | 22 + docs/android-chrome-192x192.png | Bin 0 -> 17032 bytes docs/android-chrome-256x256.png | Bin 0 -> 24599 bytes docs/api.md | 179 + docs/apple-touch-icon.png | Bin 0 -> 8053 bytes docs/assets/css/style.scss | 57 + docs/browserconfig.xml | 9 + docs/faq.md | 101 + docs/favicon-16x16.png | Bin 0 -> 1160 bytes docs/favicon-32x32.png | Bin 0 -> 1937 bytes docs/favicon.ico | Bin 0 -> 15086 bytes docs/google14ef723abb376cd3.html | 1 + docs/index.md | 68 + docs/mstile-150x150.png | Bin 0 -> 4246 bytes docs/perf.md | 127 + docs/safari-pinned-tab.svg | 40 + docs/site.webmanifest | 19 + docs/usage.md | 123 + docs/wp-cli.md | 73 + functions.php | 209 ++ lib/cron-expression/CronExpression.php | 318 ++ .../CronExpression_AbstractField.php | 100 + .../CronExpression_DayOfMonthField.php | 110 + .../CronExpression_DayOfWeekField.php | 124 + .../CronExpression_FieldFactory.php | 55 + .../CronExpression_FieldInterface.php | 39 + .../CronExpression_HoursField.php | 47 + .../CronExpression_MinutesField.php | 39 + .../CronExpression_MonthField.php | 55 + .../CronExpression_YearField.php | 43 + lib/cron-expression/LICENSE | 19 + lib/cron-expression/README.md | 92 + license.txt | 674 ++++ tests/ActionScheduler_UnitTestCase.php | 44 + tests/bootstrap.php | 31 + tests/phpunit.xml.dist | 32 + .../ActionScheduler_UnitTestCase.php | 44 + .../ActionScheduler_TimezoneHelper_Test.php | 100 + .../jobs/ActionScheduler_Action_Test.php | 55 + .../jobs/ActionScheduler_NullAction_Test.php | 16 + .../ActionScheduler_wpPostStore_Test.php | 375 +++ .../ActionScheduler_wpCommentLogger_Test.php | 185 ++ .../procedural_api/procedural_api_Test.php | 222 ++ .../wc_get_scheduled_actions_Test.php | 100 + .../ActionScheduler_QueueCleaner_Test.php | 151 + .../ActionScheduler_QueueRunner_Test.php | 262 ++ .../ActionScheduler_CronSchedule_Test.php | 45 + .../ActionScheduler_IntervalSchedule_Test.php | 28 + .../ActionScheduler_NullSchedule_Test.php | 18 + .../ActionScheduler_SimpleSchedule_Test.php | 37 + .../ActionScheduler_Versions_Test.php | 43 + tests/travis/setup.sh | 38 + tests/travis/wp-tests-config.php | 38 + 105 files changed, 12958 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/release-drafter.yml create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 README.md create mode 100644 action-scheduler.php create mode 100644 classes/ActionScheduler.php create mode 100644 classes/ActionScheduler_Abstract_ListTable.php create mode 100644 classes/ActionScheduler_Abstract_QueueRunner.php create mode 100644 classes/ActionScheduler_Action.php create mode 100644 classes/ActionScheduler_ActionClaim.php create mode 100644 classes/ActionScheduler_ActionFactory.php create mode 100644 classes/ActionScheduler_AdminView.php create mode 100644 classes/ActionScheduler_CanceledAction.php create mode 100644 classes/ActionScheduler_Compatibility.php create mode 100644 classes/ActionScheduler_CronSchedule.php create mode 100644 classes/ActionScheduler_DateTime.php create mode 100644 classes/ActionScheduler_Exception.php create mode 100644 classes/ActionScheduler_FatalErrorMonitor.php create mode 100644 classes/ActionScheduler_FinishedAction.php create mode 100644 classes/ActionScheduler_IntervalSchedule.php create mode 100644 classes/ActionScheduler_InvalidActionException.php create mode 100644 classes/ActionScheduler_ListTable.php create mode 100644 classes/ActionScheduler_LogEntry.php create mode 100644 classes/ActionScheduler_Logger.php create mode 100644 classes/ActionScheduler_NullAction.php create mode 100644 classes/ActionScheduler_NullLogEntry.php create mode 100644 classes/ActionScheduler_NullSchedule.php create mode 100644 classes/ActionScheduler_QueueCleaner.php create mode 100644 classes/ActionScheduler_QueueRunner.php create mode 100644 classes/ActionScheduler_Schedule.php create mode 100644 classes/ActionScheduler_SimpleSchedule.php create mode 100644 classes/ActionScheduler_Store.php create mode 100644 classes/ActionScheduler_TimezoneHelper.php create mode 100644 classes/ActionScheduler_Versions.php create mode 100644 classes/ActionScheduler_WPCLI_QueueRunner.php create mode 100644 classes/ActionScheduler_WPCLI_Scheduler_command.php create mode 100644 classes/ActionScheduler_wcSystemStatus.php create mode 100644 classes/ActionScheduler_wpCommentLogger.php create mode 100644 classes/ActionScheduler_wpPostStore.php create mode 100644 classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php create mode 100644 classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php create mode 100644 classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php create mode 100644 codecov.yml create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php create mode 100644 deprecated/ActionScheduler_AdminView_Deprecated.php create mode 100644 deprecated/functions.php create mode 100644 docs/CNAME create mode 100644 docs/_config.yml create mode 100644 docs/_layouts/default.html create mode 100644 docs/admin.md create mode 100644 docs/android-chrome-192x192.png create mode 100644 docs/android-chrome-256x256.png create mode 100644 docs/api.md create mode 100644 docs/apple-touch-icon.png create mode 100644 docs/assets/css/style.scss create mode 100644 docs/browserconfig.xml create mode 100644 docs/faq.md create mode 100644 docs/favicon-16x16.png create mode 100644 docs/favicon-32x32.png create mode 100644 docs/favicon.ico create mode 100644 docs/google14ef723abb376cd3.html create mode 100644 docs/index.md create mode 100644 docs/mstile-150x150.png create mode 100644 docs/perf.md create mode 100644 docs/safari-pinned-tab.svg create mode 100644 docs/site.webmanifest create mode 100644 docs/usage.md create mode 100644 docs/wp-cli.md create mode 100644 functions.php create mode 100755 lib/cron-expression/CronExpression.php create mode 100755 lib/cron-expression/CronExpression_AbstractField.php create mode 100755 lib/cron-expression/CronExpression_DayOfMonthField.php create mode 100755 lib/cron-expression/CronExpression_DayOfWeekField.php create mode 100755 lib/cron-expression/CronExpression_FieldFactory.php create mode 100755 lib/cron-expression/CronExpression_FieldInterface.php create mode 100755 lib/cron-expression/CronExpression_HoursField.php create mode 100755 lib/cron-expression/CronExpression_MinutesField.php create mode 100755 lib/cron-expression/CronExpression_MonthField.php create mode 100755 lib/cron-expression/CronExpression_YearField.php create mode 100755 lib/cron-expression/LICENSE create mode 100755 lib/cron-expression/README.md create mode 100644 license.txt create mode 100644 tests/ActionScheduler_UnitTestCase.php create mode 100644 tests/bootstrap.php create mode 100644 tests/phpunit.xml.dist create mode 100644 tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php create mode 100644 tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php create mode 100644 tests/phpunit/jobs/ActionScheduler_Action_Test.php create mode 100644 tests/phpunit/jobs/ActionScheduler_NullAction_Test.php create mode 100644 tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php create mode 100644 tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php create mode 100644 tests/phpunit/procedural_api/procedural_api_Test.php create mode 100644 tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php create mode 100644 tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php create mode 100644 tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php create mode 100644 tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php create mode 100644 tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php create mode 100644 tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php create mode 100644 tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php create mode 100644 tests/phpunit/versioning/ActionScheduler_Versions_Test.php create mode 100755 tests/travis/setup.sh create mode 100644 tests/travis/wp-tests-config.php diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..aa62d10c423 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +docs export-ignore +tests export-ignore +codecov.yml export-ignore +.github export-ignore +.travis.yml export-ignore +.gitattributes export-ignore +.gitignore export-ignore +phpunit.xml.dist export-ignore + diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000000..702a6908c58 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,15 @@ +template: | + ## next release – date + + + + $CHANGES + + **Added** + **Changed** + **Deprecated** + **Removed** + **Fixed** + **Security** + +change-template: '* $TITLE (PR #$NUMBER)' diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..e779da84a38 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +phpunit.xml +vendor +.idea diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..675301bc543 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,37 @@ +# Travis CI Configuration File + +# Tell Travis CI we're using PHP +language: php + +# We nee to use Precise, not Trusty, to test against PHP 5.3, see https://github.com/travis-ci/travis-ci/issues/8219 +dist: precise + +# Versions of PHP to test against +php: + - "5.3" + - "5.4" + - "5.5" + - "5.6" + - "7.0" + - "7.1" + +# Specify versions of WordPress to test against +# WP_VERSION = WordPress version number (use "master" for SVN trunk) +# WP_MULTISITE = whether to test multisite (use either "0" or "1") +env: + - WP_VERSION=4.8 WP_MULTISITE=0 + - WP_VERSION=4.7 WP_MULTISITE=0 + - WP_VERSION=4.6 WP_MULTISITE=0 + - WP_VERSION=4.8 WP_MULTISITE=1 + - WP_VERSION=4.7 WP_MULTISITE=1 + - WP_VERSION=4.6 WP_MULTISITE=1 + +# Grab the setup script and execute +before_script: + - source tests/travis/setup.sh $TRAVIS_PHP_VERSION + +script: + - if [[ "$TRAVIS_PHP_VERSION" == "7.1" ]] && [[ "$WP_VERSION" == "4.8" ]] && [[ "$WP_MULTISITE" == "0" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then phpunit --configuration tests/phpunit.xml.dist --coverage-clover clover.xml; else phpunit --configuration tests/phpunit.xml.dist; fi + +after_script: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md new file mode 100644 index 00000000000..e2ea559ebdb --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# Action Scheduler - Job Queue for WordPress [![Build Status](https://travis-ci.org/Prospress/action-scheduler.png?branch=master)](https://travis-ci.org/Prospress/action-scheduler) [![codecov](https://codecov.io/gh/Prospress/action-scheduler/branch/master/graph/badge.svg)](https://codecov.io/gh/Prospress/action-scheduler) + +Action Scheduler is a scalable, traceable job queue for background processing large sets of actions in WordPress. It's specially designed to be distributed in WordPress plugins. + +Action Scheduler works by triggering an action hook to run at some time in the future. Each hook can be scheduled with unique data, to allow callbacks to perform operations on that data. The hook can also be scheduled to run on one or more occassions. + +Think of it like an extension to `do_action()` which adds the ability to delay and repeat a hook. + +## Battle-Tested Background Processing + +Every month, Action Scheduler processes millions of payments for [Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/), webhooks for [WooCommerce](https://wordpress.org/plugins/woocommerce/), as well as emails and other events for a range of other plugins. + +It's been seen on live sites processing queues in excess of 50,000 jobs and doing resource intensive operations, like processing payments and creating orders, at a sustained rate of over 10,000 / hour without negatively impacting normal site operations. + +This is all on infrastructure and WordPress sites outside the control of the plugin author. + +If your plugin needs background processing, especially of large sets of tasks, Action Scheduler can help. + +## Learn More + +To learn more about how to Action Scheduler works, and how to use it in your plugin, check out the docs on [ActionScheduler.org](https://actionscheduler.org). + +There you will find: + +* [Usage guide](https://actionscheduler.org/usage/): instructions on installing and using Action Scheduler +* [WP CLI guide](https://actionscheduler.org/wp-cli/): instructions on running Action Scheduler at scale via WP CLI +* [API Reference](https://actionscheduler.org/api/): complete reference guide for all API functions +* [Administration Guide](https://actionscheduler.org/admin/): guide to managing scheduled actions via the administration screen +* [Guide to Background Processing at Scale](https://actionscheduler.org/perf/): instructions for running Action Scheduler at scale via the default WP Cron queue runner + +## Credits + +Action Scheduler is developed and maintained by [Prospress](http://prospress.com/) in collaboration with [Flightless](https://flightless.us/). + +Collaboration is cool. We'd love to work with you to improve Action Scheduler. [Pull Requests](https://github.com/prospress/action-scheduler/pulls) welcome. + +--- + +

    + +

    diff --git a/action-scheduler.php b/action-scheduler.php new file mode 100644 index 00000000000..f4f99524ad0 --- /dev/null +++ b/action-scheduler.php @@ -0,0 +1,47 @@ +. + * + */ + +if ( ! function_exists( 'action_scheduler_register_2_dot_2_dot_3' ) ) { + + if ( ! class_exists( 'ActionScheduler_Versions' ) ) { + require_once( 'classes/ActionScheduler_Versions.php' ); + add_action( 'plugins_loaded', array( 'ActionScheduler_Versions', 'initialize_latest_version' ), 1, 0 ); + } + + add_action( 'plugins_loaded', 'action_scheduler_register_2_dot_2_dot_3', 0, 0 ); + + function action_scheduler_register_2_dot_2_dot_3() { + $versions = ActionScheduler_Versions::instance(); + $versions->register( '2.2.3', 'action_scheduler_initialize_2_dot_2_dot_3' ); + } + + function action_scheduler_initialize_2_dot_2_dot_3() { + require_once( 'classes/ActionScheduler.php' ); + ActionScheduler::init( __FILE__ ); + } + +} diff --git a/classes/ActionScheduler.php b/classes/ActionScheduler.php new file mode 100644 index 00000000000..2c5d0315ebb --- /dev/null +++ b/classes/ActionScheduler.php @@ -0,0 +1,133 @@ + value pair. The + * key must much the table column name and the value is the label, which is + * automatically translated. + */ + protected $columns = array(); + + /** + * Defines the row-actions. It expects an array where the key + * is the column name and the value is an array of actions. + * + * The array of actions are key => value, where key is the method name + * (with the prefix row_action_) and the value is the label + * and title. + */ + protected $row_actions = array(); + + /** + * The Primary key of our table + */ + protected $ID = 'ID'; + + /** + * Enables sorting, it expects an array + * of columns (the column names are the values) + */ + protected $sort_by = array(); + + protected $filter_by = array(); + + /** + * @var array The status name => count combinations for this table's items. Used to display status filters. + */ + protected $status_counts = array(); + + /** + * @var array Notices to display when loading the table. Array of arrays of form array( 'class' => {updated|error}, 'message' => 'This is the notice text display.' ). + */ + protected $admin_notices = array(); + + /** + * @var string Localised string displayed in the

    element above the able. + */ + protected $table_header; + + /** + * Enables bulk actions. It must be an array where the key is the action name + * and the value is the label (which is translated automatically). It is important + * to notice that it will check that the method exists (`bulk_$name`) and will throw + * an exception if it does not exists. + * + * This class will automatically check if the current request has a bulk action, will do the + * validations and afterwards will execute the bulk method, with two arguments. The first argument + * is the array with primary keys, the second argument is a string with a list of the primary keys, + * escaped and ready to use (with `IN`). + */ + protected $bulk_actions = array(); + + /** + * Makes translation easier, it basically just wraps + * `_x` with some default (the package name) + */ + protected function translate( $text, $context = '' ) { + return _x( $text, $context, $this->package ); + } + + /** + * Reads `$this->bulk_actions` and returns an array that WP_List_Table understands. It + * also validates that the bulk method handler exists. It throws an exception because + * this is a library meant for developers and missing a bulk method is a development-time error. + */ + protected function get_bulk_actions() { + $actions = array(); + + foreach ( $this->bulk_actions as $action => $label ) { + if ( ! is_callable( array( $this, 'bulk_' . $action ) ) ) { + throw new RuntimeException( "The bulk action $action does not have a callback method" ); + } + + $actions[ $action ] = $this->translate( $label ); + } + + return $actions; + } + + /** + * Checks if the current request has a bulk action. If that is the case it will validate and will + * execute the bulk method handler. Regardless if the action is valid or not it will redirect to + * the previous page removing the current arguments that makes this request a bulk action. + */ + protected function process_bulk_action() { + global $wpdb; + // Detect when a bulk action is being triggered. + $action = $this->current_action(); + + if ( ! $action ) { + return; + } + + check_admin_referer( 'bulk-' . $this->_args['plural'] ); + + $method = 'bulk_' . $action; + if ( array_key_exists( $action, $this->bulk_actions ) && is_callable( array( $this, $method ) ) && ! empty( $_GET['ID'] ) && is_array( $_GET['ID'] ) ) { + $ids_sql = '(' . implode( ',', array_fill( 0, count( $_GET['ID'] ), '%s' ) ) . ')'; + $this->$method( $_GET['ID'], $wpdb->prepare( $ids_sql, $_GET['ID'] ) ); + } + + wp_redirect( remove_query_arg( + array( '_wp_http_referer', '_wpnonce', 'ID', 'action', 'action2' ), + wp_unslash( $_SERVER['REQUEST_URI'] ) + ) ); + exit; + } + + /** + * Default code for deleting entries. We trust ids_sql because it is + * validated already by process_bulk_action() + */ + protected function bulk_delete( array $ids, $ids_sql ) { + global $wpdb; + + $wpdb->query( "DELETE FROM {$this->table_name} WHERE {$this->ID} IN $ids_sql" ); + } + + /** + * Prepares the _column_headers property which is used by WP_Table_List at rendering. + * It merges the columns and the sortable columns. + */ + protected function prepare_column_headers() { + $this->_column_headers = array( + $this->get_columns(), + array(), + $this->get_sortable_columns(), + ); + } + + /** + * Reads $this->sort_by and returns the columns name in a format that WP_Table_List + * expects + */ + public function get_sortable_columns() { + $sort_by = array(); + foreach ( $this->sort_by as $column ) { + $sort_by[ $column ] = array( $column, true ); + } + return $sort_by; + } + + /** + * Returns the columns names for rendering. It adds a checkbox for selecting everything + * as the first column + */ + public function get_columns() { + $columns = array_merge( + array( 'cb' => '' ), + array_map( array( $this, 'translate' ), $this->columns ) + ); + + return $columns; + } + + /** + * Get prepared LIMIT clause for items query + * + * @global wpdb $wpdb + * + * @return string Prepared LIMIT clause for items query. + */ + protected function get_items_query_limit() { + global $wpdb; + + $per_page = $this->get_items_per_page( $this->package . '_items_per_page', $this->items_per_page ); + return $wpdb->prepare( 'LIMIT %d', $per_page ); + } + + /** + * Returns the number of items to offset/skip for this current view. + * + * @return int + */ + protected function get_items_offset() { + $per_page = $this->get_items_per_page( $this->package . '_items_per_page', $this->items_per_page ); + $current_page = $this->get_pagenum(); + if ( 1 < $current_page ) { + $offset = $per_page * ( $current_page - 1 ); + } else { + $offset = 0; + } + + return $offset; + } + + /** + * Get prepared OFFSET clause for items query + * + * @global wpdb $wpdb + * + * @return string Prepared OFFSET clause for items query. + */ + protected function get_items_query_offset() { + global $wpdb; + + return $wpdb->prepare( 'OFFSET %d', $this->get_items_offset() ); + } + + /** + * Prepares the ORDER BY sql statement. It uses `$this->sort_by` to know which + * columns are sortable. This requests validates the orderby $_GET parameter is a valid + * column and sortable. It will also use order (ASC|DESC) using DESC by default. + */ + protected function get_items_query_order() { + if ( empty( $this->sort_by ) ) { + return ''; + } + + $orderby = esc_sql( $this->get_request_orderby() ); + $order = esc_sql( $this->get_request_order() ); + + return "ORDER BY {$orderby} {$order}"; + } + + /** + * Return the sortable column specified for this request to order the results by, if any. + * + * @return string + */ + protected function get_request_orderby() { + + $valid_sortable_columns = array_values( $this->sort_by ); + + if ( ! empty( $_GET['orderby'] ) && in_array( $_GET['orderby'], $valid_sortable_columns ) ) { + $orderby = sanitize_text_field( $_GET['orderby'] ); + } else { + $orderby = $valid_sortable_columns[0]; + } + + return $orderby; + } + + /** + * Return the sortable column order specified for this request. + * + * @return string + */ + protected function get_request_order() { + + if ( ! empty( $_GET['order'] ) && 'desc' === strtolower( $_GET['order'] ) ) { + $order = 'DESC'; + } else { + $order = 'ASC'; + } + + return $order; + } + + /** + * Return the status filter for this request, if any. + * + * @return string + */ + protected function get_request_status() { + $status = ( ! empty( $_GET['status'] ) ) ? $_GET['status'] : ''; + return $status; + } + + /** + * Return the search filter for this request, if any. + * + * @return string + */ + protected function get_request_search_query() { + $search_query = ( ! empty( $_GET['s'] ) ) ? $_GET['s'] : ''; + return $search_query; + } + + /** + * Process and return the columns name. This is meant for using with SQL, this means it + * always includes the primary key. + * + * @return array + */ + protected function get_table_columns() { + $columns = array_keys( $this->columns ); + if ( ! in_array( $this->ID, $columns ) ) { + $columns[] = $this->ID; + } + + return $columns; + } + + /** + * Check if the current request is doing a "full text" search. If that is the case + * prepares the SQL to search texts using LIKE. + * + * If the current request does not have any search or if this list table does not support + * that feature it will return an empty string. + * + * TODO: + * - Improve search doing LIKE by word rather than by phrases. + * + * @return string + */ + protected function get_items_query_search() { + global $wpdb; + + if ( empty( $_GET['s'] ) || empty( $this->search_by ) ) { + return ''; + } + + $filter = array(); + foreach ( $this->search_by as $column ) { + $filter[] = '`' . $column . '` like "%' . $wpdb->esc_like( $_GET['s'] ) . '%"'; + } + return implode( ' OR ', $filter ); + } + + /** + * Prepares the SQL to filter rows by the options defined at `$this->filter_by`. Before trusting + * any data sent by the user it validates that it is a valid option. + */ + protected function get_items_query_filters() { + global $wpdb; + + if ( ! $this->filter_by || empty( $_GET['filter_by'] ) || ! is_array( $_GET['filter_by'] ) ) { + return ''; + } + + $filter = array(); + + foreach ( $this->filter_by as $column => $options ) { + if ( empty( $_GET['filter_by'][ $column ] ) || empty( $options[ $_GET['filter_by'][ $column ] ] ) ) { + continue; + } + + $filter[] = $wpdb->prepare( "`$column` = %s", $_GET['filter_by'][ $column ] ); + } + + return implode( ' AND ', $filter ); + + } + + /** + * Prepares the data to feed WP_Table_List. + * + * This has the core for selecting, sorting and filting data. To keep the code simple + * its logic is split among many methods (get_items_query_*). + * + * Beside populating the items this function will also count all the records that matches + * the filtering criteria and will do fill the pagination variables. + */ + public function prepare_items() { + global $wpdb; + + $this->process_bulk_action(); + + $this->process_row_actions(); + + if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { + // _wp_http_referer is used only on bulk actions, we remove it to keep the $_GET shorter + wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); + exit; + } + + $this->prepare_column_headers(); + + $limit = $this->get_items_query_limit(); + $offset = $this->get_items_query_offset(); + $order = $this->get_items_query_order(); + $where = array_filter(array( + $this->get_items_query_search(), + $this->get_items_query_filters(), + )); + $columns = '`' . implode( '`, `', $this->get_table_columns() ) . '`'; + + if ( ! empty( $where ) ) { + $where = 'WHERE ('. implode( ') AND (', $where ) . ')'; + } else { + $where = ''; + } + + $sql = "SELECT $columns FROM {$this->table_name} {$where} {$order} {$limit} {$offset}"; + + $this->set_items( $wpdb->get_results( $sql, ARRAY_A ) ); + + $query_count = "SELECT COUNT({$this->ID}) FROM {$this->table_name} {$where}"; + $total_items = $wpdb->get_var( $query_count ); + $per_page = $this->get_items_per_page( $this->package . '_items_per_page', $this->items_per_page ); + $this->set_pagination_args( array( + 'total_items' => $total_items, + 'per_page' => $per_page, + 'total_pages' => ceil( $total_items / $per_page ), + ) ); + } + + public function extra_tablenav( $which ) { + if ( ! $this->filter_by || 'top' !== $which ) { + return; + } + + echo '
    '; + + foreach ( $this->filter_by as $id => $options ) { + $default = ! empty( $_GET['filter_by'][ $id ] ) ? $_GET['filter_by'][ $id ] : ''; + if ( empty( $options[ $default ] ) ) { + $default = ''; + } + + echo ''; + } + + submit_button( $this->translate( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); + echo '
    '; + } + + /** + * Set the data for displaying. It will attempt to unserialize (There is a chance that some columns + * are serialized). This can be override in child classes for futher data transformation. + */ + protected function set_items( array $items ) { + $this->items = array(); + foreach ( $items as $item ) { + $this->items[ $item[ $this->ID ] ] = array_map( 'maybe_unserialize', $item ); + } + } + + /** + * Renders the checkbox for each row, this is the first column and it is named ID regardless + * of how the primary key is named (to keep the code simpler). The bulk actions will do the proper + * name transformation though using `$this->ID`. + */ + public function column_cb( $row ) { + return ''; + } + + /** + * Renders the row-actions. + * + * This method renders the action menu, it reads the definition from the $row_actions property, + * and it checks that the row action method exists before rendering it. + * + * @param array $row Row to render + * @param $column_name Current row + * @return + */ + protected function maybe_render_actions( $row, $column_name ) { + if ( empty( $this->row_actions[ $column_name ] ) ) { + return; + } + + $row_id = $row[ $this->ID ]; + + $actions = '
    '; + $action_count = 0; + foreach ( $this->row_actions[ $column_name ] as $action_key => $action ) { + + $action_count++; + + if ( ! method_exists( $this, 'row_action_' . $action_key ) ) { + continue; + } + + $action_link = ! empty( $action['link'] ) ? $action['link'] : add_query_arg( array( 'row_action' => $action_key, 'row_id' => $row_id, 'nonce' => wp_create_nonce( $action_key . '::' . $row_id ) ) ); + $span_class = ! empty( $action['class'] ) ? $action['class'] : $action_key; + $separator = ( $action_count < count( $this->row_actions[ $column_name ] ) ) ? ' | ' : ''; + + $actions .= sprintf( '', esc_attr( $span_class ) ); + $actions .= sprintf( '%3$s', esc_url( $action_link ), esc_attr( $action['desc'] ), esc_html( $action['name'] ) ); + $actions .= sprintf( '%s', $separator ); + } + $actions .= '
    '; + return $actions; + } + + protected function process_row_actions() { + $parameters = array( 'row_action', 'row_id', 'nonce' ); + foreach ( $parameters as $parameter ) { + if ( empty( $_REQUEST[ $parameter ] ) ) { + return; + } + } + + $method = 'row_action_' . $_REQUEST['row_action']; + + if ( $_REQUEST['nonce'] === wp_create_nonce( $_REQUEST[ 'row_action' ] . '::' . $_REQUEST[ 'row_id' ] ) && method_exists( $this, $method ) ) { + $this->$method( $_REQUEST['row_id'] ); + } + + wp_redirect( remove_query_arg( + array( 'row_id', 'row_action', 'nonce' ), + wp_unslash( $_SERVER['REQUEST_URI'] ) + ) ); + exit; + } + + /** + * Default column formatting, it will escape everythig for security. + */ + public function column_default( $item, $column_name ) { + $column_html = esc_html( $item[ $column_name ] ); + $column_html .= $this->maybe_render_actions( $item, $column_name ); + return $column_html; + } + + /** + * Display the table heading and search query, if any + */ + protected function display_header() { + echo '

    ' . esc_attr( $this->table_header ) . '

    '; + if ( $this->get_request_search_query() ) { + echo '' . esc_attr( $this->translate( sprintf( 'Search results for "%s"', $this->get_request_search_query() ) ) ) . ''; + } + echo '
    '; + } + + /** + * Display the table heading and search query, if any + */ + protected function display_admin_notices() { + foreach ( $this->admin_notices as $notice ) { + echo '
    '; + echo '

    ' . wp_kses_post( $notice['message'] ) . '

    '; + echo '
    '; + } + } + + /** + * Prints the available statuses so the user can click to filter. + */ + protected function display_filter_by_status() { + + $status_list_items = array(); + $request_status = $this->get_request_status(); + + // Helper to set 'all' filter when not set on status counts passed in + if ( ! isset( $this->status_counts['all'] ) ) { + $this->status_counts = array( 'all' => array_sum( $this->status_counts ) ) + $this->status_counts; + } + + foreach ( $this->status_counts as $status_name => $count ) { + + if ( 0 === $count ) { + continue; + } + + if ( $status_name === $request_status || ( empty( $request_status ) && 'all' === $status_name ) ) { + $status_list_item = '
  • %3$s (%4$d)
  • '; + } else { + $status_list_item = '
  • %3$s (%4$d)
  • '; + } + + $status_filter_url = ( 'all' === $status_name ) ? remove_query_arg( 'status' ) : add_query_arg( 'status', $status_name ); + $status_list_items[] = sprintf( $status_list_item, esc_attr( $status_name ), esc_url( $status_filter_url ), esc_html( ucfirst( $status_name ) ), absint( $count ) ); + } + + if ( $status_list_items ) { + echo '
      '; + echo implode( " | \n", $status_list_items ); + echo '
    '; + } + } + + /** + * Renders the table list, we override the original class to render the table inside a form + * and to render any needed HTML (like the search box). By doing so the callee of a function can simple + * forget about any extra HTML. + */ + protected function display_table() { + echo '
    '; + foreach ( $_GET as $key => $value ) { + if ( '_' === $key[0] || 'paged' === $key ) { + continue; + } + echo ''; + } + if ( ! empty( $this->search_by ) ) { + echo $this->search_box( $this->get_search_box_button_text(), 'plugin' ); // WPCS: XSS OK + } + parent::display(); + echo '
    '; + } + + /** + * Render the list table page, including header, notices, status filters and table. + */ + public function display_page() { + $this->prepare_items(); + + echo '
    '; + $this->display_header(); + $this->display_admin_notices(); + $this->display_filter_by_status(); + $this->display_table(); + echo '
    '; + } + + /** + * Get the text to display in the search box on the list table. + */ + protected function get_search_box_placeholder() { + return $this->translate( 'Search' ); + } +} diff --git a/classes/ActionScheduler_Abstract_QueueRunner.php b/classes/ActionScheduler_Abstract_QueueRunner.php new file mode 100644 index 00000000000..e34fb8752f9 --- /dev/null +++ b/classes/ActionScheduler_Abstract_QueueRunner.php @@ -0,0 +1,219 @@ +created_time = microtime( true ); + + $this->store = $store ? $store : ActionScheduler_Store::instance(); + $this->monitor = $monitor ? $monitor : new ActionScheduler_FatalErrorMonitor( $this->store ); + $this->cleaner = $cleaner ? $cleaner : new ActionScheduler_QueueCleaner( $this->store ); + } + + /** + * Process an individual action. + * + * @param int $action_id The action ID to process. + */ + public function process_action( $action_id ) { + try { + do_action( 'action_scheduler_before_execute', $action_id ); + + if ( ActionScheduler_Store::STATUS_PENDING !== $this->store->get_status( $action_id ) ) { + do_action( 'action_scheduler_execution_ignored', $action_id ); + return; + } + + $action = $this->store->fetch_action( $action_id ); + $this->store->log_execution( $action_id ); + $action->execute(); + do_action( 'action_scheduler_after_execute', $action_id, $action ); + $this->store->mark_complete( $action_id ); + } catch ( Exception $e ) { + $this->store->mark_failure( $action_id ); + do_action( 'action_scheduler_failed_execution', $action_id, $e ); + } + + if ( isset( $action ) && is_a( $action, 'ActionScheduler_Action' ) ) { + $this->schedule_next_instance( $action ); + } + } + + /** + * Schedule the next instance of the action if necessary. + * + * @param ActionScheduler_Action $action + */ + protected function schedule_next_instance( ActionScheduler_Action $action ) { + $schedule = $action->get_schedule(); + $next = $schedule->next( as_get_datetime_object() ); + + if ( ! is_null( $next ) && $schedule->is_recurring() ) { + $this->store->save_action( $action, $next ); + } + } + + /** + * Run the queue cleaner. + * + * @author Jeremy Pry + */ + protected function run_cleanup() { + $this->cleaner->clean( 10 * $this->get_time_limit() ); + } + + /** + * Get the number of concurrent batches a runner allows. + * + * @return int + */ + public function get_allowed_concurrent_batches() { + return apply_filters( 'action_scheduler_queue_runner_concurrent_batches', 5 ); + } + + /** + * Get the maximum number of seconds a batch can run for. + * + * @return int The number of seconds. + */ + protected function get_time_limit() { + + $time_limit = 30; + + // Apply deprecated filter from deprecated get_maximum_execution_time() method + if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) { + _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' ); + $time_limit = apply_filters( 'action_scheduler_maximum_execution_time', $time_limit ); + } + + return absint( apply_filters( 'action_scheduler_queue_runner_time_limit', $time_limit ) ); + } + + /** + * Get the number of seconds the process has been running. + * + * @return int The number of seconds. + */ + protected function get_execution_time() { + $execution_time = microtime( true ) - $this->created_time; + + // Get the CPU time if the hosting environment uses it rather than wall-clock time to calculate a process's execution time. + if ( function_exists( 'getrusage' ) && apply_filters( 'action_scheduler_use_cpu_execution_time', defined( 'PANTHEON_ENVIRONMENT' ) ) ) { + $resource_usages = getrusage(); + + if ( isset( $resource_usages['ru_stime.tv_usec'], $resource_usages['ru_stime.tv_usec'] ) ) { + $execution_time = $resource_usages['ru_stime.tv_sec'] + ( $resource_usages['ru_stime.tv_usec'] / 1000000 ); + } + } + + return $execution_time; + } + + /** + * Check if the host's max execution time is (likely) to be exceeded if processing more actions. + * + * @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action + * @return bool + */ + protected function time_likely_to_be_exceeded( $processed_actions ) { + + $execution_time = $this->get_execution_time(); + $max_execution_time = $this->get_time_limit(); + $time_per_action = $execution_time / $processed_actions; + $estimated_time = $execution_time + ( $time_per_action * 3 ); + $likely_to_be_exceeded = $estimated_time > $max_execution_time; + + return apply_filters( 'action_scheduler_maximum_execution_time_likely_to_be_exceeded', $likely_to_be_exceeded, $this, $processed_actions, $execution_time, $max_execution_time ); + } + + /** + * Get memory limit + * + * Based on WP_Background_Process::get_memory_limit() + * + * @return int + */ + protected function get_memory_limit() { + if ( function_exists( 'ini_get' ) ) { + $memory_limit = ini_get( 'memory_limit' ); + } else { + $memory_limit = '128M'; // Sensible default, and minimum required by WooCommerce + } + + if ( ! $memory_limit || -1 === $memory_limit || '-1' === $memory_limit ) { + // Unlimited, set to 32GB. + $memory_limit = '32G'; + } + + return ActionScheduler_Compatibility::convert_hr_to_bytes( $memory_limit ); + } + + /** + * Memory exceeded + * + * Ensures the batch process never exceeds 90% of the maximum WordPress memory. + * + * Based on WP_Background_Process::memory_exceeded() + * + * @return bool + */ + protected function memory_exceeded() { + + $memory_limit = $this->get_memory_limit() * 0.90; + $current_memory = memory_get_usage( true ); + $memory_exceeded = $current_memory >= $memory_limit; + + return apply_filters( 'action_scheduler_memory_exceeded', $memory_exceeded, $this ); + } + + /** + * See if the batch limits have been exceeded, which is when memory usage is almost at + * the maximum limit, or the time to process more actions will exceed the max time limit. + * + * Based on WC_Background_Process::batch_limits_exceeded() + * + * @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action + * @return bool + */ + protected function batch_limits_exceeded( $processed_actions ) { + return $this->memory_exceeded() || $this->time_likely_to_be_exceeded( $processed_actions ); + } + + /** + * Process actions in the queue. + * + * @author Jeremy Pry + * @return int The number of actions processed. + */ + abstract public function run(); +} diff --git a/classes/ActionScheduler_Action.php b/classes/ActionScheduler_Action.php new file mode 100644 index 00000000000..6258ba1637a --- /dev/null +++ b/classes/ActionScheduler_Action.php @@ -0,0 +1,75 @@ +set_hook($hook); + $this->set_schedule($schedule); + $this->set_args($args); + $this->set_group($group); + } + + public function execute() { + return do_action_ref_array($this->get_hook(), $this->get_args()); + } + + /** + * @param string $hook + */ + protected function set_hook( $hook ) { + $this->hook = $hook; + } + + public function get_hook() { + return $this->hook; + } + + protected function set_schedule( ActionScheduler_Schedule $schedule ) { + $this->schedule = $schedule; + } + + /** + * @return ActionScheduler_Schedule + */ + public function get_schedule() { + return $this->schedule; + } + + protected function set_args( array $args ) { + $this->args = $args; + } + + public function get_args() { + return $this->args; + } + + /** + * @param string $group + */ + protected function set_group( $group ) { + $this->group = $group; + } + + /** + * @return string + */ + public function get_group() { + return $this->group; + } + + /** + * @return bool If the action has been finished + */ + public function is_finished() { + return FALSE; + } +} diff --git a/classes/ActionScheduler_ActionClaim.php b/classes/ActionScheduler_ActionClaim.php new file mode 100644 index 00000000000..8b5681620e3 --- /dev/null +++ b/classes/ActionScheduler_ActionClaim.php @@ -0,0 +1,23 @@ +id = $id; + $this->action_ids = $action_ids; + } + + public function get_id() { + return $this->id; + } + + public function get_actions() { + return $this->action_ids; + } +} + \ No newline at end of file diff --git a/classes/ActionScheduler_ActionFactory.php b/classes/ActionScheduler_ActionFactory.php new file mode 100644 index 00000000000..8d97417c5f2 --- /dev/null +++ b/classes/ActionScheduler_ActionFactory.php @@ -0,0 +1,111 @@ +store( $action ); + } + + /** + * @param string $hook The hook to trigger when this action runs + * @param array $args Args to pass when the hook is triggered + * @param int $first Unix timestamp for the first run + * @param int $interval Seconds between runs + * @param string $group A group to put the action in + * + * @return string The ID of the stored action + */ + public function recurring( $hook, $args = array(), $first = null, $interval = null, $group = '' ) { + if ( empty($interval) ) { + return $this->single( $hook, $args, $first, $group ); + } + $date = as_get_datetime_object( $first ); + $schedule = new ActionScheduler_IntervalSchedule( $date, $interval ); + $action = new ActionScheduler_Action( $hook, $args, $schedule, $group ); + return $this->store( $action ); + } + + + /** + * @param string $hook The hook to trigger when this action runs + * @param array $args Args to pass when the hook is triggered + * @param int $first Unix timestamp for the first run + * @param int $schedule A cron definition string + * @param string $group A group to put the action in + * + * @return string The ID of the stored action + */ + public function cron( $hook, $args = array(), $first = null, $schedule = null, $group = '' ) { + if ( empty($schedule) ) { + return $this->single( $hook, $args, $first, $group ); + } + $date = as_get_datetime_object( $first ); + $cron = CronExpression::factory( $schedule ); + $schedule = new ActionScheduler_CronSchedule( $date, $cron ); + $action = new ActionScheduler_Action( $hook, $args, $schedule, $group ); + return $this->store( $action ); + } + + /** + * @param ActionScheduler_Action $action + * + * @return string The ID of the stored action + */ + protected function store( ActionScheduler_Action $action ) { + $store = ActionScheduler_Store::instance(); + return $store->save_action( $action ); + } +} diff --git a/classes/ActionScheduler_AdminView.php b/classes/ActionScheduler_AdminView.php new file mode 100644 index 00000000000..91d8b189279 --- /dev/null +++ b/classes/ActionScheduler_AdminView.php @@ -0,0 +1,83 @@ +print(); + } + + /** + * Registers action-scheduler into WooCommerce > System status. + * + * @param array $tabs An associative array of tab key => label. + * @return array $tabs An associative array of tab key => label, including Action Scheduler's tabs + */ + public function register_system_status_tab( array $tabs ) { + $tabs['action-scheduler'] = __( 'Scheduled Actions', 'action-scheduler' ); + + return $tabs; + } + + /** + * Include Action Scheduler's administration under the Tools menu. + * + * A menu under the Tools menu is important for backward compatibility (as that's + * where it started), and also provides more convenient access than the WooCommerce + * System Status page, and for sites where WooCommerce isn't active. + */ + public function register_menu() { + add_submenu_page( + 'tools.php', + __( 'Scheduled Actions', 'action-scheduler' ), + __( 'Scheduled Actions', 'action-scheduler' ), + 'manage_options', + 'action-scheduler', + array( $this, 'render_admin_ui' ) + ); + } + + /** + * Renders the Admin UI + */ + public function render_admin_ui() { + $table = new ActionScheduler_ListTable( ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner() ); + $table->display_page(); + } +} diff --git a/classes/ActionScheduler_CanceledAction.php b/classes/ActionScheduler_CanceledAction.php new file mode 100644 index 00000000000..b1db531143f --- /dev/null +++ b/classes/ActionScheduler_CanceledAction.php @@ -0,0 +1,21 @@ +set_schedule( new ActionScheduler_NullSchedule() ); + } +} diff --git a/classes/ActionScheduler_Compatibility.php b/classes/ActionScheduler_Compatibility.php new file mode 100644 index 00000000000..c06e5a44d00 --- /dev/null +++ b/classes/ActionScheduler_Compatibility.php @@ -0,0 +1,99 @@ + $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) { + if ( false !== @ini_set( 'memory_limit', $filtered_limit ) ) { + return $filtered_limit; + } else { + return false; + } + } elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) { + if ( false !== @ini_set( 'memory_limit', $wp_max_limit ) ) { + return $wp_max_limit; + } else { + return false; + } + } + return false; + } + + /** + * Attempts to raise the PHP timeout for time intensive processes. + * + * Only allows raising the existing limit and prevents lowering it. Wrapper for wc_set_time_limit(), when available. + * + * @param int The time limit in seconds. + */ + public static function raise_time_limit( $limit = 0 ) { + if ( $limit < ini_get( 'max_execution_time' ) ) { + return; + } + + if ( function_exists( 'wc_set_time_limit' ) ) { + wc_set_time_limit( $limit ); + } elseif ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { + @set_time_limit( $limit ); + } + } +} diff --git a/classes/ActionScheduler_CronSchedule.php b/classes/ActionScheduler_CronSchedule.php new file mode 100644 index 00000000000..0441e40a5db --- /dev/null +++ b/classes/ActionScheduler_CronSchedule.php @@ -0,0 +1,57 @@ +start = $start; + $this->cron = $cron; + } + + /** + * @param DateTime $after + * @return DateTime|null + */ + public function next( DateTime $after = NULL ) { + $after = empty($after) ? clone $this->start : clone $after; + return $this->cron->getNextRunDate($after, 0, false); + } + + /** + * @return bool + */ + public function is_recurring() { + return true; + } + + /** + * @return string + */ + public function get_recurrence() { + return strval($this->cron); + } + + /** + * For PHP 5.2 compat, since DateTime objects can't be serialized + * @return array + */ + public function __sleep() { + $this->start_timestamp = $this->start->getTimestamp(); + return array( + 'start_timestamp', + 'cron' + ); + } + + public function __wakeup() { + $this->start = as_get_datetime_object($this->start_timestamp); + } +} + diff --git a/classes/ActionScheduler_DateTime.php b/classes/ActionScheduler_DateTime.php new file mode 100644 index 00000000000..5e8743cae74 --- /dev/null +++ b/classes/ActionScheduler_DateTime.php @@ -0,0 +1,76 @@ +format( 'U' ); + } + + /** + * Set the UTC offset. + * + * This represents a fixed offset instead of a timezone setting. + * + * @param $offset + */ + public function setUtcOffset( $offset ) { + $this->utcOffset = intval( $offset ); + } + + /** + * Returns the timezone offset. + * + * @return int + * @link http://php.net/manual/en/datetime.getoffset.php + */ + public function getOffset() { + return $this->utcOffset ? $this->utcOffset : parent::getOffset(); + } + + /** + * Set the TimeZone associated with the DateTime + * + * @param DateTimeZone $timezone + * + * @return static + * @link http://php.net/manual/en/datetime.settimezone.php + */ + public function setTimezone( $timezone ) { + $this->utcOffset = 0; + parent::setTimezone( $timezone ); + + return $this; + } + + /** + * Get the timestamp with the WordPress timezone offset added or subtracted. + * + * @since 3.0.0 + * @return int + */ + public function getOffsetTimestamp() { + return $this->getTimestamp() + $this->getOffset(); + } +} diff --git a/classes/ActionScheduler_Exception.php b/classes/ActionScheduler_Exception.php new file mode 100644 index 00000000000..9ec713f67ad --- /dev/null +++ b/classes/ActionScheduler_Exception.php @@ -0,0 +1,11 @@ +store = $store; + } + + public function attach( ActionScheduler_ActionClaim $claim ) { + $this->claim = $claim; + add_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) ); + add_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0, 1 ); + add_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0, 0 ); + add_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0, 0 ); + add_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0, 0 ); + } + + public function detach() { + $this->claim = NULL; + $this->untrack_action(); + remove_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) ); + remove_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0 ); + remove_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0 ); + remove_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0 ); + remove_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0 ); + } + + public function track_current_action( $action_id ) { + $this->action_id = $action_id; + } + + public function untrack_action() { + $this->action_id = 0; + } + + public function handle_unexpected_shutdown() { + if ( $error = error_get_last() ) { + if ( in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ) ) ) { + if ( !empty($this->action_id) ) { + $this->store->mark_failure( $this->action_id ); + do_action( 'action_scheduler_unexpected_shutdown', $this->action_id, $error ); + } + } + $this->store->release_claim( $this->claim ); + } + } +} diff --git a/classes/ActionScheduler_FinishedAction.php b/classes/ActionScheduler_FinishedAction.php new file mode 100644 index 00000000000..b23a56c66b7 --- /dev/null +++ b/classes/ActionScheduler_FinishedAction.php @@ -0,0 +1,16 @@ +start = $start; + $this->interval_in_seconds = (int)$interval; + } + + /** + * @param DateTime $after + * + * @return DateTime|null + */ + public function next( DateTime $after = NULL ) { + $after = empty($after) ? as_get_datetime_object('@0') : clone $after; + if ( $after > $this->start ) { + $after->modify('+'.$this->interval_in_seconds.' seconds'); + return $after; + } + return clone $this->start; + } + + /** + * @return bool + */ + public function is_recurring() { + return true; + } + + /** + * @return int + */ + public function interval_in_seconds() { + return $this->interval_in_seconds; + } + + /** + * For PHP 5.2 compat, since DateTime objects can't be serialized + * @return array + */ + public function __sleep() { + $this->start_timestamp = $this->start->getTimestamp(); + return array( + 'start_timestamp', + 'interval_in_seconds' + ); + } + + public function __wakeup() { + $this->start = as_get_datetime_object($this->start_timestamp); + } +} diff --git a/classes/ActionScheduler_InvalidActionException.php b/classes/ActionScheduler_InvalidActionException.php new file mode 100644 index 00000000000..a7decdcac6e --- /dev/null +++ b/classes/ActionScheduler_InvalidActionException.php @@ -0,0 +1,28 @@ + label). + * + * @var array + */ + protected $columns = array(); + + /** + * Actions (name => label). + * + * @var array + */ + protected $row_actions = array(); + + /** + * The active data stores + * + * @var ActionScheduler_Store + */ + protected $store; + + /** + * A logger to use for getting action logs to display + * + * @var ActionScheduler_Logger + */ + protected $logger; + + /** + * A ActionScheduler_QueueRunner runner instance (or child class) + * + * @var ActionScheduler_QueueRunner + */ + protected $runner; + + /** + * Bulk actions. The key of the array is the method name of the implementation: + * + * bulk_(array $ids, string $sql_in). + * + * See the comments in the parent class for further details + * + * @var array + */ + protected $bulk_actions = array(); + + /** + * Flag variable to render our notifications, if any, once. + * + * @var bool + */ + protected static $did_notification = false; + + /** + * Array of seconds for common time periods, like week or month, alongside an internationalised string representation, i.e. "Day" or "Days" + * + * @var array + */ + private static $time_periods; + + /** + * Sets the current data store object into `store->action` and initialises the object. + * + * @param ActionScheduler_Store $store + * @param ActionScheduler_Logger $logger + * @param ActionScheduler_QueueRunner $runner + */ + public function __construct( ActionScheduler_Store $store, ActionScheduler_Logger $logger, ActionScheduler_QueueRunner $runner ) { + + $this->store = $store; + $this->logger = $logger; + $this->runner = $runner; + + $this->table_header = __( 'Scheduled Actions', 'action-scheduler' ); + + $this->bulk_actions = array( + 'delete' => __( 'Delete', 'action-scheduler' ), + ); + + $this->columns = array( + 'hook' => __( 'Hook', 'action-scheduler' ), + 'status' => __( 'Status', 'action-scheduler' ), + 'args' => __( 'Arguments', 'action-scheduler' ), + 'group' => __( 'Group', 'action-scheduler' ), + 'recurrence' => __( 'Recurrence', 'action-scheduler' ), + 'schedule' => __( 'Scheduled Date', 'action-scheduler' ), + 'log_entries' => __( 'Log', 'action-scheduler' ), + ); + + $this->sort_by = array( + 'schedule', + 'hook', + 'group', + ); + + $this->search_by = array( + 'hook', + 'args', + 'claim_id', + ); + + $request_status = $this->get_request_status(); + + if ( empty( $request_status ) ) { + $this->sort_by[] = 'status'; + } elseif ( in_array( $request_status, array( 'in-progress', 'failed' ) ) ) { + $this->columns += array( 'claim_id' => __( 'Claim ID', 'action-scheduler' ) ); + $this->sort_by[] = 'claim_id'; + } + + $this->row_actions = array( + 'hook' => array( + 'run' => array( + 'name' => __( 'Run', 'action-scheduler' ), + 'desc' => __( 'Process the action now as if it were run as part of a queue', 'action-scheduler' ), + ), + 'cancel' => array( + 'name' => __( 'Cancel', 'action-scheduler' ), + 'desc' => __( 'Cancel the action now to avoid it being run in future', 'action-scheduler' ), + 'class' => 'cancel trash', + ), + ), + ); + + self::$time_periods = array( + array( + 'seconds' => YEAR_IN_SECONDS, + 'names' => _n_noop( '%s year', '%s years', 'action-scheduler' ), + ), + array( + 'seconds' => MONTH_IN_SECONDS, + 'names' => _n_noop( '%s month', '%s months', 'action-scheduler' ), + ), + array( + 'seconds' => WEEK_IN_SECONDS, + 'names' => _n_noop( '%s week', '%s weeks', 'action-scheduler' ), + ), + array( + 'seconds' => DAY_IN_SECONDS, + 'names' => _n_noop( '%s day', '%s days', 'action-scheduler' ), + ), + array( + 'seconds' => HOUR_IN_SECONDS, + 'names' => _n_noop( '%s hour', '%s hours', 'action-scheduler' ), + ), + array( + 'seconds' => MINUTE_IN_SECONDS, + 'names' => _n_noop( '%s minute', '%s minutes', 'action-scheduler' ), + ), + array( + 'seconds' => 1, + 'names' => _n_noop( '%s second', '%s seconds', 'action-scheduler' ), + ), + ); + + parent::__construct( array( + 'singular' => 'action-scheduler', + 'plural' => 'action-scheduler', + 'ajax' => false, + ) ); + } + + /** + * Convert an interval of seconds into a two part human friendly string. + * + * The WordPress human_time_diff() function only calculates the time difference to one degree, meaning + * even if an action is 1 day and 11 hours away, it will display "1 day". This function goes one step + * further to display two degrees of accuracy. + * + * Inspired by the Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/ + * + * @param int $interval A interval in seconds. + * @param int $periods_to_include Depth of time periods to include, e.g. for an interval of 70, and $periods_to_include of 2, both minutes and seconds would be included. With a value of 1, only minutes would be included. + * @return string A human friendly string representation of the interval. + */ + private static function human_interval( $interval, $periods_to_include = 2 ) { + + if ( $interval <= 0 ) { + return __( 'Now!', 'action-scheduler' ); + } + + $output = ''; + + for ( $time_period_index = 0, $periods_included = 0, $seconds_remaining = $interval; $time_period_index < count( self::$time_periods ) && $seconds_remaining > 0 && $periods_included < $periods_to_include; $time_period_index++ ) { + + $periods_in_interval = floor( $seconds_remaining / self::$time_periods[ $time_period_index ]['seconds'] ); + + if ( $periods_in_interval > 0 ) { + if ( ! empty( $output ) ) { + $output .= ' '; + } + $output .= sprintf( _n( self::$time_periods[ $time_period_index ]['names'][0], self::$time_periods[ $time_period_index ]['names'][1], $periods_in_interval, 'action-scheduler' ), $periods_in_interval ); + $seconds_remaining -= $periods_in_interval * self::$time_periods[ $time_period_index ]['seconds']; + $periods_included++; + } + } + + return $output; + } + + /** + * Returns the recurrence of an action or 'Non-repeating'. The output is human readable. + * + * @param ActionScheduler_Action $action + * + * @return string + */ + protected function get_recurrence( $action ) { + $recurrence = $action->get_schedule(); + if ( $recurrence->is_recurring() ) { + if ( method_exists( $recurrence, 'interval_in_seconds' ) ) { + return sprintf( __( 'Every %s', 'action-scheduler' ), self::human_interval( $recurrence->interval_in_seconds() ) ); + } + + if ( method_exists( $recurrence, 'get_recurrence' ) ) { + return sprintf( __( 'Cron %s', 'action-scheduler' ), $recurrence->get_recurrence() ); + } + } + + return __( 'Non-repeating', 'action-scheduler' ); + } + + /** + * Serializes the argument of an action to render it in a human friendly format. + * + * @param array $row The array representation of the current row of the table + * + * @return string + */ + public function column_args( array $row ) { + if ( empty( $row['args'] ) ) { + return ''; + } + + $row_html = '
      '; + foreach ( $row['args'] as $key => $value ) { + $row_html .= sprintf( '
    • %s => %s
    • ', esc_html( var_export( $key, true ) ), esc_html( var_export( $value, true ) ) ); + } + $row_html .= '
    '; + + return apply_filters( 'action_scheduler_list_table_column_args', $row_html, $row ); + } + + /** + * Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal. + * + * @param array $row Action array. + * @return string + */ + public function column_log_entries( array $row ) { + + $log_entries_html = '
      '; + + $timezone = new DateTimezone( 'UTC' ); + + foreach ( $row['log_entries'] as $log_entry ) { + $log_entries_html .= $this->get_log_entry_html( $log_entry, $timezone ); + } + + $log_entries_html .= '
    '; + + return $log_entries_html; + } + + /** + * Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal. + * + * @param ActionScheduler_LogEntry $log_entry + * @param DateTimezone $timezone + * @return string + */ + protected function get_log_entry_html( ActionScheduler_LogEntry $log_entry, DateTimezone $timezone ) { + $date = $log_entry->get_date(); + $date->setTimezone( $timezone ); + return sprintf( '
  • %s
    %s
  • ', esc_html( $date->format( 'Y-m-d H:i:s O' ) ), esc_html( $log_entry->get_message() ) ); + } + + /** + * Only display row actions for pending actions. + * + * @param array $row Row to render + * @param string $column_name Current row + * + * @return string + */ + protected function maybe_render_actions( $row, $column_name ) { + if ( 'pending' === strtolower( $row['status'] ) ) { + return parent::maybe_render_actions( $row, $column_name ); + } + + return ''; + } + + /** + * Renders admin notifications + * + * Notifications: + * 1. When the maximum number of tasks are being executed simultaneously + * 2. Notifications when a task us manually executed + */ + public function display_admin_notices() { + + if ( $this->store->get_claim_count() >= $this->runner->get_allowed_concurrent_batches() ) { + $this->admin_notices[] = array( + 'class' => 'updated', + 'message' => sprintf( __( 'Maximum simultaneous batches already in progress (%s queues). No actions will be processed until the current batches are complete.', 'action-scheduler' ), $this->store->get_claim_count() ), + ); + } + + $notification = get_transient( 'action_scheduler_admin_notice' ); + + if ( is_array( $notification ) ) { + delete_transient( 'action_scheduler_admin_notice' ); + + $action = $this->store->fetch_action( $notification['action_id'] ); + $action_hook_html = '' . $action->get_hook() . ''; + if ( 1 == $notification['success'] ) { + $class = 'updated'; + switch ( $notification['row_action_type'] ) { + case 'run' : + $action_message_html = sprintf( __( 'Successfully executed action: %s', 'action-scheduler' ), $action_hook_html ); + break; + case 'cancel' : + $action_message_html = sprintf( __( 'Successfully canceled action: %s', 'action-scheduler' ), $action_hook_html ); + break; + default : + $action_message_html = sprintf( __( 'Successfully processed change for action: %s', 'action-scheduler' ), $action_hook_html ); + break; + } + } else { + $class = 'error'; + $action_message_html = sprintf( __( 'Could not process change for action: "%s" (ID: %d). Error: %s', 'action-scheduler' ), $action_hook_html, esc_html( $notification['action_id'] ), esc_html( $notification['error_message'] ) ); + } + + $action_message_html = apply_filters( 'action_scheduler_admin_notice_html', $action_message_html, $action, $notification ); + + $this->admin_notices[] = array( + 'class' => $class, + 'message' => $action_message_html, + ); + } + + parent::display_admin_notices(); + } + + /** + * Prints the scheduled date in a human friendly format. + * + * @param array $row The array representation of the current row of the table + * + * @return string + */ + public function column_schedule( $row ) { + return $this->get_schedule_display_string( $row['schedule'] ); + } + + /** + * Get the scheduled date in a human friendly format. + * + * @param ActionScheduler_Schedule $schedule + * @return string + */ + protected function get_schedule_display_string( ActionScheduler_Schedule $schedule ) { + + $schedule_display_string = ''; + + if ( ! $schedule->next() ) { + return $schedule_display_string; + } + + $next_timestamp = $schedule->next()->getTimestamp(); + + $schedule_display_string .= $schedule->next()->format( 'Y-m-d H:i:s O' ); + $schedule_display_string .= '
    '; + + if ( gmdate( 'U' ) > $next_timestamp ) { + $schedule_display_string .= sprintf( __( ' (%s ago)', 'action-scheduler' ), self::human_interval( gmdate( 'U' ) - $next_timestamp ) ); + } else { + $schedule_display_string .= sprintf( __( ' (%s)', 'action-scheduler' ), self::human_interval( $next_timestamp - gmdate( 'U' ) ) ); + } + + return $schedule_display_string; + } + + /** + * Bulk delete + * + * Deletes actions based on their ID. This is the handler for the bulk delete. It assumes the data + * properly validated by the callee and it will delete the actions without any extra validation. + * + * @param array $ids + * @param string $ids_sql Inherited and unused + */ + protected function bulk_delete( array $ids, $ids_sql ) { + foreach ( $ids as $id ) { + $this->store->delete_action( $id ); + } + } + + /** + * Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their + * parameters are valid. + * + * @param int $action_id + */ + protected function row_action_cancel( $action_id ) { + $this->process_row_action( $action_id, 'cancel' ); + } + + /** + * Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their + * parameters are valid. + * + * @param int $action_id + */ + protected function row_action_run( $action_id ) { + $this->process_row_action( $action_id, 'run' ); + } + + /** + * Implements the logic behind processing an action once an action link is clicked on the list table. + * + * @param int $action_id + * @param string $row_action_type The type of action to perform on the action. + */ + protected function process_row_action( $action_id, $row_action_type ) { + try { + switch ( $row_action_type ) { + case 'run' : + $this->runner->process_action( $action_id ); + break; + case 'cancel' : + $this->store->cancel_action( $action_id ); + break; + } + $success = 1; + $error_message = ''; + } catch ( Exception $e ) { + $success = 0; + $error_message = $e->getMessage(); + } + + set_transient( 'action_scheduler_admin_notice', compact( 'action_id', 'success', 'error_message', 'row_action_type' ), 30 ); + } + + /** + * {@inheritDoc} + */ + public function prepare_items() { + $this->process_bulk_action(); + + $this->process_row_actions(); + + if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { + // _wp_http_referer is used only on bulk actions, we remove it to keep the $_GET shorter + wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); + exit; + } + + $this->prepare_column_headers(); + + $per_page = $this->get_items_per_page( $this->package . '_items_per_page', $this->items_per_page ); + $query = array( + 'per_page' => $per_page, + 'offset' => $this->get_items_offset(), + 'status' => $this->get_request_status(), + 'orderby' => $this->get_request_orderby(), + 'order' => $this->get_request_order(), + 'search' => $this->get_request_search_query(), + ); + + $this->items = array(); + + $total_items = $this->store->query_actions( $query, 'count' ); + + $status_labels = $this->store->get_status_labels(); + + foreach ( $this->store->query_actions( $query ) as $action_id ) { + try { + $action = $this->store->fetch_action( $action_id ); + } catch ( Exception $e ) { + continue; + } + $this->items[ $action_id ] = array( + 'ID' => $action_id, + 'hook' => $action->get_hook(), + 'status' => $status_labels[ $this->store->get_status( $action_id ) ], + 'args' => $action->get_args(), + 'group' => $action->get_group(), + 'log_entries' => $this->logger->get_logs( $action_id ), + 'claim_id' => $this->store->get_claim_id( $action_id ), + 'recurrence' => $this->get_recurrence( $action ), + 'schedule' => $action->get_schedule(), + ); + } + + $this->set_pagination_args( array( + 'total_items' => $total_items, + 'per_page' => $per_page, + 'total_pages' => ceil( $total_items / $per_page ), + ) ); + } + + /** + * Prints the available statuses so the user can click to filter. + */ + protected function display_filter_by_status() { + $this->status_counts = $this->store->action_counts(); + parent::display_filter_by_status(); + } + + /** + * Get the text to display in the search box on the list table. + */ + protected function get_search_box_button_text() { + return __( 'Search hook, args and claim ID', 'action-scheduler' ); + } +} diff --git a/classes/ActionScheduler_LogEntry.php b/classes/ActionScheduler_LogEntry.php new file mode 100644 index 00000000000..649636debf7 --- /dev/null +++ b/classes/ActionScheduler_LogEntry.php @@ -0,0 +1,67 @@ +comment_type + * to ActionScheduler_LogEntry::__construct(), goodness knows why, and the Follow-up Emails plugin + * hard-codes loading its own version of ActionScheduler_wpCommentLogger with that out-dated method, + * goodness knows why, so we need to guard against that here instead of using a DateTime type declaration + * for the constructor's 3rd param of $date and causing a fatal error with older versions of FUE. + */ + if ( null !== $date && ! is_a( $date, 'DateTime' ) ) { + _doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' ); + $date = null; + } + + $this->action_id = $action_id; + $this->message = $message; + $this->date = $date ? $date : new Datetime; + } + + /** + * Returns the date when this log entry was created + * + * @return Datetime + */ + public function get_date() { + return $this->date; + } + + public function get_action_id() { + return $this->action_id; + } + + public function get_message() { + return $this->message; + } +} + diff --git a/classes/ActionScheduler_Logger.php b/classes/ActionScheduler_Logger.php new file mode 100644 index 00000000000..3da06ab48de --- /dev/null +++ b/classes/ActionScheduler_Logger.php @@ -0,0 +1,98 @@ +log( $action_id, __( 'action created', 'action-scheduler' ) ); + } + + public function log_canceled_action( $action_id ) { + $this->log( $action_id, __( 'action canceled', 'action-scheduler' ) ); + } + + public function log_started_action( $action_id ) { + $this->log( $action_id, __( 'action started', 'action-scheduler' ) ); + } + + public function log_completed_action( $action_id ) { + $this->log( $action_id, __( 'action complete', 'action-scheduler' ) ); + } + + public function log_failed_action( $action_id, Exception $exception ) { + $this->log( $action_id, sprintf( __( 'action failed: %s', 'action-scheduler' ), $exception->getMessage() ) ); + } + + public function log_timed_out_action( $action_id, $timeout ) { + $this->log( $action_id, sprintf( __( 'action timed out after %s seconds', 'action-scheduler' ), $timeout ) ); + } + + public function log_unexpected_shutdown( $action_id, $error ) { + if ( ! empty( $error ) ) { + $this->log( $action_id, sprintf( __( 'unexpected shutdown: PHP Fatal error %s in %s on line %s', 'action-scheduler' ), $error['message'], $error['file'], $error['line'] ) ); + } + } + + public function log_reset_action( $action_id ) { + $this->log( $action_id, __( 'action reset', 'action_scheduler' ) ); + } + + public function log_ignored_action( $action_id ) { + $this->log( $action_id, __( 'action ignored', 'action-scheduler' ) ); + } +} + \ No newline at end of file diff --git a/classes/ActionScheduler_NullAction.php b/classes/ActionScheduler_NullAction.php new file mode 100644 index 00000000000..cd5dc3b0f98 --- /dev/null +++ b/classes/ActionScheduler_NullAction.php @@ -0,0 +1,16 @@ +set_schedule( new ActionScheduler_NullSchedule() ); + } + + public function execute() { + // don't execute + } +} + \ No newline at end of file diff --git a/classes/ActionScheduler_NullLogEntry.php b/classes/ActionScheduler_NullLogEntry.php new file mode 100644 index 00000000000..6f8f218aab4 --- /dev/null +++ b/classes/ActionScheduler_NullLogEntry.php @@ -0,0 +1,11 @@ +store = $store ? $store : ActionScheduler_Store::instance(); + $this->batch_size = $batch_size; + } + + public function delete_old_actions() { + $lifespan = apply_filters( 'action_scheduler_retention_period', $this->month_in_seconds ); + $cutoff = as_get_datetime_object($lifespan.' seconds ago'); + + $statuses_to_purge = array( + ActionScheduler_Store::STATUS_COMPLETE, + ActionScheduler_Store::STATUS_CANCELED, + ); + + foreach ( $statuses_to_purge as $status ) { + $actions_to_delete = $this->store->query_actions( array( + 'status' => $status, + 'modified' => $cutoff, + 'modified_compare' => '<=', + 'per_page' => $this->get_batch_size(), + ) ); + + foreach ( $actions_to_delete as $action_id ) { + try { + $this->store->delete_action( $action_id ); + } catch ( Exception $e ) { + + /** + * Notify 3rd party code of exceptions when deleting a completed action older than the retention period + * + * This hook provides a way for 3rd party code to log or otherwise handle exceptions relating to their + * actions. + * + * @since 2.0.0 + * + * @param int $action_id The scheduled actions ID in the data store + * @param Exception $e The exception thrown when attempting to delete the action from the data store + * @param int $lifespan The retention period, in seconds, for old actions + * @param int $count_of_actions_to_delete The number of old actions being deleted in this batch + */ + do_action( 'action_scheduler_failed_old_action_deletion', $action_id, $e, $lifespan, count( $actions_to_delete ) ); + } + } + } + } + + /** + * Unclaim pending actions that have not been run within a given time limit. + * + * When called by ActionScheduler_Abstract_QueueRunner::run_cleanup(), the time limit passed + * as a parameter is 10x the time limit used for queue processing. + * + * @param int $time_limit The number of seconds to allow a queue to run before unclaiming its pending actions. Default 300 (5 minutes). + */ + public function reset_timeouts( $time_limit = 300 ) { + $timeout = apply_filters( 'action_scheduler_timeout_period', $time_limit ); + if ( $timeout < 0 ) { + return; + } + $cutoff = as_get_datetime_object($timeout.' seconds ago'); + $actions_to_reset = $this->store->query_actions( array( + 'status' => ActionScheduler_Store::STATUS_PENDING, + 'modified' => $cutoff, + 'modified_compare' => '<=', + 'claimed' => true, + 'per_page' => $this->get_batch_size(), + ) ); + + foreach ( $actions_to_reset as $action_id ) { + $this->store->unclaim_action( $action_id ); + do_action( 'action_scheduler_reset_action', $action_id ); + } + } + + /** + * Mark actions that have been running for more than a given time limit as failed, based on + * the assumption some uncatachable and unloggable fatal error occurred during processing. + * + * When called by ActionScheduler_Abstract_QueueRunner::run_cleanup(), the time limit passed + * as a parameter is 10x the time limit used for queue processing. + * + * @param int $time_limit The number of seconds to allow an action to run before it is considered to have failed. Default 300 (5 minutes). + */ + public function mark_failures( $time_limit = 300 ) { + $timeout = apply_filters( 'action_scheduler_failure_period', $time_limit ); + if ( $timeout < 0 ) { + return; + } + $cutoff = as_get_datetime_object($timeout.' seconds ago'); + $actions_to_reset = $this->store->query_actions( array( + 'status' => ActionScheduler_Store::STATUS_RUNNING, + 'modified' => $cutoff, + 'modified_compare' => '<=', + 'per_page' => $this->get_batch_size(), + ) ); + + foreach ( $actions_to_reset as $action_id ) { + $this->store->mark_failure( $action_id ); + do_action( 'action_scheduler_failed_action', $action_id, $timeout ); + } + } + + /** + * Do all of the cleaning actions. + * + * @param int $time_limit The number of seconds to use as the timeout and failure period. Default 300 (5 minutes). + * @author Jeremy Pry + */ + public function clean( $time_limit = 300 ) { + $this->delete_old_actions(); + $this->reset_timeouts( $time_limit ); + $this->mark_failures( $time_limit ); + } + + /** + * Get the batch size for cleaning the queue. + * + * @author Jeremy Pry + * @return int + */ + protected function get_batch_size() { + /** + * Filter the batch size when cleaning the queue. + * + * @param int $batch_size The number of actions to clean in one batch. + */ + return absint( apply_filters( 'action_scheduler_cleanup_batch_size', $this->batch_size ) ); + } +} diff --git a/classes/ActionScheduler_QueueRunner.php b/classes/ActionScheduler_QueueRunner.php new file mode 100644 index 00000000000..f1e5b83b372 --- /dev/null +++ b/classes/ActionScheduler_QueueRunner.php @@ -0,0 +1,115 @@ +get_time_limit() ); + do_action( 'action_scheduler_before_process_queue' ); + $this->run_cleanup(); + $processed_actions = 0; + if ( $this->store->get_claim_count() < $this->get_allowed_concurrent_batches() ) { + $batch_size = apply_filters( 'action_scheduler_queue_runner_batch_size', 25 ); + do { + $processed_actions_in_batch = $this->do_batch( $batch_size ); + $processed_actions += $processed_actions_in_batch; + } while ( $processed_actions_in_batch > 0 && ! $this->batch_limits_exceeded( $processed_actions ) ); // keep going until we run out of actions, time, or memory + } + + do_action( 'action_scheduler_after_process_queue' ); + return $processed_actions; + } + + protected function do_batch( $size = 100 ) { + $claim = $this->store->stake_claim($size); + $this->monitor->attach($claim); + $processed_actions = 0; + + foreach ( $claim->get_actions() as $action_id ) { + // bail if we lost the claim + if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $claim->get_id() ) ) ) { + break; + } + $this->process_action( $action_id ); + $processed_actions++; + + if ( $this->batch_limits_exceeded( $processed_actions ) ) { + break; + } + } + $this->store->release_claim($claim); + $this->monitor->detach(); + $this->clear_caches(); + return $processed_actions; + } + + /** + * Running large batches can eat up memory, as WP adds data to its object cache. + * + * If using a persistent object store, this has the side effect of flushing that + * as well, so this is disabled by default. To enable: + * + * add_filter( 'action_scheduler_queue_runner_flush_cache', '__return_true' ); + */ + protected function clear_caches() { + if ( ! wp_using_ext_object_cache() || apply_filters( 'action_scheduler_queue_runner_flush_cache', false ) ) { + wp_cache_flush(); + } + } + + public function add_wp_cron_schedule( $schedules ) { + $schedules['every_minute'] = array( + 'interval' => 60, // in seconds + 'display' => __( 'Every minute' ), + ); + + return $schedules; + } +} diff --git a/classes/ActionScheduler_Schedule.php b/classes/ActionScheduler_Schedule.php new file mode 100644 index 00000000000..d61a9f7c920 --- /dev/null +++ b/classes/ActionScheduler_Schedule.php @@ -0,0 +1,18 @@ +date = clone $date; + } + + /** + * @param DateTime $after + * + * @return DateTime|null + */ + public function next( DateTime $after = NULL ) { + $after = empty($after) ? as_get_datetime_object('@0') : $after; + return ( $after > $this->date ) ? NULL : clone $this->date; + } + + /** + * @return bool + */ + public function is_recurring() { + return false; + } + + /** + * For PHP 5.2 compat, since DateTime objects can't be serialized + * @return array + */ + public function __sleep() { + $this->timestamp = $this->date->getTimestamp(); + return array( + 'timestamp', + ); + } + + public function __wakeup() { + $this->date = as_get_datetime_object($this->timestamp); + } +} diff --git a/classes/ActionScheduler_Store.php b/classes/ActionScheduler_Store.php new file mode 100644 index 00000000000..59ac236af9a --- /dev/null +++ b/classes/ActionScheduler_Store.php @@ -0,0 +1,212 @@ +', '>=', '<', '<=', '=') ) ) { + return $comparison_operator; + } + return '='; + } + + /** + * Get the time MySQL formated date/time string for an action's (next) scheduled date. + * + * @param ActionScheduler_Action $action + * @param DateTime $scheduled_date (optional) + * @return string + */ + protected function get_scheduled_date_string( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) { + $next = null === $scheduled_date ? $action->get_schedule()->next() : $scheduled_date; + if ( ! $next ) { + throw new InvalidArgumentException( __( 'Invalid schedule. Cannot save action.', 'action-scheduler' ) ); + } + $next->setTimezone( new DateTimeZone( 'UTC' ) ); + + return $next->format( 'Y-m-d H:i:s' ); + } + + /** + * Get the time MySQL formated date/time string for an action's (next) scheduled date. + * + * @param ActionScheduler_Action $action + * @param DateTime $scheduled_date (optional) + * @return string + */ + protected function get_scheduled_date_string_local( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) { + $next = null === $scheduled_date ? $action->get_schedule()->next() : $scheduled_date; + if ( ! $next ) { + throw new InvalidArgumentException( __( 'Invalid schedule. Cannot save action.', 'action-scheduler' ) ); + } + + ActionScheduler_TimezoneHelper::set_local_timezone( $next ); + return $next->format( 'Y-m-d H:i:s' ); + } + + /** + * @return array + */ + public function get_status_labels() { + return array( + self::STATUS_COMPLETE => __( 'Complete', 'action-scheduler' ), + self::STATUS_PENDING => __( 'Pending', 'action-scheduler' ), + self::STATUS_RUNNING => __( 'In-progress', 'action-scheduler' ), + self::STATUS_FAILED => __( 'Failed', 'action-scheduler' ), + self::STATUS_CANCELED => __( 'Canceled', 'action-scheduler' ), + ); + } + + public function init() {} + + /** + * @return ActionScheduler_Store + */ + public static function instance() { + if ( empty(self::$store) ) { + $class = apply_filters('action_scheduler_store_class', 'ActionScheduler_wpPostStore'); + self::$store = new $class(); + } + return self::$store; + } + + /** + * Get the site's local time. + * + * @deprecated 2.1.0 + * @return DateTimeZone + */ + protected function get_local_timezone() { + _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); + return ActionScheduler_TimezoneHelper::get_local_timezone(); + } +} diff --git a/classes/ActionScheduler_TimezoneHelper.php b/classes/ActionScheduler_TimezoneHelper.php new file mode 100644 index 00000000000..fd01449412e --- /dev/null +++ b/classes/ActionScheduler_TimezoneHelper.php @@ -0,0 +1,152 @@ +format( 'U' ) ); + } + + if ( get_option( 'timezone_string' ) ) { + $date->setTimezone( new DateTimeZone( self::get_local_timezone_string() ) ); + } else { + $date->setUtcOffset( self::get_local_timezone_offset() ); + } + + return $date; + } + + /** + * Helper to retrieve the timezone string for a site until a WP core method exists + * (see https://core.trac.wordpress.org/ticket/24730). + * + * Adapted from wc_timezone_string() and https://secure.php.net/manual/en/function.timezone-name-from-abbr.php#89155. + * + * If no timezone string is set, and its not possible to match the UTC offset set for the site to a timezone + * string, then an empty string will be returned, and the UTC offset should be used to set a DateTime's + * timezone. + * + * @since 2.1.0 + * @return string PHP timezone string for the site or empty if no timezone string is available. + */ + protected static function get_local_timezone_string( $reset = false ) { + // If site timezone string exists, return it. + $timezone = get_option( 'timezone_string' ); + if ( $timezone ) { + return $timezone; + } + + // Get UTC offset, if it isn't set then return UTC. + $utc_offset = intval( get_option( 'gmt_offset', 0 ) ); + if ( 0 === $utc_offset ) { + return 'UTC'; + } + + // Adjust UTC offset from hours to seconds. + $utc_offset *= 3600; + + // Attempt to guess the timezone string from the UTC offset. + $timezone = timezone_name_from_abbr( '', $utc_offset ); + if ( $timezone ) { + return $timezone; + } + + // Last try, guess timezone string manually. + foreach ( timezone_abbreviations_list() as $abbr ) { + foreach ( $abbr as $city ) { + if ( (bool) date( 'I' ) === (bool) $city['dst'] && $city['timezone_id'] && intval( $city['offset'] ) === $utc_offset ) { + return $city['timezone_id']; + } + } + } + + // No timezone string + return ''; + } + + /** + * Get timezone offset in seconds. + * + * @since 2.1.0 + * @return float + */ + protected static function get_local_timezone_offset() { + $timezone = get_option( 'timezone_string' ); + + if ( $timezone ) { + $timezone_object = new DateTimeZone( $timezone ); + return $timezone_object->getOffset( new DateTime( 'now' ) ); + } else { + return floatval( get_option( 'gmt_offset', 0 ) ) * HOUR_IN_SECONDS; + } + } + + /** + * @deprecated 2.1.0 + */ + public static function get_local_timezone( $reset = FALSE ) { + _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); + if ( $reset ) { + self::$local_timezone = NULL; + } + if ( !isset(self::$local_timezone) ) { + $tzstring = get_option('timezone_string'); + + if ( empty($tzstring) ) { + $gmt_offset = get_option('gmt_offset'); + if ( $gmt_offset == 0 ) { + $tzstring = 'UTC'; + } else { + $gmt_offset *= HOUR_IN_SECONDS; + $tzstring = timezone_name_from_abbr( '', $gmt_offset, 1 ); + + // If there's no timezone string, try again with no DST. + if ( false === $tzstring ) { + $tzstring = timezone_name_from_abbr( '', $gmt_offset, 0 ); + } + + // Try mapping to the first abbreviation we can find. + if ( false === $tzstring ) { + $is_dst = date( 'I' ); + foreach ( timezone_abbreviations_list() as $abbr ) { + foreach ( $abbr as $city ) { + if ( $city['dst'] == $is_dst && $city['offset'] == $gmt_offset ) { + // If there's no valid timezone ID, keep looking. + if ( null === $city['timezone_id'] ) { + continue; + } + + $tzstring = $city['timezone_id']; + break 2; + } + } + } + } + + // If we still have no valid string, then fall back to UTC. + if ( false === $tzstring ) { + $tzstring = 'UTC'; + } + } + } + + self::$local_timezone = new DateTimeZone($tzstring); + } + return self::$local_timezone; + } +} diff --git a/classes/ActionScheduler_Versions.php b/classes/ActionScheduler_Versions.php new file mode 100644 index 00000000000..915c2e63297 --- /dev/null +++ b/classes/ActionScheduler_Versions.php @@ -0,0 +1,62 @@ +versions[$version_string]) ) { + return FALSE; + } + $this->versions[$version_string] = $initialization_callback; + return TRUE; + } + + public function get_versions() { + return $this->versions; + } + + public function latest_version() { + $keys = array_keys($this->versions); + if ( empty($keys) ) { + return false; + } + uasort( $keys, 'version_compare' ); + return end($keys); + } + + public function latest_version_callback() { + $latest = $this->latest_version(); + if ( empty($latest) || !isset($this->versions[$latest]) ) { + return '__return_null'; + } + return $this->versions[$latest]; + } + + /** + * @return ActionScheduler_Versions + * @codeCoverageIgnore + */ + public static function instance() { + if ( empty(self::$instance) ) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * @codeCoverageIgnore + */ + public static function initialize_latest_version() { + $self = self::instance(); + call_user_func($self->latest_version_callback()); + } +} + \ No newline at end of file diff --git a/classes/ActionScheduler_WPCLI_QueueRunner.php b/classes/ActionScheduler_WPCLI_QueueRunner.php new file mode 100644 index 00000000000..c5689b5cec3 --- /dev/null +++ b/classes/ActionScheduler_WPCLI_QueueRunner.php @@ -0,0 +1,217 @@ +run_cleanup(); + $this->add_hooks(); + + // Check to make sure there aren't too many concurrent processes running. + $claim_count = $this->store->get_claim_count(); + $too_many = $claim_count >= $this->get_allowed_concurrent_batches(); + if ( $too_many ) { + if ( $force ) { + WP_CLI::warning( __( 'There are too many concurrent batches, but the run is forced to continue.', 'action-scheduler' ) ); + } else { + WP_CLI::error( __( 'There are too many concurrent batches.', 'action-scheduler' ) ); + } + } + + // Stake a claim and store it. + $this->claim = $this->store->stake_claim( $batch_size, null, $hooks, $group ); + $this->monitor->attach( $this->claim ); + $this->actions = $this->claim->get_actions(); + + return count( $this->actions ); + } + + /** + * Add our hooks to the appropriate actions. + * + * @author Jeremy Pry + */ + protected function add_hooks() { + add_action( 'action_scheduler_before_execute', array( $this, 'before_execute' ) ); + add_action( 'action_scheduler_after_execute', array( $this, 'after_execute' ), 10, 2 ); + add_action( 'action_scheduler_failed_execution', array( $this, 'action_failed' ), 10, 2 ); + } + + /** + * Set up the WP CLI progress bar. + * + * @author Jeremy Pry + */ + protected function setup_progress_bar() { + $count = count( $this->actions ); + $this->progress_bar = \WP_CLI\Utils\make_progress_bar( + sprintf( _n( 'Running %d action', 'Running %d actions', $count, 'action-scheduler' ), number_format_i18n( $count ) ), + $count + ); + } + + /** + * Process actions in the queue. + * + * @author Jeremy Pry + * @return int The number of actions processed. + */ + public function run() { + do_action( 'action_scheduler_before_process_queue' ); + $this->setup_progress_bar(); + foreach ( $this->actions as $action_id ) { + // Error if we lost the claim. + if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $this->claim->get_id() ) ) ) { + WP_CLI::warning( __( 'The claim has been lost. Aborting current batch.', 'action-scheduler' ) ); + break; + } + + $this->process_action( $action_id ); + $this->progress_bar->tick(); + $this->maybe_stop_the_insanity(); + } + + $completed = $this->progress_bar->current(); + $this->progress_bar->finish(); + $this->store->release_claim( $this->claim ); + do_action( 'action_scheduler_after_process_queue' ); + + return $completed; + } + + /** + * Handle WP CLI message when the action is starting. + * + * @author Jeremy Pry + * + * @param $action_id + */ + public function before_execute( $action_id ) { + /* translators: %s refers to the action ID */ + WP_CLI::log( sprintf( __( 'Started processing action %s', 'action-scheduler' ), $action_id ) ); + } + + /** + * Handle WP CLI message when the action has completed. + * + * @author Jeremy Pry + * + * @param int $action_id + * @param null|ActionScheduler_Action $action The instance of the action. Default to null for backward compatibility. + */ + public function after_execute( $action_id, $action = null ) { + // backward compatibility + if ( null === $action ) { + $action = $this->store->fetch_action( $action_id ); + } + /* translators: %s refers to the action ID */ + WP_CLI::log( sprintf( __( 'Completed processing action %s with hook: %s', 'action-scheduler' ), $action_id, $action->get_hook() ) ); + } + + /** + * Handle WP CLI message when the action has failed. + * + * @author Jeremy Pry + * + * @param int $action_id + * @param Exception $exception + * @throws \WP_CLI\ExitException With failure message. + */ + public function action_failed( $action_id, $exception ) { + WP_CLI::error( + /* translators: %1$s refers to the action ID, %2$s refers to the Exception message */ + sprintf( __( 'Error processing action %1$s: %2$s', 'action-scheduler' ), $action_id, $exception->getMessage() ), + false + ); + } + + /** + * Sleep and help avoid hitting memory limit + * + * @param int $sleep_time Amount of seconds to sleep + */ + protected function stop_the_insanity( $sleep_time = 0 ) { + if ( 0 < $sleep_time ) { + WP_CLI::warning( sprintf( 'Stopped the insanity for %d %s', $sleep_time, _n( 'second', 'seconds', $sleep_time ) ) ); + sleep( $sleep_time ); + } + + WP_CLI::warning( __( 'Attempting to reduce used memory...', 'action-scheduler' ) ); + + /** + * @var $wpdb \wpdb + * @var $wp_object_cache \WP_Object_Cache + */ + global $wpdb, $wp_object_cache; + + $wpdb->queries = array(); + + if ( ! is_object( $wp_object_cache ) ) { + return; + } + + $wp_object_cache->group_ops = array(); + $wp_object_cache->stats = array(); + $wp_object_cache->memcache_debug = array(); + $wp_object_cache->cache = array(); + + if ( is_callable( array( $wp_object_cache, '__remoteset' ) ) ) { + call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important + } + } + + /** + * Maybe trigger the stop_the_insanity() method to free up memory. + */ + protected function maybe_stop_the_insanity() { + // The value returned by progress_bar->current() might be padded. Remove padding, and convert to int. + $current_iteration = intval( trim( $this->progress_bar->current() ) ); + if ( 0 === $current_iteration % 50 ) { + $this->stop_the_insanity(); + } + } +} diff --git a/classes/ActionScheduler_WPCLI_Scheduler_command.php b/classes/ActionScheduler_WPCLI_Scheduler_command.php new file mode 100644 index 00000000000..30d0974510d --- /dev/null +++ b/classes/ActionScheduler_WPCLI_Scheduler_command.php @@ -0,0 +1,145 @@ +] + * : The maximum number of actions to run. Defaults to 100. + * + * [--batches=] + * : Limit execution to a number of batches. Defaults to 0, meaning batches will continue being executed until all actions are complete. + * + * [--cleanup-batch-size=] + * : The maximum number of actions to clean up. Defaults to the value of --batch-size. + * + * [--hooks=] + * : Only run actions with the specified hook. Omitting this option runs actions with any hook. Define multiple hooks as a comma separated string (without spaces), e.g. `--hooks=hook_one,hook_two,hook_three` + * + * [--group=] + * : Only run actions from the specified group. Omitting this option runs actions from all groups. + * + * [--force] + * : Whether to force execution despite the maximum number of concurrent processes being exceeded. + * + * @param array $args Positional arguments. + * @param array $assoc_args Keyed arguments. + * @throws \WP_CLI\ExitException When an error occurs. + */ + public function run( $args, $assoc_args ) { + // Handle passed arguments. + $batch = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'batch-size', 100 ) ); + $batches = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'batches', 0 ) ); + $clean = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'cleanup-batch-size', $batch ) ); + $hooks = explode( ',', WP_CLI\Utils\get_flag_value( $assoc_args, 'hooks', '' ) ); + $hooks = array_filter( array_map( 'trim', $hooks ) ); + $group = \WP_CLI\Utils\get_flag_value( $assoc_args, 'group', '' ); + $force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force', false ); + + $batches_completed = 0; + $actions_completed = 0; + $unlimited = $batches === 0; + + try { + // Custom queue cleaner instance. + $cleaner = new ActionScheduler_QueueCleaner( null, $clean ); + + // Get the queue runner instance + $runner = new ActionScheduler_WPCLI_QueueRunner( null, null, $cleaner ); + + // Determine how many tasks will be run in the first batch. + $total = $runner->setup( $batch, $hooks, $group, $force ); + + // Run actions for as long as possible. + while ( $total > 0 ) { + $this->print_total_actions( $total ); + $actions_completed += $runner->run(); + $batches_completed++; + + // Maybe set up tasks for the next batch. + $total = ( $unlimited || $batches_completed < $batches ) ? $runner->setup( $batch, $hooks, $group, $force ) : 0; + } + } catch ( Exception $e ) { + $this->print_error( $e ); + } + + $this->print_total_batches( $batches_completed ); + $this->print_success( $actions_completed ); + } + + /** + * Print WP CLI message about how many actions are about to be processed. + * + * @author Jeremy Pry + * + * @param int $total + */ + protected function print_total_actions( $total ) { + WP_CLI::log( + sprintf( + /* translators: %d refers to how many scheduled taks were found to run */ + _n( 'Found %d scheduled task', 'Found %d scheduled tasks', $total, 'action-scheduler' ), + number_format_i18n( $total ) + ) + ); + } + + /** + * Print WP CLI message about how many batches of actions were processed. + * + * @author Jeremy Pry + * + * @param int $batches_completed + */ + protected function print_total_batches( $batches_completed ) { + WP_CLI::log( + sprintf( + /* translators: %d refers to the total number of batches executed */ + _n( '%d batch executed.', '%d batches executed.', $batches_completed, 'action-scheduler' ), + number_format_i18n( $batches_completed ) + ) + ); + } + + /** + * Convert an exception into a WP CLI error. + * + * @author Jeremy Pry + * + * @param Exception $e The error object. + * + * @throws \WP_CLI\ExitException + */ + protected function print_error( Exception $e ) { + WP_CLI::error( + sprintf( + /* translators: %s refers to the exception error message. */ + __( 'There was an error running the action scheduler: %s', 'action-scheduler' ), + $e->getMessage() + ) + ); + } + + /** + * Print a success message with the number of completed actions. + * + * @author Jeremy Pry + * + * @param int $actions_completed + */ + protected function print_success( $actions_completed ) { + WP_CLI::success( + sprintf( + /* translators: %d refers to the total number of taskes completed */ + _n( '%d scheduled task completed.', '%d scheduled tasks completed.', $actions_completed, 'action-scheduler' ), + number_format_i18n( $actions_completed ) + ) + ); + } +} diff --git a/classes/ActionScheduler_wcSystemStatus.php b/classes/ActionScheduler_wcSystemStatus.php new file mode 100644 index 00000000000..ec7f5a44661 --- /dev/null +++ b/classes/ActionScheduler_wcSystemStatus.php @@ -0,0 +1,129 @@ +store = $store; + } + + /** + * Display action data, including number of actions grouped by status and the oldest & newest action in each status. + * + * Helpful to identify issues, like a clogged queue. + */ + public function print() { + $action_counts = $this->store->action_counts(); + $status_labels = $this->store->get_status_labels(); + $oldest_and_newest = $this->get_oldest_and_newest( array_keys( $status_labels ) ); + + $this->get_template( $status_labels, $action_counts, $oldest_and_newest ); + } + + /** + * Get oldest and newest scheduled dates for a given set of statuses. + * + * @param array $status_keys Set of statuses to find oldest & newest action for. + * @return array + */ + protected function get_oldest_and_newest( $status_keys ) { + + $oldest_and_newest = array(); + + foreach ( $status_keys as $status ) { + $oldest_and_newest[ $status ] = array( + 'oldest' => '–', + 'newest' => '–', + ); + + if ( 'in-progress' === $status ) { + continue; + } + + $oldest_and_newest[ $status ]['oldest'] = $this->get_action_status_date( $status, 'oldest' ); + $oldest_and_newest[ $status ]['newest'] = $this->get_action_status_date( $status, 'newest' ); + } + + return $oldest_and_newest; + } + + /** + * Get oldest or newest scheduled date for a given status. + * + * @param string $status Action status label/name string. + * @param string $date_type Oldest or Newest. + * @return DateTime + */ + protected function get_action_status_date( $status, $date_type = 'oldest' ) { + + $order = 'oldest' === $date_type ? 'ASC' : 'DESC'; + + $action = $this->store->query_actions( array( + 'claimed' => false, + 'status' => $status, + 'per_page' => 1, + 'order' => $order, + ) ); + + if ( ! empty( $action ) ) { + $date_object = $this->store->get_date( $action[0] ); + $action_date = $date_object->format( 'Y-m-d H:i:s O' ); + } else { + $action_date = '–'; + } + + return $action_date; + } + + /** + * Get oldest or newest scheduled date for a given status. + * + * @param array $status_labels Set of statuses to find oldest & newest action for. + * @param array $action_counts Number of actions grouped by status. + * @param array $oldest_and_newest Date of the oldest and newest action with each status. + */ + protected function get_template( $status_labels, $action_counts, $oldest_and_newest ) { + ?> + + + + + + + + + + + + + + + + $count ) { + // WC uses the 3rd column for export, so we need to display more data in that (hidden when viewed as part of the table) and add an empty 2nd column. + printf( + '', + esc_html( $status_labels[ $status ] ), + number_format_i18n( $count ), + $oldest_and_newest[ $status ]['oldest'], + $oldest_and_newest[ $status ]['newest'] + ); + } + ?> + +

     
    %1$s %2$s, Oldest: %3$s, Newest: %4$s%3$s%4$s
    + + create_wp_comment( $action_id, $message, $date ); + return $comment_id; + } + + protected function create_wp_comment( $action_id, $message, DateTime $date ) { + + $comment_date_gmt = $date->format('Y-m-d H:i:s'); + ActionScheduler_TimezoneHelper::set_local_timezone( $date ); + $comment_data = array( + 'comment_post_ID' => $action_id, + 'comment_date' => $date->format('Y-m-d H:i:s'), + 'comment_date_gmt' => $comment_date_gmt, + 'comment_author' => self::AGENT, + 'comment_content' => $message, + 'comment_agent' => self::AGENT, + 'comment_type' => self::TYPE, + ); + return wp_insert_comment($comment_data); + } + + /** + * @param string $entry_id + * + * @return ActionScheduler_LogEntry + */ + public function get_entry( $entry_id ) { + $comment = $this->get_comment( $entry_id ); + if ( empty($comment) || $comment->comment_type != self::TYPE ) { + return new ActionScheduler_NullLogEntry(); + } + + $date = as_get_datetime_object( $comment->comment_date_gmt ); + ActionScheduler_TimezoneHelper::set_local_timezone( $date ); + return new ActionScheduler_LogEntry( $comment->comment_post_ID, $comment->comment_content, $date ); + } + + /** + * @param string $action_id + * + * @return ActionScheduler_LogEntry[] + */ + public function get_logs( $action_id ) { + $status = 'all'; + if ( get_post_status($action_id) == 'trash' ) { + $status = 'post-trashed'; + } + $comments = get_comments(array( + 'post_id' => $action_id, + 'orderby' => 'comment_date_gmt', + 'order' => 'ASC', + 'type' => self::TYPE, + 'status' => $status, + )); + $logs = array(); + foreach ( $comments as $c ) { + $entry = $this->get_entry( $c ); + if ( !empty($entry) ) { + $logs[] = $entry; + } + } + return $logs; + } + + protected function get_comment( $comment_id ) { + return get_comment( $comment_id ); + } + + + + /** + * @param WP_Comment_Query $query + */ + public function filter_comment_queries( $query ) { + foreach ( array('ID', 'parent', 'post_author', 'post_name', 'post_parent', 'type', 'post_type', 'post_id', 'post_ID') as $key ) { + if ( !empty($query->query_vars[$key]) ) { + return; // don't slow down queries that wouldn't include action_log comments anyway + } + } + $query->query_vars['action_log_filter'] = TRUE; + add_filter( 'comments_clauses', array( $this, 'filter_comment_query_clauses' ), 10, 2 ); + } + + /** + * @param array $clauses + * @param WP_Comment_Query $query + * + * @return array + */ + public function filter_comment_query_clauses( $clauses, $query ) { + if ( !empty($query->query_vars['action_log_filter']) ) { + $clauses['where'] .= $this->get_where_clause(); + } + return $clauses; + } + + /** + * Make sure Action Scheduler logs are excluded from comment feeds, which use WP_Query, not + * the WP_Comment_Query class handled by @see self::filter_comment_queries(). + * + * @param string $where + * @param WP_Query $query + * + * @return string + */ + public function filter_comment_feed( $where, $query ) { + if ( is_comment_feed() ) { + $where .= $this->get_where_clause(); + } + return $where; + } + + /** + * Return a SQL clause to exclude Action Scheduler comments. + * + * @return string + */ + protected function get_where_clause() { + global $wpdb; + return sprintf( " AND {$wpdb->comments}.comment_type != '%s'", self::TYPE ); + } + + /** + * Remove action log entries from wp_count_comments() + * + * @param array $stats + * @param int $post_id + * + * @return object + */ + public function filter_comment_count( $stats, $post_id ) { + global $wpdb; + + if ( 0 === $post_id ) { + $stats = $this->get_comment_count(); + } + + return $stats; + } + + /** + * Retrieve the comment counts from our cache, or the database if the cached version isn't set. + * + * @return object + */ + protected function get_comment_count() { + global $wpdb; + + $stats = get_transient( 'as_comment_count' ); + + if ( ! $stats ) { + $stats = array(); + + $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN('order_note','action_log') GROUP BY comment_approved", ARRAY_A ); + + $total = 0; + $stats = array(); + $approved = array( '0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed' ); + + foreach ( (array) $count as $row ) { + // Don't count post-trashed toward totals + if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) { + $total += $row['num_comments']; + } + if ( isset( $approved[ $row['comment_approved'] ] ) ) { + $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments']; + } + } + + $stats['total_comments'] = $total; + $stats['all'] = $total; + + foreach ( $approved as $key ) { + if ( empty( $stats[ $key ] ) ) { + $stats[ $key ] = 0; + } + } + + $stats = (object) $stats; + set_transient( 'as_comment_count', $stats ); + } + + return $stats; + } + + /** + * Delete comment count cache whenever there is new comment or the status of a comment changes. Cache + * will be regenerated next time ActionScheduler_wpCommentLogger::filter_comment_count() is called. + */ + public function delete_comment_count_cache() { + delete_transient( 'as_comment_count' ); + } + + /** + * @codeCoverageIgnore + */ + public function init() { + add_action( 'action_scheduler_before_process_queue', array( $this, 'disable_comment_counting' ), 10, 0 ); + add_action( 'action_scheduler_after_process_queue', array( $this, 'enable_comment_counting' ), 10, 0 ); + + parent::init(); + + add_action( 'pre_get_comments', array( $this, 'filter_comment_queries' ), 10, 1 ); + add_action( 'wp_count_comments', array( $this, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs + add_action( 'comment_feed_where', array( $this, 'filter_comment_feed' ), 10, 2 ); + + // Delete comments count cache whenever there is a new comment or a comment status changes + add_action( 'wp_insert_comment', array( $this, 'delete_comment_count_cache' ) ); + add_action( 'wp_set_comment_status', array( $this, 'delete_comment_count_cache' ) ); + } + + public function disable_comment_counting() { + wp_defer_comment_counting(true); + } + public function enable_comment_counting() { + wp_defer_comment_counting(false); + } + +} diff --git a/classes/ActionScheduler_wpPostStore.php b/classes/ActionScheduler_wpPostStore.php new file mode 100644 index 00000000000..59ee651522e --- /dev/null +++ b/classes/ActionScheduler_wpPostStore.php @@ -0,0 +1,807 @@ +validate_action( $action ); + $post_array = $this->create_post_array( $action, $scheduled_date ); + $post_id = $this->save_post_array( $post_array ); + $this->save_post_schedule( $post_id, $action->get_schedule() ); + $this->save_action_group( $post_id, $action->get_group() ); + do_action( 'action_scheduler_stored_action', $post_id ); + return $post_id; + } catch ( Exception $e ) { + throw new RuntimeException( sprintf( __('Error saving action: %s', 'action-scheduler'), $e->getMessage() ), 0 ); + } + } + + protected function create_post_array( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) { + $post = array( + 'post_type' => self::POST_TYPE, + 'post_title' => $action->get_hook(), + 'post_content' => json_encode($action->get_args()), + 'post_status' => ( $action->is_finished() ? 'publish' : 'pending' ), + 'post_date_gmt' => $this->get_scheduled_date_string( $action, $scheduled_date ), + 'post_date' => $this->get_scheduled_date_string_local( $action, $scheduled_date ), + ); + return $post; + } + + protected function save_post_array( $post_array ) { + add_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10, 1 ); + add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 ); + $post_id = wp_insert_post($post_array); + remove_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10 ); + remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 ); + + if ( is_wp_error($post_id) || empty($post_id) ) { + throw new RuntimeException(__('Unable to save action.', 'action-scheduler')); + } + return $post_id; + } + + public function filter_insert_post_data( $postdata ) { + if ( $postdata['post_type'] == self::POST_TYPE ) { + $postdata['post_author'] = 0; + if ( $postdata['post_status'] == 'future' ) { + $postdata['post_status'] = 'publish'; + } + } + return $postdata; + } + + /** + * Create a (probably unique) post name for scheduled actions in a more performant manner than wp_unique_post_slug(). + * + * When an action's post status is transitioned to something other than 'draft', 'pending' or 'auto-draft, like 'publish' + * or 'failed' or 'trash', WordPress will find a unique slug (stored in post_name column) using the wp_unique_post_slug() + * function. This is done to ensure URL uniqueness. The approach taken by wp_unique_post_slug() is to iterate over existing + * post_name values that match, and append a number 1 greater than the largest. This makes sense when manually creating a + * post from the Edit Post screen. It becomes a bottleneck when automatically processing thousands of actions, with a + * database containing thousands of related post_name values. + * + * WordPress 5.1 introduces the 'pre_wp_unique_post_slug' filter for plugins to address this issue. + * + * We can short-circuit WordPress's wp_unique_post_slug() approach using the 'pre_wp_unique_post_slug' filter. This + * method is available to be used as a callback on that filter. It provides a more scalable approach to generating a + * post_name/slug that is probably unique. Because Action Scheduler never actually uses the post_name field, or an + * action's slug, being probably unique is good enough. + * + * For more backstory on this issue, see: + * - https://github.com/Prospress/action-scheduler/issues/44 and + * - https://core.trac.wordpress.org/ticket/21112 + * + * @param string $override_slug Short-circuit return value. + * @param string $slug The desired slug (post_name). + * @param int $post_ID Post ID. + * @param string $post_status The post status. + * @param string $post_type Post type. + * @return string + */ + public function set_unique_post_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) { + if ( self::POST_TYPE == $post_type ) { + $override_slug = uniqid( self::POST_TYPE . '-', true ) . '-' . wp_generate_password( 32, false ); + } + return $override_slug; + } + + protected function save_post_schedule( $post_id, $schedule ) { + update_post_meta( $post_id, self::SCHEDULE_META_KEY, $schedule ); + } + + protected function save_action_group( $post_id, $group ) { + if ( empty($group) ) { + wp_set_object_terms( $post_id, array(), self::GROUP_TAXONOMY, FALSE ); + } else { + wp_set_object_terms( $post_id, array($group), self::GROUP_TAXONOMY, FALSE ); + } + } + + public function fetch_action( $action_id ) { + $post = $this->get_post( $action_id ); + if ( empty($post) || $post->post_type != self::POST_TYPE ) { + return $this->get_null_action(); + } + return $this->make_action_from_post($post); + } + + protected function get_post( $action_id ) { + if ( empty($action_id) ) { + return NULL; + } + return get_post($action_id); + } + + protected function get_null_action() { + return new ActionScheduler_NullAction(); + } + + protected function make_action_from_post( $post ) { + $hook = $post->post_title; + $args = json_decode( $post->post_content, true ); + $this->validate_args( $args, $post->ID ); + + $schedule = get_post_meta( $post->ID, self::SCHEDULE_META_KEY, true ); + if ( empty( $schedule ) || ! is_a( $schedule, 'ActionScheduler_Schedule' ) ) { + $schedule = new ActionScheduler_NullSchedule(); + } + $group = wp_get_object_terms( $post->ID, self::GROUP_TAXONOMY, array('fields' => 'names') ); + $group = empty( $group ) ? '' : reset($group); + + return ActionScheduler::factory()->get_stored_action( $this->get_action_status_by_post_status( $post->post_status ), $hook, $args, $schedule, $group ); + } + + /** + * @param string $post_status + * + * @throws InvalidArgumentException if $post_status not in known status fields returned by $this->get_status_labels() + * @return string + */ + protected function get_action_status_by_post_status( $post_status ) { + + switch ( $post_status ) { + case 'publish' : + $action_status = self::STATUS_COMPLETE; + break; + case 'trash' : + $action_status = self::STATUS_CANCELED; + break; + default : + if ( ! array_key_exists( $post_status, $this->get_status_labels() ) ) { + throw new InvalidArgumentException( sprintf( 'Invalid post status: "%s". No matching action status available.', $post_status ) ); + } + $action_status = $post_status; + break; + } + + return $action_status; + } + + /** + * @param string $action_status + * @throws InvalidArgumentException if $post_status not in known status fields returned by $this->get_status_labels() + * @return string + */ + protected function get_post_status_by_action_status( $action_status ) { + + switch ( $action_status ) { + case self::STATUS_COMPLETE : + $post_status = 'publish'; + break; + case self::STATUS_CANCELED : + $post_status = 'trash'; + break; + default : + if ( ! array_key_exists( $action_status, $this->get_status_labels() ) ) { + throw new InvalidArgumentException( sprintf( 'Invalid action status: "%s".', $action_status ) ); + } + $post_status = $action_status; + break; + } + + return $post_status; + } + + /** + * @param string $hook + * @param array $params + * + * @return string ID of the next action matching the criteria or NULL if not found + */ + public function find_action( $hook, $params = array() ) { + $params = wp_parse_args( $params, array( + 'args' => NULL, + 'status' => ActionScheduler_Store::STATUS_PENDING, + 'group' => '', + )); + /** @var wpdb $wpdb */ + global $wpdb; + $query = "SELECT p.ID FROM {$wpdb->posts} p"; + $args = array(); + if ( !empty($params['group']) ) { + $query .= " INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id=p.ID"; + $query .= " INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id=tt.term_taxonomy_id"; + $query .= " INNER JOIN {$wpdb->terms} t ON tt.term_id=t.term_id AND t.slug=%s"; + $args[] = $params['group']; + } + $query .= " WHERE p.post_title=%s"; + $args[] = $hook; + $query .= " AND p.post_type=%s"; + $args[] = self::POST_TYPE; + if ( !is_null($params['args']) ) { + $query .= " AND p.post_content=%s"; + $args[] = json_encode($params['args']); + } + + if ( ! empty( $params['status'] ) ) { + $query .= " AND p.post_status=%s"; + $args[] = $this->get_post_status_by_action_status( $params['status'] ); + } + + switch ( $params['status'] ) { + case self::STATUS_COMPLETE: + case self::STATUS_RUNNING: + case self::STATUS_FAILED: + $order = 'DESC'; // Find the most recent action that matches + break; + case self::STATUS_PENDING: + default: + $order = 'ASC'; // Find the next action that matches + break; + } + $query .= " ORDER BY post_date_gmt $order LIMIT 1"; + + $query = $wpdb->prepare( $query, $args ); + + $id = $wpdb->get_var($query); + return $id; + } + + /** + * Returns the SQL statement to query (or count) actions. + * + * @param array $query Filtering options + * @param string $select_or_count Whether the SQL should select and return the IDs or just the row count + * @throws InvalidArgumentException if $select_or_count not count or select + * @return string SQL statement. The returned SQL is already properly escaped. + */ + protected function get_query_actions_sql( array $query, $select_or_count = 'select' ) { + + if ( ! in_array( $select_or_count, array( 'select', 'count' ) ) ) { + throw new InvalidArgumentException(__('Invalid schedule. Cannot save action.', 'action-scheduler')); + } + + $query = wp_parse_args( $query, array( + 'hook' => '', + 'args' => NULL, + 'date' => NULL, + 'date_compare' => '<=', + 'modified' => NULL, + 'modified_compare' => '<=', + 'group' => '', + 'status' => '', + 'claimed' => NULL, + 'per_page' => 5, + 'offset' => 0, + 'orderby' => 'date', + 'order' => 'ASC', + 'search' => '', + ) ); + + /** @var wpdb $wpdb */ + global $wpdb; + $sql = ( 'count' === $select_or_count ) ? 'SELECT count(p.ID)' : 'SELECT p.ID '; + $sql .= "FROM {$wpdb->posts} p"; + $sql_params = array(); + if ( ! empty( $query['group'] ) || 'group' === $query['orderby'] ) { + $sql .= " INNER JOIN {$wpdb->term_relationships} tr ON tr.object_id=p.ID"; + $sql .= " INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id=tt.term_taxonomy_id"; + $sql .= " INNER JOIN {$wpdb->terms} t ON tt.term_id=t.term_id"; + + if ( ! empty( $query['group'] ) ) { + $sql .= " AND t.slug=%s"; + $sql_params[] = $query['group']; + } + } + $sql .= " WHERE post_type=%s"; + $sql_params[] = self::POST_TYPE; + if ( $query['hook'] ) { + $sql .= " AND p.post_title=%s"; + $sql_params[] = $query['hook']; + } + if ( !is_null($query['args']) ) { + $sql .= " AND p.post_content=%s"; + $sql_params[] = json_encode($query['args']); + } + + if ( ! empty( $query['status'] ) ) { + $sql .= " AND p.post_status=%s"; + $sql_params[] = $this->get_post_status_by_action_status( $query['status'] ); + } + + if ( $query['date'] instanceof DateTime ) { + $date = clone $query['date']; + $date->setTimezone( new DateTimeZone('UTC') ); + $date_string = $date->format('Y-m-d H:i:s'); + $comparator = $this->validate_sql_comparator($query['date_compare']); + $sql .= " AND p.post_date_gmt $comparator %s"; + $sql_params[] = $date_string; + } + + if ( $query['modified'] instanceof DateTime ) { + $modified = clone $query['modified']; + $modified->setTimezone( new DateTimeZone('UTC') ); + $date_string = $modified->format('Y-m-d H:i:s'); + $comparator = $this->validate_sql_comparator($query['modified_compare']); + $sql .= " AND p.post_modified_gmt $comparator %s"; + $sql_params[] = $date_string; + } + + if ( $query['claimed'] === TRUE ) { + $sql .= " AND p.post_password != ''"; + } elseif ( $query['claimed'] === FALSE ) { + $sql .= " AND p.post_password = ''"; + } elseif ( !is_null($query['claimed']) ) { + $sql .= " AND p.post_password = %s"; + $sql_params[] = $query['claimed']; + } + + if ( ! empty( $query['search'] ) ) { + $sql .= " AND (p.post_title LIKE %s OR p.post_content LIKE %s OR p.post_password LIKE %s)"; + for( $i = 0; $i < 3; $i++ ) { + $sql_params[] = sprintf( '%%%s%%', $query['search'] ); + } + } + + if ( 'select' === $select_or_count ) { + switch ( $query['orderby'] ) { + case 'hook': + $orderby = 'p.post_title'; + break; + case 'group': + $orderby = 't.name'; + break; + case 'status': + $orderby = 'p.post_status'; + break; + case 'modified': + $orderby = 'p.post_modified'; + break; + case 'claim_id': + $orderby = 'p.post_password'; + break; + case 'schedule': + case 'date': + default: + $orderby = 'p.post_date_gmt'; + break; + } + if ( 'ASC' === strtoupper( $query['order'] ) ) { + $order = 'ASC'; + } else { + $order = 'DESC'; + } + $sql .= " ORDER BY $orderby $order"; + if ( $query['per_page'] > 0 ) { + $sql .= " LIMIT %d, %d"; + $sql_params[] = $query['offset']; + $sql_params[] = $query['per_page']; + } + } + + return $wpdb->prepare( $sql, $sql_params ); + } + + /** + * @param array $query + * @param string $query_type Whether to select or count the results. Default, select. + * @return string|array The IDs of actions matching the query + */ + public function query_actions( $query = array(), $query_type = 'select' ) { + /** @var wpdb $wpdb */ + global $wpdb; + + $sql = $this->get_query_actions_sql( $query, $query_type ); + + return ( 'count' === $query_type ) ? $wpdb->get_var( $sql ) : $wpdb->get_col( $sql ); + } + + /** + * Get a count of all actions in the store, grouped by status + * + * @return array + */ + public function action_counts() { + + $action_counts_by_status = array(); + $action_stati_and_labels = $this->get_status_labels(); + $posts_count_by_status = (array) wp_count_posts( self::POST_TYPE, 'readable' ); + + foreach ( $posts_count_by_status as $post_status_name => $count ) { + + try { + $action_status_name = $this->get_action_status_by_post_status( $post_status_name ); + } catch ( Exception $e ) { + // Ignore any post statuses that aren't for actions + continue; + } + if ( array_key_exists( $action_status_name, $action_stati_and_labels ) ) { + $action_counts_by_status[ $action_status_name ] = $count; + } + } + + return $action_counts_by_status; + } + + /** + * @param string $action_id + * + * @throws InvalidArgumentException + */ + public function cancel_action( $action_id ) { + $post = get_post($action_id); + if ( empty($post) || ($post->post_type != self::POST_TYPE) ) { + throw new InvalidArgumentException(sprintf(__('Unidentified action %s', 'action-scheduler'), $action_id)); + } + do_action( 'action_scheduler_canceled_action', $action_id ); + add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 ); + wp_trash_post($action_id); + remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 ); + } + + public function delete_action( $action_id ) { + $post = get_post($action_id); + if ( empty($post) || ($post->post_type != self::POST_TYPE) ) { + throw new InvalidArgumentException(sprintf(__('Unidentified action %s', 'action-scheduler'), $action_id)); + } + do_action( 'action_scheduler_deleted_action', $action_id ); + wp_delete_post($action_id, TRUE); + } + + /** + * @param string $action_id + * + * @throws InvalidArgumentException + * @return ActionScheduler_DateTime The date the action is schedule to run, or the date that it ran. + */ + public function get_date( $action_id ) { + $next = $this->get_date_gmt( $action_id ); + return ActionScheduler_TimezoneHelper::set_local_timezone( $next ); + } + + /** + * @param string $action_id + * + * @throws InvalidArgumentException + * @return ActionScheduler_DateTime The date the action is schedule to run, or the date that it ran. + */ + public function get_date_gmt( $action_id ) { + $post = get_post($action_id); + if ( empty($post) || ($post->post_type != self::POST_TYPE) ) { + throw new InvalidArgumentException(sprintf(__('Unidentified action %s', 'action-scheduler'), $action_id)); + } + if ( $post->post_status == 'publish' ) { + return as_get_datetime_object($post->post_modified_gmt); + } else { + return as_get_datetime_object($post->post_date_gmt); + } + } + + /** + * @param int $max_actions + * @param DateTime $before_date Jobs must be schedule before this date. Defaults to now. + * @param array $hooks Claim only actions with a hook or hooks. + * @param string $group Claim only actions in the given group. + * + * @return ActionScheduler_ActionClaim + * @throws RuntimeException When there is an error staking a claim. + * @throws InvalidArgumentException When the given group is not valid. + */ + public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' ) { + $claim_id = $this->generate_claim_id(); + $this->claim_actions( $claim_id, $max_actions, $before_date, $hooks, $group ); + $action_ids = $this->find_actions_by_claim_id( $claim_id ); + + return new ActionScheduler_ActionClaim( $claim_id, $action_ids ); + } + + /** + * @return int + */ + public function get_claim_count(){ + global $wpdb; + + $sql = "SELECT COUNT(DISTINCT post_password) FROM {$wpdb->posts} WHERE post_password != '' AND post_type = %s AND post_status IN ('in-progress','pending')"; + $sql = $wpdb->prepare( $sql, array( self::POST_TYPE ) ); + + return $wpdb->get_var( $sql ); + } + + protected function generate_claim_id() { + $claim_id = md5(microtime(true) . rand(0,1000)); + return substr($claim_id, 0, 20); // to fit in db field with 20 char limit + } + + /** + * @param string $claim_id + * @param int $limit + * @param DateTime $before_date Should use UTC timezone. + * @param array $hooks Claim only actions with a hook or hooks. + * @param string $group Claim only actions in the given group. + * + * @return int The number of actions that were claimed + * @throws RuntimeException When there is a database error. + * @throws InvalidArgumentException When the group is invalid. + */ + protected function claim_actions( $claim_id, $limit, DateTime $before_date = null, $hooks = array(), $group = '' ) { + // Set up initial variables. + $date = null === $before_date ? as_get_datetime_object() : clone $before_date; + $limit_ids = ! empty( $group ); + $ids = $limit_ids ? $this->get_actions_by_group( $group, $limit, $date ) : array(); + + // If limiting by IDs and no posts found, then return early since we have nothing to update. + if ( $limit_ids && 0 === count( $ids ) ) { + return 0; + } + + /** @var wpdb $wpdb */ + global $wpdb; + + /* + * Build up custom query to update the affected posts. Parameters are built as a separate array + * to make it easier to identify where they are in the query. + * + * We can't use $wpdb->update() here because of the "ID IN ..." clause. + */ + $update = "UPDATE {$wpdb->posts} SET post_password = %s, post_modified_gmt = %s, post_modified = %s"; + $params = array( + $claim_id, + current_time( 'mysql', true ), + current_time( 'mysql' ), + ); + + // Build initial WHERE clause. + $where = "WHERE post_type = %s AND post_status = %s AND post_password = ''"; + $params[] = self::POST_TYPE; + $params[] = ActionScheduler_Store::STATUS_PENDING; + + if ( ! empty( $hooks ) ) { + $placeholders = array_fill( 0, count( $hooks ), '%s' ); + $where .= ' AND post_title IN (' . join( ', ', $placeholders ) . ')'; + $params = array_merge( $params, array_values( $hooks ) ); + } + + /* + * Add the IDs to the WHERE clause. IDs not escaped because they came directly from a prior DB query. + * + * If we're not limiting by IDs, then include the post_date_gmt clause. + */ + if ( $limit_ids ) { + $where .= ' AND ID IN (' . join( ',', $ids ) . ')'; + } else { + $where .= ' AND post_date_gmt <= %s'; + $params[] = $date->format( 'Y-m-d H:i:s' ); + } + + // Add the ORDER BY clause and,ms limit. + $order = 'ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC LIMIT %d'; + $params[] = $limit; + + // Run the query and gather results. + $rows_affected = $wpdb->query( $wpdb->prepare( "{$update} {$where} {$order}", $params ) ); + if ( $rows_affected === false ) { + throw new RuntimeException( __( 'Unable to claim actions. Database error.', 'action-scheduler' ) ); + } + + return (int) $rows_affected; + } + + /** + * Get IDs of actions within a certain group and up to a certain date/time. + * + * @param string $group The group to use in finding actions. + * @param int $limit The number of actions to retrieve. + * @param DateTime $date DateTime object representing cutoff time for actions. Actions retrieved will be + * up to and including this DateTime. + * + * @return array IDs of actions in the appropriate group and before the appropriate time. + * @throws InvalidArgumentException When the group does not exist. + */ + protected function get_actions_by_group( $group, $limit, DateTime $date ) { + // Ensure the group exists before continuing. + if ( ! term_exists( $group, self::GROUP_TAXONOMY )) { + throw new InvalidArgumentException( sprintf( __( 'The group "%s" does not exist.', 'action-scheduler' ), $group ) ); + } + + // Set up a query for post IDs to use later. + $query = new WP_Query(); + $query_args = array( + 'fields' => 'ids', + 'post_type' => self::POST_TYPE, + 'post_status' => ActionScheduler_Store::STATUS_PENDING, + 'has_password' => false, + 'posts_per_page' => $limit * 3, + 'suppress_filters' => true, + 'no_found_rows' => true, + 'orderby' => array( + 'menu_order' => 'ASC', + 'date' => 'ASC', + 'ID' => 'ASC', + ), + 'date_query' => array( + 'column' => 'post_date_gmt', + 'before' => $date->format( 'Y-m-d H:i' ), + 'inclusive' => true, + ), + 'tax_query' => array( + array( + 'taxonomy' => self::GROUP_TAXONOMY, + 'field' => 'slug', + 'terms' => $group, + 'include_children' => false, + ), + ), + ); + + return $query->query( $query_args ); + } + + /** + * @param string $claim_id + * @return array + */ + public function find_actions_by_claim_id( $claim_id ) { + /** @var wpdb $wpdb */ + global $wpdb; + $sql = "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_password = %s"; + $sql = $wpdb->prepare( $sql, array( self::POST_TYPE, $claim_id ) ); + $action_ids = $wpdb->get_col( $sql ); + return $action_ids; + } + + public function release_claim( ActionScheduler_ActionClaim $claim ) { + $action_ids = $this->find_actions_by_claim_id( $claim->get_id() ); + if ( empty($action_ids) ) { + return; // nothing to do + } + $action_id_string = implode(',', array_map('intval', $action_ids)); + /** @var wpdb $wpdb */ + global $wpdb; + $sql = "UPDATE {$wpdb->posts} SET post_password = '' WHERE ID IN ($action_id_string) AND post_password = %s"; + $sql = $wpdb->prepare( $sql, array( $claim->get_id() ) ); + $result = $wpdb->query($sql); + if ( $result === false ) { + throw new RuntimeException( sprintf( __('Unable to unlock claim %s. Database error.', 'action-scheduler'), $claim->get_id() ) ); + } + } + + /** + * @param string $action_id + */ + public function unclaim_action( $action_id ) { + /** @var wpdb $wpdb */ + global $wpdb; + $sql = "UPDATE {$wpdb->posts} SET post_password = '' WHERE ID = %d AND post_type = %s"; + $sql = $wpdb->prepare( $sql, $action_id, self::POST_TYPE ); + $result = $wpdb->query($sql); + if ( $result === false ) { + throw new RuntimeException( sprintf( __('Unable to unlock claim on action %s. Database error.', 'action-scheduler'), $action_id ) ); + } + } + + public function mark_failure( $action_id ) { + /** @var wpdb $wpdb */ + global $wpdb; + $sql = "UPDATE {$wpdb->posts} SET post_status = %s WHERE ID = %d AND post_type = %s"; + $sql = $wpdb->prepare( $sql, self::STATUS_FAILED, $action_id, self::POST_TYPE ); + $result = $wpdb->query($sql); + if ( $result === false ) { + throw new RuntimeException( sprintf( __('Unable to mark failure on action %s. Database error.', 'action-scheduler'), $action_id ) ); + } + } + + /** + * Return an action's claim ID, as stored in the post password column + * + * @param string $action_id + * @return mixed + */ + public function get_claim_id( $action_id ) { + return $this->get_post_column( $action_id, 'post_password' ); + } + + /** + * Return an action's status, as stored in the post status column + * + * @param string $action_id + * @return mixed + */ + public function get_status( $action_id ) { + $status = $this->get_post_column( $action_id, 'post_status' ); + + if ( $status === null ) { + throw new InvalidArgumentException( __( 'Invalid action ID. No status found.', 'action-scheduler' ) ); + } + + return $this->get_action_status_by_post_status( $status ); + } + + private function get_post_column( $action_id, $column_name ) { + /** @var \wpdb $wpdb */ + global $wpdb; + return $wpdb->get_var( $wpdb->prepare( "SELECT {$column_name} FROM {$wpdb->posts} WHERE ID=%d AND post_type=%s", $action_id, self::POST_TYPE ) ); + } + + /** + * @param string $action_id + */ + public function log_execution( $action_id ) { + /** @var wpdb $wpdb */ + global $wpdb; + + $sql = "UPDATE {$wpdb->posts} SET menu_order = menu_order+1, post_status=%s, post_modified_gmt = %s, post_modified = %s WHERE ID = %d AND post_type = %s"; + $sql = $wpdb->prepare( $sql, self::STATUS_RUNNING, current_time('mysql', true), current_time('mysql'), $action_id, self::POST_TYPE ); + $wpdb->query($sql); + } + + + public function mark_complete( $action_id ) { + $post = get_post($action_id); + if ( empty($post) || ($post->post_type != self::POST_TYPE) ) { + throw new InvalidArgumentException(sprintf(__('Unidentified action %s', 'action-scheduler'), $action_id)); + } + add_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10, 1 ); + add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 ); + $result = wp_update_post(array( + 'ID' => $action_id, + 'post_status' => 'publish', + ), TRUE); + remove_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10 ); + remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 ); + if ( is_wp_error($result) ) { + throw new RuntimeException($result->get_error_message()); + } + } + + /** + * InnoDB indexes have a maximum size of 767 bytes by default, which is only 191 characters with utf8mb4. + * + * Previously, AS wasn't concerned about args length, as we used the (unindex) post_content column. However, + * as we prepare to move to custom tables, and can use an indexed VARCHAR column instead, we want to warn + * developers of this impending requirement. + * + * @param ActionScheduler_Action $action + */ + protected function validate_action( ActionScheduler_Action $action ) { + if ( strlen( json_encode( $action->get_args() ) ) > self::$max_index_length ) { + _doing_it_wrong( 'ActionScheduler_Action::$args', sprintf( 'To ensure the action args column can be indexed, action args should not be more than %d characters when encoded as JSON. Support for strings longer than this will be removed in a future version.', self::$max_index_length ), '2.1.0' ); + } + } + + /** + * @codeCoverageIgnore + */ + public function init() { + $post_type_registrar = new ActionScheduler_wpPostStore_PostTypeRegistrar(); + $post_type_registrar->register(); + + $post_status_registrar = new ActionScheduler_wpPostStore_PostStatusRegistrar(); + $post_status_registrar->register(); + + $taxonomy_registrar = new ActionScheduler_wpPostStore_TaxonomyRegistrar(); + $taxonomy_registrar->register(); + } + + /** + * Validate that we could decode action arguments. + * + * @param mixed $args The decoded arguments. + * @param int $action_id The action ID. + * + * @throws ActionScheduler_InvalidActionException When the decoded arguments are invalid. + */ + private function validate_args( $args, $action_id ) { + // Ensure we have an array of args. + if ( ! is_array( $args ) ) { + throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id ); + } + + // Validate JSON decoding if possible. + if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) { + throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id ); + } + } +} diff --git a/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php b/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php new file mode 100644 index 00000000000..a85b154f3a3 --- /dev/null +++ b/classes/ActionScheduler_wpPostStore_PostStatusRegistrar.php @@ -0,0 +1,57 @@ +post_status_args(), $this->post_status_running_labels() ) ); + register_post_status( ActionScheduler_Store::STATUS_FAILED, array_merge( $this->post_status_args(), $this->post_status_failed_labels() ) ); + } + + /** + * Build the args array for the post type definition + * + * @return array + */ + protected function post_status_args() { + $args = array( + 'public' => false, + 'exclude_from_search' => false, + 'show_in_admin_all_list' => true, + 'show_in_admin_status_list' => true, + ); + + return apply_filters( 'action_scheduler_post_status_args', $args ); + } + + /** + * Build the args array for the post type definition + * + * @return array + */ + protected function post_status_failed_labels() { + $labels = array( + 'label' => _x( 'Failed', 'post' ), + 'label_count' => _n_noop( 'Failed (%s)', 'Failed (%s)' ), + ); + + return apply_filters( 'action_scheduler_post_status_failed_labels', $labels ); + } + + /** + * Build the args array for the post type definition + * + * @return array + */ + protected function post_status_running_labels() { + $labels = array( + 'label' => _x( 'In-Progress', 'post' ), + 'label_count' => _n_noop( 'In-Progress (%s)', 'In-Progress (%s)' ), + ); + + return apply_filters( 'action_scheduler_post_status_running_labels', $labels ); + } +} + \ No newline at end of file diff --git a/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php b/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php new file mode 100644 index 00000000000..8c63bd0f7ab --- /dev/null +++ b/classes/ActionScheduler_wpPostStore_PostTypeRegistrar.php @@ -0,0 +1,50 @@ +post_type_args() ); + } + + /** + * Build the args array for the post type definition + * + * @return array + */ + protected function post_type_args() { + $args = array( + 'label' => __( 'Scheduled Actions', 'action-scheduler' ), + 'description' => __( 'Scheduled actions are hooks triggered on a cetain date and time.', 'action-scheduler' ), + 'public' => false, + 'map_meta_cap' => true, + 'hierarchical' => false, + 'supports' => array('title', 'editor','comments'), + 'rewrite' => false, + 'query_var' => false, + 'can_export' => true, + 'ep_mask' => EP_NONE, + 'labels' => array( + 'name' => __( 'Scheduled Actions', 'action-scheduler' ), + 'singular_name' => __( 'Scheduled Action', 'action-scheduler' ), + 'menu_name' => _x( 'Scheduled Actions', 'Admin menu name', 'action-scheduler' ), + 'add_new' => __( 'Add', 'action-scheduler' ), + 'add_new_item' => __( 'Add New Scheduled Action', 'action-scheduler' ), + 'edit' => __( 'Edit', 'action-scheduler' ), + 'edit_item' => __( 'Edit Scheduled Action', 'action-scheduler' ), + 'new_item' => __( 'New Scheduled Action', 'action-scheduler' ), + 'view' => __( 'View Action', 'action-scheduler' ), + 'view_item' => __( 'View Action', 'action-scheduler' ), + 'search_items' => __( 'Search Scheduled Actions', 'action-scheduler' ), + 'not_found' => __( 'No actions found', 'action-scheduler' ), + 'not_found_in_trash' => __( 'No actions found in trash', 'action-scheduler' ), + ), + ); + + $args = apply_filters('action_scheduler_post_type_args', $args); + return $args; + } +} + \ No newline at end of file diff --git a/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php b/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php new file mode 100644 index 00000000000..026d6257e81 --- /dev/null +++ b/classes/ActionScheduler_wpPostStore_TaxonomyRegistrar.php @@ -0,0 +1,26 @@ +taxonomy_args() ); + } + + protected function taxonomy_args() { + $args = array( + 'label' => __('Action Group', 'action-scheduler'), + 'public' => false, + 'hierarchical' => false, + 'show_admin_column' => true, + 'query_var' => false, + 'rewrite' => false, + ); + + $args = apply_filters('action_scheduler_taxonomy_args', $args); + return $args; + } +} + \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000000..fe69f966954 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,13 @@ +codecov: + branch: master + +coverage: + ignore: + - tests/.* + - lib/.* + status: + project: false + patch: false + changes: false + +comment: false diff --git a/composer.json b/composer.json new file mode 100644 index 00000000000..a3b2c4af462 --- /dev/null +++ b/composer.json @@ -0,0 +1,11 @@ +{ + "name": "prospress/action-scheduler", + "description": "Action Scheduler for WordPress and WooCommerce", + "type": "wordpress-plugin", + "license": "GPL-3.0", + "minimum-stability": "dev", + "require": {}, + "require-dev": { + "wp-cli/wp-cli": "1.5.1" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000000..de44d8153ec --- /dev/null +++ b/composer.lock @@ -0,0 +1,2909 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "f4556531e7b95173d1b769b3d7350926", + "packages": [], + "packages-dev": [ + { + "name": "composer/ca-bundle", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12", + "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0" + }, + "suggest": { + "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "time": "2017-03-06T11:59:08+00:00" + }, + { + "name": "composer/composer", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/composer/composer.git", + "reference": "82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/composer/zipball/82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff", + "reference": "82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "composer/semver": "^1.0", + "composer/spdx-licenses": "^1.0", + "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0", + "seld/cli-prompt": "^1.0", + "seld/jsonlint": "^1.4", + "seld/phar-utils": "^1.0", + "symfony/console": "^2.7 || ^3.0", + "symfony/filesystem": "^2.7 || ^3.0", + "symfony/finder": "^2.7 || ^3.0", + "symfony/process": "^2.7 || ^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" + }, + "suggest": { + "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", + "ext-zip": "Enabling the zip extension allows you to unzip archives", + "ext-zlib": "Allow gzip compression of HTTP requests" + }, + "bin": [ + "bin/composer" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\": "src/Composer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "time": "2017-08-09T14:23:46+00:00" + }, + { + "name": "composer/semver", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "7ea669582e6396857cf6d1c0a6cd2728f4e7e383" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/7ea669582e6396857cf6d1c0a6cd2728f4e7e383", + "reference": "7ea669582e6396857cf6d1c0a6cd2728f4e7e383", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2017-05-15T12:49:06+00:00" + }, + { + "name": "composer/spdx-licenses", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/2603a0d7ddc00a015deb576fa5297ca43dee6b1c", + "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "time": "2017-04-03T19:08:52+00:00" + }, + { + "name": "justinrainbow/json-schema", + "version": "5.x-dev", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d", + "reference": "36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.22" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2017-06-23T11:43:36+00:00" + }, + { + "name": "mustache/mustache", + "version": "v2.12.0", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/mustache.php.git", + "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/fe8fe72e9d580591854de404cc59a1b83ca4d19e", + "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~1.11", + "phpunit/phpunit": "~3.7|~4.0|~5.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Mustache": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "A Mustache implementation in PHP.", + "homepage": "https://github.com/bobthecow/mustache.php", + "keywords": [ + "mustache", + "templating" + ], + "time": "2017-07-11T12:54:05+00:00" + }, + { + "name": "nb/oxymel", + "version": "v0.1.0", + "source": { + "type": "git", + "url": "https://github.com/nb/oxymel.git", + "reference": "cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nb/oxymel/zipball/cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c", + "reference": "cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "type": "library", + "autoload": { + "psr-0": { + "Oxymel": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nikolay Bachiyski", + "email": "nb@nikolay.bg", + "homepage": "http://extrapolate.me/" + } + ], + "description": "A sweet XML builder", + "homepage": "https://github.com/nb/oxymel", + "keywords": [ + "xml" + ], + "time": "2013-02-24T15:01:54+00:00" + }, + { + "name": "psr/container", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "2cc4a01788191489dc7459446ba832fa79a216a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/2cc4a01788191489dc7459446ba832fa79a216a7", + "reference": "2cc4a01788191489dc7459446ba832fa79a216a7", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-06-28T15:35:32+00:00" + }, + { + "name": "psr/log", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "ramsey/array_column", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/ramsey/array_column.git", + "reference": "f8e52eb28e67eb50e613b451dd916abcf783c1db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/array_column/zipball/f8e52eb28e67eb50e613b451dd916abcf783c1db", + "reference": "f8e52eb28e67eb50e613b451dd916abcf783c1db", + "shasum": "" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "0.8.*", + "phpunit/phpunit": "~4.5", + "satooshi/php-coveralls": "0.6.*", + "squizlabs/php_codesniffer": "~2.2" + }, + "type": "library", + "autoload": { + "files": [ + "src/array_column.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "homepage": "http://benramsey.com" + } + ], + "description": "Provides functionality for array_column() to projects using PHP earlier than version 5.5.", + "homepage": "https://github.com/ramsey/array_column", + "keywords": [ + "array", + "array_column", + "column" + ], + "time": "2015-03-20T22:07:39+00:00" + }, + { + "name": "rmccue/requests", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/rmccue/Requests.git", + "reference": "87932f52ffad70504d93f04f15690cf16a089546" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rmccue/Requests/zipball/87932f52ffad70504d93f04f15690cf16a089546", + "reference": "87932f52ffad70504d93f04f15690cf16a089546", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "requests/test-server": "dev-master" + }, + "type": "library", + "autoload": { + "psr-0": { + "Requests": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Ryan McCue", + "homepage": "http://ryanmccue.info" + } + ], + "description": "A HTTP library written in PHP, for human beings.", + "homepage": "http://github.com/rmccue/Requests", + "keywords": [ + "curl", + "fsockopen", + "http", + "idna", + "ipv6", + "iri", + "sockets" + ], + "time": "2016-10-13T00:11:37+00:00" + }, + { + "name": "seld/cli-prompt", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/cli-prompt.git", + "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", + "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\CliPrompt\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", + "keywords": [ + "cli", + "console", + "hidden", + "input", + "prompt" + ], + "time": "2017-03-18T11:32:45+00:00" + }, + { + "name": "seld/jsonlint", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", + "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "time": "2017-06-18T15:11:04+00:00" + }, + { + "name": "seld/phar-utils", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\PharUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "PHAR file format utilities, for when PHP phars you up", + "keywords": [ + "phra" + ], + "time": "2015-10-13T18:44:15+00:00" + }, + { + "name": "symfony/config", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "d668d8c0502d2b485c00d107db65fdbc56c26282" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/d668d8c0502d2b485c00d107db65fdbc56c26282", + "reference": "d668d8c0502d2b485c00d107db65fdbc56c26282", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, + "require-dev": { + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2017-08-05T17:34:46+00:00" + }, + { + "name": "symfony/console", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "0e283478c2d68c9bf9cc52592ad1ef1834083a85" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/0e283478c2d68c9bf9cc52592ad1ef1834083a85", + "reference": "0e283478c2d68c9bf9cc52592ad1ef1834083a85", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-kernel": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2017-08-10T07:07:17+00:00" + }, + { + "name": "symfony/debug", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "50bda5b4b8641616d45254c6855bcd45f2f64187" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/50bda5b4b8641616d45254c6855bcd45f2f64187", + "reference": "50bda5b4b8641616d45254c6855bcd45f2f64187", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2017-08-10T07:07:17+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "aaee88765cb21a838e8da26d6acda4ca2ae3a2ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/aaee88765cb21a838e8da26d6acda4ca2ae3a2ea", + "reference": "aaee88765cb21a838e8da26d6acda4ca2ae3a2ea", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/container": "^1.0" + }, + "conflict": { + "symfony/config": "<3.3.1", + "symfony/finder": "<3.3", + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "psr/container-implementation": "1.0" + }, + "require-dev": { + "symfony/config": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "https://symfony.com", + "time": "2017-08-10T19:43:00+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "cd8b015f859e6b60933324db00067c2f060b4d18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/cd8b015f859e6b60933324db00067c2f060b4d18", + "reference": "cd8b015f859e6b60933324db00067c2f060b4d18", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2017-08-03T09:34:20+00:00" + }, + { + "name": "symfony/filesystem", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "e4d366b620c8b6e2d4977c154f6a1d5b416db4dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e4d366b620c8b6e2d4977c154f6a1d5b416db4dd", + "reference": "e4d366b620c8b6e2d4977c154f6a1d5b416db4dd", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2017-08-03T09:34:20+00:00" + }, + { + "name": "symfony/finder", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "bf0450cfe7282c5f06539c4733ba64273e91e918" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/bf0450cfe7282c5f06539c4733ba64273e91e918", + "reference": "bf0450cfe7282c5f06539c4733ba64273e91e918", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2017-08-03T09:34:20+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-06-14T15:44:48+00:00" + }, + { + "name": "symfony/process", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "9794f948d9af3be0157185051275d78b24d68b92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/9794f948d9af3be0157185051275d78b24d68b92", + "reference": "9794f948d9af3be0157185051275d78b24d68b92", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2017-08-03T09:34:20+00:00" + }, + { + "name": "symfony/translation", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "62bb068e004874bbe39624101e1aae70ca7c05cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/62bb068e004874bbe39624101e1aae70ca7c05cd", + "reference": "62bb068e004874bbe39624101e1aae70ca7c05cd", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/intl": "^2.8.18|^3.2.5|~4.0", + "symfony/yaml": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com", + "time": "2017-08-03T12:04:31+00:00" + }, + { + "name": "symfony/yaml", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc", + "reference": "1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2017-08-04T13:29:48+00:00" + }, + { + "name": "wp-cli/autoload-splitter", + "version": "v0.1.5", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/autoload-splitter.git", + "reference": "fb4302da26390811d2631c62b42b75976d224bb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/autoload-splitter/zipball/fb4302da26390811d2631c62b42b75976d224bb8", + "reference": "fb4302da26390811d2631c62b42b75976d224bb8", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1" + }, + "type": "composer-plugin", + "extra": { + "class": "WP_CLI\\AutoloadSplitter\\ComposerPlugin" + }, + "autoload": { + "psr-4": { + "WP_CLI\\AutoloadSplitter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alain Schlesser", + "email": "alain.schlesser@gmail.com", + "homepage": "https://www.alainschlesser.com" + } + ], + "description": "Composer plugin for splitting a generated autoloader into two distinct parts.", + "homepage": "https://wp-cli.org", + "time": "2017-08-03T08:40:16+00:00" + }, + { + "name": "wp-cli/cache-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/cache-command.git", + "reference": "485f7cc6630ecabe22bbf9fa9e827958e95a2d21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/cache-command/zipball/485f7cc6630ecabe22bbf9fa9e827958e95a2d21", + "reference": "485f7cc6630ecabe22bbf9fa9e827958e95a2d21", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "cache", + "transient" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "cache-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage object and transient caches.", + "homepage": "https://github.com/wp-cli/cache-command", + "time": "2017-08-04T11:37:19+00:00" + }, + { + "name": "wp-cli/checksum-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/checksum-command.git", + "reference": "88ccde2e82de5c2232842a9fccc2e6ade232dec6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/checksum-command/zipball/88ccde2e82de5c2232842a9fccc2e6ade232dec6", + "reference": "88ccde2e82de5c2232842a9fccc2e6ade232dec6", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "checksum core" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "checksum-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Verify WordPress core checksums.", + "homepage": "https://github.com/wp-cli/checksum-command", + "time": "2017-08-09T23:34:29+00:00" + }, + { + "name": "wp-cli/config-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/config-command.git", + "reference": "ca83ade8fb2d059b561744610947e38123b10c22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/config-command/zipball/ca83ade8fb2d059b561744610947e38123b10c22", + "reference": "ca83ade8fb2d059b561744610947e38123b10c22", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "config", + "config create", + "config get", + "config path" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "config-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage the wp-config.php file.", + "homepage": "https://github.com/wp-cli/config-command", + "time": "2017-08-04T23:41:35+00:00" + }, + { + "name": "wp-cli/core-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/core-command.git", + "reference": "fb743dab792e21b57163c5c0f563987d1471c152" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/core-command/zipball/fb743dab792e21b57163c5c0f563987d1471c152", + "reference": "fb743dab792e21b57163c5c0f563987d1471c152", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "core check-update", + "core download", + "core install", + "core is-installed", + "core multisite-convert", + "core multisite-install", + "core update", + "core update-db", + "core version" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "core-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Download, install, update and manage a WordPress install.", + "homepage": "https://github.com/wp-cli/core-command", + "time": "2017-08-04T12:31:18+00:00" + }, + { + "name": "wp-cli/cron-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/cron-command.git", + "reference": "92114b695ab0253bb705d9bd3e6d2fb47b51fad2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/cron-command/zipball/92114b695ab0253bb705d9bd3e6d2fb47b51fad2", + "reference": "92114b695ab0253bb705d9bd3e6d2fb47b51fad2", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "cron test", + "cron event delete", + "cron event list", + "cron event run", + "cron event schedule", + "cron schedule list" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "cron-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage WP-Cron events and schedules.", + "homepage": "https://github.com/wp-cli/cron-command", + "time": "2017-08-04T12:45:50+00:00" + }, + { + "name": "wp-cli/db-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/db-command.git", + "reference": "5c597abb642bcaf329e7da0801c69f4405d41c23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/db-command/zipball/5c597abb642bcaf329e7da0801c69f4405d41c23", + "reference": "5c597abb642bcaf329e7da0801c69f4405d41c23", + "shasum": "" + }, + "require": { + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "db create", + "db drop", + "db reset", + "db check", + "db optimize", + "db prefix", + "db repair", + "db cli", + "db query", + "db export", + "db import", + "db search", + "db tables", + "db size" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "db-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Perform basic database operations using credentials stored in wp-config.php.", + "homepage": "https://github.com/wp-cli/db-command", + "time": "2017-08-04T23:21:46+00:00" + }, + { + "name": "wp-cli/entity-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/entity-command.git", + "reference": "d0cd99c14e4d01aad368328da97231df0c01f9dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/d0cd99c14e4d01aad368328da97231df0c01f9dc", + "reference": "d0cd99c14e4d01aad368328da97231df0c01f9dc", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "phpunit/phpunit": "^4.8", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "comment", + "comment meta", + "menu", + "menu item", + "menu location", + "network meta", + "option", + "option add", + "option delete", + "option get", + "option list", + "option update", + "post", + "post meta", + "post term", + "post-type", + "site", + "taxonomy", + "term", + "term meta", + "user", + "user meta", + "user term" + ] + }, + "autoload": { + "psr-4": { + "": "src/", + "WP_CLI\\": "src/WP_CLI" + }, + "files": [ + "entity-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage WordPress core entities.", + "homepage": "https://github.com/wp-cli/entity-command", + "time": "2017-08-11T11:53:04+00:00" + }, + { + "name": "wp-cli/eval-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/eval-command.git", + "reference": "e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/eval-command/zipball/e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4", + "reference": "e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4", + "shasum": "" + }, + "require": { + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "eval", + "eval-file" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "eval-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Execute arbitrary PHP code.", + "homepage": "https://github.com/wp-cli/eval-command", + "time": "2017-08-04T12:46:58+00:00" + }, + { + "name": "wp-cli/export-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/export-command.git", + "reference": "f5647155830d1275de4cb69cfb79748b9449b8ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/export-command/zipball/f5647155830d1275de4cb69cfb79748b9449b8ab", + "reference": "f5647155830d1275de4cb69cfb79748b9449b8ab", + "shasum": "" + }, + "require": { + "nb/oxymel": "~0.1.0", + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "export" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "export-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Export WordPress content to a WXR file.", + "homepage": "https://github.com/wp-cli/export-command", + "time": "2017-08-04T13:13:08+00:00" + }, + { + "name": "wp-cli/extension-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/extension-command.git", + "reference": "08bf48e842b9e1cb579b50cec1b6897cebf65bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/08bf48e842b9e1cb579b50cec1b6897cebf65bda", + "reference": "08bf48e842b9e1cb579b50cec1b6897cebf65bda", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "plugin activate", + "plugin deactivate", + "plugin delete", + "plugin get", + "plugin install", + "plugin is-installed", + "plugin list", + "plugin path", + "plugin search", + "plugin status", + "plugin toggle", + "plugin uninstall", + "plugin update", + "theme activate", + "theme delete", + "theme disable", + "theme enable", + "theme get", + "theme install", + "theme is-installed", + "theme list", + "theme mod get", + "theme mod set", + "theme mod remove", + "theme path", + "theme search", + "theme status", + "theme update" + ] + }, + "autoload": { + "psr-4": { + "": "src/", + "WP_CLI\\": "src/WP_CLI" + }, + "files": [ + "extension-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage WordPress plugins and themes.", + "homepage": "https://github.com/wp-cli/extension-command", + "time": "2017-08-04T13:43:53+00:00" + }, + { + "name": "wp-cli/import-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/import-command.git", + "reference": "89d14aa4b8b621effbe7f9bacad2ea8a096598a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/import-command/zipball/89d14aa4b8b621effbe7f9bacad2ea8a096598a7", + "reference": "89d14aa4b8b621effbe7f9bacad2ea8a096598a7", + "shasum": "" + }, + "require": { + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "bundled": true, + "commands": [ + "import" + ] + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "import-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Import content from a WXR file.", + "homepage": "https://github.com/wp-cli/import-command", + "time": "2017-08-04T13:45:57+00:00" + }, + { + "name": "wp-cli/language-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/language-command.git", + "reference": "aff3fb6c6d7698008c7e5d33a97b25457091ae1b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/language-command/zipball/aff3fb6c6d7698008c7e5d33a97b25457091ae1b", + "reference": "aff3fb6c6d7698008c7e5d33a97b25457091ae1b", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "language core activate", + "language core install", + "language core list", + "language core uninstall", + "language core update" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "language-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage language packs.", + "homepage": "https://github.com/wp-cli/language-command", + "time": "2017-08-04T23:23:03+00:00" + }, + { + "name": "wp-cli/media-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/media-command.git", + "reference": "4a19de54a11c96b21c10719e2b7f9dd131c4261e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/media-command/zipball/4a19de54a11c96b21c10719e2b7f9dd131c4261e", + "reference": "4a19de54a11c96b21c10719e2b7f9dd131c4261e", + "shasum": "" + }, + "require": { + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "media import", + "media regenerate" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "media-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Import new attachments or regenerate existing ones.", + "homepage": "https://github.com/wp-cli/media-command", + "time": "2017-08-05T04:54:48+00:00" + }, + { + "name": "wp-cli/mustangostang-spyc", + "version": "0.6.3", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/spyc.git", + "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/spyc/zipball/6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", + "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", + "shasum": "" + }, + "require": { + "php": ">=5.3.1" + }, + "require-dev": { + "phpunit/phpunit": "4.3.*@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "Mustangostang\\": "src/" + }, + "files": [ + "includes/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "mustangostang", + "email": "vlad.andersen@gmail.com" + } + ], + "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", + "homepage": "https://github.com/mustangostang/spyc/", + "time": "2017-04-25T11:26:20+00:00" + }, + { + "name": "wp-cli/package-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/package-command.git", + "reference": "744692180a4240ddc75a3196934cafe396dd9178" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/package-command/zipball/744692180a4240ddc75a3196934cafe396dd9178", + "reference": "744692180a4240ddc75a3196934cafe396dd9178", + "shasum": "" + }, + "require": { + "composer/composer": "^1.2.0", + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "package browse", + "package install", + "package list", + "package update", + "package uninstall" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "package-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage WP-CLI packages.", + "homepage": "https://github.com/wp-cli/package-command", + "time": "2017-08-07T12:21:11+00:00" + }, + { + "name": "wp-cli/php-cli-tools", + "version": "v0.11.6", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/php-cli-tools.git", + "reference": "d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05", + "reference": "d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05", + "shasum": "" + }, + "require": { + "php": ">= 5.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "cli": "lib/" + }, + "files": [ + "lib/cli/cli.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "James Logsdon", + "email": "jlogsdon@php.net", + "role": "Developer" + }, + { + "name": "Daniel Bachhuber", + "email": "daniel@handbuilt.co", + "role": "Maintainer" + } + ], + "description": "Console utilities for PHP", + "homepage": "http://github.com/wp-cli/php-cli-tools", + "keywords": [ + "cli", + "console" + ], + "time": "2017-08-04T10:42:04+00:00" + }, + { + "name": "wp-cli/rewrite-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/rewrite-command.git", + "reference": "e858feac8d3fe053e052d8af43c090ff0b2a4e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/rewrite-command/zipball/e858feac8d3fe053e052d8af43c090ff0b2a4e8a", + "reference": "e858feac8d3fe053e052d8af43c090ff0b2a4e8a", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "rewrite flush", + "rewrite list", + "rewrite structure" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "rewrite-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage rewrite rules.", + "homepage": "https://github.com/wp-cli/rewrite-command", + "time": "2017-08-04T15:15:53+00:00" + }, + { + "name": "wp-cli/role-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/role-command.git", + "reference": "85ddf53525b14ab040830f385710f4493058d295" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/role-command/zipball/85ddf53525b14ab040830f385710f4493058d295", + "reference": "85ddf53525b14ab040830f385710f4493058d295", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "role create", + "role delete", + "role exists", + "role list", + "role reset", + "cap add", + "cap list", + "cap remove" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "role-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage user roles and capabilities.", + "homepage": "https://github.com/wp-cli/role-command", + "time": "2017-08-04T15:17:29+00:00" + }, + { + "name": "wp-cli/scaffold-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/scaffold-command.git", + "reference": "41f1e1aa41af76b70d6cf3d21d52995e854acf4c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/scaffold-command/zipball/41f1e1aa41af76b70d6cf3d21d52995e854acf4c", + "reference": "41f1e1aa41af76b70d6cf3d21d52995e854acf4c", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "scaffold", + "scaffold _s", + "scaffold child-theme", + "scaffold plugin", + "scaffold plugin-tests", + "scaffold post-type", + "scaffold taxonomy", + "scaffold theme-tests" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "scaffold-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Generate code for post types, taxonomies, plugins, child themes, etc.", + "homepage": "https://github.com/wp-cli/scaffold-command", + "time": "2017-08-11T08:07:10+00:00" + }, + { + "name": "wp-cli/search-replace-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/search-replace-command.git", + "reference": "3e7499a65354e3a322d4d1043123b3fa55ef4f12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/search-replace-command/zipball/3e7499a65354e3a322d4d1043123b3fa55ef4f12", + "reference": "3e7499a65354e3a322d4d1043123b3fa55ef4f12", + "shasum": "" + }, + "require": { + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "search-replace" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/", + "WP_CLI\\": "src/WP_CLI" + }, + "files": [ + "search-replace-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Search/replace strings in the database.", + "homepage": "https://github.com/wp-cli/search-replace-command", + "time": "2017-08-08T16:41:49+00:00" + }, + { + "name": "wp-cli/server-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/server-command.git", + "reference": "ce93df07c33e716adbbd2d329c311a3c1dd3a0b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/server-command/zipball/ce93df07c33e716adbbd2d329c311a3c1dd3a0b0", + "reference": "ce93df07c33e716adbbd2d329c311a3c1dd3a0b0", + "shasum": "" + }, + "require": { + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "server" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "server-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Launch PHP's built-in web server for this specific WordPress installation.", + "homepage": "https://github.com/wp-cli/server-command", + "time": "2017-08-04T15:19:26+00:00" + }, + { + "name": "wp-cli/shell-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/shell-command.git", + "reference": "70681666302cc193a1bd41bade9ecc61e74a8c83" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/shell-command/zipball/70681666302cc193a1bd41bade9ecc61e74a8c83", + "reference": "70681666302cc193a1bd41bade9ecc61e74a8c83", + "shasum": "" + }, + "require": { + "wp-cli/wp-cli": "*" + }, + "require-dev": { + "behat/behat": "~2.5" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "shell" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/", + "WP_CLI\\": "src/WP_CLI" + }, + "files": [ + "shell-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Interactive PHP console.", + "homepage": "https://github.com/wp-cli/shell-command", + "time": "2017-08-04T15:21:52+00:00" + }, + { + "name": "wp-cli/super-admin-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/super-admin-command.git", + "reference": "b650836d13762c764df2bbe70ad34212c0b773cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/super-admin-command/zipball/b650836d13762c764df2bbe70ad34212c0b773cd", + "reference": "b650836d13762c764df2bbe70ad34212c0b773cd", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "super-admin add", + "super-admin list", + "super-admin remove" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "super-admin-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage super admins on WordPress multisite.", + "homepage": "https://github.com/wp-cli/super-admin-command", + "time": "2017-08-04T15:45:41+00:00" + }, + { + "name": "wp-cli/widget-command", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/widget-command.git", + "reference": "727af7c7b661031bc8c04ad176d4f24b862e3402" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/widget-command/zipball/727af7c7b661031bc8c04ad176d4f24b862e3402", + "reference": "727af7c7b661031bc8c04ad176d4f24b862e3402", + "shasum": "" + }, + "require-dev": { + "behat/behat": "~2.5", + "wp-cli/wp-cli": "*" + }, + "type": "wp-cli-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "commands": [ + "widget add", + "widget deactivate", + "widget delete", + "widget list", + "widget move", + "widget reset", + "widget update", + "sidebar list" + ], + "bundled": true + }, + "autoload": { + "psr-4": { + "": "src/" + }, + "files": [ + "widget-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@runcommand.io", + "homepage": "https://runcommand.io" + } + ], + "description": "Manage widgets and sidebars.", + "homepage": "https://github.com/wp-cli/widget-command", + "time": "2017-08-04T15:24:29+00:00" + }, + { + "name": "wp-cli/wp-cli", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/wp-cli.git", + "reference": "4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086", + "reference": "4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086", + "shasum": "" + }, + "require": { + "composer/composer": "^1.2.0", + "composer/semver": "~1.0", + "mustache/mustache": "~2.4", + "php": ">=5.3.29", + "ramsey/array_column": "~1.1", + "rmccue/requests": "~1.6", + "symfony/config": "^2.7|^3.0", + "symfony/console": "^2.7|^3.0", + "symfony/debug": "^2.7|^3.0", + "symfony/dependency-injection": "^2.7|^3.0", + "symfony/event-dispatcher": "^2.7|^3.0", + "symfony/filesystem": "^2.7|^3.0", + "symfony/finder": "^2.7|^3.0", + "symfony/process": "^2.1|^3.0", + "symfony/translation": "^2.7|^3.0", + "symfony/yaml": "^2.7|^3.0", + "wp-cli/autoload-splitter": "^0.1.5", + "wp-cli/cache-command": "^1.0", + "wp-cli/checksum-command": "^1.0", + "wp-cli/config-command": "^1.0", + "wp-cli/core-command": "^1.0", + "wp-cli/cron-command": "^1.0", + "wp-cli/db-command": "^1.0", + "wp-cli/entity-command": "^1.0", + "wp-cli/eval-command": "^1.0", + "wp-cli/export-command": "^1.0", + "wp-cli/extension-command": "^1.0", + "wp-cli/import-command": "^1.0", + "wp-cli/language-command": "^1.0", + "wp-cli/media-command": "^1.0", + "wp-cli/mustangostang-spyc": "^0.6.3", + "wp-cli/package-command": "^1.0", + "wp-cli/php-cli-tools": "~0.11.2", + "wp-cli/rewrite-command": "^1.0", + "wp-cli/role-command": "^1.0", + "wp-cli/scaffold-command": "^1.0", + "wp-cli/search-replace-command": "^1.0", + "wp-cli/server-command": "^1.0", + "wp-cli/shell-command": "^1.0", + "wp-cli/super-admin-command": "^1.0", + "wp-cli/widget-command": "^1.0" + }, + "require-dev": { + "behat/behat": "2.5.*", + "phpunit/phpunit": "3.7.*", + "roave/security-advisories": "dev-master" + }, + "suggest": { + "psy/psysh": "Enhanced `wp shell` functionality" + }, + "bin": [ + "bin/wp.bat", + "bin/wp" + ], + "type": "library", + "extra": { + "autoload-splitter": { + "splitter-logic": "WP_CLI\\AutoloadSplitter", + "splitter-location": "php/WP_CLI/AutoloadSplitter.php", + "split-target-prefix-true": "autoload_commands", + "split-target-prefix-false": "autoload_framework" + } + }, + "autoload": { + "psr-0": { + "WP_CLI": "php" + }, + "psr-4": { + "": "php/commands/src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A command line interface for WordPress", + "homepage": "http://wp-cli.org", + "keywords": [ + "cli", + "wordpress" + ], + "time": "2017-08-08T14:28:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php b/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php new file mode 100644 index 00000000000..dac17aa42eb --- /dev/null +++ b/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php @@ -0,0 +1,27 @@ + '' - the name of the action that will be triggered + * 'args' => NULL - the args array that will be passed with the action + * 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. + * 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' + * 'modified' => NULL - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. + * 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' + * 'group' => '' - the group the action belongs to + * 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING + * 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID + * 'per_page' => 5 - Number of results to return + * 'offset' => 0 + * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date' + * 'order' => 'ASC' + * @param string $return_format OBJECT, ARRAY_A, or ids + * + * @deprecated 2.1.0 + * + * @return array + */ +function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { + _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); + return as_get_scheduled_actions( $args, $return_format ); +} diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 00000000000..3b480b54c79 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +actionscheduler.org \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 00000000000..fe521d98c39 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,7 @@ +title: Action Scheduler - Job Queue for WordPress +description: A scalable, traceable job queue for background processing large queues of tasks in WordPress. Designed for distribution in WordPress plugins - no server access required. +theme: jekyll-theme-hacker +permalink: /:slug/ +plugins: + - jekyll-seo-tag + - jekyll-sitemap diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html new file mode 100644 index 00000000000..b7670ce9a41 --- /dev/null +++ b/docs/_layouts/default.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + +{% seo %} + + + + +
    + + + +
    +

    Usage | Admin | WP-CLI | Background Processing at Scale | API | FAQ +

    action-scheduler

    +

    A scalable, traceable job queue for background processing large queues of tasks in WordPress. Designed for distribution in WordPress plugins - no server access required.

    +
    +
    + +
    +
    + {{ content }} +
    +
    + + + + {% if site.google_analytics %} + + {% endif %} + + \ No newline at end of file diff --git a/docs/admin.md b/docs/admin.md new file mode 100644 index 00000000000..5ef0b56cb8f --- /dev/null +++ b/docs/admin.md @@ -0,0 +1,22 @@ +--- +description: Learn how to administer background jobs with the Action Scheduler job queue for WordPress. +--- +# Scheduled Actions Administration Screen + +Action Scheduler has a built in administration screen for monitoring, debugging and manually triggering scheduled actions. + +The administration interface is accesible through both: + +1. **Tools > Scheduled Actions** +1. **WooCommerce > Status > Scheduled Actions**, when WooCommerce is installed. + +Among other tasks, from the admin screen you can: + +* run a pending action +* view the scheduled actions with a specific status, like the all actions which have failed or are in-progress (https://cldup.com/NNTwE88Xl8.png). +* view the log entries for a specific action to find out why it failed. +* sort scheduled actions by hook name, scheduled date, claim ID or group name. + +Still have questions? Check out the [FAQ](/faq). + +![](https://cldup.com/5BA2BNB1sw.png) diff --git a/docs/android-chrome-192x192.png b/docs/android-chrome-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..86753dbcd990ac6080f3ef07d53dbbc538a023fc GIT binary patch literal 17032 zcma%C1y>tw(+=)#r8pEQUZl9YySqb?;!bdP*W&K(*5Yo(p#*n#3Gn54f5CThvU_&3 zXEQrHGxy9j*F-8SN}(ZtMg{-?Xfo2`s*wHf|GtRukge*59Rg$rYbBx}0su6`qkv7| zAjjlp(y9sofHw^Q5D)?Yyg*I`9034s-vEFUV*r3R0{|d!{MD(#5BUM!R8C49@b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tm7+#4BmV9zDoeH#q!PC{xWt~$(699YnQAPj& literal 0 HcmV?d00001 diff --git a/docs/android-chrome-256x256.png b/docs/android-chrome-256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..3e5f9b1029d0d99763727a10537539943ae7404f GIT binary patch literal 24599 zcmbSy^;cWX_jO1E4cb7FVuj!i#a)7HaVJQz;ua|G4#lB3#frOAoCgXNYjJld?hg6# zdH;lW-5*Boy6c`bb7tnu-upzVs>otvkYE4+0Bm_VDRlq<<)w-O0HeJWhAt(RF9pa- zLRkU;sExyXG(~-BQ+|?DR|WvQ=m3C#5CGu*r7K_$06=g60Q)8YfZ#U(fXFGUO-=aa z1)7DL>WM5t6$ddATo004N4yp)9ImxZGaop>7gjQ7{A z-VvHbjeGmY`!=jHmzO2k1oiD6-YtEBgMHZ&@syxgMXou#H$LlcDXe|+h|x*Ff3V)z za=$`Rh^PEAz(p4LANldMgM+(!!`|m*qvh!$i~acHvGB5zsF~h{ z-sZGfwcU*SO^dhqjLVUti3I{cB@hG z8#u5cCB0Vg$CPhZ(j`QBMb@`TrxK+*S{98Fr2&N%a!pf?_!G?gpfpXB1kloyM^S~* zXd#5Wj|F86b!uQl6twsx7M$fabrhf&2!m3BZ!#4#Ee$23hTLmPu7_`&jIC!=6@tZPm^f^xxG>0=5!mD*9$MWuX1WFFPXY!I zg@e_B)+pDMr=uah)i4!F_=(_ddtuo>!@sVuzxA92CF&_o^}#=!6x5`v%c4z(CrV3P zzNybE6W;?$lA+YJU??YM0A4_#_$zU+xOn$Or&WX^I!b_KZ(=|IO<1y1Q3xZycB>+x zVK~bIoiE&wz|~SK*VW!^nz=%I-ULygKn@_YrVL-hmBvzA2ts15nI}mo0KEG}b#9(8 zypsc78*2a>CRiH-Km1@$@@T)z+WW&<7Y$j_+N1lykn*II@JchGFF8MrbAI<}IhEsY zcZ&*;2C$ABnp}dB#?r>-X_ooLVP;Qb#KiRq!$8kZMQ3(r8Us4@9}Xi8G@K>`ux5_e zBi}YJ8$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Q0u>c8`5$9EoIbn?cX$j_&r`QYSrV6 zXh-$&^{7d^;W!iUV;_ScjQ~Y$m*W^1^d}SG@C1eW1USC07XAN-;a{JD8B*Yu-Hf-i z09t#I0IkOXPWA!L%8oCbfiIA(%&j|;w{A(w-ZqnwSH3L=d?aLUDa*)ovd>)lzaH@N zaeD3&^8bFITHmJtc);?N+2a5c`(Odz7d|e}J)H#tLVTSCp8Ezkf}2^l;MzL?g^B<;ct_%&C{cMZ+ne86nr{L?c{dCNMZV)z>xDb+wCrFycYBt`rEx X%N}reUp@_Z1?Zucfo8>hyQu#I?q2|H literal 0 HcmV?d00001 diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 00000000000..a0bbb5d3fbd --- /dev/null +++ b/docs/api.md @@ -0,0 +1,179 @@ +--- +description: Reference guide for background processing functions provided by the Action Scheduler job queue for WordPress. +--- +# API Reference + +Action Scheduler provides a range of functions for scheduling hooks to run at some time in the future on one or more occassions. + +To understand the scheduling functoins, it can help to think of them as extensions to WordPress' `do_action()` function that add the ability to delay and repeat when the hook will be triggered. + +## WP-Cron APIs vs. Action Scheduler APIs + +The Action Scheduler API functions are designed to mirror the WordPress [WP-Cron API functions](http://codex.wordpress.org/Category:WP-Cron_Functions). + +Functions return similar values and accept similar arguments to their WP-Cron counterparts. The notable differences are: + +* `as_schedule_single_action()` & `as_schedule_recurring_action()` will return the post ID of the scheduled action rather than boolean indicating whether the event was scheduled +* `as_schedule_recurring_action()` takes an interval in seconds as the recurring interval rather than an arbitrary string +* `as_schedule_single_action()` & `as_schedule_recurring_action()` can accept a `$group` parameter to group different actions for the one plugin together. +* the `wp_` prefix is substituted with `as_` and the term `event` is replaced with `action` + +## API Function Availability + +As mentioned in the [Usage - Load Order](/usage/#load-order) section, Action Scheduler will initialize itself on the `'init'` hook with priority `1`. While API functions are loaded prior to this and call be called, they should not be called until after `'init'` with priority `1`, because each component, like the data store, has not yet been initialized. + +Do not use Action Scheduler API functions prior to `'init'` hook with priority `1`. Doing so could lead to unexpected results, like data being stored in the incorrect location. + +## Function Reference / `as_schedule_single_action()` + +### Description + +Schedule an action to run one time. + +### Usage + +```php +as_schedule_single_action( $timestamp, $hook, $args, $group ) +```` + +### Parameters + +- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_. +- **$hook** (string)(required) Name of the action hook. Default: _none_. +- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. +- **$group** (array) The group to assign this job to. Default: _''_. + +### Return value + +(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table. + + +## Function Reference / `as_schedule_recurring_action()` + +### Description + +Schedule an action to run repeatedly with a specified interval in seconds. + +### Usage + +```php +as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ) +```` + +### Parameters + +- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_. +- **$interval_in_seconds** (integer)(required) How long to wait between runs. Default: _none_. +- **$hook** (string)(required) Name of the action hook. Default: _none_. +- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. +- **$group** (array) The group to assign this job to. Default: _''_. + +### Return value + +(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table. + + +## Function Reference / `as_schedule_cron_action()` + +### Description + +Schedule an action that recurs on a cron-like schedule. + +### Usage + +```php +as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ) +```` + +### Parameters + +- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_. +- **$schedule** (string)(required) $schedule A cron-link schedule string, see http://en.wikipedia.org/wiki/Cron. Default: _none_. +- **$hook** (string)(required) Name of the action hook. Default: _none_. +- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. +- **$group** (array) The group to assign this job to. Default: _''_. + +### Return value + +(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table. + + +## Function Reference / `as_unschedule_action()` + +### Description + +Cancel the next occurrence of a job. + +### Usage + +```php +as_unschedule_action( $hook, $args, $group ) +```` + +### Parameters + +- **$hook** (string)(required) Name of the action hook. Default: _none_. +- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. +- **$group** (array) The group to assign this job to. Default: _''_. + +### Return value + +(null) + + +## Function Reference / `as_next_scheduled_action()` + +### Description + +Returns the next timestamp for a scheduled action. + +### Usage + +```php +as_next_scheduled_action( $hook, $args, $group ) +```` + +### Parameters + +- **$hook** (string)(required) Name of the action hook. Default: _none_. +- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. +- **$group** (array) The group to assign this job to. Default: _''_. + +### Return value + +(integer|boolean) The timestamp for the next occurrence, or false if nothing was found. + + +## Function Reference / `as_get_scheduled_actions()` + +### Description + +Find scheduled actions. + +### Usage + +```php +as_get_scheduled_actions( $args, $return_format ) +```` + +### Parameters + +- **$args** (array) Arguments to search and filter results by. Possible arguments, with their default values: + * `'hook' => ''` - the name of the action that will be triggered + * `'args' => NULL` - the args array that will be passed with the action + * `'date' => NULL` - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). + * `'date_compare' => '<=`' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' + * `'modified' => NULL` - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). + * `'modified_compare' => '<='` - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' + * `'group' => ''` - the group the action belongs to + * `'status' => ''` - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING + * `'claimed' => NULL` - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID + * `'per_page' => 5` - Number of results to return + * `'offset' => 0` + * `'orderby' => 'date'` - accepted values are 'hook', 'group', 'modified', or 'date' + * `'order' => 'ASC'` +- **$return_format** (string) The format in which to return the scheduled actions: 'OBJECT', 'ARRAY_A', or 'ids'. Default: _'OBJECT'_. + +### Return value + +(array) Array of the actions matching the criteria specified with `$args`. diff --git a/docs/apple-touch-icon.png b/docs/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1bc497520175a3fdf0c0f43a85db65219ae1ca07 GIT binary patch literal 8053 zcmb_>Ra9GD)NKm11P@ZAMS@c(UfkWGcySNKA-GE^TA&mwPLblJxJ%LCUP{p7?oc4e zJ>Sb6<38M{{~sAAdt_(J$vQJ@&NX-RTXh9I>=)P|5C~66QC16R>;AjIXux|-RiX{h zVAx8jNr6Ds2{?BaPl3-+D@83e5Xg@S1PTcUfo_4WkR1@nlM4jeGY5f$zk)zyu30Ub zqQDo=EL9X_L685v^4g1&fF4W_B{ezBH5{_1bhKT1$XF1Fnp8P4EsY_%48zMn5wxYIPRtY*(-Iefpun-_m79)Z zD0Kqn&W$$UBJdW z37^cy{R`sIxZl{D=9L8(ldG0??6{lSl9%L=*@g4Us~9oF2;n5T z=bE}KDqLwP`D_7*@lmlcjxp?N!l4r~jlH z1Ey3yKj!?b#y>nGR3v+)2~%uJSBBdV3xQl{Z2}L?UG3xF%0jw1E8KZ=AqdGgb{~~i zH`f`YfaBp&@gYY{;RRK0*apwkJb~U=8(B%u`ba+_l(=MC&68k4M#L#_;Wc~q_XwY% zw$4i8uj!9xgG}ru_LMg(eL>QRblMHW128{lZO4O}Iu#n@y5lF|uXN#C-m# zq6AWA<6O6eNksDW8L@Lcv7X4T^EYJcZoDaS+S1jpjMuZDzI!1UwE;ZyIPnt0!O*`^ zJ#v@$=?Y#8D1{1kD*2(1*&VS8^l(W{Xi_52t5?}1#G1538+2>|tQ=cBS{(G%pYjp* zfz*VA80La|u1U*!R*z9O=Do;yg@r6@Mh%No@Z;6W*m4I^Ro}IyjS!gVvX1;#p@P2k z5Qw}pjqZ3fx^y0bb(p2J34((&38BGvoqR5y0)bNi!7CiCvs2e9X&e=->uIoBT=g%UCgRJam2_(DUXha0 zNpVoFhN(Ed?zQFB;$R>2^j$8e{35;JzjNAi)E;Tlfp0}|+U^?ixEq}7cgCW<^s-z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^l&***5qdzkvqu^@xN8#xD#R}^LSu7!2p>Se=H z3(6Cym$ao<%i&NAv?{=VENv}q)hB-Nh4EGi#7@-#cIuztMXTw>iee%thN>RmE+)`e zGaVPE!rYrHa2=A$Of@p}@PRUQ{1?F8HeK$@JWQ`gd1{l=nUm5dcm}GKi3O{br-!Ql zMGY_Ljk@#yr?HLYfvUWVs8uk@D909X==j;4#vpo|Z;C1PM7STqS~t)ma-~vdjP=Hf z{xcFy&Gqga->1i72=Oz|oqr9F%NN=tr}DnQO@3ROj49olAs*sx zS`uz5@UiOGrCw5hI0zQ|VWd6zEPuZ2fSYnYc(FW?SCwRjZF_IdxuNBVl5A%I<@qA<<-F_>I3Wg5^T>$K>soDvI6gScOEzd#)3SGA;oxwRLW9#<_tI z==7p;y+x|9c(%ETzrfM2oTe6hI*>dF^<`(Mh-aivUwy3tMC@p>M$jtD4drxgPs=$ljKFwd)okSKH0>3af z#f-MS=)I4Sv8nxvrUusNAq{ZQ^ke$eF;2Z_xOzXNyhwZh)G-E^Gds?D+ON%+IF23D z=@&uHiFpRP*~86Zdj^%{WWbvSN+2VPeK5?tlm!3CO<>FihO*(k#taLq#)`b^(szw+ zHa$Ei&dhw4ie3h#Ag*U7TxlVxTC*E93I)1Au7~IE1@m@slix>m`f;>O{#!5y*8IhI zwQk1lAT+)@w&~+qicKZgNJ6fbHqmNHOmtCOM{!K?v!d1@_fzcggCi})bXtDVn^FE1Mxw=fsivxeQY|7U`ei?toh_y0e^dtZ|cn4s^c^Ug!d!W-%ecY)bC+CV*g zU2ULtt{zq(kWbe787|mOkA-DOV|YYqQwxMnkHcYwLrhPsl0 + + + + + #151515 + + + diff --git a/docs/faq.md b/docs/faq.md new file mode 100644 index 00000000000..38f07f59de1 --- /dev/null +++ b/docs/faq.md @@ -0,0 +1,101 @@ +## FAQ + +### Is it safe to release Action Scheduler in my plugin? Won't its functions conflict with another copy of the library? + +Action Scheduler is designed to be used and released in plugins. It avoids redeclaring public API functions when more than one copy of the library is being loaded by different plugins. It will also load only the most recent version of itself (by checking registered versions after all plugins are loaded on the `'plugins_loaded'` hook). + +To use it in your plugin, simply require the `action-scheduler/action-scheduler.php` file. Action Scheduler will take care of the rest. + +### I don't want to use WP-Cron. Does Action Scheduler depend on WP-Cron? + +By default, Action Scheduler is initiated by WP-Cron. However, it has no dependency on the WP-Cron system. You can initiate the Action Scheduler queue in other ways with just one or two lines of code. + +For example, you can start a queue directly by calling: + +```php +ActionScheduler::runner()->run(); +``` + +Or trigger the `'action_scheduler_run_queue'` hook and let Action Scheduler do it for you: + +```php +do_action( 'action_scheduler_run_queue' ); +``` + +Further customization can be done by extending the `ActionScheduler_Abstract_QueueRunner` class to create a custom Queue Runner. For an example of a customized queue runner, see the [`ActionScheduler_WPCLI_QueueRunner`](https://github.com/Prospress/action-scheduler/blob/master/classes/ActionScheduler_WPCLI_QueueRunner.php), which is used when running WP CLI. + +Want to create some other method for initiating Action Scheduler? [Open a new issue](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it. + +### I don't want to use WP-Cron, ever. Does Action Scheduler replace WP-Cron? + +By default, Action Scheduler is designed to work alongside WP-Cron and not change any of its behaviour. This helps avoid unexpectedly overriding WP-Cron on sites installing your plugin, which may have nothing to do with WP-Cron. + +However, we can understand why you might want to replace WP-Cron completely in environments within you control, especially as it gets you the advantages of Action Scheduler. This should be possible without too much code. + +You could use the `'schedule_event'` hook in WordPress to use Action Scheduler for only newly scheduled WP-Cron jobs and map the `$event` param to Action Scheduler API functions. + +Alternatively, you can use a combination of the `'pre_update_option_cron'` and `'pre_option_cron'` hooks to override all new and previously scheduled WP-Cron jobs (similar to the way [Cavalcade](https://github.com/humanmade/Cavalcade) does it). + +If you'd like to create a plugin to do this automatically and want to share your work with others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it. + +### Eww gross, Custom Post Types! That's _so_ 2010. Can I use a different storage scheme? + +Of course! Action Scheduler data storage is completely swappable, and always has been. + +You can store scheduled actions in custom tables in the WordPress site's database. Some sites using it already are. You can actually store them anywhere for that matter, like in a remote storage service from Amazon Web Services. + +To implement a custom store: + +1. extend the abstract `ActionScheduler_Store` class, being careful to implement each of its methods +2. attach a callback to `'action_scheduler_store_class'` to tell Action Scheduler your class is the one which should be used to manage storage, e.g. + +``` +function eg_define_custom_store( $existing_storage_class ) { + return 'My_Radical_Action_Scheduler_Store'; +} +add_filter( 'action_scheduler_store_class', 'eg_define_custom_store', 10, 1 ); +``` + +Take a look at the `ActionScheduler_wpPostStore` class for an example implementation of `ActionScheduler_Store`. + +If you'd like to create a plugin to do this automatically and release it publicly to help others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it. + +> Note: we're also moving Action Scheduler itself to use [custom tables for better scalability](https://github.com/Prospress/action-scheduler/issues/77). + +### Can I use a different storage scheme just for logging? + +Of course! Action Scheduler's logger is completely swappable, and always has been. You can also customise where logs are stored, and the storage mechanism. + +To implement a custom logger: + +1. extend the abstract `ActionScheduler_Logger` class, being careful to implement each of its methods +2. attach a callback to `'action_scheduler_logger_class'` to tell Action Scheduler your class is the one which should be used to manage logging, e.g. + +``` +function eg_define_custom_logger( $existing_storage_class ) { + return 'My_Radical_Action_Scheduler_Logger'; +} +add_filter( 'action_scheduler_logger_class', 'eg_define_custom_logger', 10, 1 ); +``` + +Take a look at the `ActionScheduler_wpCommentLogger` class for an example implementation of `ActionScheduler_Logger`. + +### I want to run Action Scheduler only on a dedicated application server in my cluster. Can I do that? + +Wow, now you're really asking the tough questions. In theory, yes, this is possible. The `ActionScheduler_QueueRunner` class, which is responsible for running queues, is swappable via the `'action_scheduler_queue_runner_class'` filter. + +Because of this, you can effectively customise queue running however you need. Whether that means tweaking minor things, like not using WP-Cron at all to initiate queues by overriding `ActionScheduler_QueueRunner::init()`, or completely changing how and where queues are run, by overriding `ActionScheduler_QueueRunner::run()`. + +### Is Action Scheduler safe to use on my production site? + +Yes, absolutely! Action Scheduler is actively used on tens of thousands of production sites already. Right now it's responsible for scheduling everything from emails to payments. + +In fact, every month, Action Scheduler processes millions of payments as part of the [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/) extension. + +It requires no setup, and won't override any WordPress APIs (unless you want it to). + +### How does Action Scheduler work on WordPress Multisite? + +Action Scheduler is designed to manage the scheduled actions on a single site. It has no special handling for running queues across multiple sites in a multisite network. That said, because it's storage and Queue Runner are completely swappable, it would be possible to write multisite handling classes to use with it. + +If you'd like to create a multisite plugin to do this and release it publicly to help others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it. diff --git a/docs/favicon-16x16.png b/docs/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..aa772d149406dc6659ad4d2f6b6b2a92bfe68b76 GIT binary patch literal 1160 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>zH?Vnqn7!viegk@W~G#e{-!wXNZTvuxg z;i7Pft8;ev@y};u-NlpH!}KGHW6#pw2yK_l6YvF58ckN(BO`k=JOnB?v5($;g&Iu^*`EbxddW?m>IMou^K@|xk+__kz`*3@CKzZ~$muEQrqJFQ=oRG_<`?G} z=o#r6+B?%R);ZWa+CAL={(%7h<0o#k91J<_bM;PB>&%NmEf-JSIyUW~-?@7SFP@w^ z@#@j3y*JO^ZEn1K=gejAyR)66P9C3r`TQ063|EJQ32Tx!xOr$OheuSfoCr!=eqzOo z88FZb3O*x!)@G!mU^*!6;#8Yq}W8%}Bht4*r99VJhlp4=d z28P3rG+ti`*>eHtW7QJZh?11Vl2ohYqEsNoU}Ruup=)TUYh)Z^U}|M-Vr6WsZD43+ zV8FKR<#ZGcx%nxXX_dG&l)nzt25Jbe3W+EQN-S3>D9TUE%t=)!sVqoU$Sf#HW?-n8 z^Y{}FM`4(T#wq{PXFQ(m_pwD+_y17GV}vaA`0(oWiWUIYi;~jVmXPoH-(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aGLozxZJG)jB~VFH$ROx94p`h<2Bb?-al` zp-}AmvlGaPX3?5M&II^8qsKMKefi}&OU z-)i<6lwdeb{cF9x0w(r#fXUDYwYhLo?}nqvMeUoJ1GYvZV~r>FB6n?k0Q4kR#4d<2 zPnk?|vl*J2>f7*47qkUsZ5G5{P-K(*&mV8And%^gwjd9(+dkkqMEfJvFlu z@?tS_iR0bXaY~~OkyRd=R$xBf`jq(5ACE?)1#F?ex%59_NMD6qyDZ%C60R=kb?7L z&-qYW$mj@G4BYTnRsSMwXILt)=cSHm;k6_R$kIR{&E-@*CaYhb&cfI{@X8CamT-Nn z2$5LhrIA=w`ZEi5&sgTWR&RUi2CXK7EpkKp05_R!QpEAKmjdrt_qENlR81|6x{5eE z%d+lGs7ZO{;n|DiDL!JeD(<%F=B5Ya@nm+iA%d^x}`x7c> zMb+-;tG&Jv;l2(kdaJs;Wz}lW&gUrh-x>|h!bG1Mn5PtvP7YSr8ergRy12KIkgZFq zrQdsbTS@`5#GI8K(=^anhxM1Iw>50X*F03b)H8aVw9^czr$2pZz-{c-luk{lT}$25 zCz)pQx%7nrWAKh_D2&itx~;4bTAcPRZz~RRDQjP|B7R!GRNbE%40d4Rory8^IkH{C z-|-8>hQyP-S{|h-FO~wEK literal 0 HcmV?d00001 diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..3cdbb517ab61e63daa89208f9e8ffb4fa22efb95 GIT binary patch literal 15086 zcmeI233OD|8OL7;s{)}SvZzc@uu`c)t&~b7;!zfnkWDRAD!8E>Y^}S94H^nn(a@?W zRE%0d1(78aP!1RZDabY~qOw%h3Q8>`AdrMGufPAxyvdtkl6eziP0w-8`ElR9_q*Ty z?)Ke<7)G2CZ*=Wy5GES$bTW+YhG8To2I4IYV+Uz12$g?#eZv@!z{SW=#25xjw|*Tf zf*<}3?SXWkw;m*%PU67GiT(*aT*P6=`edpIs?Y zx4*FYX@~7W%SDr^i6(1x+3rGWfw>vUgU!@6g^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TTxA%?7aPW*R}CY-oF~&#!zeg{94|yF`(MaKb6Wra literal 0 HcmV?d00001 diff --git a/docs/google14ef723abb376cd3.html b/docs/google14ef723abb376cd3.html new file mode 100644 index 00000000000..f3bf1712501 --- /dev/null +++ b/docs/google14ef723abb376cd3.html @@ -0,0 +1 @@ +google-site-verification: google14ef723abb376cd3.html \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000000..989f262a4fc --- /dev/null +++ b/docs/index.md @@ -0,0 +1,68 @@ +--- +title: Action Scheduler - Background Processing Job Queue for WordPress +--- +## WordPress Job Queue with Background Processing + +Action Scheduler is a library for triggering a WordPress hook to run at some time in the future. Each hook can be scheduled with unique data, to allow callbacks to perform operations on that data. The hook can also be scheduled to run on one or more occassions. + +Think of it like an extension to `do_action()` which adds the ability to delay and repeat a hook. + +It just so happens, this functionality also creates a robust job queue for background processing large queues of tasks in WordPress. With the additional of logging and an [administration interface](/admin/), that also provide tracability on your tasks processed in the background. + +### Battle-Tested Background Processing + +Every month, Action Scheduler processes millions of payments for [Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/), webhooks for [WooCommerce](https://wordpress.org/plugins/woocommerce/), as well as emails and other events for a range of other plugins. + +It's been seen on live sites processing queues in excess of 50,000 jobs and doing resource intensive operations, like processing payments and creating orders, in 10 concurrent queues at a rate of over 10,000 actions / hour without negatively impacting normal site operations. + +This is all possible on infrastructure and WordPress sites outside the control of the plugin author. + +Action Scheduler is specifically designed for distribution in WordPress plugins (and themes) - no server access required. If your plugin needs background processing, especially of large sets of tasks, Action Scheduler can help. + +### How it Works + +Action Scheduler uses a WordPress [custom post type](http://codex.wordpress.org/Post_Types), creatively named `scheduled-action`, to store the hook name, arguments and scheduled date for an action that should be triggered at some time in the future. + +The scheduler will attempt to run every minute by attaching itself as a callback to the `'action_scheduler_run_schedule'` hook, which is scheduled using WordPress's built-in [WP-Cron](http://codex.wordpress.org/Function_Reference/wp_cron) system. + +When triggered, Action Scheduler will check for posts of the `scheduled-action` type that have a `post_date` at or before this point in time i.e. actions scheduled to run now or at sometime in the past. + +### Batch Processing Background Jobs + +If there are actions to be processed, Action Scheduler will stake a unique claim for a batch of 20 actions and begin processing that batch. The PHP process spawned to run the batch will then continue processing batches of 20 actions until it times out or exhausts available memory. + +If your site has a large number of actions scheduled to run at the same time, Action Scheduler will process more than one batch at a time. Specifically, when the `'action_scheduler_run_schedule'` hook is triggered approximately one minute after the first batch began processing, a new PHP process will stake a new claim to a batch of actions which were not claimed by the previous process. It will then begin to process that batch. + +This will continue until all actions are processed using a maximum of 5 concurrent queues. + +### Housekeeping + +Before processing a batch, the scheduler will remove any existing claims on actions which have been sitting in a queue for more than five minutes. + +Action Scheduler will also trash any actions which were completed more than a month ago. + +If an action runs for more than 5 minutes, Action Scheduler will assume the action has timed out and will mark it as failed. However, if all callbacks attached to the action were to successfully complete sometime after that 5 minute timeout, its status would later be updated to completed. + +### Traceable Background Processing + +Did your background job run? + +Never be left wondering with Action Scheduler's built-in record keeping. + +All events for each action are logged in the [comments table](http://codex.wordpress.org/Database_Description#Table_Overview) and displayed in the [administration interface](/admin/). + +The events logged by default include when an action: + * is created + * starts + * completes + * fails + +If it fails with an error that can be recorded, that error will be recorded in the log and visible in administration interface, making it possible to trace what went wrong at some point in the past on a site you didn't have access to in the past. + +Actions can also be grouped together using a custom taxonomy named `action-group`. + +## Credits + +Developed and maintained by [Prospress](http://prospress.com/) in collaboration with [Flightless](https://flightless.us/). + +Collaboration is cool. We'd love to work with you to improve Action Scheduler. [Pull Requests](https://github.com/prospress/action-scheduler/pulls) welcome. \ No newline at end of file diff --git a/docs/mstile-150x150.png b/docs/mstile-150x150.png new file mode 100644 index 0000000000000000000000000000000000000000..3a3ed191109e302730b66dd5853a6e6f5228e489 GIT binary patch literal 4246 zcmbVPS5y;aUNax_Gj9x#S}cq_i~s3kp85i;)8WZYXN2tC|GNZ7l|2 zO;>Zf_I6aRUkSbY=ux%rOJvn7{lDr;4T%PLH|uEtf7C@D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d{UZ$k1986ZWoo$-?e;K@doZV4@|F_|To=@?m!5n8|fi-gQ7kGy8 zLAiUn2w(%Bxd^yF!#V)~0XfV2%-7InVq$%d`v>zgC6b@Q;0rgkV vc4t~porysI%tTMeKnHIJL;ov8p3XhMCKnraA1 'POST', + 'timeout' => 45, + 'redirection' => 5, + 'httpversion' => '1.0', + 'blocking' => false, + 'headers' => array(), + 'body' => array( + 'action' => 'eg_create_additional_runners', + 'instance' => $i, + 'eg_nonce' => wp_create_nonce( 'eg_additional_runner_' . $i ), + ), + 'cookies' => array(), + ) ); + } +} +add_action( 'action_scheduler_run_queue', 'eg_request_additional_runners', 0 ); + +/** + * Handle requests initiated by eg_request_additional_runners() and start a queue runner if the request is valid. + */ +function eg_create_additional_runners() { + + if ( isset( $_POST['eg_nonce'] ) && isset( $_POST['instance'] ) && wp_verify_nonce( $_POST['eg_nonce'], 'eg_additional_runner_' . $_POST['instance'] ) ) { + ActionScheduler_QueueRunner::instance()->run(); + } + + wp_die(); +} +add_action( 'wp_ajax_nopriv_eg_create_additional_runners', 'eg_create_additional_runners', 0 ); +``` + +## High Volume Plugin + +It's not necessary to add all of this code yourself, the folks at [Prospress](https://prospress.com) have created a handy plugin to get access to each of these increases - the [Action Scheduler - High Volume](https://github.com/prospress/action-scheduler-high-volume) plugin. diff --git a/docs/safari-pinned-tab.svg b/docs/safari-pinned-tab.svg new file mode 100644 index 00000000000..b67c32ba580 --- /dev/null +++ b/docs/safari-pinned-tab.svg @@ -0,0 +1,40 @@ + + + + +Created by potrace 1.11, written by Peter Selinger 2001-2013 + + + + + diff --git a/docs/site.webmanifest b/docs/site.webmanifest new file mode 100644 index 00000000000..de65106f489 --- /dev/null +++ b/docs/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-256x256.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 00000000000..dda4ed7d902 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,123 @@ +--- +description: Learn how to use the Action Scheduler background processing job queue for WordPress in your WordPress plugin. +--- +# Usage + +Using Action Scheduler requires: + +1. installing the library +1. scheduling and action +1. attaching a callback to that action + +## Scheduling an Action + +To schedule an action, call the [API function](/api/) for the desired schedule type passing in the required parameters. + +The example code below shows everything needed to schedule a function to run at midnight, if it's not already scheduled: + +```php +require_once( plugin_dir_path( __FILE__ ) . '/libraries/action-scheduler/action-scheduler.php' ); + +/** + * Schedule an action with the hook 'eg_midnight_log' to run at midnight each day + * so that our callback is run then. + */ +function eg_log_action_data() { + if ( false === as_next_scheduled_action( 'eg_midnight_log' ) ) { + as_schedule_recurring_action( strtotime( 'midnight tonight' ), DAY_IN_SECONDS, 'eg_midnight_log' ); + } +} +add_action( 'init', 'eg_log_action_data' ); + +/** + * A callback to run when the 'eg_midnight_log' scheduled action is run. + */ +function eg_log_action_data() { + error_log( 'It is just after midnight on ' . date( 'Y-m-d' ) ); +} +add_action( 'eg_midnight_log', 'eg_log_action_data' ); +``` + +For more details on all available API functions, and the data they accept, refer to the [API Reference](/api/). + +## Installation + +There are two ways to install Action Scheduler: + +1. regular WordPress plugin; or +1. a library within your plugin's codebase. + +### Usage as a Plugin + +Action Scheduler includes the necessary file headers to be used as a standard WordPress plugin. + +To install it as a plugin: + +1. Download the .zip archive of the latest [stable release](https://github.com/Prospress/action-scheduler/releases) +1. Go to the **Plugins > Add New > Upload** administration screen on your WordPress site +1. Select the archive file you just downloaded +1. Click **Install Now** +1. Click **Activate** + +Or clone the Git repository into your site's `wp-content/plugins` folder. + +Using Action Scheduler as a plugin can be handy for developing against newer versions, rather than having to update the subtree in your codebase. **When installed as a plugin, Action Scheduler does not provide any user interfaces for scheduling actions**. The only way to interact with Action Scheduler is via code. + +### Usage as a Library + +To use Action Scheduler as a library: + +1. include the Action Scheduler codebase +1. load the library by including the `action-scheduler.php` file + +Using a [subtree in your plugin, theme or site's Git repository](https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree) to include Action Scheduler is the recommended method. Composer can also be used. + +To include Action Scheduler as a git subtree: + +#### Step 1. Add the Repository as a Remote + +``` +git remote add -f subtree-action-scheduler https://github.com/Prospress/action-scheduler.git +``` + +Adding the subtree as a remote allows us to refer to it in short from via the name `subtree-action-scheduler`, instead of the full GitHub URL. + +#### Step 2. Add the Repo as a Subtree + +``` +git subtree add --prefix libraries/action-scheduler subtree-action-scheduler master --squash +``` + +This will add the `master` branch of Action Scheduler to your repository in the folder `libraries/action-scheduler`. + +You can change the `--prefix` to change where the code is included. Or change the `master` branch to a tag, like `2.1.0` to include only a stable version. + +#### Step 3. Update the Subtree + +To update Action Scheduler to a new version, use the commands: + +``` +git fetch subtree-action-scheduler master +git subtree pull --prefix libraries/action-scheduler subtree-action-scheduler master --squash +``` + +### Loading Action Scheduler + +Regardless of how it is installed, to load Action Scheduler, you only need to include the `action-scheduler.php` file, e.g. + +```php +single( $hook, $args, $timestamp, $group ); +} + +/** + * Schedule a recurring action + * + * @param int $timestamp When the first instance of the job will run + * @param int $interval_in_seconds How long to wait between runs + * @param string $hook The hook to trigger + * @param array $args Arguments to pass when the hook triggers + * @param string $group The group to assign this job to + * + * @return string The job ID + */ +function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { + return ActionScheduler::factory()->recurring( $hook, $args, $timestamp, $interval_in_seconds, $group ); +} + +/** + * Schedule an action that recurs on a cron-like schedule. + * + * @param int $timestamp The schedule will start on or after this time + * @param string $schedule A cron-link schedule string + * @see http://en.wikipedia.org/wiki/Cron + * * * * * * * + * ┬ ┬ ┬ ┬ ┬ ┬ + * | | | | | | + * | | | | | + year [optional] + * | | | | +----- day of week (0 - 7) (Sunday=0 or 7) + * | | | +---------- month (1 - 12) + * | | +--------------- day of month (1 - 31) + * | +-------------------- hour (0 - 23) + * +------------------------- min (0 - 59) + * @param string $hook The hook to trigger + * @param array $args Arguments to pass when the hook triggers + * @param string $group The group to assign this job to + * + * @return string The job ID + */ +function as_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { + return ActionScheduler::factory()->cron( $hook, $args, $timestamp, $schedule, $group ); +} + +/** + * Cancel the next occurrence of a scheduled action. + * + * While only the next instance of a recurring or cron action is unscheduled by this method, that will also prevent + * all future instances of that recurring or cron action from being run. Recurring and cron actions are scheduled in + * a sequence instead of all being scheduled at once. Each successive occurrence of a recurring action is scheduled + * only after the former action is run. If the next instance is never run, because it's unscheduled by this function, + * then the following instance will never be scheduled (or exist), which is effectively the same as being unscheduled + * by this method also. + * + * @param string $hook The hook that the job will trigger + * @param array $args Args that would have been passed to the job + * @param string $group + * + * @return string The scheduled action ID if a scheduled action was found, or empty string if no matching action found. + */ +function as_unschedule_action( $hook, $args = array(), $group = '' ) { + $params = array(); + if ( is_array($args) ) { + $params['args'] = $args; + } + if ( !empty($group) ) { + $params['group'] = $group; + } + $job_id = ActionScheduler::store()->find_action( $hook, $params ); + + if ( ! empty( $job_id ) ) { + ActionScheduler::store()->cancel_action( $job_id ); + } + + return $job_id; +} + +/** + * Cancel all occurrences of a scheduled action. + * + * @param string $hook The hook that the job will trigger + * @param array $args Args that would have been passed to the job + * @param string $group + */ +function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) { + do { + $unscheduled_action = as_unschedule_action( $hook, $args, $group ); + } while ( ! empty( $unscheduled_action ) ); +} + +/** + * @param string $hook + * @param array $args + * @param string $group + * + * @return int|bool The timestamp for the next occurrence, or false if nothing was found + */ +function as_next_scheduled_action( $hook, $args = NULL, $group = '' ) { + $params = array(); + if ( is_array($args) ) { + $params['args'] = $args; + } + if ( !empty($group) ) { + $params['group'] = $group; + } + $job_id = ActionScheduler::store()->find_action( $hook, $params ); + if ( empty($job_id) ) { + return false; + } + $job = ActionScheduler::store()->fetch_action( $job_id ); + $next = $job->get_schedule()->next(); + if ( $next ) { + return (int)($next->format('U')); + } + return false; +} + +/** + * Find scheduled actions + * + * @param array $args Possible arguments, with their default values: + * 'hook' => '' - the name of the action that will be triggered + * 'args' => NULL - the args array that will be passed with the action + * 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. + * 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' + * 'modified' => NULL - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. + * 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' + * 'group' => '' - the group the action belongs to + * 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING + * 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID + * 'per_page' => 5 - Number of results to return + * 'offset' => 0 + * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date' + * 'order' => 'ASC' + * + * @param string $return_format OBJECT, ARRAY_A, or ids + * + * @return array + */ +function as_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { + $store = ActionScheduler::store(); + foreach ( array('date', 'modified') as $key ) { + if ( isset($args[$key]) ) { + $args[$key] = as_get_datetime_object($args[$key]); + } + } + $ids = $store->query_actions( $args ); + + if ( $return_format == 'ids' || $return_format == 'int' ) { + return $ids; + } + + $actions = array(); + foreach ( $ids as $action_id ) { + $actions[$action_id] = $store->fetch_action( $action_id ); + } + + if ( $return_format == ARRAY_A ) { + foreach ( $actions as $action_id => $action_object ) { + $actions[$action_id] = get_object_vars($action_object); + } + } + + return $actions; +} + +/** + * Helper function to create an instance of DateTime based on a given + * string and timezone. By default, will return the current date/time + * in the UTC timezone. + * + * Needed because new DateTime() called without an explicit timezone + * will create a date/time in PHP's timezone, but we need to have + * assurance that a date/time uses the right timezone (which we almost + * always want to be UTC), which means we need to always include the + * timezone when instantiating datetimes rather than leaving it up to + * the PHP default. + * + * @param mixed $date_string A date/time string. Valid formats are explained in http://php.net/manual/en/datetime.formats.php + * @param string $timezone A timezone identifier, like UTC or Europe/Lisbon. The list of valid identifiers is available http://php.net/manual/en/timezones.php + * + * @return ActionScheduler_DateTime + */ +function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) { + if ( is_object( $date_string ) && $date_string instanceof DateTime ) { + $date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) ); + } elseif ( is_numeric( $date_string ) ) { + $date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) ); + } else { + $date = new ActionScheduler_DateTime( $date_string, new DateTimeZone( $timezone ) ); + } + return $date; +} diff --git a/lib/cron-expression/CronExpression.php b/lib/cron-expression/CronExpression.php new file mode 100755 index 00000000000..7f33c378f9e --- /dev/null +++ b/lib/cron-expression/CronExpression.php @@ -0,0 +1,318 @@ + + * @link http://en.wikipedia.org/wiki/Cron + */ +class CronExpression +{ + const MINUTE = 0; + const HOUR = 1; + const DAY = 2; + const MONTH = 3; + const WEEKDAY = 4; + const YEAR = 5; + + /** + * @var array CRON expression parts + */ + private $cronParts; + + /** + * @var CronExpression_FieldFactory CRON field factory + */ + private $fieldFactory; + + /** + * @var array Order in which to test of cron parts + */ + private static $order = array(self::YEAR, self::MONTH, self::DAY, self::WEEKDAY, self::HOUR, self::MINUTE); + + /** + * Factory method to create a new CronExpression. + * + * @param string $expression The CRON expression to create. There are + * several special predefined values which can be used to substitute the + * CRON expression: + * + * @yearly, @annually) - Run once a year, midnight, Jan. 1 - 0 0 1 1 * + * @monthly - Run once a month, midnight, first of month - 0 0 1 * * + * @weekly - Run once a week, midnight on Sun - 0 0 * * 0 + * @daily - Run once a day, midnight - 0 0 * * * + * @hourly - Run once an hour, first minute - 0 * * * * + * +*@param CronExpression_FieldFactory $fieldFactory (optional) Field factory to use + * + * @return CronExpression + */ + public static function factory($expression, CronExpression_FieldFactory $fieldFactory = null) + { + $mappings = array( + '@yearly' => '0 0 1 1 *', + '@annually' => '0 0 1 1 *', + '@monthly' => '0 0 1 * *', + '@weekly' => '0 0 * * 0', + '@daily' => '0 0 * * *', + '@hourly' => '0 * * * *' + ); + + if (isset($mappings[$expression])) { + $expression = $mappings[$expression]; + } + + return new self($expression, $fieldFactory ? $fieldFactory : new CronExpression_FieldFactory()); + } + + /** + * Parse a CRON expression + * + * @param string $expression CRON expression (e.g. '8 * * * *') + * @param CronExpression_FieldFactory $fieldFactory Factory to create cron fields + */ + public function __construct($expression, CronExpression_FieldFactory $fieldFactory) + { + $this->fieldFactory = $fieldFactory; + $this->setExpression($expression); + } + + /** + * Set or change the CRON expression + * + * @param string $value CRON expression (e.g. 8 * * * *) + * + * @return CronExpression + * @throws InvalidArgumentException if not a valid CRON expression + */ + public function setExpression($value) + { + $this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); + if (count($this->cronParts) < 5) { + throw new InvalidArgumentException( + $value . ' is not a valid CRON expression' + ); + } + + foreach ($this->cronParts as $position => $part) { + $this->setPart($position, $part); + } + + return $this; + } + + /** + * Set part of the CRON expression + * + * @param int $position The position of the CRON expression to set + * @param string $value The value to set + * + * @return CronExpression + * @throws InvalidArgumentException if the value is not valid for the part + */ + public function setPart($position, $value) + { + if (!$this->fieldFactory->getField($position)->validate($value)) { + throw new InvalidArgumentException( + 'Invalid CRON field value ' . $value . ' as position ' . $position + ); + } + + $this->cronParts[$position] = $value; + + return $this; + } + + /** + * Get a next run date relative to the current date or a specific date + * + * @param string|DateTime $currentTime (optional) Relative calculation date + * @param int $nth (optional) Number of matches to skip before returning a + * matching next run date. 0, the default, will return the current + * date and time if the next run date falls on the current date and + * time. Setting this value to 1 will skip the first match and go to + * the second match. Setting this value to 2 will skip the first 2 + * matches and so on. + * @param bool $allowCurrentDate (optional) Set to TRUE to return the + * current date if it matches the cron expression + * + * @return DateTime + * @throws RuntimeException on too many iterations + */ + public function getNextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) + { + return $this->getRunDate($currentTime, $nth, false, $allowCurrentDate); + } + + /** + * Get a previous run date relative to the current date or a specific date + * + * @param string|DateTime $currentTime (optional) Relative calculation date + * @param int $nth (optional) Number of matches to skip before returning + * @param bool $allowCurrentDate (optional) Set to TRUE to return the + * current date if it matches the cron expression + * + * @return DateTime + * @throws RuntimeException on too many iterations + * @see CronExpression::getNextRunDate + */ + public function getPreviousRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) + { + return $this->getRunDate($currentTime, $nth, true, $allowCurrentDate); + } + + /** + * Get multiple run dates starting at the current date or a specific date + * + * @param int $total Set the total number of dates to calculate + * @param string|DateTime $currentTime (optional) Relative calculation date + * @param bool $invert (optional) Set to TRUE to retrieve previous dates + * @param bool $allowCurrentDate (optional) Set to TRUE to return the + * current date if it matches the cron expression + * + * @return array Returns an array of run dates + */ + public function getMultipleRunDates($total, $currentTime = 'now', $invert = false, $allowCurrentDate = false) + { + $matches = array(); + for ($i = 0; $i < max(0, $total); $i++) { + $matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate); + } + + return $matches; + } + + /** + * Get all or part of the CRON expression + * + * @param string $part (optional) Specify the part to retrieve or NULL to + * get the full cron schedule string. + * + * @return string|null Returns the CRON expression, a part of the + * CRON expression, or NULL if the part was specified but not found + */ + public function getExpression($part = null) + { + if (null === $part) { + return implode(' ', $this->cronParts); + } elseif (array_key_exists($part, $this->cronParts)) { + return $this->cronParts[$part]; + } + + return null; + } + + /** + * Helper method to output the full expression. + * + * @return string Full CRON expression + */ + public function __toString() + { + return $this->getExpression(); + } + + /** + * Determine if the cron is due to run based on the current date or a + * specific date. This method assumes that the current number of + * seconds are irrelevant, and should be called once per minute. + * + * @param string|DateTime $currentTime (optional) Relative calculation date + * + * @return bool Returns TRUE if the cron is due to run or FALSE if not + */ + public function isDue($currentTime = 'now') + { + if ('now' === $currentTime) { + $currentDate = date('Y-m-d H:i'); + $currentTime = strtotime($currentDate); + } elseif ($currentTime instanceof DateTime) { + $currentDate = $currentTime->format('Y-m-d H:i'); + $currentTime = strtotime($currentDate); + } else { + $currentTime = new DateTime($currentTime); + $currentTime->setTime($currentTime->format('H'), $currentTime->format('i'), 0); + $currentDate = $currentTime->format('Y-m-d H:i'); + $currentTime = (int)($currentTime->getTimestamp()); + } + + return $this->getNextRunDate($currentDate, 0, true)->getTimestamp() == $currentTime; + } + + /** + * Get the next or previous run date of the expression relative to a date + * + * @param string|DateTime $currentTime (optional) Relative calculation date + * @param int $nth (optional) Number of matches to skip before returning + * @param bool $invert (optional) Set to TRUE to go backwards in time + * @param bool $allowCurrentDate (optional) Set to TRUE to return the + * current date if it matches the cron expression + * + * @return DateTime + * @throws RuntimeException on too many iterations + */ + protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false) + { + if ($currentTime instanceof DateTime) { + $currentDate = $currentTime; + } else { + $currentDate = new DateTime($currentTime ? $currentTime : 'now'); + $currentDate->setTimezone(new DateTimeZone(date_default_timezone_get())); + } + + $currentDate->setTime($currentDate->format('H'), $currentDate->format('i'), 0); + $nextRun = clone $currentDate; + $nth = (int) $nth; + + // Set a hard limit to bail on an impossible date + for ($i = 0; $i < 1000; $i++) { + + foreach (self::$order as $position) { + $part = $this->getExpression($position); + if (null === $part) { + continue; + } + + $satisfied = false; + // Get the field object used to validate this part + $field = $this->fieldFactory->getField($position); + // Check if this is singular or a list + if (strpos($part, ',') === false) { + $satisfied = $field->isSatisfiedBy($nextRun, $part); + } else { + foreach (array_map('trim', explode(',', $part)) as $listPart) { + if ($field->isSatisfiedBy($nextRun, $listPart)) { + $satisfied = true; + break; + } + } + } + + // If the field is not satisfied, then start over + if (!$satisfied) { + $field->increment($nextRun, $invert); + continue 2; + } + } + + // Skip this match if needed + if ((!$allowCurrentDate && $nextRun == $currentDate) || --$nth > -1) { + $this->fieldFactory->getField(0)->increment($nextRun, $invert); + continue; + } + + return $nextRun; + } + + // @codeCoverageIgnoreStart + throw new RuntimeException('Impossible CRON expression'); + // @codeCoverageIgnoreEnd + } +} diff --git a/lib/cron-expression/CronExpression_AbstractField.php b/lib/cron-expression/CronExpression_AbstractField.php new file mode 100755 index 00000000000..f8d5c00ae79 --- /dev/null +++ b/lib/cron-expression/CronExpression_AbstractField.php @@ -0,0 +1,100 @@ + + */ +abstract class CronExpression_AbstractField implements CronExpression_FieldInterface +{ + /** + * Check to see if a field is satisfied by a value + * + * @param string $dateValue Date value to check + * @param string $value Value to test + * + * @return bool + */ + public function isSatisfied($dateValue, $value) + { + if ($this->isIncrementsOfRanges($value)) { + return $this->isInIncrementsOfRanges($dateValue, $value); + } elseif ($this->isRange($value)) { + return $this->isInRange($dateValue, $value); + } + + return $value == '*' || $dateValue == $value; + } + + /** + * Check if a value is a range + * + * @param string $value Value to test + * + * @return bool + */ + public function isRange($value) + { + return strpos($value, '-') !== false; + } + + /** + * Check if a value is an increments of ranges + * + * @param string $value Value to test + * + * @return bool + */ + public function isIncrementsOfRanges($value) + { + return strpos($value, '/') !== false; + } + + /** + * Test if a value is within a range + * + * @param string $dateValue Set date value + * @param string $value Value to test + * + * @return bool + */ + public function isInRange($dateValue, $value) + { + $parts = array_map('trim', explode('-', $value, 2)); + + return $dateValue >= $parts[0] && $dateValue <= $parts[1]; + } + + /** + * Test if a value is within an increments of ranges (offset[-to]/step size) + * + * @param string $dateValue Set date value + * @param string $value Value to test + * + * @return bool + */ + public function isInIncrementsOfRanges($dateValue, $value) + { + $parts = array_map('trim', explode('/', $value, 2)); + $stepSize = isset($parts[1]) ? $parts[1] : 0; + if ($parts[0] == '*' || $parts[0] === '0') { + return (int) $dateValue % $stepSize == 0; + } + + $range = explode('-', $parts[0], 2); + $offset = $range[0]; + $to = isset($range[1]) ? $range[1] : $dateValue; + // Ensure that the date value is within the range + if ($dateValue < $offset || $dateValue > $to) { + return false; + } + + for ($i = $offset; $i <= $to; $i+= $stepSize) { + if ($i == $dateValue) { + return true; + } + } + + return false; + } +} diff --git a/lib/cron-expression/CronExpression_DayOfMonthField.php b/lib/cron-expression/CronExpression_DayOfMonthField.php new file mode 100755 index 00000000000..40c1d6c6e78 --- /dev/null +++ b/lib/cron-expression/CronExpression_DayOfMonthField.php @@ -0,0 +1,110 @@ + + */ +class CronExpression_DayOfMonthField extends CronExpression_AbstractField +{ + /** + * Get the nearest day of the week for a given day in a month + * + * @param int $currentYear Current year + * @param int $currentMonth Current month + * @param int $targetDay Target day of the month + * + * @return DateTime Returns the nearest date + */ + private static function getNearestWeekday($currentYear, $currentMonth, $targetDay) + { + $tday = str_pad($targetDay, 2, '0', STR_PAD_LEFT); + $target = new DateTime("$currentYear-$currentMonth-$tday"); + $currentWeekday = (int) $target->format('N'); + + if ($currentWeekday < 6) { + return $target; + } + + $lastDayOfMonth = $target->format('t'); + + foreach (array(-1, 1, -2, 2) as $i) { + $adjusted = $targetDay + $i; + if ($adjusted > 0 && $adjusted <= $lastDayOfMonth) { + $target->setDate($currentYear, $currentMonth, $adjusted); + if ($target->format('N') < 6 && $target->format('m') == $currentMonth) { + return $target; + } + } + } + } + + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + // ? states that the field value is to be skipped + if ($value == '?') { + return true; + } + + $fieldValue = $date->format('d'); + + // Check to see if this is the last day of the month + if ($value == 'L') { + return $fieldValue == $date->format('t'); + } + + // Check to see if this is the nearest weekday to a particular value + if (strpos($value, 'W')) { + // Parse the target day + $targetDay = substr($value, 0, strpos($value, 'W')); + // Find out if the current day is the nearest day of the week + return $date->format('j') == self::getNearestWeekday( + $date->format('Y'), + $date->format('m'), + $targetDay + )->format('j'); + } + + return $this->isSatisfied($date->format('d'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('previous day'); + $date->setTime(23, 59); + } else { + $date->modify('next day'); + $date->setTime(0, 0); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-\?LW0-9A-Za-z]+/', $value); + } +} diff --git a/lib/cron-expression/CronExpression_DayOfWeekField.php b/lib/cron-expression/CronExpression_DayOfWeekField.php new file mode 100755 index 00000000000..e9f68a7cd6f --- /dev/null +++ b/lib/cron-expression/CronExpression_DayOfWeekField.php @@ -0,0 +1,124 @@ + + */ +class CronExpression_DayOfWeekField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + if ($value == '?') { + return true; + } + + // Convert text day of the week values to integers + $value = str_ireplace( + array('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'), + range(0, 6), + $value + ); + + $currentYear = $date->format('Y'); + $currentMonth = $date->format('m'); + $lastDayOfMonth = $date->format('t'); + + // Find out if this is the last specific weekday of the month + if (strpos($value, 'L')) { + $weekday = str_replace('7', '0', substr($value, 0, strpos($value, 'L'))); + $tdate = clone $date; + $tdate->setDate($currentYear, $currentMonth, $lastDayOfMonth); + while ($tdate->format('w') != $weekday) { + $tdate->setDate($currentYear, $currentMonth, --$lastDayOfMonth); + } + + return $date->format('j') == $lastDayOfMonth; + } + + // Handle # hash tokens + if (strpos($value, '#')) { + list($weekday, $nth) = explode('#', $value); + // Validate the hash fields + if ($weekday < 1 || $weekday > 5) { + throw new InvalidArgumentException("Weekday must be a value between 1 and 5. {$weekday} given"); + } + if ($nth > 5) { + throw new InvalidArgumentException('There are never more than 5 of a given weekday in a month'); + } + // The current weekday must match the targeted weekday to proceed + if ($date->format('N') != $weekday) { + return false; + } + + $tdate = clone $date; + $tdate->setDate($currentYear, $currentMonth, 1); + $dayCount = 0; + $currentDay = 1; + while ($currentDay < $lastDayOfMonth + 1) { + if ($tdate->format('N') == $weekday) { + if (++$dayCount >= $nth) { + break; + } + } + $tdate->setDate($currentYear, $currentMonth, ++$currentDay); + } + + return $date->format('j') == $currentDay; + } + + // Handle day of the week values + if (strpos($value, '-')) { + $parts = explode('-', $value); + if ($parts[0] == '7') { + $parts[0] = '0'; + } elseif ($parts[1] == '0') { + $parts[1] = '7'; + } + $value = implode('-', $parts); + } + + // Test to see which Sunday to use -- 0 == 7 == Sunday + $format = in_array(7, str_split($value)) ? 'N' : 'w'; + $fieldValue = $date->format($format); + + return $this->isSatisfied($fieldValue, $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('-1 day'); + $date->setTime(23, 59, 0); + } else { + $date->modify('+1 day'); + $date->setTime(0, 0, 0); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9A-Z]+/', $value); + } +} diff --git a/lib/cron-expression/CronExpression_FieldFactory.php b/lib/cron-expression/CronExpression_FieldFactory.php new file mode 100755 index 00000000000..556ba1a3e31 --- /dev/null +++ b/lib/cron-expression/CronExpression_FieldFactory.php @@ -0,0 +1,55 @@ + + * @link http://en.wikipedia.org/wiki/Cron + */ +class CronExpression_FieldFactory +{ + /** + * @var array Cache of instantiated fields + */ + private $fields = array(); + + /** + * Get an instance of a field object for a cron expression position + * + * @param int $position CRON expression position value to retrieve + * + * @return CronExpression_FieldInterface + * @throws InvalidArgumentException if a position is not valid + */ + public function getField($position) + { + if (!isset($this->fields[$position])) { + switch ($position) { + case 0: + $this->fields[$position] = new CronExpression_MinutesField(); + break; + case 1: + $this->fields[$position] = new CronExpression_HoursField(); + break; + case 2: + $this->fields[$position] = new CronExpression_DayOfMonthField(); + break; + case 3: + $this->fields[$position] = new CronExpression_MonthField(); + break; + case 4: + $this->fields[$position] = new CronExpression_DayOfWeekField(); + break; + case 5: + $this->fields[$position] = new CronExpression_YearField(); + break; + default: + throw new InvalidArgumentException( + $position . ' is not a valid position' + ); + } + } + + return $this->fields[$position]; + } +} diff --git a/lib/cron-expression/CronExpression_FieldInterface.php b/lib/cron-expression/CronExpression_FieldInterface.php new file mode 100755 index 00000000000..5d5109b70d4 --- /dev/null +++ b/lib/cron-expression/CronExpression_FieldInterface.php @@ -0,0 +1,39 @@ + + */ +interface CronExpression_FieldInterface +{ + /** + * Check if the respective value of a DateTime field satisfies a CRON exp + * + * @param DateTime $date DateTime object to check + * @param string $value CRON expression to test against + * + * @return bool Returns TRUE if satisfied, FALSE otherwise + */ + public function isSatisfiedBy(DateTime $date, $value); + + /** + * When a CRON expression is not satisfied, this method is used to increment + * or decrement a DateTime object by the unit of the cron field + * + * @param DateTime $date DateTime object to change + * @param bool $invert (optional) Set to TRUE to decrement + * + * @return CronExpression_FieldInterface + */ + public function increment(DateTime $date, $invert = false); + + /** + * Validates a CRON expression for a given field + * + * @param string $value CRON expression value to validate + * + * @return bool Returns TRUE if valid, FALSE otherwise + */ + public function validate($value); +} diff --git a/lib/cron-expression/CronExpression_HoursField.php b/lib/cron-expression/CronExpression_HoursField.php new file mode 100755 index 00000000000..088ca73c719 --- /dev/null +++ b/lib/cron-expression/CronExpression_HoursField.php @@ -0,0 +1,47 @@ + + */ +class CronExpression_HoursField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + return $this->isSatisfied($date->format('H'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + // Change timezone to UTC temporarily. This will + // allow us to go back or forwards and hour even + // if DST will be changed between the hours. + $timezone = $date->getTimezone(); + $date->setTimezone(new DateTimeZone('UTC')); + if ($invert) { + $date->modify('-1 hour'); + $date->setTime($date->format('H'), 59); + } else { + $date->modify('+1 hour'); + $date->setTime($date->format('H'), 0); + } + $date->setTimezone($timezone); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9]+/', $value); + } +} diff --git a/lib/cron-expression/CronExpression_MinutesField.php b/lib/cron-expression/CronExpression_MinutesField.php new file mode 100755 index 00000000000..436acf2f560 --- /dev/null +++ b/lib/cron-expression/CronExpression_MinutesField.php @@ -0,0 +1,39 @@ + + */ +class CronExpression_MinutesField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + return $this->isSatisfied($date->format('i'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('-1 minute'); + } else { + $date->modify('+1 minute'); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9]+/', $value); + } +} diff --git a/lib/cron-expression/CronExpression_MonthField.php b/lib/cron-expression/CronExpression_MonthField.php new file mode 100755 index 00000000000..d3deb129f46 --- /dev/null +++ b/lib/cron-expression/CronExpression_MonthField.php @@ -0,0 +1,55 @@ + + */ +class CronExpression_MonthField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + // Convert text month values to integers + $value = str_ireplace( + array( + 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', + 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC' + ), + range(1, 12), + $value + ); + + return $this->isSatisfied($date->format('m'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + // $date->modify('last day of previous month'); // remove for php 5.2 compat + $date->modify('previous month'); + $date->modify($date->format('Y-m-t')); + $date->setTime(23, 59); + } else { + //$date->modify('first day of next month'); // remove for php 5.2 compat + $date->modify('next month'); + $date->modify($date->format('Y-m-01')); + $date->setTime(0, 0); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9A-Z]+/', $value); + } +} diff --git a/lib/cron-expression/CronExpression_YearField.php b/lib/cron-expression/CronExpression_YearField.php new file mode 100755 index 00000000000..f11562e4513 --- /dev/null +++ b/lib/cron-expression/CronExpression_YearField.php @@ -0,0 +1,43 @@ + + */ +class CronExpression_YearField extends CronExpression_AbstractField +{ + /** + * {@inheritdoc} + */ + public function isSatisfiedBy(DateTime $date, $value) + { + return $this->isSatisfied($date->format('Y'), $value); + } + + /** + * {@inheritdoc} + */ + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('-1 year'); + $date->setDate($date->format('Y'), 12, 31); + $date->setTime(23, 59, 0); + } else { + $date->modify('+1 year'); + $date->setDate($date->format('Y'), 1, 1); + $date->setTime(0, 0, 0); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value) + { + return (bool) preg_match('/[\*,\/\-0-9]+/', $value); + } +} diff --git a/lib/cron-expression/LICENSE b/lib/cron-expression/LICENSE new file mode 100755 index 00000000000..c6d88ac6c2f --- /dev/null +++ b/lib/cron-expression/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Michael Dowling and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/lib/cron-expression/README.md b/lib/cron-expression/README.md new file mode 100755 index 00000000000..d4d9d5add19 --- /dev/null +++ b/lib/cron-expression/README.md @@ -0,0 +1,92 @@ +PHP Cron Expression Parser +========================== + +[![Latest Stable Version](https://poser.pugx.org/mtdowling/cron-expression/v/stable.png)](https://packagist.org/packages/mtdowling/cron-expression) [![Total Downloads](https://poser.pugx.org/mtdowling/cron-expression/downloads.png)](https://packagist.org/packages/mtdowling/cron-expression) [![Build Status](https://secure.travis-ci.org/mtdowling/cron-expression.png)](http://travis-ci.org/mtdowling/cron-expression) + +The PHP cron expression parser can parse a CRON expression, determine if it is +due to run, calculate the next run date of the expression, and calculate the previous +run date of the expression. You can calculate dates far into the future or past by +skipping n number of matching dates. + +The parser can handle increments of ranges (e.g. */12, 2-59/3), intervals (e.g. 0-9), +lists (e.g. 1,2,3), W to find the nearest weekday for a given day of the month, L to +find the last day of the month, L to find the last given weekday of a month, and hash +(#) to find the nth weekday of a given month. + +Credits +========== + +Created by Micheal Dowling. Ported to PHP 5.2 by Flightless, Inc. +Based on version 1.0.3: https://github.com/mtdowling/cron-expression/tree/v1.0.3 + +Installing +========== + +Add the following to your project's composer.json: + +```javascript +{ + "require": { + "mtdowling/cron-expression": "1.0.*" + } +} +``` + +Usage +===== +```php +isDue(); +echo $cron->getNextRunDate()->format('Y-m-d H:i:s'); +echo $cron->getPreviousRunDate()->format('Y-m-d H:i:s'); + +// Works with complex expressions +$cron = Cron\CronExpression::factory('3-59/15 2,6-12 */15 1 2-5'); +echo $cron->getNextRunDate()->format('Y-m-d H:i:s'); + +// Calculate a run date two iterations into the future +$cron = Cron\CronExpression::factory('@daily'); +echo $cron->getNextRunDate(null, 2)->format('Y-m-d H:i:s'); + +// Calculate a run date relative to a specific time +$cron = Cron\CronExpression::factory('@monthly'); +echo $cron->getNextRunDate('2010-01-12 00:00:00')->format('Y-m-d H:i:s'); +``` + +CRON Expressions +================ + +A CRON expression is a string representing the schedule for a particular command to execute. The parts of a CRON schedule are as follows: + + * * * * * * + - - - - - - + | | | | | | + | | | | | + year [optional] + | | | | +----- day of week (0 - 7) (Sunday=0 or 7) + | | | +---------- month (1 - 12) + | | +--------------- day of month (1 - 31) + | +-------------------- hour (0 - 23) + +------------------------- min (0 - 59) + +Requirements +============ + +- PHP 5.3+ +- PHPUnit is required to run the unit tests +- Composer is required to run the unit tests + +CHANGELOG +========= + +1.0.3 (2013-11-23) +------------------ + +* Only set default timezone if the given $currentTime is not a DateTime instance (#34) +* Fixes issue #28 where PHP increments of ranges were failing due to PHP casting hyphens to 0 +* Now supports expressions with any number of extra spaces, tabs, or newlines +* Using static instead of self in `CronExpression::factory` diff --git a/license.txt b/license.txt new file mode 100644 index 00000000000..20d40b6bcec --- /dev/null +++ b/license.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/tests/ActionScheduler_UnitTestCase.php b/tests/ActionScheduler_UnitTestCase.php new file mode 100644 index 00000000000..f51e6ccdc7b --- /dev/null +++ b/tests/ActionScheduler_UnitTestCase.php @@ -0,0 +1,44 @@ +createResult(); + } + + if ( 'UTC' != ( $this->existing_timezone = date_default_timezone_get() ) ) { + date_default_timezone_set( 'UTC' ); + $result->run( $this ); + } + + date_default_timezone_set( 'Pacific/Fiji' ); // UTC+12 + $result->run( $this ); + + date_default_timezone_set( 'Pacific/Tahiti' ); // UTC-10: it's a magical place + $result->run( $this ); + + date_default_timezone_set( $this->existing_timezone ); + + return $result; + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 00000000000..f7096db473c --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,31 @@ + + + + + + ./phpunit + + + + + ignore + + + + + .. + + . + + + + \ No newline at end of file diff --git a/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php b/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php new file mode 100644 index 00000000000..03901155715 --- /dev/null +++ b/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php @@ -0,0 +1,44 @@ +createResult(); + } + + if ( 'UTC' != ( $this->existing_timezone = date_default_timezone_get() ) ) { + date_default_timezone_set( 'UTC' ); + $result->run( $this ); + } + + date_default_timezone_set( 'Pacific/Fiji' ); // UTC+12 + $result->run( $this ); + + date_default_timezone_set( 'Pacific/Tahiti' ); // UTC-10: it's a magical place + $result->run( $this ); + + date_default_timezone_set( $this->existing_timezone ); + + return $result; + } +} diff --git a/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php b/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php new file mode 100644 index 00000000000..03d8195eb6d --- /dev/null +++ b/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php @@ -0,0 +1,100 @@ +getTimezone(); + $this->assertInstanceOf( 'DateTimeZone', $timezone ); + $this->assertEquals( $timezone_string, $timezone->getName() ); + + remove_filter( 'option_timezone_string', $timezone_filter ); + } + + public function local_timezone_provider() { + return array( + array( 'America/New_York' ), + array( 'Australia/Melbourne' ), + array( 'UTC' ), + ); + } + + /** + * Ensure that most GMT offsets don't return UTC as the timezone. + * + * @dataProvider local_timezone_offsets_provider + * + * @param $gmt_offset + */ + public function test_local_timezone_offsets( $gmt_offset ) { + $gmt_filter = function ( $gmt ) use ( $gmt_offset ) { + return $gmt_offset; + }; + + $date = new ActionScheduler_DateTime(); + + add_filter( 'option_gmt_offset', $gmt_filter ); + ActionScheduler_TimezoneHelper::set_local_timezone( $date ); + remove_filter( 'option_gmt_offset', $gmt_filter ); + + $offset_in_seconds = $gmt_offset * HOUR_IN_SECONDS; + + $this->assertEquals( $offset_in_seconds, $date->getOffset() ); + $this->assertEquals( $offset_in_seconds, $date->getOffsetTimestamp() - $date->getTimestamp() ); + } + + public function local_timezone_offsets_provider() { + return array( + array( '-11' ), + array( '-10.5' ), + array( '-10' ), + array( '-9' ), + array( '-8' ), + array( '-7' ), + array( '-6' ), + array( '-5' ), + array( '-4.5' ), + array( '-4' ), + array( '-3.5' ), + array( '-3' ), + array( '-2' ), + array( '-1' ), + array( '1' ), + array( '1.5' ), + array( '2' ), + array( '3' ), + array( '4' ), + array( '5' ), + array( '5.5' ), + array( '5.75' ), + array( '6' ), + array( '7' ), + array( '8' ), + array( '8.5' ), + array( '9' ), + array( '9.5' ), + array( '10' ), + array( '10.5' ), + array( '11' ), + array( '11.5' ), + array( '12' ), + array( '13' ), + ); + } +} diff --git a/tests/phpunit/jobs/ActionScheduler_Action_Test.php b/tests/phpunit/jobs/ActionScheduler_Action_Test.php new file mode 100644 index 00000000000..629f97f7c1d --- /dev/null +++ b/tests/phpunit/jobs/ActionScheduler_Action_Test.php @@ -0,0 +1,55 @@ +assertEquals( $schedule, $action->get_schedule() ); + } + + public function test_null_schedule() { + $action = new ActionScheduler_Action('my_hook'); + $this->assertInstanceOf( 'ActionScheduler_NullSchedule', $action->get_schedule() ); + } + + public function test_set_hook() { + $action = new ActionScheduler_Action('my_hook'); + $this->assertEquals( 'my_hook', $action->get_hook() ); + } + + public function test_args() { + $action = new ActionScheduler_Action('my_hook'); + $this->assertEmpty($action->get_args()); + + $action = new ActionScheduler_Action('my_hook', array(5,10,15)); + $this->assertEqualSets(array(5,10,15), $action->get_args()); + } + + public function test_set_group() { + $action = new ActionScheduler_Action('my_hook', array(), NULL, 'my_group'); + $this->assertEquals('my_group', $action->get_group()); + } + + public function test_execute() { + $mock = new MockAction(); + + $random = md5(rand()); + add_action( $random, array( $mock, 'action' ) ); + + $action = new ActionScheduler_Action( $random, array($random) ); + $action->execute(); + + remove_action( $random, array( $mock, 'action' ) ); + + $this->assertEquals( 1, $mock->get_call_count() ); + $events = $mock->get_events(); + $event = reset($events); + $this->assertEquals( $random, reset($event['args']) ); + } +} + \ No newline at end of file diff --git a/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php b/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php new file mode 100644 index 00000000000..d144e88e21c --- /dev/null +++ b/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php @@ -0,0 +1,16 @@ +assertEmpty($action->get_hook()); + $this->assertEmpty($action->get_args()); + $this->assertNull($action->get_schedule()->next()); + } +} + \ No newline at end of file diff --git a/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php b/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php new file mode 100644 index 00000000000..4cbd8485065 --- /dev/null +++ b/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php @@ -0,0 +1,375 @@ +save_action($action); + + $this->assertNotEmpty($action_id); + } + + public function test_create_action_with_scheduled_date() { + $time = as_get_datetime_object( strtotime( '-1 week' ) ); + $action = new ActionScheduler_Action( 'my_hook', array(), new ActionScheduler_SimpleSchedule( $time ) ); + $store = new ActionScheduler_wpPostStore(); + + $action_id = $store->save_action( $action, $time ); + $action_date = $store->get_date( $action_id ); + + $this->assertEquals( $time->getTimestamp(), $action_date->getTimestamp() ); + } + + public function test_retrieve_action() { + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array(), $schedule, 'my_group'); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $retrieved = $store->fetch_action($action_id); + $this->assertEquals($action->get_hook(), $retrieved->get_hook()); + $this->assertEqualSets($action->get_args(), $retrieved->get_args()); + $this->assertEquals($action->get_schedule()->next()->getTimestamp(), $retrieved->get_schedule()->next()->getTimestamp()); + $this->assertEquals($action->get_group(), $retrieved->get_group()); + } + + /** + * @expectedException ActionScheduler_InvalidActionException + * @dataProvider provide_bad_args + * + * @param string $content + */ + public function test_action_bad_args( $content ) { + $store = new ActionScheduler_wpPostStore(); + $post_id = wp_insert_post( array( + 'post_type' => ActionScheduler_wpPostStore::POST_TYPE, + 'post_status' => ActionScheduler_Store::STATUS_PENDING, + 'post_content' => $content, + ) ); + + $store->fetch_action( $post_id ); + } + + public function provide_bad_args() { + return array( + array( '{"bad_json":true}}' ), + ); + } + + public function test_cancel_action() { + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array(), $schedule, 'my_group'); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + $store->cancel_action( $action_id ); + + $fetched = $store->fetch_action( $action_id ); + $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); + } + + public function test_claim_actions() { + $created_actions = array(); + $store = new ActionScheduler_wpPostStore(); + for ( $i = 3 ; $i > -3 ; $i-- ) { + $time = as_get_datetime_object($i.' hours'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); + $created_actions[] = $store->save_action($action); + } + + $claim = $store->stake_claim(); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + + $this->assertCount( 3, $claim->get_actions() ); + $this->assertEqualSets( array_slice( $created_actions, 3, 3 ), $claim->get_actions() ); + } + + public function test_claim_actions_order() { + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + $created_actions = array( + $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), + $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), + ); + + $claim = $store->stake_claim(); + $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); + + // Verify uniqueness of action IDs. + $this->assertEquals( 2, count( array_unique( $created_actions ) ) ); + + // Verify the count and order of the actions. + $claimed_actions = $claim->get_actions(); + $this->assertCount( 2, $claimed_actions ); + $this->assertEquals( $created_actions, $claimed_actions ); + + // Verify the reversed order doesn't pass. + $reversed_actions = array_reverse( $created_actions ); + $this->assertNotEquals( $reversed_actions, $claimed_actions ); + } + + public function test_duplicate_claim() { + $created_actions = array(); + $store = new ActionScheduler_wpPostStore(); + for ( $i = 0 ; $i > -3 ; $i-- ) { + $time = as_get_datetime_object($i.' hours'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); + $created_actions[] = $store->save_action($action); + } + + $claim1 = $store->stake_claim(); + $claim2 = $store->stake_claim(); + $this->assertCount( 3, $claim1->get_actions() ); + $this->assertCount( 0, $claim2->get_actions() ); + } + + public function test_release_claim() { + $created_actions = array(); + $store = new ActionScheduler_wpPostStore(); + for ( $i = 0 ; $i > -3 ; $i-- ) { + $time = as_get_datetime_object($i.' hours'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); + $created_actions[] = $store->save_action($action); + } + + $claim1 = $store->stake_claim(); + + $store->release_claim( $claim1 ); + + $claim2 = $store->stake_claim(); + $this->assertCount( 3, $claim2->get_actions() ); + } + + public function test_search() { + $created_actions = array(); + $store = new ActionScheduler_wpPostStore(); + for ( $i = -3 ; $i <= 3 ; $i++ ) { + $time = as_get_datetime_object($i.' hours'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); + $created_actions[] = $store->save_action($action); + } + + $next_no_args = $store->find_action( 'my_hook' ); + $this->assertEquals( $created_actions[0], $next_no_args ); + + $next_with_args = $store->find_action( 'my_hook', array( 'args' => array( 1 ) ) ); + $this->assertEquals( $created_actions[4], $next_with_args ); + + $non_existent = $store->find_action( 'my_hook', array( 'args' => array( 17 ) ) ); + $this->assertNull( $non_existent ); + } + + public function test_search_by_group() { + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('tomorrow')); + $abc = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'abc')); + $def = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'def')); + $ghi = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'ghi')); + + $this->assertEquals( $abc, $store->find_action('my_hook', array('group' => 'abc'))); + $this->assertEquals( $def, $store->find_action('my_hook', array('group' => 'def'))); + $this->assertEquals( $ghi, $store->find_action('my_hook', array('group' => 'ghi'))); + } + + public function test_post_author() { + $current_user = get_current_user_id(); + + $time = as_get_datetime_object(); + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $post = get_post($action_id); + $this->assertEquals(0, $post->post_author); + + $new_user = $this->factory->user->create_object(array( + 'user_login' => __FUNCTION__, + 'user_pass' => md5(rand()), + )); + wp_set_current_user( $new_user ); + + + $schedule = new ActionScheduler_SimpleSchedule($time); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $action_id = $store->save_action($action); + $post = get_post($action_id); + $this->assertEquals(0, $post->post_author); + + wp_set_current_user($current_user); + } + + /** + * @issue 13 + */ + public function test_post_status_for_recurring_action() { + $time = as_get_datetime_object('10 minutes'); + $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $action = $store->fetch_action($action_id); + $action->execute(); + $store->mark_complete( $action_id ); + + $next = $action->get_schedule()->next( as_get_datetime_object() ); + $new_action_id = $store->save_action( $action, $next ); + + $this->assertEquals('publish', get_post_status($action_id)); + $this->assertEquals('pending', get_post_status($new_action_id)); + } + + public function test_get_run_date() { + $time = as_get_datetime_object('-10 minutes'); + $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $this->assertEquals( $store->get_date($action_id)->getTimestamp(), $time->getTimestamp() ); + + $action = $store->fetch_action($action_id); + $action->execute(); + $now = as_get_datetime_object(); + $store->mark_complete( $action_id ); + + $this->assertEquals( $store->get_date($action_id)->getTimestamp(), $now->getTimestamp() ); + + $next = $action->get_schedule()->next( $now ); + $new_action_id = $store->save_action( $action, $next ); + + $this->assertEquals( (int)($now->getTimestamp()) + HOUR_IN_SECONDS, $store->get_date($new_action_id)->getTimestamp() ); + } + + public function test_get_status() { + $time = as_get_datetime_object('-10 minutes'); + $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); + $action = new ActionScheduler_Action('my_hook', array(), $schedule); + $store = new ActionScheduler_wpPostStore(); + $action_id = $store->save_action($action); + + $this->assertEquals( ActionScheduler_Store::STATUS_PENDING, $store->get_status( $action_id ) ); + + $store->mark_complete( $action_id ); + $this->assertEquals( ActionScheduler_Store::STATUS_COMPLETE, $store->get_status( $action_id ) ); + + $store->mark_failure( $action_id ); + $this->assertEquals( ActionScheduler_Store::STATUS_FAILED, $store->get_status( $action_id ) ); + } + + public function test_claim_actions_by_hooks() { + $hook1 = __FUNCTION__ . '_hook_1'; + $hook2 = __FUNCTION__ . '_hook_2'; + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + + $action1 = $store->save_action( new ActionScheduler_Action( $hook1, array(), $schedule ) ); + $action2 = $store->save_action( new ActionScheduler_Action( $hook2, array(), $schedule ) ); + + // Claiming no hooks should include all actions. + $claim = $store->stake_claim( 10 ); + $this->assertEquals( 2, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a hook should claim only actions with that hook + $claim = $store->stake_claim( 10, null, array( $hook1 ) ); + $this->assertEquals( 1, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming two hooks should claim actions with either of those hooks + $claim = $store->stake_claim( 10, null, array( $hook1, $hook2 ) ); + $this->assertEquals( 2, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming two hooks should claim actions with either of those hooks + $claim = $store->stake_claim( 10, null, array( __METHOD__ . '_hook_3' ) ); + $this->assertEquals( 0, count( $claim->get_actions() ) ); + $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); + $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + } + + /** + * @issue 121 + */ + public function test_claim_actions_by_group() { + $group1 = md5( rand() ); + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + + $action1 = $store->save_action( new ActionScheduler_Action( __METHOD__, array(), $schedule, $group1 ) ); + $action2 = $store->save_action( new ActionScheduler_Action( __METHOD__, array(), $schedule ) ); + + // Claiming no group should include all actions. + $claim = $store->stake_claim( 10 ); + $this->assertEquals( 2, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a group should claim only actions in that group. + $claim = $store->stake_claim( 10, null, array(), $group1 ); + $this->assertEquals( 1, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $store->release_claim( $claim ); + } + + public function test_claim_actions_by_hook_and_group() { + $hook1 = __FUNCTION__ . '_hook_1'; + $hook2 = __FUNCTION__ . '_hook_2'; + $hook3 = __FUNCTION__ . '_hook_3'; + $group1 = 'group_' . md5( rand() ); + $group2 = 'group_' . md5( rand() ); + $store = new ActionScheduler_wpPostStore(); + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); + + $action1 = $store->save_action( new ActionScheduler_Action( $hook1, array(), $schedule, $group1 ) ); + $action2 = $store->save_action( new ActionScheduler_Action( $hook2, array(), $schedule ) ); + $action3 = $store->save_action( new ActionScheduler_Action( $hook3, array(), $schedule, $group2 ) ); + + // Claiming no hooks or group should include all actions. + $claim = $store->stake_claim( 10 ); + $this->assertEquals( 3, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a group and hook should claim only actions in that group. + $claim = $store->stake_claim( 10, null, array( $hook1 ), $group1 ); + $this->assertEquals( 1, count( $claim->get_actions() ) ); + $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a group and hook should claim only actions with that hook in that group. + $claim = $store->stake_claim( 10, null, array( $hook2 ), $group1 ); + $this->assertEquals( 0, count( $claim->get_actions() ) ); + $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); + $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + + // Claiming a group and hook should claim only actions with that hook in that group. + $claim = $store->stake_claim( 10, null, array( $hook1, $hook2 ), $group2 ); + $this->assertEquals( 0, count( $claim->get_actions() ) ); + $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); + $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); + $store->release_claim( $claim ); + } +} diff --git a/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php b/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php new file mode 100644 index 00000000000..154b822a896 --- /dev/null +++ b/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php @@ -0,0 +1,185 @@ +assertInstanceOf( 'ActionScheduler_Logger', $logger ); + $this->assertInstanceOf( 'ActionScheduler_wpCommentLogger', $logger ); + } + + public function test_add_log_entry() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $message = 'Logging that something happened'; + $log_id = $logger->log( $action_id, $message ); + $entry = $logger->get_entry( $log_id ); + + $this->assertEquals( $action_id, $entry->get_action_id() ); + $this->assertEquals( $message, $entry->get_message() ); + } + + public function test_add_log_datetime() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $message = 'Logging that something happened'; + $date = new DateTime( 'now', new DateTimeZone( 'UTC' ) ); + $log_id = $logger->log( $action_id, $message, $date ); + $entry = $logger->get_entry( $log_id ); + + $this->assertEquals( $action_id, $entry->get_action_id() ); + $this->assertEquals( $message, $entry->get_message() ); + + $date = new ActionScheduler_DateTime( 'now', new DateTimeZone( 'UTC' ) ); + $log_id = $logger->log( $action_id, $message, $date ); + $entry = $logger->get_entry( $log_id ); + + $this->assertEquals( $action_id, $entry->get_action_id() ); + $this->assertEquals( $message, $entry->get_message() ); + } + + public function test_null_log_entry() { + $logger = ActionScheduler::logger(); + $entry = $logger->get_entry( 1 ); + $this->assertEquals( '', $entry->get_action_id() ); + $this->assertEquals( '', $entry->get_message() ); + } + + public function test_erroneous_entry_id() { + $comment = wp_insert_comment(array( + 'comment_post_ID' => 1, + 'comment_author' => 'test', + 'comment_content' => 'this is not a log entry', + )); + $logger = ActionScheduler::logger(); + $entry = $logger->get_entry( $comment ); + $this->assertEquals( '', $entry->get_action_id() ); + $this->assertEquals( '', $entry->get_message() ); + } + + public function test_storage_comments() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $logs = $logger->get_logs( $action_id ); + $expected = new ActionScheduler_LogEntry( $action_id, 'action created' ); + $this->assertTrue( in_array( $this->log_entry_to_array( $expected ) , $this->log_entry_to_array( $logs ) ) ); + } + + protected function log_entry_to_array( $logs ) { + if ( $logs instanceof ActionScheduler_LogEntry ) { + return array( 'action_id' => $logs->get_action_id(), 'message' => $logs->get_message() ); + } + + foreach ( $logs as $id => $log) { + $logs[ $id ] = array( 'action_id' => $log->get_action_id(), 'message' => $log->get_message() ); + } + + return $logs; + } + + public function test_execution_comments() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $started = new ActionScheduler_LogEntry( $action_id, 'action started' ); + $finished = new ActionScheduler_LogEntry( $action_id, 'action complete' ); + + $runner = new ActionScheduler_QueueRunner(); + $runner->run(); + + $logs = $logger->get_logs( $action_id ); + $this->assertTrue( in_array( $this->log_entry_to_array( $started ), $this->log_entry_to_array( $logs ) ) ); + $this->assertTrue( in_array( $this->log_entry_to_array( $finished ), $this->log_entry_to_array( $logs ) ) ); + } + + public function test_failed_execution_comments() { + $hook = md5(rand()); + add_action( $hook, array( $this, '_a_hook_callback_that_throws_an_exception' ) ); + $action_id = as_schedule_single_action( time(), $hook ); + $logger = ActionScheduler::logger(); + $started = new ActionScheduler_LogEntry( $action_id, 'action started' ); + $finished = new ActionScheduler_LogEntry( $action_id, 'action complete' ); + $failed = new ActionScheduler_LogEntry( $action_id, 'action failed: Execution failed' ); + + $runner = new ActionScheduler_QueueRunner(); + $runner->run(); + + $logs = $logger->get_logs( $action_id ); + $this->assertTrue( in_array( $this->log_entry_to_array( $started ), $this->log_entry_to_array( $logs ) ) ); + $this->assertFalse( in_array( $this->log_entry_to_array( $finished ), $this->log_entry_to_array( $logs ) ) ); + $this->assertTrue( in_array( $this->log_entry_to_array( $failed ), $this->log_entry_to_array( $logs ) ) ); + } + + public function test_fatal_error_comments() { + $hook = md5(rand()); + $action_id = as_schedule_single_action( time(), $hook ); + $logger = ActionScheduler::logger(); + do_action( 'action_scheduler_unexpected_shutdown', $action_id, array( + 'type' => E_ERROR, + 'message' => 'Test error', + 'file' => __FILE__, + 'line' => __LINE__, + )); + + $logs = $logger->get_logs( $action_id ); + $found_log = FALSE; + foreach ( $logs as $l ) { + if ( strpos( $l->get_message(), 'unexpected shutdown' ) === 0 ) { + $found_log = TRUE; + } + } + $this->assertTrue( $found_log, 'Unexpected shutdown log not found' ); + } + + public function test_canceled_action_comments() { + $action_id = as_schedule_single_action( time(), 'a hook' ); + as_unschedule_action( 'a hook' ); + $logger = ActionScheduler::logger(); + $logs = $logger->get_logs( $action_id ); + $expected = new ActionScheduler_LogEntry( $action_id, 'action canceled' ); + $this->assertTrue( in_array( $this->log_entry_to_array( $expected ), $this->log_entry_to_array( $logs ) ) ); + } + + public function _a_hook_callback_that_throws_an_exception() { + throw new RuntimeException('Execution failed'); + } + + public function test_filtering_of_get_comments() { + $post_id = $this->factory->post->create_object(array( + 'post_title' => __FUNCTION__, + )); + $comment_id = $this->factory->comment->create_object(array( + 'comment_post_ID' => $post_id, + 'comment_author' => __CLASS__, + 'comment_content' => __FUNCTION__, + )); + + // Verify that we're getting the expected comment before we add logging comments + $comments = get_comments(); + $this->assertCount( 1, $comments ); + $this->assertEquals( $comment_id, $comments[0]->comment_ID ); + + + $action_id = as_schedule_single_action( time(), 'a hook' ); + $logger = ActionScheduler::logger(); + $message = 'Logging that something happened'; + $log_id = $logger->log( $action_id, $message ); + + + // Verify that logging comments are excluded from general comment queries + $comments = get_comments(); + $this->assertCount( 1, $comments ); + $this->assertEquals( $comment_id, $comments[0]->comment_ID ); + + // Verify that logging comments are returned when asking for them specifically + $comments = get_comments(array( + 'type' => ActionScheduler_wpCommentLogger::TYPE, + )); + // Expecting two: one when the action is created, another when we added our custom log + $this->assertCount( 2, $comments ); + $this->assertContains( $log_id, wp_list_pluck($comments, 'comment_ID')); + } +} + diff --git a/tests/phpunit/procedural_api/procedural_api_Test.php b/tests/phpunit/procedural_api/procedural_api_Test.php new file mode 100644 index 00000000000..543add798b1 --- /dev/null +++ b/tests/phpunit/procedural_api/procedural_api_Test.php @@ -0,0 +1,222 @@ +fetch_action($action_id); + $this->assertEquals( $time, $action->get_schedule()->next()->getTimestamp() ); + $this->assertEquals( $hook, $action->get_hook() ); + } + + public function test_recurring_action() { + $time = time(); + $hook = md5(rand()); + $action_id = as_schedule_recurring_action( $time, HOUR_IN_SECONDS, $hook ); + + $store = ActionScheduler::store(); + $action = $store->fetch_action($action_id); + $this->assertEquals( $time, $action->get_schedule()->next()->getTimestamp() ); + $this->assertEquals( $time + HOUR_IN_SECONDS + 2, $action->get_schedule()->next(as_get_datetime_object($time + 2))->getTimestamp()); + $this->assertEquals( $hook, $action->get_hook() ); + } + + public function test_cron_schedule() { + $time = as_get_datetime_object('2014-01-01'); + $hook = md5(rand()); + $action_id = as_schedule_cron_action( $time->getTimestamp(), '0 0 10 10 *', $hook ); + + $store = ActionScheduler::store(); + $action = $store->fetch_action($action_id); + $expected_date = as_get_datetime_object('2014-10-10'); + $this->assertEquals( $expected_date->getTimestamp(), $action->get_schedule()->next()->getTimestamp() ); + $this->assertEquals( $hook, $action->get_hook() ); + } + + public function test_get_next() { + $time = as_get_datetime_object('tomorrow'); + $hook = md5(rand()); + as_schedule_recurring_action( $time->getTimestamp(), HOUR_IN_SECONDS, $hook ); + + $next = as_next_scheduled_action( $hook ); + + $this->assertEquals( $time->getTimestamp(), $next ); + } + + public function provider_time_hook_args_group() { + $time = time() + 60 * 2; + $hook = md5( rand() ); + $args = array( rand(), rand() ); + $group = 'test_group'; + + return array( + + // Test with no args or group + array( + 'time' => $time, + 'hook' => $hook, + 'args' => array(), + 'group' => '', + ), + + // Test with args but no group + array( + 'time' => $time, + 'hook' => $hook, + 'args' => $args, + 'group' => '', + ), + + // Test with group but no args + array( + 'time' => $time, + 'hook' => $hook, + 'args' => array(), + 'group' => $group, + ), + + // Test with args & group + array( + 'time' => $time, + 'hook' => $hook, + 'args' => $args, + 'group' => $group, + ), + ); + } + + /** + * @dataProvider provider_time_hook_args_group + */ + public function test_unschedule( $time, $hook, $args, $group ) { + + $action_id_unscheduled = as_schedule_single_action( $time, $hook, $args, $group ); + $action_scheduled_time = $time + 1; + $action_id_scheduled = as_schedule_single_action( $action_scheduled_time, $hook, $args, $group ); + + as_unschedule_action( $hook, $args, $group ); + + $next = as_next_scheduled_action( $hook, $args, $group ); + $this->assertEquals( $action_scheduled_time, $next ); + + $store = ActionScheduler::store(); + $unscheduled_action = $store->fetch_action( $action_id_unscheduled ); + + // Make sure the next scheduled action is unscheduled + $this->assertEquals( $hook, $unscheduled_action->get_hook() ); + $this->assertNull( $unscheduled_action->get_schedule()->next() ); + + // Make sure other scheduled actions are not unscheduled + $scheduled_action = $store->fetch_action( $action_id_scheduled ); + + $this->assertEquals( $hook, $scheduled_action->get_hook() ); + $this->assertEquals( $action_scheduled_time, $scheduled_action->get_schedule()->next()->getTimestamp() ); + } + + /** + * @dataProvider provider_time_hook_args_group + */ + public function test_unschedule_all( $time, $hook, $args, $group ) { + + $hook = md5( $hook ); + $action_ids = array(); + + for ( $i = 0; $i < 3; $i++ ) { + $action_ids[] = as_schedule_single_action( $time, $hook, $args, $group ); + } + + as_unschedule_all_actions( $hook, $args, $group ); + + $next = as_next_scheduled_action( $hook ); + $this->assertFalse($next); + + $store = ActionScheduler::store(); + + foreach ( $action_ids as $action_id ) { + $action = $store->fetch_action($action_id); + + $this->assertNull($action->get_schedule()->next()); + $this->assertEquals($hook, $action->get_hook() ); + } + } + + public function test_as_get_datetime_object_default() { + + $utc_now = new ActionScheduler_DateTime(null, new DateTimeZone('UTC')); + $as_now = as_get_datetime_object(); + + // Don't want to use 'U' as timestamps will always be in UTC + $this->assertEquals($utc_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); + } + + public function test_as_get_datetime_object_relative() { + + $utc_tomorrow = new ActionScheduler_DateTime('tomorrow', new DateTimeZone('UTC')); + $as_tomorrow = as_get_datetime_object('tomorrow'); + + $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); + + $utc_tomorrow = new ActionScheduler_DateTime('yesterday', new DateTimeZone('UTC')); + $as_tomorrow = as_get_datetime_object('yesterday'); + + $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); + } + + public function test_as_get_datetime_object_fixed() { + + $utc_tomorrow = new ActionScheduler_DateTime('29 February 2016', new DateTimeZone('UTC')); + $as_tomorrow = as_get_datetime_object('29 February 2016'); + + $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); + + $utc_tomorrow = new ActionScheduler_DateTime('1st January 2024', new DateTimeZone('UTC')); + $as_tomorrow = as_get_datetime_object('1st January 2024'); + + $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); + } + + public function test_as_get_datetime_object_timezone() { + + $timezone_au = 'Australia/Brisbane'; + $timezone_default = date_default_timezone_get(); + + date_default_timezone_set( $timezone_au ); + + $au_now = new ActionScheduler_DateTime(null); + $as_now = as_get_datetime_object(); + + // Make sure they're for the same time + $this->assertEquals($au_now->getTimestamp(),$as_now->getTimestamp()); + + // But not in the same timezone, as $as_now should be using UTC + $this->assertNotEquals($au_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); + + $au_now = new ActionScheduler_DateTime(null); + $as_au_now = as_get_datetime_object(); + + $this->assertEquals($au_now->getTimestamp(),$as_now->getTimestamp()); + + // But not in the same timezone, as $as_now should be using UTC + $this->assertNotEquals($au_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); + + // Just in cases + date_default_timezone_set( $timezone_default ); + } + + public function test_as_get_datetime_object_type() { + $f = 'Y-m-d H:i:s'; + $now = as_get_datetime_object(); + $this->assertInstanceOf( 'ActionScheduler_DateTime', $now ); + + $dateTime = new DateTime( 'now', new DateTimeZone( 'UTC' ) ); + $asDateTime = as_get_datetime_object( $dateTime ); + $this->assertEquals( $dateTime->format( $f ), $asDateTime->format( $f ) ); + } +} diff --git a/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php b/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php new file mode 100644 index 00000000000..af839d9195a --- /dev/null +++ b/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php @@ -0,0 +1,100 @@ +hooks[$i] = md5(rand()); + $this->args[$i] = md5(rand()); + $this->groups[$i] = md5(rand()); + } + + for ( $i = 0 ; $i < 10 ; $i++ ) { + for ( $j = 0 ; $j < 10 ; $j++ ) { + $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( $j - 3 . 'days') ); + $group = $this->groups[ ( $i + $j ) % 10 ]; + $action = new ActionScheduler_Action( $this->hooks[$i], array($this->args[$j]), $schedule, $group ); + $store->save_action( $action ); + } + } + } + + public function test_date_queries() { + $actions = as_get_scheduled_actions(array( + 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), + 'per_page' => -1, + ), 'ids'); + $this->assertCount(30, $actions); + + $actions = as_get_scheduled_actions(array( + 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), + 'date_compare' => '>=', + 'per_page' => -1, + ), 'ids'); + $this->assertCount(70, $actions); + } + + public function test_hook_queries() { + $actions = as_get_scheduled_actions(array( + 'hook' => $this->hooks[2], + 'per_page' => -1, + ), 'ids'); + $this->assertCount(10, $actions); + + $actions = as_get_scheduled_actions(array( + 'hook' => $this->hooks[2], + 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), + 'per_page' => -1, + ), 'ids'); + $this->assertCount(3, $actions); + } + + public function test_args_queries() { + $actions = as_get_scheduled_actions(array( + 'args' => array($this->args[5]), + 'per_page' => -1, + ), 'ids'); + $this->assertCount(10, $actions); + + $actions = as_get_scheduled_actions(array( + 'args' => array($this->args[5]), + 'hook' => $this->hooks[3], + 'per_page' => -1, + ), 'ids'); + $this->assertCount(1, $actions); + + $actions = as_get_scheduled_actions(array( + 'args' => array($this->args[5]), + 'hook' => $this->hooks[3], + 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), + 'per_page' => -1, + ), 'ids'); + $this->assertCount(0, $actions); + } + + public function test_group_queries() { + $actions = as_get_scheduled_actions(array( + 'group' => $this->groups[1], + 'per_page' => -1, + ), 'ids'); + $this->assertCount(10, $actions); + + $actions = as_get_scheduled_actions(array( + 'group' => $this->groups[1], + 'hook' => $this->hooks[9], + 'per_page' => -1, + ), 'ids'); + $this->assertCount(1, $actions); + } +} + \ No newline at end of file diff --git a/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php b/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php new file mode 100644 index 00000000000..401a1d676e1 --- /dev/null +++ b/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php @@ -0,0 +1,151 @@ +save_action( $action ); + } + + $runner->run(); + + add_filter( 'action_scheduler_retention_period', '__return_zero' ); // delete any finished job + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->delete_old_actions(); + remove_filter( 'action_scheduler_retention_period', '__return_zero' ); + + foreach ( $created_actions as $action_id ) { + $action = $store->fetch_action($action_id); + $this->assertFalse($action->is_finished()); // it's a NullAction + } + } + + public function test_delete_canceled_actions() { + $store = ActionScheduler::store(); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + $created_actions = array(); + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $action_id = $store->save_action( $action ); + $store->cancel_action( $action_id ); + $created_actions[] = $action_id; + } + + // track the actions that are deleted + $mock_action = new MockAction(); + add_action( 'action_scheduler_deleted_action', array( $mock_action, 'action' ), 10, 1 ); + add_filter( 'action_scheduler_retention_period', '__return_zero' ); // delete any finished job + + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->delete_old_actions(); + + remove_filter( 'action_scheduler_retention_period', '__return_zero' ); + remove_action( 'action_scheduler_deleted_action', array( $mock_action, 'action' ), 10 ); + + $deleted_actions = array_map( 'reset', $mock_action->get_args() ); + $this->assertEqualSets( $created_actions, $deleted_actions ); + } + + public function test_do_not_delete_recent_actions() { + $store = ActionScheduler::store(); + $runner = new ActionScheduler_QueueRunner( $store ); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + $created_actions = array(); + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $created_actions[] = $store->save_action( $action ); + } + + $runner->run(); + + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->delete_old_actions(); + + foreach ( $created_actions as $action_id ) { + $action = $store->fetch_action($action_id); + $this->assertTrue($action->is_finished()); // It's a FinishedAction + } + } + + public function test_reset_unrun_actions() { + $store = ActionScheduler::store(); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + $created_actions = array(); + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $created_actions[] = $store->save_action( $action ); + } + + $store->stake_claim(10); + + // don't actually process the jobs, to simulate a request that timed out + + add_filter( 'action_scheduler_timeout_period', '__return_zero' ); // delete any finished job + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->reset_timeouts(); + + remove_filter( 'action_scheduler_timeout_period', '__return_zero' ); + + $claim = $store->stake_claim(10); + $this->assertEqualSets($created_actions, $claim->get_actions()); + } + + public function test_do_not_reset_failed_action() { + $store = ActionScheduler::store(); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + $created_actions = array(); + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $created_actions[] = $store->save_action( $action ); + } + + $claim = $store->stake_claim(10); + foreach ( $claim->get_actions() as $action_id ) { + // simulate the first action interrupted by an uncatchable fatal error + $store->log_execution( $action_id ); + break; + } + + add_filter( 'action_scheduler_timeout_period', '__return_zero' ); // delete any finished job + $cleaner = new ActionScheduler_QueueCleaner( $store ); + $cleaner->reset_timeouts(); + remove_filter( 'action_scheduler_timeout_period', '__return_zero' ); + + $new_claim = $store->stake_claim(10); + $this->assertCount( 4, $new_claim->get_actions() ); + + add_filter( 'action_scheduler_failure_period', '__return_zero' ); + $cleaner->mark_failures(); + remove_filter( 'action_scheduler_failure_period', '__return_zero' ); + + $failed = $store->query_actions(array('status' => ActionScheduler_Store::STATUS_FAILED)); + $this->assertEquals( $created_actions[0], $failed[0] ); + $this->assertCount( 1, $failed ); + + + } +} + \ No newline at end of file diff --git a/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php b/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php new file mode 100644 index 00000000000..e68b3e06fb9 --- /dev/null +++ b/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php @@ -0,0 +1,262 @@ +run(); + + $this->assertEquals( 0, $actions_run ); + } + + public function test_run() { + $store = ActionScheduler::store(); + $runner = new ActionScheduler_QueueRunner( $store ); + + $mock = new MockAction(); + $random = md5(rand()); + add_action( $random, array( $mock, 'action' ) ); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + for ( $i = 0 ; $i < 5 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $actions_run = $runner->run(); + + remove_action( $random, array( $mock, 'action' ) ); + + $this->assertEquals( 5, $mock->get_call_count() ); + $this->assertEquals( 5, $actions_run ); + } + + public function test_run_with_future_actions() { + $store = ActionScheduler::store(); + $runner = new ActionScheduler_QueueRunner( $store ); + + $mock = new MockAction(); + $random = md5(rand()); + add_action( $random, array( $mock, 'action' ) ); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); + + for ( $i = 0 ; $i < 3 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('tomorrow')); + for ( $i = 0 ; $i < 3 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $actions_run = $runner->run(); + + remove_action( $random, array( $mock, 'action' ) ); + + $this->assertEquals( 3, $mock->get_call_count() ); + $this->assertEquals( 3, $actions_run ); + } + + public function test_completed_action_status() { + $store = ActionScheduler::store(); + $runner = new ActionScheduler_QueueRunner( $store ); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('12 hours ago')); + + $action = new ActionScheduler_Action( $random, array(), $schedule ); + $action_id = $store->save_action( $action ); + + $runner->run(); + + $finished_action = $store->fetch_action( $action_id ); + + $this->assertTrue( $finished_action->is_finished() ); + } + + public function test_next_instance_of_action() { + $store = ActionScheduler::store(); + $runner = new ActionScheduler_QueueRunner( $store ); + + $random = md5(rand()); + $schedule = new ActionScheduler_IntervalSchedule(as_get_datetime_object('12 hours ago'), DAY_IN_SECONDS); + + $action = new ActionScheduler_Action( $random, array(), $schedule ); + $store->save_action( $action ); + + $runner->run(); + + $claim = $store->stake_claim(10, as_get_datetime_object((DAY_IN_SECONDS - 60).' seconds')); + $this->assertCount(0, $claim->get_actions()); + + $claim = $store->stake_claim(10, as_get_datetime_object(DAY_IN_SECONDS.' seconds')); + $actions = $claim->get_actions(); + $this->assertCount(1, $actions); + + $action_id = reset($actions); + $new_action = $store->fetch_action($action_id); + + + $this->assertEquals( $random, $new_action->get_hook() ); + $this->assertEquals( $schedule->next(as_get_datetime_object())->getTimestamp(), $new_action->get_schedule()->next(as_get_datetime_object())->getTimestamp() ); + } + + public function test_hooked_into_wp_cron() { + $next = wp_next_scheduled( ActionScheduler_QueueRunner::WP_CRON_HOOK ); + $this->assertNotEmpty($next); + } + + public function test_batch_count_limit() { + $store = ActionScheduler::store(); + $runner = new ActionScheduler_QueueRunner( $store ); + + $mock = new MockAction(); + $random = md5(rand()); + add_action( $random, array( $mock, 'action' ) ); + $schedule = new ActionScheduler_SimpleSchedule(new ActionScheduler_DateTime('1 day ago')); + + for ( $i = 0 ; $i < 30 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $claims = array(); + + for ( $i = 0 ; $i < 5 ; $i++ ) { + $claims[] = $store->stake_claim( 5 ); + } + + $actions_run = $runner->run(); + + + $this->assertEquals( 0, $mock->get_call_count() ); + $this->assertEquals( 0, $actions_run ); + + $first = reset($claims); + $store->release_claim( $first ); + + $actions_run = $runner->run(); + $this->assertEquals( 10, $mock->get_call_count() ); + $this->assertEquals( 10, $actions_run ); + + remove_action( $random, array( $mock, 'action' ) ); + } + + public function test_changing_batch_count_limit() { + $store = ActionScheduler::store(); + $runner = new ActionScheduler_QueueRunner( $store ); + + $random = md5(rand()); + $schedule = new ActionScheduler_SimpleSchedule(new ActionScheduler_DateTime('1 day ago')); + + for ( $i = 0 ; $i < 30 ; $i++ ) { + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $claims = array(); + + for ( $i = 0 ; $i < 5 ; $i++ ) { + $claims[] = $store->stake_claim( 5 ); + } + + $mock1 = new MockAction(); + add_action( $random, array( $mock1, 'action' ) ); + $actions_run = $runner->run(); + remove_action( $random, array( $mock1, 'action' ) ); + + $this->assertEquals( 0, $mock1->get_call_count() ); + $this->assertEquals( 0, $actions_run ); + + + add_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); + + $mock2 = new MockAction(); + add_action( $random, array( $mock2, 'action' ) ); + $actions_run = $runner->run(); + remove_action( $random, array( $mock2, 'action' ) ); + + $this->assertEquals( 5, $mock2->get_call_count() ); + $this->assertEquals( 5, $actions_run ); + + remove_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); + + for ( $i = 0 ; $i < 5 ; $i++ ) { // to make up for the actions we just processed + $action = new ActionScheduler_Action( $random, array($random), $schedule ); + $store->save_action( $action ); + } + + $mock3 = new MockAction(); + add_action( $random, array( $mock3, 'action' ) ); + $actions_run = $runner->run(); + remove_action( $random, array( $mock3, 'action' ) ); + + $this->assertEquals( 0, $mock3->get_call_count() ); + $this->assertEquals( 0, $actions_run ); + + remove_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); + } + + public function return_6() { + return 6; + } + + public function test_store_fetch_action_failure_schedule_next_instance() { + $random = md5( rand() ); + $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object( '12 hours ago' ), DAY_IN_SECONDS ); + $action = new ActionScheduler_Action( $random, array(), $schedule ); + $action_id = ActionScheduler::store()->save_action( $action ); + + // Set up a mock store that will throw an exception when fetching actions. + $store = $this + ->getMockBuilder( 'ActionScheduler_wpPostStore' ) + ->setMethods( array( 'fetch_action' ) ) + ->getMock(); + $store + ->method( 'fetch_action' ) + ->with( $action_id ) + ->will( $this->throwException( new Exception() ) ); + + // Set up a mock queue runner to verify that schedule_next_instance() + // isn't called for an undefined $action. + $runner = $this + ->getMockBuilder( 'ActionScheduler_QueueRunner' ) + ->setConstructorArgs( array( $store ) ) + ->setMethods( array( 'schedule_next_instance' ) ) + ->getMock(); + $runner + ->expects( $this->never() ) + ->method( 'schedule_next_instance' ); + + $runner->run(); + + // Set up a mock store that will throw an exception when fetching actions. + $store2 = $this + ->getMockBuilder( 'ActionScheduler_wpPostStore' ) + ->setMethods( array( 'fetch_action' ) ) + ->getMock(); + $store2 + ->method( 'fetch_action' ) + ->with( $action_id ) + ->willReturn( null ); + + // Set up a mock queue runner to verify that schedule_next_instance() + // isn't called for an undefined $action. + $runner2 = $this + ->getMockBuilder( 'ActionScheduler_QueueRunner' ) + ->setConstructorArgs( array( $store ) ) + ->setMethods( array( 'schedule_next_instance' ) ) + ->getMock(); + $runner2 + ->expects( $this->never() ) + ->method( 'schedule_next_instance' ); + + $runner2->run(); + } +} diff --git a/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php b/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php new file mode 100644 index 00000000000..4d1ee9a7991 --- /dev/null +++ b/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php @@ -0,0 +1,45 @@ +assertEquals( $time, $schedule->next() ); + } + + public function test_next() { + $time = as_get_datetime_object('2013-06-14'); + $cron = CronExpression::factory('@daily'); + $schedule = new ActionScheduler_CronSchedule($time, $cron); + $this->assertEquals( as_get_datetime_object('tomorrow'), $schedule->next( as_get_datetime_object() ) ); + } + + public function test_is_recurring() { + $schedule = new ActionScheduler_CronSchedule(as_get_datetime_object('2013-06-14'), CronExpression::factory('@daily')); + $this->assertTrue( $schedule->is_recurring() ); + } + + public function test_cron_format() { + $time = as_get_datetime_object('2014-01-01'); + $cron = CronExpression::factory('0 0 10 10 *'); + $schedule = new ActionScheduler_CronSchedule($time, $cron); + $this->assertEquals( as_get_datetime_object('2014-10-10'), $schedule->next() ); + + $cron = CronExpression::factory('0 0 L 1/2 *'); + $schedule = new ActionScheduler_CronSchedule($time, $cron); + $this->assertEquals( as_get_datetime_object('2014-01-31'), $schedule->next() ); + $this->assertEquals( as_get_datetime_object('2014-07-31'), $schedule->next( as_get_datetime_object('2014-06-01') ) ); + $this->assertEquals( as_get_datetime_object('2028-11-30'), $schedule->next( as_get_datetime_object('2028-11-01') ) ); + + $cron = CronExpression::factory('30 14 * * MON#3 *'); + $schedule = new ActionScheduler_CronSchedule($time, $cron); + $this->assertEquals( as_get_datetime_object('2014-01-20 14:30:00'), $schedule->next() ); + $this->assertEquals( as_get_datetime_object('2014-05-19 14:30:00'), $schedule->next( as_get_datetime_object('2014-05-01') ) ); + } +} + \ No newline at end of file diff --git a/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php b/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php new file mode 100644 index 00000000000..2f68ccb2023 --- /dev/null +++ b/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php @@ -0,0 +1,28 @@ +assertEquals( $time, $schedule->next() ); + } + + public function test_next() { + $now = time(); + $start = $now - 30; + $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS ); + $this->assertEquals( $start, $schedule->next()->getTimestamp() ); + $this->assertEquals( $now + MINUTE_IN_SECONDS, $schedule->next(as_get_datetime_object())->getTimestamp() ); + $this->assertEquals( $start, $schedule->next(as_get_datetime_object("@$start"))->getTimestamp() ); + } + + public function test_is_recurring() { + $start = time() - 30; + $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS ); + $this->assertTrue( $schedule->is_recurring() ); + } +} diff --git a/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php b/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php new file mode 100644 index 00000000000..cd2c601061b --- /dev/null +++ b/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php @@ -0,0 +1,18 @@ +assertNull( $schedule->next() ); + } + + public function test_is_recurring() { + $schedule = new ActionScheduler_NullSchedule(); + $this->assertFalse( $schedule->is_recurring() ); + } +} + \ No newline at end of file diff --git a/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php b/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php new file mode 100644 index 00000000000..022dd66aadc --- /dev/null +++ b/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php @@ -0,0 +1,37 @@ +assertEquals( $time, $schedule->next() ); + } + + public function test_past_date() { + $time = as_get_datetime_object('-1 day'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $this->assertEquals( $time, $schedule->next() ); + } + + public function test_future_date() { + $time = as_get_datetime_object('+1 day'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $this->assertEquals( $time, $schedule->next() ); + } + + public function test_grace_period_for_next() { + $time = as_get_datetime_object('3 seconds ago'); + $schedule = new ActionScheduler_SimpleSchedule($time); + $this->assertEquals( $time, $schedule->next() ); + } + + public function test_is_recurring() { + $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('+1 day')); + $this->assertFalse( $schedule->is_recurring() ); + } +} + \ No newline at end of file diff --git a/tests/phpunit/versioning/ActionScheduler_Versions_Test.php b/tests/phpunit/versioning/ActionScheduler_Versions_Test.php new file mode 100644 index 00000000000..9e79e024595 --- /dev/null +++ b/tests/phpunit/versioning/ActionScheduler_Versions_Test.php @@ -0,0 +1,43 @@ +register('1.0-dev', 'callback_1_dot_0_dev'); + $versions->register('1.0', 'callback_1_dot_0'); + + $registered = $versions->get_versions(); + + $this->assertArrayHasKey( '1.0-dev', $registered ); + $this->assertArrayHasKey( '1.0', $registered ); + $this->assertCount( 2, $registered ); + + $this->assertEquals( 'callback_1_dot_0_dev', $registered['1.0-dev'] ); + } + + public function test_duplicate_version() { + $versions = new ActionScheduler_Versions(); + $versions->register('1.0', 'callback_1_dot_0_a'); + $versions->register('1.0', 'callback_1_dot_0_b'); + + $registered = $versions->get_versions(); + + $this->assertArrayHasKey( '1.0', $registered ); + $this->assertCount( 1, $registered ); + } + + public function test_latest_version() { + $versions = new ActionScheduler_Versions(); + $this->assertEquals('__return_null', $versions->latest_version_callback() ); + $versions->register('1.2', 'callback_1_dot_2'); + $versions->register('1.3', 'callback_1_dot_3'); + $versions->register('1.0', 'callback_1_dot_0'); + + $this->assertEquals( '1.3', $versions->latest_version() ); + $this->assertEquals( 'callback_1_dot_3', $versions->latest_version_callback() ); + } +} + \ No newline at end of file diff --git a/tests/travis/setup.sh b/tests/travis/setup.sh new file mode 100755 index 00000000000..068198af5f5 --- /dev/null +++ b/tests/travis/setup.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# WordPress test setup script for Travis CI +# +# Author: Benjamin J. Balter ( ben@balter.com | ben.balter.com ) +# License: GPL3 + +export WP_CORE_DIR=/tmp/wordpress +export WP_TESTS_DIR=/tmp/wordpress-tests/tests/phpunit + +if [[ "$1" = "5.6" || "$1" > "5.6" ]] +then + wget -c https://phar.phpunit.de/phpunit-5.7.phar + chmod +x phpunit-5.7.phar + mv phpunit-5.7.phar `which phpunit` +fi + +plugin_slug=$(basename $(pwd)) +plugin_dir=$WP_CORE_DIR/wp-content/plugins/$plugin_slug + +# Init database +mysql -e 'CREATE DATABASE wordpress_test;' -uroot + +# Grab specified version of WordPress from github +wget -nv -O /tmp/wordpress.tar.gz https://github.com/WordPress/WordPress/tarball/$WP_VERSION +mkdir -p $WP_CORE_DIR +tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR + +# Grab testing framework +svn co --quiet https://develop.svn.wordpress.org/tags/$WP_VERSION/ /tmp/wordpress-tests + +# Put various components in proper folders +cp tests/travis/wp-tests-config.php $WP_TESTS_DIR/wp-tests-config.php + +cd .. +mv $plugin_slug $plugin_dir + +cd $plugin_dir diff --git a/tests/travis/wp-tests-config.php b/tests/travis/wp-tests-config.php new file mode 100644 index 00000000000..f626da090a2 --- /dev/null +++ b/tests/travis/wp-tests-config.php @@ -0,0 +1,38 @@ + Date: Thu, 28 Mar 2019 15:33:41 +1000 Subject: [PATCH 3/3] Remove Action Scheduler development files --- .../libraries/action-scheduler/.gitattributes | 9 - .../.github/release-drafter.yml | 15 - .../libraries/action-scheduler/.gitignore | 3 - .../libraries/action-scheduler/.travis.yml | 37 - .../libraries/action-scheduler/codecov.yml | 13 - .../libraries/action-scheduler/composer.lock | 2909 ----------------- .../libraries/action-scheduler/docs/CNAME | 1 - .../action-scheduler/docs/_config.yml | 7 - .../docs/_layouts/default.html | 62 - .../libraries/action-scheduler/docs/admin.md | 22 - .../docs/android-chrome-192x192.png | Bin 17032 -> 0 bytes .../docs/android-chrome-256x256.png | Bin 24599 -> 0 bytes .../libraries/action-scheduler/docs/api.md | 179 - .../docs/apple-touch-icon.png | Bin 8053 -> 0 bytes .../docs/assets/css/style.scss | 57 - .../action-scheduler/docs/browserconfig.xml | 9 - .../libraries/action-scheduler/docs/faq.md | 101 - .../action-scheduler/docs/favicon-16x16.png | Bin 1160 -> 0 bytes .../action-scheduler/docs/favicon-32x32.png | Bin 1937 -> 0 bytes .../action-scheduler/docs/favicon.ico | Bin 15086 -> 0 bytes .../docs/google14ef723abb376cd3.html | 1 - .../libraries/action-scheduler/docs/index.md | 68 - .../action-scheduler/docs/mstile-150x150.png | Bin 4246 -> 0 bytes .../libraries/action-scheduler/docs/perf.md | 127 - .../docs/safari-pinned-tab.svg | 40 - .../action-scheduler/docs/site.webmanifest | 19 - .../libraries/action-scheduler/docs/usage.md | 123 - .../libraries/action-scheduler/docs/wp-cli.md | 73 - .../tests/ActionScheduler_UnitTestCase.php | 44 - .../action-scheduler/tests/bootstrap.php | 31 - .../action-scheduler/tests/phpunit.xml.dist | 32 - .../ActionScheduler_UnitTestCase.php | 44 - .../ActionScheduler_TimezoneHelper_Test.php | 100 - .../jobs/ActionScheduler_Action_Test.php | 55 - .../jobs/ActionScheduler_NullAction_Test.php | 16 - .../ActionScheduler_wpPostStore_Test.php | 375 --- .../ActionScheduler_wpCommentLogger_Test.php | 185 -- .../procedural_api/procedural_api_Test.php | 222 -- .../wc_get_scheduled_actions_Test.php | 100 - .../ActionScheduler_QueueCleaner_Test.php | 151 - .../ActionScheduler_QueueRunner_Test.php | 262 -- .../ActionScheduler_CronSchedule_Test.php | 45 - .../ActionScheduler_IntervalSchedule_Test.php | 28 - .../ActionScheduler_NullSchedule_Test.php | 18 - .../ActionScheduler_SimpleSchedule_Test.php | 37 - .../ActionScheduler_Versions_Test.php | 43 - .../action-scheduler/tests/travis/setup.sh | 38 - .../tests/travis/wp-tests-config.php | 38 - 48 files changed, 5739 deletions(-) delete mode 100644 includes/libraries/action-scheduler/.gitattributes delete mode 100644 includes/libraries/action-scheduler/.github/release-drafter.yml delete mode 100644 includes/libraries/action-scheduler/.gitignore delete mode 100644 includes/libraries/action-scheduler/.travis.yml delete mode 100644 includes/libraries/action-scheduler/codecov.yml delete mode 100644 includes/libraries/action-scheduler/composer.lock delete mode 100644 includes/libraries/action-scheduler/docs/CNAME delete mode 100644 includes/libraries/action-scheduler/docs/_config.yml delete mode 100644 includes/libraries/action-scheduler/docs/_layouts/default.html delete mode 100644 includes/libraries/action-scheduler/docs/admin.md delete mode 100644 includes/libraries/action-scheduler/docs/android-chrome-192x192.png delete mode 100644 includes/libraries/action-scheduler/docs/android-chrome-256x256.png delete mode 100644 includes/libraries/action-scheduler/docs/api.md delete mode 100644 includes/libraries/action-scheduler/docs/apple-touch-icon.png delete mode 100644 includes/libraries/action-scheduler/docs/assets/css/style.scss delete mode 100644 includes/libraries/action-scheduler/docs/browserconfig.xml delete mode 100644 includes/libraries/action-scheduler/docs/faq.md delete mode 100644 includes/libraries/action-scheduler/docs/favicon-16x16.png delete mode 100644 includes/libraries/action-scheduler/docs/favicon-32x32.png delete mode 100644 includes/libraries/action-scheduler/docs/favicon.ico delete mode 100644 includes/libraries/action-scheduler/docs/google14ef723abb376cd3.html delete mode 100644 includes/libraries/action-scheduler/docs/index.md delete mode 100644 includes/libraries/action-scheduler/docs/mstile-150x150.png delete mode 100644 includes/libraries/action-scheduler/docs/perf.md delete mode 100644 includes/libraries/action-scheduler/docs/safari-pinned-tab.svg delete mode 100644 includes/libraries/action-scheduler/docs/site.webmanifest delete mode 100644 includes/libraries/action-scheduler/docs/usage.md delete mode 100644 includes/libraries/action-scheduler/docs/wp-cli.md delete mode 100644 includes/libraries/action-scheduler/tests/ActionScheduler_UnitTestCase.php delete mode 100644 includes/libraries/action-scheduler/tests/bootstrap.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit.xml.dist delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php delete mode 100644 includes/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php delete mode 100755 includes/libraries/action-scheduler/tests/travis/setup.sh delete mode 100644 includes/libraries/action-scheduler/tests/travis/wp-tests-config.php diff --git a/includes/libraries/action-scheduler/.gitattributes b/includes/libraries/action-scheduler/.gitattributes deleted file mode 100644 index aa62d10c423..00000000000 --- a/includes/libraries/action-scheduler/.gitattributes +++ /dev/null @@ -1,9 +0,0 @@ -docs export-ignore -tests export-ignore -codecov.yml export-ignore -.github export-ignore -.travis.yml export-ignore -.gitattributes export-ignore -.gitignore export-ignore -phpunit.xml.dist export-ignore - diff --git a/includes/libraries/action-scheduler/.github/release-drafter.yml b/includes/libraries/action-scheduler/.github/release-drafter.yml deleted file mode 100644 index 702a6908c58..00000000000 --- a/includes/libraries/action-scheduler/.github/release-drafter.yml +++ /dev/null @@ -1,15 +0,0 @@ -template: | - ## next release – date - - - - $CHANGES - - **Added** - **Changed** - **Deprecated** - **Removed** - **Fixed** - **Security** - -change-template: '* $TITLE (PR #$NUMBER)' diff --git a/includes/libraries/action-scheduler/.gitignore b/includes/libraries/action-scheduler/.gitignore deleted file mode 100644 index e779da84a38..00000000000 --- a/includes/libraries/action-scheduler/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -phpunit.xml -vendor -.idea diff --git a/includes/libraries/action-scheduler/.travis.yml b/includes/libraries/action-scheduler/.travis.yml deleted file mode 100644 index 675301bc543..00000000000 --- a/includes/libraries/action-scheduler/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Travis CI Configuration File - -# Tell Travis CI we're using PHP -language: php - -# We nee to use Precise, not Trusty, to test against PHP 5.3, see https://github.com/travis-ci/travis-ci/issues/8219 -dist: precise - -# Versions of PHP to test against -php: - - "5.3" - - "5.4" - - "5.5" - - "5.6" - - "7.0" - - "7.1" - -# Specify versions of WordPress to test against -# WP_VERSION = WordPress version number (use "master" for SVN trunk) -# WP_MULTISITE = whether to test multisite (use either "0" or "1") -env: - - WP_VERSION=4.8 WP_MULTISITE=0 - - WP_VERSION=4.7 WP_MULTISITE=0 - - WP_VERSION=4.6 WP_MULTISITE=0 - - WP_VERSION=4.8 WP_MULTISITE=1 - - WP_VERSION=4.7 WP_MULTISITE=1 - - WP_VERSION=4.6 WP_MULTISITE=1 - -# Grab the setup script and execute -before_script: - - source tests/travis/setup.sh $TRAVIS_PHP_VERSION - -script: - - if [[ "$TRAVIS_PHP_VERSION" == "7.1" ]] && [[ "$WP_VERSION" == "4.8" ]] && [[ "$WP_MULTISITE" == "0" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then phpunit --configuration tests/phpunit.xml.dist --coverage-clover clover.xml; else phpunit --configuration tests/phpunit.xml.dist; fi - -after_script: - - bash <(curl -s https://codecov.io/bash) diff --git a/includes/libraries/action-scheduler/codecov.yml b/includes/libraries/action-scheduler/codecov.yml deleted file mode 100644 index fe69f966954..00000000000 --- a/includes/libraries/action-scheduler/codecov.yml +++ /dev/null @@ -1,13 +0,0 @@ -codecov: - branch: master - -coverage: - ignore: - - tests/.* - - lib/.* - status: - project: false - patch: false - changes: false - -comment: false diff --git a/includes/libraries/action-scheduler/composer.lock b/includes/libraries/action-scheduler/composer.lock deleted file mode 100644 index de44d8153ec..00000000000 --- a/includes/libraries/action-scheduler/composer.lock +++ /dev/null @@ -1,2909 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "f4556531e7b95173d1b769b3d7350926", - "packages": [], - "packages-dev": [ - { - "name": "composer/ca-bundle", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12", - "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5", - "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0" - }, - "suggest": { - "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\CaBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "time": "2017-03-06T11:59:08+00:00" - }, - { - "name": "composer/composer", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/composer.git", - "reference": "82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff", - "reference": "82c27a68bc5cb76f3d00b82c27496e3cdbb6d4ff", - "shasum": "" - }, - "require": { - "composer/ca-bundle": "^1.0", - "composer/semver": "^1.0", - "composer/spdx-licenses": "^1.0", - "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", - "php": "^5.3.2 || ^7.0", - "psr/log": "^1.0", - "seld/cli-prompt": "^1.0", - "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.7 || ^3.0", - "symfony/filesystem": "^2.7 || ^3.0", - "symfony/finder": "^2.7 || ^3.0", - "symfony/process": "^2.7 || ^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" - }, - "suggest": { - "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", - "ext-zip": "Enabling the zip extension allows you to unzip archives", - "ext-zlib": "Allow gzip compression of HTTP requests" - }, - "bin": [ - "bin/composer" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\": "src/Composer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", - "homepage": "https://getcomposer.org/", - "keywords": [ - "autoload", - "dependency", - "package" - ], - "time": "2017-08-09T14:23:46+00:00" - }, - { - "name": "composer/semver", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "7ea669582e6396857cf6d1c0a6cd2728f4e7e383" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/7ea669582e6396857cf6d1c0a6cd2728f4e7e383", - "reference": "7ea669582e6396857cf6d1c0a6cd2728f4e7e383", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "time": "2017-05-15T12:49:06+00:00" - }, - { - "name": "composer/spdx-licenses", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/spdx-licenses.git", - "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/2603a0d7ddc00a015deb576fa5297ca43dee6b1c", - "reference": "2603a0d7ddc00a015deb576fa5297ca43dee6b1c", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Spdx\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "SPDX licenses list and validation library.", - "keywords": [ - "license", - "spdx", - "validator" - ], - "time": "2017-04-03T19:08:52+00:00" - }, - { - "name": "justinrainbow/json-schema", - "version": "5.x-dev", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d", - "reference": "36ed4d935f8f5eb958dbd29e1fa5a241ec3ece4d", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.1", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.22" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2017-06-23T11:43:36+00:00" - }, - { - "name": "mustache/mustache", - "version": "v2.12.0", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/mustache.php.git", - "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/fe8fe72e9d580591854de404cc59a1b83ca4d19e", - "reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e", - "shasum": "" - }, - "require": { - "php": ">=5.2.4" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~1.11", - "phpunit/phpunit": "~3.7|~4.0|~5.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Mustache": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "A Mustache implementation in PHP.", - "homepage": "https://github.com/bobthecow/mustache.php", - "keywords": [ - "mustache", - "templating" - ], - "time": "2017-07-11T12:54:05+00:00" - }, - { - "name": "nb/oxymel", - "version": "v0.1.0", - "source": { - "type": "git", - "url": "https://github.com/nb/oxymel.git", - "reference": "cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nb/oxymel/zipball/cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c", - "reference": "cbe626ef55d5c4cc9b5e6e3904b395861ea76e3c", - "shasum": "" - }, - "require": { - "php": ">=5.2.4" - }, - "type": "library", - "autoload": { - "psr-0": { - "Oxymel": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nikolay Bachiyski", - "email": "nb@nikolay.bg", - "homepage": "http://extrapolate.me/" - } - ], - "description": "A sweet XML builder", - "homepage": "https://github.com/nb/oxymel", - "keywords": [ - "xml" - ], - "time": "2013-02-24T15:01:54+00:00" - }, - { - "name": "psr/container", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "2cc4a01788191489dc7459446ba832fa79a216a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/2cc4a01788191489dc7459446ba832fa79a216a7", - "reference": "2cc4a01788191489dc7459446ba832fa79a216a7", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-06-28T15:35:32+00:00" - }, - { - "name": "psr/log", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "ramsey/array_column", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/ramsey/array_column.git", - "reference": "f8e52eb28e67eb50e613b451dd916abcf783c1db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/array_column/zipball/f8e52eb28e67eb50e613b451dd916abcf783c1db", - "reference": "f8e52eb28e67eb50e613b451dd916abcf783c1db", - "shasum": "" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.8.*", - "phpunit/phpunit": "~4.5", - "satooshi/php-coveralls": "0.6.*", - "squizlabs/php_codesniffer": "~2.2" - }, - "type": "library", - "autoload": { - "files": [ - "src/array_column.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "homepage": "http://benramsey.com" - } - ], - "description": "Provides functionality for array_column() to projects using PHP earlier than version 5.5.", - "homepage": "https://github.com/ramsey/array_column", - "keywords": [ - "array", - "array_column", - "column" - ], - "time": "2015-03-20T22:07:39+00:00" - }, - { - "name": "rmccue/requests", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/rmccue/Requests.git", - "reference": "87932f52ffad70504d93f04f15690cf16a089546" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/rmccue/Requests/zipball/87932f52ffad70504d93f04f15690cf16a089546", - "reference": "87932f52ffad70504d93f04f15690cf16a089546", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "require-dev": { - "requests/test-server": "dev-master" - }, - "type": "library", - "autoload": { - "psr-0": { - "Requests": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Ryan McCue", - "homepage": "http://ryanmccue.info" - } - ], - "description": "A HTTP library written in PHP, for human beings.", - "homepage": "http://github.com/rmccue/Requests", - "keywords": [ - "curl", - "fsockopen", - "http", - "idna", - "ipv6", - "iri", - "sockets" - ], - "time": "2016-10-13T00:11:37+00:00" - }, - { - "name": "seld/cli-prompt", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/cli-prompt.git", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\CliPrompt\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", - "keywords": [ - "cli", - "console", - "hidden", - "input", - "prompt" - ], - "time": "2017-03-18T11:32:45+00:00" - }, - { - "name": "seld/jsonlint", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", - "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", - "shasum": "" - }, - "require": { - "php": "^5.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5" - }, - "bin": [ - "bin/jsonlint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Seld\\JsonLint\\": "src/Seld/JsonLint/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "JSON Linter", - "keywords": [ - "json", - "linter", - "parser", - "validator" - ], - "time": "2017-06-18T15:11:04+00:00" - }, - { - "name": "seld/phar-utils", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\PharUtils\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "PHAR file format utilities, for when PHP phars you up", - "keywords": [ - "phra" - ], - "time": "2015-10-13T18:44:15+00:00" - }, - { - "name": "symfony/config", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "d668d8c0502d2b485c00d107db65fdbc56c26282" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/d668d8c0502d2b485c00d107db65fdbc56c26282", - "reference": "d668d8c0502d2b485c00d107db65fdbc56c26282", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2017-08-05T17:34:46+00:00" - }, - { - "name": "symfony/console", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "0e283478c2d68c9bf9cc52592ad1ef1834083a85" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0e283478c2d68c9bf9cc52592ad1ef1834083a85", - "reference": "0e283478c2d68c9bf9cc52592ad1ef1834083a85", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2017-08-10T07:07:17+00:00" - }, - { - "name": "symfony/debug", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "50bda5b4b8641616d45254c6855bcd45f2f64187" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/50bda5b4b8641616d45254c6855bcd45f2f64187", - "reference": "50bda5b4b8641616d45254c6855bcd45f2f64187", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2017-08-10T07:07:17+00:00" - }, - { - "name": "symfony/dependency-injection", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "aaee88765cb21a838e8da26d6acda4ca2ae3a2ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/aaee88765cb21a838e8da26d6acda4ca2ae3a2ea", - "reference": "aaee88765cb21a838e8da26d6acda4ca2ae3a2ea", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.3.1", - "symfony/finder": "<3.3", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "require-dev": { - "symfony/config": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2017-08-10T19:43:00+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "cd8b015f859e6b60933324db00067c2f060b4d18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/cd8b015f859e6b60933324db00067c2f060b4d18", - "reference": "cd8b015f859e6b60933324db00067c2f060b4d18", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T09:34:20+00:00" - }, - { - "name": "symfony/filesystem", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "e4d366b620c8b6e2d4977c154f6a1d5b416db4dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e4d366b620c8b6e2d4977c154f6a1d5b416db4dd", - "reference": "e4d366b620c8b6e2d4977c154f6a1d5b416db4dd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T09:34:20+00:00" - }, - { - "name": "symfony/finder", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "bf0450cfe7282c5f06539c4733ba64273e91e918" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/bf0450cfe7282c5f06539c4733ba64273e91e918", - "reference": "bf0450cfe7282c5f06539c4733ba64273e91e918", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T09:34:20+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-06-14T15:44:48+00:00" - }, - { - "name": "symfony/process", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "9794f948d9af3be0157185051275d78b24d68b92" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/9794f948d9af3be0157185051275d78b24d68b92", - "reference": "9794f948d9af3be0157185051275d78b24d68b92", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T09:34:20+00:00" - }, - { - "name": "symfony/translation", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "62bb068e004874bbe39624101e1aae70ca7c05cd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/62bb068e004874bbe39624101e1aae70ca7c05cd", - "reference": "62bb068e004874bbe39624101e1aae70ca7c05cd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/yaml": "~3.3|~4.0" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2017-08-03T12:04:31+00:00" - }, - { - "name": "symfony/yaml", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc", - "reference": "1395ddba6f65bf46cdf1d80d59223cbab8ff3ccc", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-08-04T13:29:48+00:00" - }, - { - "name": "wp-cli/autoload-splitter", - "version": "v0.1.5", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/autoload-splitter.git", - "reference": "fb4302da26390811d2631c62b42b75976d224bb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/autoload-splitter/zipball/fb4302da26390811d2631c62b42b75976d224bb8", - "reference": "fb4302da26390811d2631c62b42b75976d224bb8", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1" - }, - "type": "composer-plugin", - "extra": { - "class": "WP_CLI\\AutoloadSplitter\\ComposerPlugin" - }, - "autoload": { - "psr-4": { - "WP_CLI\\AutoloadSplitter\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alain Schlesser", - "email": "alain.schlesser@gmail.com", - "homepage": "https://www.alainschlesser.com" - } - ], - "description": "Composer plugin for splitting a generated autoloader into two distinct parts.", - "homepage": "https://wp-cli.org", - "time": "2017-08-03T08:40:16+00:00" - }, - { - "name": "wp-cli/cache-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/cache-command.git", - "reference": "485f7cc6630ecabe22bbf9fa9e827958e95a2d21" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/cache-command/zipball/485f7cc6630ecabe22bbf9fa9e827958e95a2d21", - "reference": "485f7cc6630ecabe22bbf9fa9e827958e95a2d21", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "cache", - "transient" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "cache-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage object and transient caches.", - "homepage": "https://github.com/wp-cli/cache-command", - "time": "2017-08-04T11:37:19+00:00" - }, - { - "name": "wp-cli/checksum-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/checksum-command.git", - "reference": "88ccde2e82de5c2232842a9fccc2e6ade232dec6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/checksum-command/zipball/88ccde2e82de5c2232842a9fccc2e6ade232dec6", - "reference": "88ccde2e82de5c2232842a9fccc2e6ade232dec6", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "checksum core" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "checksum-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Verify WordPress core checksums.", - "homepage": "https://github.com/wp-cli/checksum-command", - "time": "2017-08-09T23:34:29+00:00" - }, - { - "name": "wp-cli/config-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/config-command.git", - "reference": "ca83ade8fb2d059b561744610947e38123b10c22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/config-command/zipball/ca83ade8fb2d059b561744610947e38123b10c22", - "reference": "ca83ade8fb2d059b561744610947e38123b10c22", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "config", - "config create", - "config get", - "config path" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "config-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage the wp-config.php file.", - "homepage": "https://github.com/wp-cli/config-command", - "time": "2017-08-04T23:41:35+00:00" - }, - { - "name": "wp-cli/core-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/core-command.git", - "reference": "fb743dab792e21b57163c5c0f563987d1471c152" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/core-command/zipball/fb743dab792e21b57163c5c0f563987d1471c152", - "reference": "fb743dab792e21b57163c5c0f563987d1471c152", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "core check-update", - "core download", - "core install", - "core is-installed", - "core multisite-convert", - "core multisite-install", - "core update", - "core update-db", - "core version" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "core-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Download, install, update and manage a WordPress install.", - "homepage": "https://github.com/wp-cli/core-command", - "time": "2017-08-04T12:31:18+00:00" - }, - { - "name": "wp-cli/cron-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/cron-command.git", - "reference": "92114b695ab0253bb705d9bd3e6d2fb47b51fad2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/cron-command/zipball/92114b695ab0253bb705d9bd3e6d2fb47b51fad2", - "reference": "92114b695ab0253bb705d9bd3e6d2fb47b51fad2", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "cron test", - "cron event delete", - "cron event list", - "cron event run", - "cron event schedule", - "cron schedule list" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "cron-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage WP-Cron events and schedules.", - "homepage": "https://github.com/wp-cli/cron-command", - "time": "2017-08-04T12:45:50+00:00" - }, - { - "name": "wp-cli/db-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/db-command.git", - "reference": "5c597abb642bcaf329e7da0801c69f4405d41c23" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/db-command/zipball/5c597abb642bcaf329e7da0801c69f4405d41c23", - "reference": "5c597abb642bcaf329e7da0801c69f4405d41c23", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "db create", - "db drop", - "db reset", - "db check", - "db optimize", - "db prefix", - "db repair", - "db cli", - "db query", - "db export", - "db import", - "db search", - "db tables", - "db size" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "db-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Perform basic database operations using credentials stored in wp-config.php.", - "homepage": "https://github.com/wp-cli/db-command", - "time": "2017-08-04T23:21:46+00:00" - }, - { - "name": "wp-cli/entity-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/entity-command.git", - "reference": "d0cd99c14e4d01aad368328da97231df0c01f9dc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/d0cd99c14e4d01aad368328da97231df0c01f9dc", - "reference": "d0cd99c14e4d01aad368328da97231df0c01f9dc", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "phpunit/phpunit": "^4.8", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "comment", - "comment meta", - "menu", - "menu item", - "menu location", - "network meta", - "option", - "option add", - "option delete", - "option get", - "option list", - "option update", - "post", - "post meta", - "post term", - "post-type", - "site", - "taxonomy", - "term", - "term meta", - "user", - "user meta", - "user term" - ] - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "entity-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage WordPress core entities.", - "homepage": "https://github.com/wp-cli/entity-command", - "time": "2017-08-11T11:53:04+00:00" - }, - { - "name": "wp-cli/eval-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/eval-command.git", - "reference": "e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/eval-command/zipball/e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4", - "reference": "e3d9502a4f8b8f582130dbb3b8ede76e17ac05a4", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "eval", - "eval-file" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "eval-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Execute arbitrary PHP code.", - "homepage": "https://github.com/wp-cli/eval-command", - "time": "2017-08-04T12:46:58+00:00" - }, - { - "name": "wp-cli/export-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/export-command.git", - "reference": "f5647155830d1275de4cb69cfb79748b9449b8ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/export-command/zipball/f5647155830d1275de4cb69cfb79748b9449b8ab", - "reference": "f5647155830d1275de4cb69cfb79748b9449b8ab", - "shasum": "" - }, - "require": { - "nb/oxymel": "~0.1.0", - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "export" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "export-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Export WordPress content to a WXR file.", - "homepage": "https://github.com/wp-cli/export-command", - "time": "2017-08-04T13:13:08+00:00" - }, - { - "name": "wp-cli/extension-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/extension-command.git", - "reference": "08bf48e842b9e1cb579b50cec1b6897cebf65bda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/08bf48e842b9e1cb579b50cec1b6897cebf65bda", - "reference": "08bf48e842b9e1cb579b50cec1b6897cebf65bda", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "plugin activate", - "plugin deactivate", - "plugin delete", - "plugin get", - "plugin install", - "plugin is-installed", - "plugin list", - "plugin path", - "plugin search", - "plugin status", - "plugin toggle", - "plugin uninstall", - "plugin update", - "theme activate", - "theme delete", - "theme disable", - "theme enable", - "theme get", - "theme install", - "theme is-installed", - "theme list", - "theme mod get", - "theme mod set", - "theme mod remove", - "theme path", - "theme search", - "theme status", - "theme update" - ] - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "extension-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage WordPress plugins and themes.", - "homepage": "https://github.com/wp-cli/extension-command", - "time": "2017-08-04T13:43:53+00:00" - }, - { - "name": "wp-cli/import-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/import-command.git", - "reference": "89d14aa4b8b621effbe7f9bacad2ea8a096598a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/import-command/zipball/89d14aa4b8b621effbe7f9bacad2ea8a096598a7", - "reference": "89d14aa4b8b621effbe7f9bacad2ea8a096598a7", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "bundled": true, - "commands": [ - "import" - ] - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "import-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Import content from a WXR file.", - "homepage": "https://github.com/wp-cli/import-command", - "time": "2017-08-04T13:45:57+00:00" - }, - { - "name": "wp-cli/language-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/language-command.git", - "reference": "aff3fb6c6d7698008c7e5d33a97b25457091ae1b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/language-command/zipball/aff3fb6c6d7698008c7e5d33a97b25457091ae1b", - "reference": "aff3fb6c6d7698008c7e5d33a97b25457091ae1b", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "language core activate", - "language core install", - "language core list", - "language core uninstall", - "language core update" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "language-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage language packs.", - "homepage": "https://github.com/wp-cli/language-command", - "time": "2017-08-04T23:23:03+00:00" - }, - { - "name": "wp-cli/media-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/media-command.git", - "reference": "4a19de54a11c96b21c10719e2b7f9dd131c4261e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/media-command/zipball/4a19de54a11c96b21c10719e2b7f9dd131c4261e", - "reference": "4a19de54a11c96b21c10719e2b7f9dd131c4261e", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "media import", - "media regenerate" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "media-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Import new attachments or regenerate existing ones.", - "homepage": "https://github.com/wp-cli/media-command", - "time": "2017-08-05T04:54:48+00:00" - }, - { - "name": "wp-cli/mustangostang-spyc", - "version": "0.6.3", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/spyc.git", - "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/spyc/zipball/6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", - "reference": "6aa0b4da69ce9e9a2c8402dab8d43cf32c581cc7", - "shasum": "" - }, - "require": { - "php": ">=5.3.1" - }, - "require-dev": { - "phpunit/phpunit": "4.3.*@dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.5.x-dev" - } - }, - "autoload": { - "psr-4": { - "Mustangostang\\": "src/" - }, - "files": [ - "includes/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "mustangostang", - "email": "vlad.andersen@gmail.com" - } - ], - "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", - "homepage": "https://github.com/mustangostang/spyc/", - "time": "2017-04-25T11:26:20+00:00" - }, - { - "name": "wp-cli/package-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/package-command.git", - "reference": "744692180a4240ddc75a3196934cafe396dd9178" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/package-command/zipball/744692180a4240ddc75a3196934cafe396dd9178", - "reference": "744692180a4240ddc75a3196934cafe396dd9178", - "shasum": "" - }, - "require": { - "composer/composer": "^1.2.0", - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "package browse", - "package install", - "package list", - "package update", - "package uninstall" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "package-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage WP-CLI packages.", - "homepage": "https://github.com/wp-cli/package-command", - "time": "2017-08-07T12:21:11+00:00" - }, - { - "name": "wp-cli/php-cli-tools", - "version": "v0.11.6", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05", - "reference": "d2a4e2eca9f1cd62a5d30f192d10f74e73eb3a05", - "shasum": "" - }, - "require": { - "php": ">= 5.3.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "cli": "lib/" - }, - "files": [ - "lib/cli/cli.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "James Logsdon", - "email": "jlogsdon@php.net", - "role": "Developer" - }, - { - "name": "Daniel Bachhuber", - "email": "daniel@handbuilt.co", - "role": "Maintainer" - } - ], - "description": "Console utilities for PHP", - "homepage": "http://github.com/wp-cli/php-cli-tools", - "keywords": [ - "cli", - "console" - ], - "time": "2017-08-04T10:42:04+00:00" - }, - { - "name": "wp-cli/rewrite-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/rewrite-command.git", - "reference": "e858feac8d3fe053e052d8af43c090ff0b2a4e8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/rewrite-command/zipball/e858feac8d3fe053e052d8af43c090ff0b2a4e8a", - "reference": "e858feac8d3fe053e052d8af43c090ff0b2a4e8a", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "rewrite flush", - "rewrite list", - "rewrite structure" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "rewrite-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage rewrite rules.", - "homepage": "https://github.com/wp-cli/rewrite-command", - "time": "2017-08-04T15:15:53+00:00" - }, - { - "name": "wp-cli/role-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/role-command.git", - "reference": "85ddf53525b14ab040830f385710f4493058d295" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/role-command/zipball/85ddf53525b14ab040830f385710f4493058d295", - "reference": "85ddf53525b14ab040830f385710f4493058d295", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "role create", - "role delete", - "role exists", - "role list", - "role reset", - "cap add", - "cap list", - "cap remove" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "role-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage user roles and capabilities.", - "homepage": "https://github.com/wp-cli/role-command", - "time": "2017-08-04T15:17:29+00:00" - }, - { - "name": "wp-cli/scaffold-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/scaffold-command.git", - "reference": "41f1e1aa41af76b70d6cf3d21d52995e854acf4c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/scaffold-command/zipball/41f1e1aa41af76b70d6cf3d21d52995e854acf4c", - "reference": "41f1e1aa41af76b70d6cf3d21d52995e854acf4c", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "scaffold", - "scaffold _s", - "scaffold child-theme", - "scaffold plugin", - "scaffold plugin-tests", - "scaffold post-type", - "scaffold taxonomy", - "scaffold theme-tests" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "scaffold-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Generate code for post types, taxonomies, plugins, child themes, etc.", - "homepage": "https://github.com/wp-cli/scaffold-command", - "time": "2017-08-11T08:07:10+00:00" - }, - { - "name": "wp-cli/search-replace-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/search-replace-command.git", - "reference": "3e7499a65354e3a322d4d1043123b3fa55ef4f12" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/search-replace-command/zipball/3e7499a65354e3a322d4d1043123b3fa55ef4f12", - "reference": "3e7499a65354e3a322d4d1043123b3fa55ef4f12", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "search-replace" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "search-replace-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Search/replace strings in the database.", - "homepage": "https://github.com/wp-cli/search-replace-command", - "time": "2017-08-08T16:41:49+00:00" - }, - { - "name": "wp-cli/server-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/server-command.git", - "reference": "ce93df07c33e716adbbd2d329c311a3c1dd3a0b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/server-command/zipball/ce93df07c33e716adbbd2d329c311a3c1dd3a0b0", - "reference": "ce93df07c33e716adbbd2d329c311a3c1dd3a0b0", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "server" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "server-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Launch PHP's built-in web server for this specific WordPress installation.", - "homepage": "https://github.com/wp-cli/server-command", - "time": "2017-08-04T15:19:26+00:00" - }, - { - "name": "wp-cli/shell-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/shell-command.git", - "reference": "70681666302cc193a1bd41bade9ecc61e74a8c83" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/shell-command/zipball/70681666302cc193a1bd41bade9ecc61e74a8c83", - "reference": "70681666302cc193a1bd41bade9ecc61e74a8c83", - "shasum": "" - }, - "require": { - "wp-cli/wp-cli": "*" - }, - "require-dev": { - "behat/behat": "~2.5" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "shell" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/", - "WP_CLI\\": "src/WP_CLI" - }, - "files": [ - "shell-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Interactive PHP console.", - "homepage": "https://github.com/wp-cli/shell-command", - "time": "2017-08-04T15:21:52+00:00" - }, - { - "name": "wp-cli/super-admin-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/super-admin-command.git", - "reference": "b650836d13762c764df2bbe70ad34212c0b773cd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/super-admin-command/zipball/b650836d13762c764df2bbe70ad34212c0b773cd", - "reference": "b650836d13762c764df2bbe70ad34212c0b773cd", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "super-admin add", - "super-admin list", - "super-admin remove" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "super-admin-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage super admins on WordPress multisite.", - "homepage": "https://github.com/wp-cli/super-admin-command", - "time": "2017-08-04T15:45:41+00:00" - }, - { - "name": "wp-cli/widget-command", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/widget-command.git", - "reference": "727af7c7b661031bc8c04ad176d4f24b862e3402" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/widget-command/zipball/727af7c7b661031bc8c04ad176d4f24b862e3402", - "reference": "727af7c7b661031bc8c04ad176d4f24b862e3402", - "shasum": "" - }, - "require-dev": { - "behat/behat": "~2.5", - "wp-cli/wp-cli": "*" - }, - "type": "wp-cli-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "commands": [ - "widget add", - "widget deactivate", - "widget delete", - "widget list", - "widget move", - "widget reset", - "widget update", - "sidebar list" - ], - "bundled": true - }, - "autoload": { - "psr-4": { - "": "src/" - }, - "files": [ - "widget-command.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Bachhuber", - "email": "daniel@runcommand.io", - "homepage": "https://runcommand.io" - } - ], - "description": "Manage widgets and sidebars.", - "homepage": "https://github.com/wp-cli/widget-command", - "time": "2017-08-04T15:24:29+00:00" - }, - { - "name": "wp-cli/wp-cli", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086", - "reference": "4ab0d99da0ad5e6ca39453ff5c82d4f06aecb086", - "shasum": "" - }, - "require": { - "composer/composer": "^1.2.0", - "composer/semver": "~1.0", - "mustache/mustache": "~2.4", - "php": ">=5.3.29", - "ramsey/array_column": "~1.1", - "rmccue/requests": "~1.6", - "symfony/config": "^2.7|^3.0", - "symfony/console": "^2.7|^3.0", - "symfony/debug": "^2.7|^3.0", - "symfony/dependency-injection": "^2.7|^3.0", - "symfony/event-dispatcher": "^2.7|^3.0", - "symfony/filesystem": "^2.7|^3.0", - "symfony/finder": "^2.7|^3.0", - "symfony/process": "^2.1|^3.0", - "symfony/translation": "^2.7|^3.0", - "symfony/yaml": "^2.7|^3.0", - "wp-cli/autoload-splitter": "^0.1.5", - "wp-cli/cache-command": "^1.0", - "wp-cli/checksum-command": "^1.0", - "wp-cli/config-command": "^1.0", - "wp-cli/core-command": "^1.0", - "wp-cli/cron-command": "^1.0", - "wp-cli/db-command": "^1.0", - "wp-cli/entity-command": "^1.0", - "wp-cli/eval-command": "^1.0", - "wp-cli/export-command": "^1.0", - "wp-cli/extension-command": "^1.0", - "wp-cli/import-command": "^1.0", - "wp-cli/language-command": "^1.0", - "wp-cli/media-command": "^1.0", - "wp-cli/mustangostang-spyc": "^0.6.3", - "wp-cli/package-command": "^1.0", - "wp-cli/php-cli-tools": "~0.11.2", - "wp-cli/rewrite-command": "^1.0", - "wp-cli/role-command": "^1.0", - "wp-cli/scaffold-command": "^1.0", - "wp-cli/search-replace-command": "^1.0", - "wp-cli/server-command": "^1.0", - "wp-cli/shell-command": "^1.0", - "wp-cli/super-admin-command": "^1.0", - "wp-cli/widget-command": "^1.0" - }, - "require-dev": { - "behat/behat": "2.5.*", - "phpunit/phpunit": "3.7.*", - "roave/security-advisories": "dev-master" - }, - "suggest": { - "psy/psysh": "Enhanced `wp shell` functionality" - }, - "bin": [ - "bin/wp.bat", - "bin/wp" - ], - "type": "library", - "extra": { - "autoload-splitter": { - "splitter-logic": "WP_CLI\\AutoloadSplitter", - "splitter-location": "php/WP_CLI/AutoloadSplitter.php", - "split-target-prefix-true": "autoload_commands", - "split-target-prefix-false": "autoload_framework" - } - }, - "autoload": { - "psr-0": { - "WP_CLI": "php" - }, - "psr-4": { - "": "php/commands/src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A command line interface for WordPress", - "homepage": "http://wp-cli.org", - "keywords": [ - "cli", - "wordpress" - ], - "time": "2017-08-08T14:28:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "dev", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/includes/libraries/action-scheduler/docs/CNAME b/includes/libraries/action-scheduler/docs/CNAME deleted file mode 100644 index 3b480b54c79..00000000000 --- a/includes/libraries/action-scheduler/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -actionscheduler.org \ No newline at end of file diff --git a/includes/libraries/action-scheduler/docs/_config.yml b/includes/libraries/action-scheduler/docs/_config.yml deleted file mode 100644 index fe521d98c39..00000000000 --- a/includes/libraries/action-scheduler/docs/_config.yml +++ /dev/null @@ -1,7 +0,0 @@ -title: Action Scheduler - Job Queue for WordPress -description: A scalable, traceable job queue for background processing large queues of tasks in WordPress. Designed for distribution in WordPress plugins - no server access required. -theme: jekyll-theme-hacker -permalink: /:slug/ -plugins: - - jekyll-seo-tag - - jekyll-sitemap diff --git a/includes/libraries/action-scheduler/docs/_layouts/default.html b/includes/libraries/action-scheduler/docs/_layouts/default.html deleted file mode 100644 index b7670ce9a41..00000000000 --- a/includes/libraries/action-scheduler/docs/_layouts/default.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - -{% seo %} - - - - -
    - - - -
    -

    Usage | Admin | WP-CLI | Background Processing at Scale | API | FAQ -

    action-scheduler

    -

    A scalable, traceable job queue for background processing large queues of tasks in WordPress. Designed for distribution in WordPress plugins - no server access required.

    -
    -
    - -
    -
    - {{ content }} -
    -
    - - - - {% if site.google_analytics %} - - {% endif %} - - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/docs/admin.md b/includes/libraries/action-scheduler/docs/admin.md deleted file mode 100644 index 5ef0b56cb8f..00000000000 --- a/includes/libraries/action-scheduler/docs/admin.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -description: Learn how to administer background jobs with the Action Scheduler job queue for WordPress. ---- -# Scheduled Actions Administration Screen - -Action Scheduler has a built in administration screen for monitoring, debugging and manually triggering scheduled actions. - -The administration interface is accesible through both: - -1. **Tools > Scheduled Actions** -1. **WooCommerce > Status > Scheduled Actions**, when WooCommerce is installed. - -Among other tasks, from the admin screen you can: - -* run a pending action -* view the scheduled actions with a specific status, like the all actions which have failed or are in-progress (https://cldup.com/NNTwE88Xl8.png). -* view the log entries for a specific action to find out why it failed. -* sort scheduled actions by hook name, scheduled date, claim ID or group name. - -Still have questions? Check out the [FAQ](/faq). - -![](https://cldup.com/5BA2BNB1sw.png) diff --git a/includes/libraries/action-scheduler/docs/android-chrome-192x192.png b/includes/libraries/action-scheduler/docs/android-chrome-192x192.png deleted file mode 100644 index 86753dbcd990ac6080f3ef07d53dbbc538a023fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17032 zcma%C1y>tw(+=)#r8pEQUZl9YySqb?;!bdP*W&K(*5Yo(p#*n#3Gn54f5CThvU_&3 zXEQrHGxy9j*F-8SN}(ZtMg{-?Xfo2`s*wHf|GtRukge*59Rg$rYbBx}0su6`qkv7| zAjjlp(y9sofHw^Q5D)?Yyg*I`9034s-vEFUV*r3R0{|d!{MD(#5BUM!R8C49@bTX# zzo#r2at6UwMnM8$2ZaERl2XSgniT*Lp_368QTJRs@6n0T*YT!#$Z@&A*SpA^OdT_K zrj2IAw>@6#tn6G!>XZtSOfZ*Whe4_zu^50^4M3YLg6ey+kGWn6U_B2M@cV3S35eC5 zkhXEF(yOUe)xxti!HXWE9@|JCWqKg;;5mGvxV7ADcXALnH{TPr^!;riE=hCgyz}~T zoA&`mnUy56Z=U=AZTL~hrGPN@cH2FVn|wEyJ3gS-T>cXuZad=V{5;&Vz^z!Y0Xs-f zz%IeBj(b2)|5$- zuR(8#1)JANU47e`j{yDU6_UzrDw49!`lCS+f!fiQGxIg|YkIlf=r^Kmb9{=r!r@Ev zQ6F+&cqqs2&~0%PVc6}{#GXwN+ium5nJlOwX~(Gu6oYsqgSlcw!sV`)*%{nKWwcef z3JzQi_dsD2RD%#%16j=B1WH_9{>HJj)c_=FICV$Dm3_4aa9CGS5nJ|AmZlQz!$z+4any=LJ8mGkyU`BM|_? zL#Uv%kdyYAH9O=qiBTqM#R$f!dD9JwZmVwBoaxF^7?W34u!FWJMB}~&a%%=%O(F{i zhk#I4gAs1~wA3q5V|Wby1z%KXi{4f63gO8a$5fbVtL$T19MR$;i580>nuZ7uT$B1U z!$zql1Z_$4;d^N_Cx(}F-#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qO_V&3%juf3tqei2|xc#u^E`= z-FG|NkKI@t6KJn1uMqyHXcaFMa|isZ$F&>X$TVf0wOJ~^Z&&tGub^JwYdKk0>}PHj zc1V9C^S2O@=Z~b#0#lCy`TDL1^j4A@HvhG?k0(f=04QV8D5wxpcQy%a@nu|If^Fga ztPOfVi=4+l9v?Z!AjkAHXivER zZT9=s#trp%1$46Sl~vohf{JiOCxJuvm>3)s72a0=2me2@9IFS4#BaF$N%&5SThMe3lfyjuMa`RI%(<*Um*yNMH6sRG*DkP#LD6w3jpeR2rGbdG{ zq_QAYA+w+)nSr5V&f`x!9ED*T8mIhEpYePe#K5e~t(VL#tSsz3S%g_w!KK0Ea0;{X t<`9L`H?EvGa^{H45%$v!9t*tm7+#4BmV9zDoeH#q!PC{xWt~$(699YnQAPj& diff --git a/includes/libraries/action-scheduler/docs/android-chrome-256x256.png b/includes/libraries/action-scheduler/docs/android-chrome-256x256.png deleted file mode 100644 index 3e5f9b1029d0d99763727a10537539943ae7404f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24599 zcmbSy^;cWX_jO1E4cb7FVuj!i#a)7HaVJQz;ua|G4#lB3#frOAoCgXNYjJld?hg6# zdH;lW-5*Boy6c`bb7tnu-upzVs>otvkYE4+0Bm_VDRlq<<)w-O0HeJWhAt(RF9pa- zLRkU;sExyXG(~-BQ+|?DR|WvQ=m3C#5CGu*r7K_$06=g60Q)8YfZ#U(fXFGUO-=aa z1)7DL>WM5t6$ddATo004N4yp)9ImxZGaop>7gjQ7{A z-VvHbjeGmY`!=jHmzO2k1oiD6-YtEBgMHZ&@syxgMXou#H$LlcDXe|+h|x*Ff3V)z za=$`Rh^PEAz(p4LANldMgM+(!!`|m*qvh!$i~acHvGB5zsF~h{ z-sZGfwcU*SO^dhqjLVUti3I{cB@hG z8#u5cCB0Vg$CPhZ(j`QBMb@`TrxK+*S{98Fr2&N%a!pf?_!G?gpfpXB1kloyM^S~* zXd#5Wj|F86b!uQl6twsx7M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ke)F!m ztHjQLe^0)V-1l481Mla($$lo7cnTRfYc+Nr1eJi?XP+PN{o1E_kODQirddL@3;yOC zayf#RXBWb`f?)zxaCO9!=_MZ8wouYux8JsGaF8PQLU+y2YGX`{nUUm5~ZTCh#$6zGgcAYJ#F(Pz=-u*)YDc-UdTv7uoCXH)>Q?>*XGDtq%N z(sWc^={fpk32WrG;$;G((Bu8vvuF>MV?|*1?b1EJu}`(eSzo_zXBeRxxV$hJ`ntuW zZ%q*w5=ycAZR?IT^b^Rxd@qr0LV66taU9A-V$rONjt!${>yy%S%t97h*#1Sq9Yz7? z9{a#ZQRcz9_EC~G2*QZ#7vQFFNdgq;lG+T6FSqR?l5PKp1?gOPeTgj=Q)7lRy?PNi z=NKQw3rGdbCJC^|e8TH83Uot(!}toj097`?Q0u>c8`5$9EoIbn?cX$j_&r`QYSrV6 zXh-$&^{7d^;W!iUV;_ScjQ~Y$m*W^1^d}SG@C1eW1USC07XAN-;a{JD8B*Yu-Hf-i z09t#I0IkOXPWA!L%8oCbfiIA(%&j|;w{A(w-ZqnwSH3L=d?aLUDa*)ovd>)lzaH@N zaeD3&^8bFITHmJtc);?N+2a5c`(Odz7d|e}J)H#tLVTSCp8Ezkf}2^l;MzL?g^B<;ct_%&C{cMZ+ne86nr{L?c{dCNMZV)z>xDb+wCrFycYBt`rEx X%N}reUp@_Z1?Zucfo8>hyQu#I?q2|H diff --git a/includes/libraries/action-scheduler/docs/api.md b/includes/libraries/action-scheduler/docs/api.md deleted file mode 100644 index a0bbb5d3fbd..00000000000 --- a/includes/libraries/action-scheduler/docs/api.md +++ /dev/null @@ -1,179 +0,0 @@ ---- -description: Reference guide for background processing functions provided by the Action Scheduler job queue for WordPress. ---- -# API Reference - -Action Scheduler provides a range of functions for scheduling hooks to run at some time in the future on one or more occassions. - -To understand the scheduling functoins, it can help to think of them as extensions to WordPress' `do_action()` function that add the ability to delay and repeat when the hook will be triggered. - -## WP-Cron APIs vs. Action Scheduler APIs - -The Action Scheduler API functions are designed to mirror the WordPress [WP-Cron API functions](http://codex.wordpress.org/Category:WP-Cron_Functions). - -Functions return similar values and accept similar arguments to their WP-Cron counterparts. The notable differences are: - -* `as_schedule_single_action()` & `as_schedule_recurring_action()` will return the post ID of the scheduled action rather than boolean indicating whether the event was scheduled -* `as_schedule_recurring_action()` takes an interval in seconds as the recurring interval rather than an arbitrary string -* `as_schedule_single_action()` & `as_schedule_recurring_action()` can accept a `$group` parameter to group different actions for the one plugin together. -* the `wp_` prefix is substituted with `as_` and the term `event` is replaced with `action` - -## API Function Availability - -As mentioned in the [Usage - Load Order](/usage/#load-order) section, Action Scheduler will initialize itself on the `'init'` hook with priority `1`. While API functions are loaded prior to this and call be called, they should not be called until after `'init'` with priority `1`, because each component, like the data store, has not yet been initialized. - -Do not use Action Scheduler API functions prior to `'init'` hook with priority `1`. Doing so could lead to unexpected results, like data being stored in the incorrect location. - -## Function Reference / `as_schedule_single_action()` - -### Description - -Schedule an action to run one time. - -### Usage - -```php -as_schedule_single_action( $timestamp, $hook, $args, $group ) -```` - -### Parameters - -- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_. -- **$hook** (string)(required) Name of the action hook. Default: _none_. -- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. -- **$group** (array) The group to assign this job to. Default: _''_. - -### Return value - -(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table. - - -## Function Reference / `as_schedule_recurring_action()` - -### Description - -Schedule an action to run repeatedly with a specified interval in seconds. - -### Usage - -```php -as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ) -```` - -### Parameters - -- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_. -- **$interval_in_seconds** (integer)(required) How long to wait between runs. Default: _none_. -- **$hook** (string)(required) Name of the action hook. Default: _none_. -- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. -- **$group** (array) The group to assign this job to. Default: _''_. - -### Return value - -(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table. - - -## Function Reference / `as_schedule_cron_action()` - -### Description - -Schedule an action that recurs on a cron-like schedule. - -### Usage - -```php -as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ) -```` - -### Parameters - -- **$timestamp** (integer)(required) The Unix timestamp representing the date you want the action to run. Default: _none_. -- **$schedule** (string)(required) $schedule A cron-link schedule string, see http://en.wikipedia.org/wiki/Cron. Default: _none_. -- **$hook** (string)(required) Name of the action hook. Default: _none_. -- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. -- **$group** (array) The group to assign this job to. Default: _''_. - -### Return value - -(integer) the action's ID in the [posts](http://codex.wordpress.org/Database_Description#Table_Overview) table. - - -## Function Reference / `as_unschedule_action()` - -### Description - -Cancel the next occurrence of a job. - -### Usage - -```php -as_unschedule_action( $hook, $args, $group ) -```` - -### Parameters - -- **$hook** (string)(required) Name of the action hook. Default: _none_. -- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. -- **$group** (array) The group to assign this job to. Default: _''_. - -### Return value - -(null) - - -## Function Reference / `as_next_scheduled_action()` - -### Description - -Returns the next timestamp for a scheduled action. - -### Usage - -```php -as_next_scheduled_action( $hook, $args, $group ) -```` - -### Parameters - -- **$hook** (string)(required) Name of the action hook. Default: _none_. -- **$args** (array) Arguments to pass to callbacks when the hook triggers. Default: _`array()`_. -- **$group** (array) The group to assign this job to. Default: _''_. - -### Return value - -(integer|boolean) The timestamp for the next occurrence, or false if nothing was found. - - -## Function Reference / `as_get_scheduled_actions()` - -### Description - -Find scheduled actions. - -### Usage - -```php -as_get_scheduled_actions( $args, $return_format ) -```` - -### Parameters - -- **$args** (array) Arguments to search and filter results by. Possible arguments, with their default values: - * `'hook' => ''` - the name of the action that will be triggered - * `'args' => NULL` - the args array that will be passed with the action - * `'date' => NULL` - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). - * `'date_compare' => '<=`' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' - * `'modified' => NULL` - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). - * `'modified_compare' => '<='` - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' - * `'group' => ''` - the group the action belongs to - * `'status' => ''` - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING - * `'claimed' => NULL` - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID - * `'per_page' => 5` - Number of results to return - * `'offset' => 0` - * `'orderby' => 'date'` - accepted values are 'hook', 'group', 'modified', or 'date' - * `'order' => 'ASC'` -- **$return_format** (string) The format in which to return the scheduled actions: 'OBJECT', 'ARRAY_A', or 'ids'. Default: _'OBJECT'_. - -### Return value - -(array) Array of the actions matching the criteria specified with `$args`. diff --git a/includes/libraries/action-scheduler/docs/apple-touch-icon.png b/includes/libraries/action-scheduler/docs/apple-touch-icon.png deleted file mode 100644 index 1bc497520175a3fdf0c0f43a85db65219ae1ca07..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8053 zcmb_>Ra9GD)NKm11P@ZAMS@c(UfkWGcySNKA-GE^TA&mwPLblJxJ%LCUP{p7?oc4e zJ>Sb6<38M{{~sAAdt_(J$vQJ@&NX-RTXh9I>=)P|5C~66QC16R>;AjIXux|-RiX{h zVAx8jNr6Ds2{?BaPl3-+D@83e5Xg@S1PTcUfo_4WkR1@nlM4jeGY5f$zk)zyu30Ub zqQDo=EL9X_L685v^4g1&fF4W_B{ezBH5{_1bhKT1$XF1Fnp8P4EsY_%48zMn5wxYIPRtY*(-Iefpun-_m79)Z zD0Kqn&W$$UBJdW z37^cy{R`sIxZl{D=9L8(ldG0??6{lSl9%L=*@g4Us~9oF2;n5T z=bE}KDqLwP`D_7*@lmlcjxp?N!l4r~jlH z1Ey3yKj!?b#y>nGR3v+)2~%uJSBBdV3xQl{Z2}L?UG3xF%0jw1E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=@&uHiFpRP*~86Zdj^%{WWbvSN+2VPeK5?tlm!3CO<>FihO*(k#taLq#)`b^(szw+ zHa$Ei&dhw4ie3h#Ag*U7TxlVxTC*E93I)1Au7~IE1@m@slix>m`f;>O{#!5y*8IhI zwQk1lAT+)@w&~+qicKZgNJ6fbHqmNHOmtCOM{!K?v!d1@_fzcggCi})bXtDVn^FE1Mxw=fsivxeQY|7U`ei?toh_y0e^dtZ|cn4s^c^Ug!d!W-%ecY)bC+CV*g zU2ULtt{zq(kWbe787|mOkA-DOV|YYqQwxMnkHcYwLrhPsl0 - - - - - #151515 - - - diff --git a/includes/libraries/action-scheduler/docs/faq.md b/includes/libraries/action-scheduler/docs/faq.md deleted file mode 100644 index 38f07f59de1..00000000000 --- a/includes/libraries/action-scheduler/docs/faq.md +++ /dev/null @@ -1,101 +0,0 @@ -## FAQ - -### Is it safe to release Action Scheduler in my plugin? Won't its functions conflict with another copy of the library? - -Action Scheduler is designed to be used and released in plugins. It avoids redeclaring public API functions when more than one copy of the library is being loaded by different plugins. It will also load only the most recent version of itself (by checking registered versions after all plugins are loaded on the `'plugins_loaded'` hook). - -To use it in your plugin, simply require the `action-scheduler/action-scheduler.php` file. Action Scheduler will take care of the rest. - -### I don't want to use WP-Cron. Does Action Scheduler depend on WP-Cron? - -By default, Action Scheduler is initiated by WP-Cron. However, it has no dependency on the WP-Cron system. You can initiate the Action Scheduler queue in other ways with just one or two lines of code. - -For example, you can start a queue directly by calling: - -```php -ActionScheduler::runner()->run(); -``` - -Or trigger the `'action_scheduler_run_queue'` hook and let Action Scheduler do it for you: - -```php -do_action( 'action_scheduler_run_queue' ); -``` - -Further customization can be done by extending the `ActionScheduler_Abstract_QueueRunner` class to create a custom Queue Runner. For an example of a customized queue runner, see the [`ActionScheduler_WPCLI_QueueRunner`](https://github.com/Prospress/action-scheduler/blob/master/classes/ActionScheduler_WPCLI_QueueRunner.php), which is used when running WP CLI. - -Want to create some other method for initiating Action Scheduler? [Open a new issue](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it. - -### I don't want to use WP-Cron, ever. Does Action Scheduler replace WP-Cron? - -By default, Action Scheduler is designed to work alongside WP-Cron and not change any of its behaviour. This helps avoid unexpectedly overriding WP-Cron on sites installing your plugin, which may have nothing to do with WP-Cron. - -However, we can understand why you might want to replace WP-Cron completely in environments within you control, especially as it gets you the advantages of Action Scheduler. This should be possible without too much code. - -You could use the `'schedule_event'` hook in WordPress to use Action Scheduler for only newly scheduled WP-Cron jobs and map the `$event` param to Action Scheduler API functions. - -Alternatively, you can use a combination of the `'pre_update_option_cron'` and `'pre_option_cron'` hooks to override all new and previously scheduled WP-Cron jobs (similar to the way [Cavalcade](https://github.com/humanmade/Cavalcade) does it). - -If you'd like to create a plugin to do this automatically and want to share your work with others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it. - -### Eww gross, Custom Post Types! That's _so_ 2010. Can I use a different storage scheme? - -Of course! Action Scheduler data storage is completely swappable, and always has been. - -You can store scheduled actions in custom tables in the WordPress site's database. Some sites using it already are. You can actually store them anywhere for that matter, like in a remote storage service from Amazon Web Services. - -To implement a custom store: - -1. extend the abstract `ActionScheduler_Store` class, being careful to implement each of its methods -2. attach a callback to `'action_scheduler_store_class'` to tell Action Scheduler your class is the one which should be used to manage storage, e.g. - -``` -function eg_define_custom_store( $existing_storage_class ) { - return 'My_Radical_Action_Scheduler_Store'; -} -add_filter( 'action_scheduler_store_class', 'eg_define_custom_store', 10, 1 ); -``` - -Take a look at the `ActionScheduler_wpPostStore` class for an example implementation of `ActionScheduler_Store`. - -If you'd like to create a plugin to do this automatically and release it publicly to help others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it. - -> Note: we're also moving Action Scheduler itself to use [custom tables for better scalability](https://github.com/Prospress/action-scheduler/issues/77). - -### Can I use a different storage scheme just for logging? - -Of course! Action Scheduler's logger is completely swappable, and always has been. You can also customise where logs are stored, and the storage mechanism. - -To implement a custom logger: - -1. extend the abstract `ActionScheduler_Logger` class, being careful to implement each of its methods -2. attach a callback to `'action_scheduler_logger_class'` to tell Action Scheduler your class is the one which should be used to manage logging, e.g. - -``` -function eg_define_custom_logger( $existing_storage_class ) { - return 'My_Radical_Action_Scheduler_Logger'; -} -add_filter( 'action_scheduler_logger_class', 'eg_define_custom_logger', 10, 1 ); -``` - -Take a look at the `ActionScheduler_wpCommentLogger` class for an example implementation of `ActionScheduler_Logger`. - -### I want to run Action Scheduler only on a dedicated application server in my cluster. Can I do that? - -Wow, now you're really asking the tough questions. In theory, yes, this is possible. The `ActionScheduler_QueueRunner` class, which is responsible for running queues, is swappable via the `'action_scheduler_queue_runner_class'` filter. - -Because of this, you can effectively customise queue running however you need. Whether that means tweaking minor things, like not using WP-Cron at all to initiate queues by overriding `ActionScheduler_QueueRunner::init()`, or completely changing how and where queues are run, by overriding `ActionScheduler_QueueRunner::run()`. - -### Is Action Scheduler safe to use on my production site? - -Yes, absolutely! Action Scheduler is actively used on tens of thousands of production sites already. Right now it's responsible for scheduling everything from emails to payments. - -In fact, every month, Action Scheduler processes millions of payments as part of the [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/) extension. - -It requires no setup, and won't override any WordPress APIs (unless you want it to). - -### How does Action Scheduler work on WordPress Multisite? - -Action Scheduler is designed to manage the scheduled actions on a single site. It has no special handling for running queues across multiple sites in a multisite network. That said, because it's storage and Queue Runner are completely swappable, it would be possible to write multisite handling classes to use with it. - -If you'd like to create a multisite plugin to do this and release it publicly to help others, [open a new issue to let us know](https://github.com/Prospress/action-scheduler/issues/new), we'd love to help you with it. diff --git a/includes/libraries/action-scheduler/docs/favicon-16x16.png b/includes/libraries/action-scheduler/docs/favicon-16x16.png deleted file mode 100644 index aa772d149406dc6659ad4d2f6b6b2a92bfe68b76..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1160 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e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z}lW&gUrh-x>|h!bG1Mn5PtvP7YSr8ergRy12KIkgZFq zrQdsbTS@`5#GI8K(=^anhxM1Iw>50X*F03b)H8aVw9^czr$2pZz-{c-luk{lT}$25 zCz)pQx%7nrWAKh_D2&itx~;4bTAcPRZz~RRDQjP|B7R!GRNbE%40d4Rory8^IkH{C z-|-8>hQyP-S{|h-FO~wEK diff --git a/includes/libraries/action-scheduler/docs/favicon.ico b/includes/libraries/action-scheduler/docs/favicon.ico deleted file mode 100644 index 3cdbb517ab61e63daa89208f9e8ffb4fa22efb95..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmeI233OD|8OL7;s{)}SvZzc@uu`c)t&~b7;!zfnkWDRAD!8E>Y^}S94H^nn(a@?W zRE%0d1(78aP!1RZDabY~qOw%h3Q8>`AdrMGufPAxyvdtkl6eziP0w-8`ElR9_q*Ty z?)Ke<7)G2CZ*=Wy5GES$bTW+YhG8To2I4IYV+Uz12$g?#eZv@!z{SW=#25xjw|*Tf zf*<}3?SXWkw;m*%PU67GiT(*aT*P6=`edpIs?Y zx4*FYX@~7W%SDr^i6(1x+3rGWfw>vUgU!@6g^Vc>7-W8WKK?*q>81nK{Q&mb4Z zK{9xN(@x#^VM|{)0#4iYeH7FNXS#gu7cd>nDX(Qv(&eIHze;OxCip#7}&D% z!Q0^x)=BH{V=S<*HTAD`*d*IZI1}9zZV&0rAp@3zbAD-TmczBFYv$JrFZW%?srMnU z`?MnTdFQ6Ac)v-cx{+-O_k-q@v)lpVe@Iz1Ct|rsx@sehIy-^Zrqh-~j6s$A*^Qe& zjAQ-wpiDkE_wo|r&t+^{*sL~ebEBj0+$nL?`8+u7H`CU6Um39I&1&ZZW!k}O;G9qT z&Q4u5_e?kS*MFZcW z9yjGrSBAb){YygZr$5=}ZgZ=fvK|PzU!ZsVHPa{6+8&4gCU8Fd7!sMM&8WlDPyBW$ zhu|2b`Miq;t(fiFpP=ss$`?6w?4b{S>b4K6l1pE|ARe8XBYCh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g3;JRo1Bc^lGZ=BU~wpWg|z zWmUpAL2K$HsGN=ZNbT4Ot052GgqL6vOa}Sq<)FE& zv9-(Y<9j4;oe}4k`osPqcP3l{niGG8WgvZaJ8YfNLXEf1sX2^ccl>kA<49TUb?Q&8 z4Xv3`ptkA_OzqqRn%7@|e6f7I=Fn8Q3)GINZMNI)HbiHAP(Nu7$%mW^?W}kW{x8;T zy|pP<@ovDs`(Zik1s*GStuW1^B%V#;VHk`_GRyzyG0T$@On=e@)9>La!?V{cNH}8d z%q}()vWv?zCzPHvSC*D!t}HGv_ZMfIhl+F17KhfQ9&-Xu7zsRIpd;{HK^1zZ(6dA$ z1m7uKzWUM6o#8Ty#{8q4)~)8x2l#@fF)N?|Wyio#=JkLYmcN+td!P_*hhD(hCbAC= zuLHZaE?xlnh}S@8iv^GgiQ)2*;>cYIMfj|2^flnSJIsQ0&@WOMXBsk%K>fG}pKjeR z_-+O|lkA`^S3BjM-{iM~^FU{tpaq#ezWd9 ze5)N>kj?2kXR77fIbWzh7m&7y@Oqd5_kw)9Z0apipt57MW> z6-it^Pi^f7>OZwf^LI0Bg)OiOrb2IQ50 p9>egDfCqT{e9SOTTxA%?7aPW*R}CY-oF~&#!zeg{94|yF`(MaKb6Wra diff --git a/includes/libraries/action-scheduler/docs/google14ef723abb376cd3.html b/includes/libraries/action-scheduler/docs/google14ef723abb376cd3.html deleted file mode 100644 index f3bf1712501..00000000000 --- a/includes/libraries/action-scheduler/docs/google14ef723abb376cd3.html +++ /dev/null @@ -1 +0,0 @@ -google-site-verification: google14ef723abb376cd3.html \ No newline at end of file diff --git a/includes/libraries/action-scheduler/docs/index.md b/includes/libraries/action-scheduler/docs/index.md deleted file mode 100644 index 989f262a4fc..00000000000 --- a/includes/libraries/action-scheduler/docs/index.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Action Scheduler - Background Processing Job Queue for WordPress ---- -## WordPress Job Queue with Background Processing - -Action Scheduler is a library for triggering a WordPress hook to run at some time in the future. Each hook can be scheduled with unique data, to allow callbacks to perform operations on that data. The hook can also be scheduled to run on one or more occassions. - -Think of it like an extension to `do_action()` which adds the ability to delay and repeat a hook. - -It just so happens, this functionality also creates a robust job queue for background processing large queues of tasks in WordPress. With the additional of logging and an [administration interface](/admin/), that also provide tracability on your tasks processed in the background. - -### Battle-Tested Background Processing - -Every month, Action Scheduler processes millions of payments for [Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/), webhooks for [WooCommerce](https://wordpress.org/plugins/woocommerce/), as well as emails and other events for a range of other plugins. - -It's been seen on live sites processing queues in excess of 50,000 jobs and doing resource intensive operations, like processing payments and creating orders, in 10 concurrent queues at a rate of over 10,000 actions / hour without negatively impacting normal site operations. - -This is all possible on infrastructure and WordPress sites outside the control of the plugin author. - -Action Scheduler is specifically designed for distribution in WordPress plugins (and themes) - no server access required. If your plugin needs background processing, especially of large sets of tasks, Action Scheduler can help. - -### How it Works - -Action Scheduler uses a WordPress [custom post type](http://codex.wordpress.org/Post_Types), creatively named `scheduled-action`, to store the hook name, arguments and scheduled date for an action that should be triggered at some time in the future. - -The scheduler will attempt to run every minute by attaching itself as a callback to the `'action_scheduler_run_schedule'` hook, which is scheduled using WordPress's built-in [WP-Cron](http://codex.wordpress.org/Function_Reference/wp_cron) system. - -When triggered, Action Scheduler will check for posts of the `scheduled-action` type that have a `post_date` at or before this point in time i.e. actions scheduled to run now or at sometime in the past. - -### Batch Processing Background Jobs - -If there are actions to be processed, Action Scheduler will stake a unique claim for a batch of 20 actions and begin processing that batch. The PHP process spawned to run the batch will then continue processing batches of 20 actions until it times out or exhausts available memory. - -If your site has a large number of actions scheduled to run at the same time, Action Scheduler will process more than one batch at a time. Specifically, when the `'action_scheduler_run_schedule'` hook is triggered approximately one minute after the first batch began processing, a new PHP process will stake a new claim to a batch of actions which were not claimed by the previous process. It will then begin to process that batch. - -This will continue until all actions are processed using a maximum of 5 concurrent queues. - -### Housekeeping - -Before processing a batch, the scheduler will remove any existing claims on actions which have been sitting in a queue for more than five minutes. - -Action Scheduler will also trash any actions which were completed more than a month ago. - -If an action runs for more than 5 minutes, Action Scheduler will assume the action has timed out and will mark it as failed. However, if all callbacks attached to the action were to successfully complete sometime after that 5 minute timeout, its status would later be updated to completed. - -### Traceable Background Processing - -Did your background job run? - -Never be left wondering with Action Scheduler's built-in record keeping. - -All events for each action are logged in the [comments table](http://codex.wordpress.org/Database_Description#Table_Overview) and displayed in the [administration interface](/admin/). - -The events logged by default include when an action: - * is created - * starts - * completes - * fails - -If it fails with an error that can be recorded, that error will be recorded in the log and visible in administration interface, making it possible to trace what went wrong at some point in the past on a site you didn't have access to in the past. - -Actions can also be grouped together using a custom taxonomy named `action-group`. - -## Credits - -Developed and maintained by [Prospress](http://prospress.com/) in collaboration with [Flightless](https://flightless.us/). - -Collaboration is cool. We'd love to work with you to improve Action Scheduler. [Pull Requests](https://github.com/prospress/action-scheduler/pulls) welcome. \ No newline at end of file diff --git a/includes/libraries/action-scheduler/docs/mstile-150x150.png b/includes/libraries/action-scheduler/docs/mstile-150x150.png deleted file mode 100644 index 3a3ed191109e302730b66dd5853a6e6f5228e489..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4246 zcmbVPS5y;aUNax_Gj9x#S}cq_i~s3kp85i;)8WZYXN2tC|GNZ7l|2 zO;>Zf_I6aRUkSbY=ux%rOJvn7{lDr;4T%PLH|uEtf7C@DrDOFaUJZv)>U~&q)kH?gyWX zt^|BPnBO^F4LNyna@P9Sz<(c7qI776#2AjmJYWQe0U|U-%=1i8pEo}Xl?-KwR-9t* z?Y$yqFAyf4A8UN4?ONZRzMDGS2yyyD(b40VYqHwM@9~QhwYk!sjttE+^Jlk;6GZSd zRJo|6RO4O?q!Sb*R+uVCt=Ekh5?1K&Zg@{P34A9%aaC(cg|t1^ovcR7jTC0TGaS%` z2CIp0cfs5oC3p6CYHIJ#aGlhmY90&WsgT(5tglcJG^|j}+n;lE(P*MB`p?>fs=*zz zA}&!pjn17;=OGk~UCi}a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%Mnrc!5Ne&71h08BjQO)Jl-b=d_;WNWPN@X-pUOkxn(s1%cQwJ}R4 zpvq;#?+Q<4DQJ3;*pJGYbj%ypBJc_MKD894&nB9KhHa-PV_2QKnR2oHQ|&R2IQ_z+ zDtOPHHwVhdLxyuQA0U+A?8LHJ7PQ0Q_OA44;P_)Pjp3uRM_4q18;*q zGP@_fxP3b5CmW^~kzEa>wD;^Wi;t%jRgIP;NCj78~tWou6MN3$0 zm3e605e2SjkMnNWQ~ER1XKlNX+1i@LYtHUVYKn6WO^xQ(R4{%R!>yMW8*drL@z;}% z@hZk-G| zN;)skL|fP7Pa|k;R((sSRaJhqzfA(RDnXcGeWZSU=0P1E=V76Cd&f}C%V!7v?XY~s z;L5Zi=P8B>U*;q^S>+=Ab{0;{(EQ#QS2J0f9M*e|UU@3B%RA}m!gWT)zz?5XUf3A6 z5{0sBU6nT7T%U+!scl z#6o2qX+^}tToR@#-Qqn!Mxb(^F23AO#C7GHv)(Olr;Kx|8b>>Ne5=GmWVXptW+c#u z#eYZ6ULU(l?AR}Fo`GK;HXYGWV|wB$8&L;jbbpY<(BFNC~Q^6 zNt47sIt6AV8Hd1yz10R=0&h_i4m__yxW?MSN9fdXeX8bGx*vKnL_XjkPbIo`@{jnU zwNMI=I;pMM@!Ihj@e%SpJPnVnz7iJK?{H%qs8Wvb*2doRs3FC4J0I;mw zLuolVX)we@Rvrd{UZ$k1986ZWoo$-?e;K@doZV4@|F_|To=@?m!5n8|fi-gQ7kGy8 zLAiUn2w(%Bxd^yF!#V)~0XfV2%-7InVq$%d`v>zgC6b@Q;0rgkV vc4t~porysI%tTMeKnHIJL;ov8p3XhMCKnraA1 'POST', - 'timeout' => 45, - 'redirection' => 5, - 'httpversion' => '1.0', - 'blocking' => false, - 'headers' => array(), - 'body' => array( - 'action' => 'eg_create_additional_runners', - 'instance' => $i, - 'eg_nonce' => wp_create_nonce( 'eg_additional_runner_' . $i ), - ), - 'cookies' => array(), - ) ); - } -} -add_action( 'action_scheduler_run_queue', 'eg_request_additional_runners', 0 ); - -/** - * Handle requests initiated by eg_request_additional_runners() and start a queue runner if the request is valid. - */ -function eg_create_additional_runners() { - - if ( isset( $_POST['eg_nonce'] ) && isset( $_POST['instance'] ) && wp_verify_nonce( $_POST['eg_nonce'], 'eg_additional_runner_' . $_POST['instance'] ) ) { - ActionScheduler_QueueRunner::instance()->run(); - } - - wp_die(); -} -add_action( 'wp_ajax_nopriv_eg_create_additional_runners', 'eg_create_additional_runners', 0 ); -``` - -## High Volume Plugin - -It's not necessary to add all of this code yourself, the folks at [Prospress](https://prospress.com) have created a handy plugin to get access to each of these increases - the [Action Scheduler - High Volume](https://github.com/prospress/action-scheduler-high-volume) plugin. diff --git a/includes/libraries/action-scheduler/docs/safari-pinned-tab.svg b/includes/libraries/action-scheduler/docs/safari-pinned-tab.svg deleted file mode 100644 index b67c32ba580..00000000000 --- a/includes/libraries/action-scheduler/docs/safari-pinned-tab.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - -Created by potrace 1.11, written by Peter Selinger 2001-2013 - - - - - diff --git a/includes/libraries/action-scheduler/docs/site.webmanifest b/includes/libraries/action-scheduler/docs/site.webmanifest deleted file mode 100644 index de65106f489..00000000000 --- a/includes/libraries/action-scheduler/docs/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-256x256.png", - "sizes": "256x256", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/includes/libraries/action-scheduler/docs/usage.md b/includes/libraries/action-scheduler/docs/usage.md deleted file mode 100644 index dda4ed7d902..00000000000 --- a/includes/libraries/action-scheduler/docs/usage.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -description: Learn how to use the Action Scheduler background processing job queue for WordPress in your WordPress plugin. ---- -# Usage - -Using Action Scheduler requires: - -1. installing the library -1. scheduling and action -1. attaching a callback to that action - -## Scheduling an Action - -To schedule an action, call the [API function](/api/) for the desired schedule type passing in the required parameters. - -The example code below shows everything needed to schedule a function to run at midnight, if it's not already scheduled: - -```php -require_once( plugin_dir_path( __FILE__ ) . '/libraries/action-scheduler/action-scheduler.php' ); - -/** - * Schedule an action with the hook 'eg_midnight_log' to run at midnight each day - * so that our callback is run then. - */ -function eg_log_action_data() { - if ( false === as_next_scheduled_action( 'eg_midnight_log' ) ) { - as_schedule_recurring_action( strtotime( 'midnight tonight' ), DAY_IN_SECONDS, 'eg_midnight_log' ); - } -} -add_action( 'init', 'eg_log_action_data' ); - -/** - * A callback to run when the 'eg_midnight_log' scheduled action is run. - */ -function eg_log_action_data() { - error_log( 'It is just after midnight on ' . date( 'Y-m-d' ) ); -} -add_action( 'eg_midnight_log', 'eg_log_action_data' ); -``` - -For more details on all available API functions, and the data they accept, refer to the [API Reference](/api/). - -## Installation - -There are two ways to install Action Scheduler: - -1. regular WordPress plugin; or -1. a library within your plugin's codebase. - -### Usage as a Plugin - -Action Scheduler includes the necessary file headers to be used as a standard WordPress plugin. - -To install it as a plugin: - -1. Download the .zip archive of the latest [stable release](https://github.com/Prospress/action-scheduler/releases) -1. Go to the **Plugins > Add New > Upload** administration screen on your WordPress site -1. Select the archive file you just downloaded -1. Click **Install Now** -1. Click **Activate** - -Or clone the Git repository into your site's `wp-content/plugins` folder. - -Using Action Scheduler as a plugin can be handy for developing against newer versions, rather than having to update the subtree in your codebase. **When installed as a plugin, Action Scheduler does not provide any user interfaces for scheduling actions**. The only way to interact with Action Scheduler is via code. - -### Usage as a Library - -To use Action Scheduler as a library: - -1. include the Action Scheduler codebase -1. load the library by including the `action-scheduler.php` file - -Using a [subtree in your plugin, theme or site's Git repository](https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree) to include Action Scheduler is the recommended method. Composer can also be used. - -To include Action Scheduler as a git subtree: - -#### Step 1. Add the Repository as a Remote - -``` -git remote add -f subtree-action-scheduler https://github.com/Prospress/action-scheduler.git -``` - -Adding the subtree as a remote allows us to refer to it in short from via the name `subtree-action-scheduler`, instead of the full GitHub URL. - -#### Step 2. Add the Repo as a Subtree - -``` -git subtree add --prefix libraries/action-scheduler subtree-action-scheduler master --squash -``` - -This will add the `master` branch of Action Scheduler to your repository in the folder `libraries/action-scheduler`. - -You can change the `--prefix` to change where the code is included. Or change the `master` branch to a tag, like `2.1.0` to include only a stable version. - -#### Step 3. Update the Subtree - -To update Action Scheduler to a new version, use the commands: - -``` -git fetch subtree-action-scheduler master -git subtree pull --prefix libraries/action-scheduler subtree-action-scheduler master --squash -``` - -### Loading Action Scheduler - -Regardless of how it is installed, to load Action Scheduler, you only need to include the `action-scheduler.php` file, e.g. - -```php -createResult(); - } - - if ( 'UTC' != ( $this->existing_timezone = date_default_timezone_get() ) ) { - date_default_timezone_set( 'UTC' ); - $result->run( $this ); - } - - date_default_timezone_set( 'Pacific/Fiji' ); // UTC+12 - $result->run( $this ); - - date_default_timezone_set( 'Pacific/Tahiti' ); // UTC-10: it's a magical place - $result->run( $this ); - - date_default_timezone_set( $this->existing_timezone ); - - return $result; - } -} diff --git a/includes/libraries/action-scheduler/tests/bootstrap.php b/includes/libraries/action-scheduler/tests/bootstrap.php deleted file mode 100644 index f7096db473c..00000000000 --- a/includes/libraries/action-scheduler/tests/bootstrap.php +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - ./phpunit - - - - - ignore - - - - - .. - - . - - - - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php b/includes/libraries/action-scheduler/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php deleted file mode 100644 index 03901155715..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php +++ /dev/null @@ -1,44 +0,0 @@ -createResult(); - } - - if ( 'UTC' != ( $this->existing_timezone = date_default_timezone_get() ) ) { - date_default_timezone_set( 'UTC' ); - $result->run( $this ); - } - - date_default_timezone_set( 'Pacific/Fiji' ); // UTC+12 - $result->run( $this ); - - date_default_timezone_set( 'Pacific/Tahiti' ); // UTC-10: it's a magical place - $result->run( $this ); - - date_default_timezone_set( $this->existing_timezone ); - - return $result; - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php b/includes/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php deleted file mode 100644 index 03d8195eb6d..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/helpers/ActionScheduler_TimezoneHelper_Test.php +++ /dev/null @@ -1,100 +0,0 @@ -getTimezone(); - $this->assertInstanceOf( 'DateTimeZone', $timezone ); - $this->assertEquals( $timezone_string, $timezone->getName() ); - - remove_filter( 'option_timezone_string', $timezone_filter ); - } - - public function local_timezone_provider() { - return array( - array( 'America/New_York' ), - array( 'Australia/Melbourne' ), - array( 'UTC' ), - ); - } - - /** - * Ensure that most GMT offsets don't return UTC as the timezone. - * - * @dataProvider local_timezone_offsets_provider - * - * @param $gmt_offset - */ - public function test_local_timezone_offsets( $gmt_offset ) { - $gmt_filter = function ( $gmt ) use ( $gmt_offset ) { - return $gmt_offset; - }; - - $date = new ActionScheduler_DateTime(); - - add_filter( 'option_gmt_offset', $gmt_filter ); - ActionScheduler_TimezoneHelper::set_local_timezone( $date ); - remove_filter( 'option_gmt_offset', $gmt_filter ); - - $offset_in_seconds = $gmt_offset * HOUR_IN_SECONDS; - - $this->assertEquals( $offset_in_seconds, $date->getOffset() ); - $this->assertEquals( $offset_in_seconds, $date->getOffsetTimestamp() - $date->getTimestamp() ); - } - - public function local_timezone_offsets_provider() { - return array( - array( '-11' ), - array( '-10.5' ), - array( '-10' ), - array( '-9' ), - array( '-8' ), - array( '-7' ), - array( '-6' ), - array( '-5' ), - array( '-4.5' ), - array( '-4' ), - array( '-3.5' ), - array( '-3' ), - array( '-2' ), - array( '-1' ), - array( '1' ), - array( '1.5' ), - array( '2' ), - array( '3' ), - array( '4' ), - array( '5' ), - array( '5.5' ), - array( '5.75' ), - array( '6' ), - array( '7' ), - array( '8' ), - array( '8.5' ), - array( '9' ), - array( '9.5' ), - array( '10' ), - array( '10.5' ), - array( '11' ), - array( '11.5' ), - array( '12' ), - array( '13' ), - ); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php b/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php deleted file mode 100644 index 629f97f7c1d..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_Action_Test.php +++ /dev/null @@ -1,55 +0,0 @@ -assertEquals( $schedule, $action->get_schedule() ); - } - - public function test_null_schedule() { - $action = new ActionScheduler_Action('my_hook'); - $this->assertInstanceOf( 'ActionScheduler_NullSchedule', $action->get_schedule() ); - } - - public function test_set_hook() { - $action = new ActionScheduler_Action('my_hook'); - $this->assertEquals( 'my_hook', $action->get_hook() ); - } - - public function test_args() { - $action = new ActionScheduler_Action('my_hook'); - $this->assertEmpty($action->get_args()); - - $action = new ActionScheduler_Action('my_hook', array(5,10,15)); - $this->assertEqualSets(array(5,10,15), $action->get_args()); - } - - public function test_set_group() { - $action = new ActionScheduler_Action('my_hook', array(), NULL, 'my_group'); - $this->assertEquals('my_group', $action->get_group()); - } - - public function test_execute() { - $mock = new MockAction(); - - $random = md5(rand()); - add_action( $random, array( $mock, 'action' ) ); - - $action = new ActionScheduler_Action( $random, array($random) ); - $action->execute(); - - remove_action( $random, array( $mock, 'action' ) ); - - $this->assertEquals( 1, $mock->get_call_count() ); - $events = $mock->get_events(); - $event = reset($events); - $this->assertEquals( $random, reset($event['args']) ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php b/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php deleted file mode 100644 index d144e88e21c..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/jobs/ActionScheduler_NullAction_Test.php +++ /dev/null @@ -1,16 +0,0 @@ -assertEmpty($action->get_hook()); - $this->assertEmpty($action->get_args()); - $this->assertNull($action->get_schedule()->next()); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php b/includes/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php deleted file mode 100644 index 4cbd8485065..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php +++ /dev/null @@ -1,375 +0,0 @@ -save_action($action); - - $this->assertNotEmpty($action_id); - } - - public function test_create_action_with_scheduled_date() { - $time = as_get_datetime_object( strtotime( '-1 week' ) ); - $action = new ActionScheduler_Action( 'my_hook', array(), new ActionScheduler_SimpleSchedule( $time ) ); - $store = new ActionScheduler_wpPostStore(); - - $action_id = $store->save_action( $action, $time ); - $action_date = $store->get_date( $action_id ); - - $this->assertEquals( $time->getTimestamp(), $action_date->getTimestamp() ); - } - - public function test_retrieve_action() { - $time = as_get_datetime_object(); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array(), $schedule, 'my_group'); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $retrieved = $store->fetch_action($action_id); - $this->assertEquals($action->get_hook(), $retrieved->get_hook()); - $this->assertEqualSets($action->get_args(), $retrieved->get_args()); - $this->assertEquals($action->get_schedule()->next()->getTimestamp(), $retrieved->get_schedule()->next()->getTimestamp()); - $this->assertEquals($action->get_group(), $retrieved->get_group()); - } - - /** - * @expectedException ActionScheduler_InvalidActionException - * @dataProvider provide_bad_args - * - * @param string $content - */ - public function test_action_bad_args( $content ) { - $store = new ActionScheduler_wpPostStore(); - $post_id = wp_insert_post( array( - 'post_type' => ActionScheduler_wpPostStore::POST_TYPE, - 'post_status' => ActionScheduler_Store::STATUS_PENDING, - 'post_content' => $content, - ) ); - - $store->fetch_action( $post_id ); - } - - public function provide_bad_args() { - return array( - array( '{"bad_json":true}}' ), - ); - } - - public function test_cancel_action() { - $time = as_get_datetime_object(); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array(), $schedule, 'my_group'); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - $store->cancel_action( $action_id ); - - $fetched = $store->fetch_action( $action_id ); - $this->assertInstanceOf( 'ActionScheduler_CanceledAction', $fetched ); - } - - public function test_claim_actions() { - $created_actions = array(); - $store = new ActionScheduler_wpPostStore(); - for ( $i = 3 ; $i > -3 ; $i-- ) { - $time = as_get_datetime_object($i.' hours'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); - $created_actions[] = $store->save_action($action); - } - - $claim = $store->stake_claim(); - $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); - - $this->assertCount( 3, $claim->get_actions() ); - $this->assertEqualSets( array_slice( $created_actions, 3, 3 ), $claim->get_actions() ); - } - - public function test_claim_actions_order() { - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); - $created_actions = array( - $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), - $store->save_action( new ActionScheduler_Action( 'my_hook', array( 1 ), $schedule, 'my_group' ) ), - ); - - $claim = $store->stake_claim(); - $this->assertInstanceof( 'ActionScheduler_ActionClaim', $claim ); - - // Verify uniqueness of action IDs. - $this->assertEquals( 2, count( array_unique( $created_actions ) ) ); - - // Verify the count and order of the actions. - $claimed_actions = $claim->get_actions(); - $this->assertCount( 2, $claimed_actions ); - $this->assertEquals( $created_actions, $claimed_actions ); - - // Verify the reversed order doesn't pass. - $reversed_actions = array_reverse( $created_actions ); - $this->assertNotEquals( $reversed_actions, $claimed_actions ); - } - - public function test_duplicate_claim() { - $created_actions = array(); - $store = new ActionScheduler_wpPostStore(); - for ( $i = 0 ; $i > -3 ; $i-- ) { - $time = as_get_datetime_object($i.' hours'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); - $created_actions[] = $store->save_action($action); - } - - $claim1 = $store->stake_claim(); - $claim2 = $store->stake_claim(); - $this->assertCount( 3, $claim1->get_actions() ); - $this->assertCount( 0, $claim2->get_actions() ); - } - - public function test_release_claim() { - $created_actions = array(); - $store = new ActionScheduler_wpPostStore(); - for ( $i = 0 ; $i > -3 ; $i-- ) { - $time = as_get_datetime_object($i.' hours'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); - $created_actions[] = $store->save_action($action); - } - - $claim1 = $store->stake_claim(); - - $store->release_claim( $claim1 ); - - $claim2 = $store->stake_claim(); - $this->assertCount( 3, $claim2->get_actions() ); - } - - public function test_search() { - $created_actions = array(); - $store = new ActionScheduler_wpPostStore(); - for ( $i = -3 ; $i <= 3 ; $i++ ) { - $time = as_get_datetime_object($i.' hours'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array($i), $schedule, 'my_group'); - $created_actions[] = $store->save_action($action); - } - - $next_no_args = $store->find_action( 'my_hook' ); - $this->assertEquals( $created_actions[0], $next_no_args ); - - $next_with_args = $store->find_action( 'my_hook', array( 'args' => array( 1 ) ) ); - $this->assertEquals( $created_actions[4], $next_with_args ); - - $non_existent = $store->find_action( 'my_hook', array( 'args' => array( 17 ) ) ); - $this->assertNull( $non_existent ); - } - - public function test_search_by_group() { - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('tomorrow')); - $abc = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'abc')); - $def = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'def')); - $ghi = $store->save_action(new ActionScheduler_Action('my_hook', array(1), $schedule, 'ghi')); - - $this->assertEquals( $abc, $store->find_action('my_hook', array('group' => 'abc'))); - $this->assertEquals( $def, $store->find_action('my_hook', array('group' => 'def'))); - $this->assertEquals( $ghi, $store->find_action('my_hook', array('group' => 'ghi'))); - } - - public function test_post_author() { - $current_user = get_current_user_id(); - - $time = as_get_datetime_object(); - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $post = get_post($action_id); - $this->assertEquals(0, $post->post_author); - - $new_user = $this->factory->user->create_object(array( - 'user_login' => __FUNCTION__, - 'user_pass' => md5(rand()), - )); - wp_set_current_user( $new_user ); - - - $schedule = new ActionScheduler_SimpleSchedule($time); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $action_id = $store->save_action($action); - $post = get_post($action_id); - $this->assertEquals(0, $post->post_author); - - wp_set_current_user($current_user); - } - - /** - * @issue 13 - */ - public function test_post_status_for_recurring_action() { - $time = as_get_datetime_object('10 minutes'); - $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $action = $store->fetch_action($action_id); - $action->execute(); - $store->mark_complete( $action_id ); - - $next = $action->get_schedule()->next( as_get_datetime_object() ); - $new_action_id = $store->save_action( $action, $next ); - - $this->assertEquals('publish', get_post_status($action_id)); - $this->assertEquals('pending', get_post_status($new_action_id)); - } - - public function test_get_run_date() { - $time = as_get_datetime_object('-10 minutes'); - $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $this->assertEquals( $store->get_date($action_id)->getTimestamp(), $time->getTimestamp() ); - - $action = $store->fetch_action($action_id); - $action->execute(); - $now = as_get_datetime_object(); - $store->mark_complete( $action_id ); - - $this->assertEquals( $store->get_date($action_id)->getTimestamp(), $now->getTimestamp() ); - - $next = $action->get_schedule()->next( $now ); - $new_action_id = $store->save_action( $action, $next ); - - $this->assertEquals( (int)($now->getTimestamp()) + HOUR_IN_SECONDS, $store->get_date($new_action_id)->getTimestamp() ); - } - - public function test_get_status() { - $time = as_get_datetime_object('-10 minutes'); - $schedule = new ActionScheduler_IntervalSchedule($time, HOUR_IN_SECONDS); - $action = new ActionScheduler_Action('my_hook', array(), $schedule); - $store = new ActionScheduler_wpPostStore(); - $action_id = $store->save_action($action); - - $this->assertEquals( ActionScheduler_Store::STATUS_PENDING, $store->get_status( $action_id ) ); - - $store->mark_complete( $action_id ); - $this->assertEquals( ActionScheduler_Store::STATUS_COMPLETE, $store->get_status( $action_id ) ); - - $store->mark_failure( $action_id ); - $this->assertEquals( ActionScheduler_Store::STATUS_FAILED, $store->get_status( $action_id ) ); - } - - public function test_claim_actions_by_hooks() { - $hook1 = __FUNCTION__ . '_hook_1'; - $hook2 = __FUNCTION__ . '_hook_2'; - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); - - $action1 = $store->save_action( new ActionScheduler_Action( $hook1, array(), $schedule ) ); - $action2 = $store->save_action( new ActionScheduler_Action( $hook2, array(), $schedule ) ); - - // Claiming no hooks should include all actions. - $claim = $store->stake_claim( 10 ); - $this->assertEquals( 2, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a hook should claim only actions with that hook - $claim = $store->stake_claim( 10, null, array( $hook1 ) ); - $this->assertEquals( 1, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming two hooks should claim actions with either of those hooks - $claim = $store->stake_claim( 10, null, array( $hook1, $hook2 ) ); - $this->assertEquals( 2, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming two hooks should claim actions with either of those hooks - $claim = $store->stake_claim( 10, null, array( __METHOD__ . '_hook_3' ) ); - $this->assertEquals( 0, count( $claim->get_actions() ) ); - $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); - $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - } - - /** - * @issue 121 - */ - public function test_claim_actions_by_group() { - $group1 = md5( rand() ); - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); - - $action1 = $store->save_action( new ActionScheduler_Action( __METHOD__, array(), $schedule, $group1 ) ); - $action2 = $store->save_action( new ActionScheduler_Action( __METHOD__, array(), $schedule ) ); - - // Claiming no group should include all actions. - $claim = $store->stake_claim( 10 ); - $this->assertEquals( 2, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a group should claim only actions in that group. - $claim = $store->stake_claim( 10, null, array(), $group1 ); - $this->assertEquals( 1, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $store->release_claim( $claim ); - } - - public function test_claim_actions_by_hook_and_group() { - $hook1 = __FUNCTION__ . '_hook_1'; - $hook2 = __FUNCTION__ . '_hook_2'; - $hook3 = __FUNCTION__ . '_hook_3'; - $group1 = 'group_' . md5( rand() ); - $group2 = 'group_' . md5( rand() ); - $store = new ActionScheduler_wpPostStore(); - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( '-1 hour' ) ); - - $action1 = $store->save_action( new ActionScheduler_Action( $hook1, array(), $schedule, $group1 ) ); - $action2 = $store->save_action( new ActionScheduler_Action( $hook2, array(), $schedule ) ); - $action3 = $store->save_action( new ActionScheduler_Action( $hook3, array(), $schedule, $group2 ) ); - - // Claiming no hooks or group should include all actions. - $claim = $store->stake_claim( 10 ); - $this->assertEquals( 3, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $this->assertTrue( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a group and hook should claim only actions in that group. - $claim = $store->stake_claim( 10, null, array( $hook1 ), $group1 ); - $this->assertEquals( 1, count( $claim->get_actions() ) ); - $this->assertTrue( in_array( $action1, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a group and hook should claim only actions with that hook in that group. - $claim = $store->stake_claim( 10, null, array( $hook2 ), $group1 ); - $this->assertEquals( 0, count( $claim->get_actions() ) ); - $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); - $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - - // Claiming a group and hook should claim only actions with that hook in that group. - $claim = $store->stake_claim( 10, null, array( $hook1, $hook2 ), $group2 ); - $this->assertEquals( 0, count( $claim->get_actions() ) ); - $this->assertFalse( in_array( $action1, $claim->get_actions() ) ); - $this->assertFalse( in_array( $action2, $claim->get_actions() ) ); - $store->release_claim( $claim ); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php b/includes/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php deleted file mode 100644 index 154b822a896..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php +++ /dev/null @@ -1,185 +0,0 @@ -assertInstanceOf( 'ActionScheduler_Logger', $logger ); - $this->assertInstanceOf( 'ActionScheduler_wpCommentLogger', $logger ); - } - - public function test_add_log_entry() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $message = 'Logging that something happened'; - $log_id = $logger->log( $action_id, $message ); - $entry = $logger->get_entry( $log_id ); - - $this->assertEquals( $action_id, $entry->get_action_id() ); - $this->assertEquals( $message, $entry->get_message() ); - } - - public function test_add_log_datetime() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $message = 'Logging that something happened'; - $date = new DateTime( 'now', new DateTimeZone( 'UTC' ) ); - $log_id = $logger->log( $action_id, $message, $date ); - $entry = $logger->get_entry( $log_id ); - - $this->assertEquals( $action_id, $entry->get_action_id() ); - $this->assertEquals( $message, $entry->get_message() ); - - $date = new ActionScheduler_DateTime( 'now', new DateTimeZone( 'UTC' ) ); - $log_id = $logger->log( $action_id, $message, $date ); - $entry = $logger->get_entry( $log_id ); - - $this->assertEquals( $action_id, $entry->get_action_id() ); - $this->assertEquals( $message, $entry->get_message() ); - } - - public function test_null_log_entry() { - $logger = ActionScheduler::logger(); - $entry = $logger->get_entry( 1 ); - $this->assertEquals( '', $entry->get_action_id() ); - $this->assertEquals( '', $entry->get_message() ); - } - - public function test_erroneous_entry_id() { - $comment = wp_insert_comment(array( - 'comment_post_ID' => 1, - 'comment_author' => 'test', - 'comment_content' => 'this is not a log entry', - )); - $logger = ActionScheduler::logger(); - $entry = $logger->get_entry( $comment ); - $this->assertEquals( '', $entry->get_action_id() ); - $this->assertEquals( '', $entry->get_message() ); - } - - public function test_storage_comments() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $logs = $logger->get_logs( $action_id ); - $expected = new ActionScheduler_LogEntry( $action_id, 'action created' ); - $this->assertTrue( in_array( $this->log_entry_to_array( $expected ) , $this->log_entry_to_array( $logs ) ) ); - } - - protected function log_entry_to_array( $logs ) { - if ( $logs instanceof ActionScheduler_LogEntry ) { - return array( 'action_id' => $logs->get_action_id(), 'message' => $logs->get_message() ); - } - - foreach ( $logs as $id => $log) { - $logs[ $id ] = array( 'action_id' => $log->get_action_id(), 'message' => $log->get_message() ); - } - - return $logs; - } - - public function test_execution_comments() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $started = new ActionScheduler_LogEntry( $action_id, 'action started' ); - $finished = new ActionScheduler_LogEntry( $action_id, 'action complete' ); - - $runner = new ActionScheduler_QueueRunner(); - $runner->run(); - - $logs = $logger->get_logs( $action_id ); - $this->assertTrue( in_array( $this->log_entry_to_array( $started ), $this->log_entry_to_array( $logs ) ) ); - $this->assertTrue( in_array( $this->log_entry_to_array( $finished ), $this->log_entry_to_array( $logs ) ) ); - } - - public function test_failed_execution_comments() { - $hook = md5(rand()); - add_action( $hook, array( $this, '_a_hook_callback_that_throws_an_exception' ) ); - $action_id = as_schedule_single_action( time(), $hook ); - $logger = ActionScheduler::logger(); - $started = new ActionScheduler_LogEntry( $action_id, 'action started' ); - $finished = new ActionScheduler_LogEntry( $action_id, 'action complete' ); - $failed = new ActionScheduler_LogEntry( $action_id, 'action failed: Execution failed' ); - - $runner = new ActionScheduler_QueueRunner(); - $runner->run(); - - $logs = $logger->get_logs( $action_id ); - $this->assertTrue( in_array( $this->log_entry_to_array( $started ), $this->log_entry_to_array( $logs ) ) ); - $this->assertFalse( in_array( $this->log_entry_to_array( $finished ), $this->log_entry_to_array( $logs ) ) ); - $this->assertTrue( in_array( $this->log_entry_to_array( $failed ), $this->log_entry_to_array( $logs ) ) ); - } - - public function test_fatal_error_comments() { - $hook = md5(rand()); - $action_id = as_schedule_single_action( time(), $hook ); - $logger = ActionScheduler::logger(); - do_action( 'action_scheduler_unexpected_shutdown', $action_id, array( - 'type' => E_ERROR, - 'message' => 'Test error', - 'file' => __FILE__, - 'line' => __LINE__, - )); - - $logs = $logger->get_logs( $action_id ); - $found_log = FALSE; - foreach ( $logs as $l ) { - if ( strpos( $l->get_message(), 'unexpected shutdown' ) === 0 ) { - $found_log = TRUE; - } - } - $this->assertTrue( $found_log, 'Unexpected shutdown log not found' ); - } - - public function test_canceled_action_comments() { - $action_id = as_schedule_single_action( time(), 'a hook' ); - as_unschedule_action( 'a hook' ); - $logger = ActionScheduler::logger(); - $logs = $logger->get_logs( $action_id ); - $expected = new ActionScheduler_LogEntry( $action_id, 'action canceled' ); - $this->assertTrue( in_array( $this->log_entry_to_array( $expected ), $this->log_entry_to_array( $logs ) ) ); - } - - public function _a_hook_callback_that_throws_an_exception() { - throw new RuntimeException('Execution failed'); - } - - public function test_filtering_of_get_comments() { - $post_id = $this->factory->post->create_object(array( - 'post_title' => __FUNCTION__, - )); - $comment_id = $this->factory->comment->create_object(array( - 'comment_post_ID' => $post_id, - 'comment_author' => __CLASS__, - 'comment_content' => __FUNCTION__, - )); - - // Verify that we're getting the expected comment before we add logging comments - $comments = get_comments(); - $this->assertCount( 1, $comments ); - $this->assertEquals( $comment_id, $comments[0]->comment_ID ); - - - $action_id = as_schedule_single_action( time(), 'a hook' ); - $logger = ActionScheduler::logger(); - $message = 'Logging that something happened'; - $log_id = $logger->log( $action_id, $message ); - - - // Verify that logging comments are excluded from general comment queries - $comments = get_comments(); - $this->assertCount( 1, $comments ); - $this->assertEquals( $comment_id, $comments[0]->comment_ID ); - - // Verify that logging comments are returned when asking for them specifically - $comments = get_comments(array( - 'type' => ActionScheduler_wpCommentLogger::TYPE, - )); - // Expecting two: one when the action is created, another when we added our custom log - $this->assertCount( 2, $comments ); - $this->assertContains( $log_id, wp_list_pluck($comments, 'comment_ID')); - } -} - diff --git a/includes/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php b/includes/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php deleted file mode 100644 index 543add798b1..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/procedural_api/procedural_api_Test.php +++ /dev/null @@ -1,222 +0,0 @@ -fetch_action($action_id); - $this->assertEquals( $time, $action->get_schedule()->next()->getTimestamp() ); - $this->assertEquals( $hook, $action->get_hook() ); - } - - public function test_recurring_action() { - $time = time(); - $hook = md5(rand()); - $action_id = as_schedule_recurring_action( $time, HOUR_IN_SECONDS, $hook ); - - $store = ActionScheduler::store(); - $action = $store->fetch_action($action_id); - $this->assertEquals( $time, $action->get_schedule()->next()->getTimestamp() ); - $this->assertEquals( $time + HOUR_IN_SECONDS + 2, $action->get_schedule()->next(as_get_datetime_object($time + 2))->getTimestamp()); - $this->assertEquals( $hook, $action->get_hook() ); - } - - public function test_cron_schedule() { - $time = as_get_datetime_object('2014-01-01'); - $hook = md5(rand()); - $action_id = as_schedule_cron_action( $time->getTimestamp(), '0 0 10 10 *', $hook ); - - $store = ActionScheduler::store(); - $action = $store->fetch_action($action_id); - $expected_date = as_get_datetime_object('2014-10-10'); - $this->assertEquals( $expected_date->getTimestamp(), $action->get_schedule()->next()->getTimestamp() ); - $this->assertEquals( $hook, $action->get_hook() ); - } - - public function test_get_next() { - $time = as_get_datetime_object('tomorrow'); - $hook = md5(rand()); - as_schedule_recurring_action( $time->getTimestamp(), HOUR_IN_SECONDS, $hook ); - - $next = as_next_scheduled_action( $hook ); - - $this->assertEquals( $time->getTimestamp(), $next ); - } - - public function provider_time_hook_args_group() { - $time = time() + 60 * 2; - $hook = md5( rand() ); - $args = array( rand(), rand() ); - $group = 'test_group'; - - return array( - - // Test with no args or group - array( - 'time' => $time, - 'hook' => $hook, - 'args' => array(), - 'group' => '', - ), - - // Test with args but no group - array( - 'time' => $time, - 'hook' => $hook, - 'args' => $args, - 'group' => '', - ), - - // Test with group but no args - array( - 'time' => $time, - 'hook' => $hook, - 'args' => array(), - 'group' => $group, - ), - - // Test with args & group - array( - 'time' => $time, - 'hook' => $hook, - 'args' => $args, - 'group' => $group, - ), - ); - } - - /** - * @dataProvider provider_time_hook_args_group - */ - public function test_unschedule( $time, $hook, $args, $group ) { - - $action_id_unscheduled = as_schedule_single_action( $time, $hook, $args, $group ); - $action_scheduled_time = $time + 1; - $action_id_scheduled = as_schedule_single_action( $action_scheduled_time, $hook, $args, $group ); - - as_unschedule_action( $hook, $args, $group ); - - $next = as_next_scheduled_action( $hook, $args, $group ); - $this->assertEquals( $action_scheduled_time, $next ); - - $store = ActionScheduler::store(); - $unscheduled_action = $store->fetch_action( $action_id_unscheduled ); - - // Make sure the next scheduled action is unscheduled - $this->assertEquals( $hook, $unscheduled_action->get_hook() ); - $this->assertNull( $unscheduled_action->get_schedule()->next() ); - - // Make sure other scheduled actions are not unscheduled - $scheduled_action = $store->fetch_action( $action_id_scheduled ); - - $this->assertEquals( $hook, $scheduled_action->get_hook() ); - $this->assertEquals( $action_scheduled_time, $scheduled_action->get_schedule()->next()->getTimestamp() ); - } - - /** - * @dataProvider provider_time_hook_args_group - */ - public function test_unschedule_all( $time, $hook, $args, $group ) { - - $hook = md5( $hook ); - $action_ids = array(); - - for ( $i = 0; $i < 3; $i++ ) { - $action_ids[] = as_schedule_single_action( $time, $hook, $args, $group ); - } - - as_unschedule_all_actions( $hook, $args, $group ); - - $next = as_next_scheduled_action( $hook ); - $this->assertFalse($next); - - $store = ActionScheduler::store(); - - foreach ( $action_ids as $action_id ) { - $action = $store->fetch_action($action_id); - - $this->assertNull($action->get_schedule()->next()); - $this->assertEquals($hook, $action->get_hook() ); - } - } - - public function test_as_get_datetime_object_default() { - - $utc_now = new ActionScheduler_DateTime(null, new DateTimeZone('UTC')); - $as_now = as_get_datetime_object(); - - // Don't want to use 'U' as timestamps will always be in UTC - $this->assertEquals($utc_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); - } - - public function test_as_get_datetime_object_relative() { - - $utc_tomorrow = new ActionScheduler_DateTime('tomorrow', new DateTimeZone('UTC')); - $as_tomorrow = as_get_datetime_object('tomorrow'); - - $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); - - $utc_tomorrow = new ActionScheduler_DateTime('yesterday', new DateTimeZone('UTC')); - $as_tomorrow = as_get_datetime_object('yesterday'); - - $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); - } - - public function test_as_get_datetime_object_fixed() { - - $utc_tomorrow = new ActionScheduler_DateTime('29 February 2016', new DateTimeZone('UTC')); - $as_tomorrow = as_get_datetime_object('29 February 2016'); - - $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); - - $utc_tomorrow = new ActionScheduler_DateTime('1st January 2024', new DateTimeZone('UTC')); - $as_tomorrow = as_get_datetime_object('1st January 2024'); - - $this->assertEquals($utc_tomorrow->format('Y-m-d H:i:s'),$as_tomorrow->format('Y-m-d H:i:s')); - } - - public function test_as_get_datetime_object_timezone() { - - $timezone_au = 'Australia/Brisbane'; - $timezone_default = date_default_timezone_get(); - - date_default_timezone_set( $timezone_au ); - - $au_now = new ActionScheduler_DateTime(null); - $as_now = as_get_datetime_object(); - - // Make sure they're for the same time - $this->assertEquals($au_now->getTimestamp(),$as_now->getTimestamp()); - - // But not in the same timezone, as $as_now should be using UTC - $this->assertNotEquals($au_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); - - $au_now = new ActionScheduler_DateTime(null); - $as_au_now = as_get_datetime_object(); - - $this->assertEquals($au_now->getTimestamp(),$as_now->getTimestamp()); - - // But not in the same timezone, as $as_now should be using UTC - $this->assertNotEquals($au_now->format('Y-m-d H:i:s'),$as_now->format('Y-m-d H:i:s')); - - // Just in cases - date_default_timezone_set( $timezone_default ); - } - - public function test_as_get_datetime_object_type() { - $f = 'Y-m-d H:i:s'; - $now = as_get_datetime_object(); - $this->assertInstanceOf( 'ActionScheduler_DateTime', $now ); - - $dateTime = new DateTime( 'now', new DateTimeZone( 'UTC' ) ); - $asDateTime = as_get_datetime_object( $dateTime ); - $this->assertEquals( $dateTime->format( $f ), $asDateTime->format( $f ) ); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php b/includes/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php deleted file mode 100644 index af839d9195a..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/procedural_api/wc_get_scheduled_actions_Test.php +++ /dev/null @@ -1,100 +0,0 @@ -hooks[$i] = md5(rand()); - $this->args[$i] = md5(rand()); - $this->groups[$i] = md5(rand()); - } - - for ( $i = 0 ; $i < 10 ; $i++ ) { - for ( $j = 0 ; $j < 10 ; $j++ ) { - $schedule = new ActionScheduler_SimpleSchedule( as_get_datetime_object( $j - 3 . 'days') ); - $group = $this->groups[ ( $i + $j ) % 10 ]; - $action = new ActionScheduler_Action( $this->hooks[$i], array($this->args[$j]), $schedule, $group ); - $store->save_action( $action ); - } - } - } - - public function test_date_queries() { - $actions = as_get_scheduled_actions(array( - 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), - 'per_page' => -1, - ), 'ids'); - $this->assertCount(30, $actions); - - $actions = as_get_scheduled_actions(array( - 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), - 'date_compare' => '>=', - 'per_page' => -1, - ), 'ids'); - $this->assertCount(70, $actions); - } - - public function test_hook_queries() { - $actions = as_get_scheduled_actions(array( - 'hook' => $this->hooks[2], - 'per_page' => -1, - ), 'ids'); - $this->assertCount(10, $actions); - - $actions = as_get_scheduled_actions(array( - 'hook' => $this->hooks[2], - 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), - 'per_page' => -1, - ), 'ids'); - $this->assertCount(3, $actions); - } - - public function test_args_queries() { - $actions = as_get_scheduled_actions(array( - 'args' => array($this->args[5]), - 'per_page' => -1, - ), 'ids'); - $this->assertCount(10, $actions); - - $actions = as_get_scheduled_actions(array( - 'args' => array($this->args[5]), - 'hook' => $this->hooks[3], - 'per_page' => -1, - ), 'ids'); - $this->assertCount(1, $actions); - - $actions = as_get_scheduled_actions(array( - 'args' => array($this->args[5]), - 'hook' => $this->hooks[3], - 'date' => as_get_datetime_object(gmdate('Y-m-d 00:00:00')), - 'per_page' => -1, - ), 'ids'); - $this->assertCount(0, $actions); - } - - public function test_group_queries() { - $actions = as_get_scheduled_actions(array( - 'group' => $this->groups[1], - 'per_page' => -1, - ), 'ids'); - $this->assertCount(10, $actions); - - $actions = as_get_scheduled_actions(array( - 'group' => $this->groups[1], - 'hook' => $this->hooks[9], - 'per_page' => -1, - ), 'ids'); - $this->assertCount(1, $actions); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php b/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php deleted file mode 100644 index 401a1d676e1..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueCleaner_Test.php +++ /dev/null @@ -1,151 +0,0 @@ -save_action( $action ); - } - - $runner->run(); - - add_filter( 'action_scheduler_retention_period', '__return_zero' ); // delete any finished job - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->delete_old_actions(); - remove_filter( 'action_scheduler_retention_period', '__return_zero' ); - - foreach ( $created_actions as $action_id ) { - $action = $store->fetch_action($action_id); - $this->assertFalse($action->is_finished()); // it's a NullAction - } - } - - public function test_delete_canceled_actions() { - $store = ActionScheduler::store(); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - $created_actions = array(); - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $action_id = $store->save_action( $action ); - $store->cancel_action( $action_id ); - $created_actions[] = $action_id; - } - - // track the actions that are deleted - $mock_action = new MockAction(); - add_action( 'action_scheduler_deleted_action', array( $mock_action, 'action' ), 10, 1 ); - add_filter( 'action_scheduler_retention_period', '__return_zero' ); // delete any finished job - - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->delete_old_actions(); - - remove_filter( 'action_scheduler_retention_period', '__return_zero' ); - remove_action( 'action_scheduler_deleted_action', array( $mock_action, 'action' ), 10 ); - - $deleted_actions = array_map( 'reset', $mock_action->get_args() ); - $this->assertEqualSets( $created_actions, $deleted_actions ); - } - - public function test_do_not_delete_recent_actions() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - $created_actions = array(); - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $created_actions[] = $store->save_action( $action ); - } - - $runner->run(); - - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->delete_old_actions(); - - foreach ( $created_actions as $action_id ) { - $action = $store->fetch_action($action_id); - $this->assertTrue($action->is_finished()); // It's a FinishedAction - } - } - - public function test_reset_unrun_actions() { - $store = ActionScheduler::store(); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - $created_actions = array(); - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $created_actions[] = $store->save_action( $action ); - } - - $store->stake_claim(10); - - // don't actually process the jobs, to simulate a request that timed out - - add_filter( 'action_scheduler_timeout_period', '__return_zero' ); // delete any finished job - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->reset_timeouts(); - - remove_filter( 'action_scheduler_timeout_period', '__return_zero' ); - - $claim = $store->stake_claim(10); - $this->assertEqualSets($created_actions, $claim->get_actions()); - } - - public function test_do_not_reset_failed_action() { - $store = ActionScheduler::store(); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - $created_actions = array(); - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $created_actions[] = $store->save_action( $action ); - } - - $claim = $store->stake_claim(10); - foreach ( $claim->get_actions() as $action_id ) { - // simulate the first action interrupted by an uncatchable fatal error - $store->log_execution( $action_id ); - break; - } - - add_filter( 'action_scheduler_timeout_period', '__return_zero' ); // delete any finished job - $cleaner = new ActionScheduler_QueueCleaner( $store ); - $cleaner->reset_timeouts(); - remove_filter( 'action_scheduler_timeout_period', '__return_zero' ); - - $new_claim = $store->stake_claim(10); - $this->assertCount( 4, $new_claim->get_actions() ); - - add_filter( 'action_scheduler_failure_period', '__return_zero' ); - $cleaner->mark_failures(); - remove_filter( 'action_scheduler_failure_period', '__return_zero' ); - - $failed = $store->query_actions(array('status' => ActionScheduler_Store::STATUS_FAILED)); - $this->assertEquals( $created_actions[0], $failed[0] ); - $this->assertCount( 1, $failed ); - - - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php b/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php deleted file mode 100644 index e68b3e06fb9..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/runner/ActionScheduler_QueueRunner_Test.php +++ /dev/null @@ -1,262 +0,0 @@ -run(); - - $this->assertEquals( 0, $actions_run ); - } - - public function test_run() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $mock = new MockAction(); - $random = md5(rand()); - add_action( $random, array( $mock, 'action' ) ); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - for ( $i = 0 ; $i < 5 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $actions_run = $runner->run(); - - remove_action( $random, array( $mock, 'action' ) ); - - $this->assertEquals( 5, $mock->get_call_count() ); - $this->assertEquals( 5, $actions_run ); - } - - public function test_run_with_future_actions() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $mock = new MockAction(); - $random = md5(rand()); - add_action( $random, array( $mock, 'action' ) ); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('1 day ago')); - - for ( $i = 0 ; $i < 3 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('tomorrow')); - for ( $i = 0 ; $i < 3 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $actions_run = $runner->run(); - - remove_action( $random, array( $mock, 'action' ) ); - - $this->assertEquals( 3, $mock->get_call_count() ); - $this->assertEquals( 3, $actions_run ); - } - - public function test_completed_action_status() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('12 hours ago')); - - $action = new ActionScheduler_Action( $random, array(), $schedule ); - $action_id = $store->save_action( $action ); - - $runner->run(); - - $finished_action = $store->fetch_action( $action_id ); - - $this->assertTrue( $finished_action->is_finished() ); - } - - public function test_next_instance_of_action() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $random = md5(rand()); - $schedule = new ActionScheduler_IntervalSchedule(as_get_datetime_object('12 hours ago'), DAY_IN_SECONDS); - - $action = new ActionScheduler_Action( $random, array(), $schedule ); - $store->save_action( $action ); - - $runner->run(); - - $claim = $store->stake_claim(10, as_get_datetime_object((DAY_IN_SECONDS - 60).' seconds')); - $this->assertCount(0, $claim->get_actions()); - - $claim = $store->stake_claim(10, as_get_datetime_object(DAY_IN_SECONDS.' seconds')); - $actions = $claim->get_actions(); - $this->assertCount(1, $actions); - - $action_id = reset($actions); - $new_action = $store->fetch_action($action_id); - - - $this->assertEquals( $random, $new_action->get_hook() ); - $this->assertEquals( $schedule->next(as_get_datetime_object())->getTimestamp(), $new_action->get_schedule()->next(as_get_datetime_object())->getTimestamp() ); - } - - public function test_hooked_into_wp_cron() { - $next = wp_next_scheduled( ActionScheduler_QueueRunner::WP_CRON_HOOK ); - $this->assertNotEmpty($next); - } - - public function test_batch_count_limit() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $mock = new MockAction(); - $random = md5(rand()); - add_action( $random, array( $mock, 'action' ) ); - $schedule = new ActionScheduler_SimpleSchedule(new ActionScheduler_DateTime('1 day ago')); - - for ( $i = 0 ; $i < 30 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $claims = array(); - - for ( $i = 0 ; $i < 5 ; $i++ ) { - $claims[] = $store->stake_claim( 5 ); - } - - $actions_run = $runner->run(); - - - $this->assertEquals( 0, $mock->get_call_count() ); - $this->assertEquals( 0, $actions_run ); - - $first = reset($claims); - $store->release_claim( $first ); - - $actions_run = $runner->run(); - $this->assertEquals( 10, $mock->get_call_count() ); - $this->assertEquals( 10, $actions_run ); - - remove_action( $random, array( $mock, 'action' ) ); - } - - public function test_changing_batch_count_limit() { - $store = ActionScheduler::store(); - $runner = new ActionScheduler_QueueRunner( $store ); - - $random = md5(rand()); - $schedule = new ActionScheduler_SimpleSchedule(new ActionScheduler_DateTime('1 day ago')); - - for ( $i = 0 ; $i < 30 ; $i++ ) { - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $claims = array(); - - for ( $i = 0 ; $i < 5 ; $i++ ) { - $claims[] = $store->stake_claim( 5 ); - } - - $mock1 = new MockAction(); - add_action( $random, array( $mock1, 'action' ) ); - $actions_run = $runner->run(); - remove_action( $random, array( $mock1, 'action' ) ); - - $this->assertEquals( 0, $mock1->get_call_count() ); - $this->assertEquals( 0, $actions_run ); - - - add_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); - - $mock2 = new MockAction(); - add_action( $random, array( $mock2, 'action' ) ); - $actions_run = $runner->run(); - remove_action( $random, array( $mock2, 'action' ) ); - - $this->assertEquals( 5, $mock2->get_call_count() ); - $this->assertEquals( 5, $actions_run ); - - remove_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); - - for ( $i = 0 ; $i < 5 ; $i++ ) { // to make up for the actions we just processed - $action = new ActionScheduler_Action( $random, array($random), $schedule ); - $store->save_action( $action ); - } - - $mock3 = new MockAction(); - add_action( $random, array( $mock3, 'action' ) ); - $actions_run = $runner->run(); - remove_action( $random, array( $mock3, 'action' ) ); - - $this->assertEquals( 0, $mock3->get_call_count() ); - $this->assertEquals( 0, $actions_run ); - - remove_filter( 'action_scheduler_queue_runner_concurrent_batches', array( $this, 'return_6' ) ); - } - - public function return_6() { - return 6; - } - - public function test_store_fetch_action_failure_schedule_next_instance() { - $random = md5( rand() ); - $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object( '12 hours ago' ), DAY_IN_SECONDS ); - $action = new ActionScheduler_Action( $random, array(), $schedule ); - $action_id = ActionScheduler::store()->save_action( $action ); - - // Set up a mock store that will throw an exception when fetching actions. - $store = $this - ->getMockBuilder( 'ActionScheduler_wpPostStore' ) - ->setMethods( array( 'fetch_action' ) ) - ->getMock(); - $store - ->method( 'fetch_action' ) - ->with( $action_id ) - ->will( $this->throwException( new Exception() ) ); - - // Set up a mock queue runner to verify that schedule_next_instance() - // isn't called for an undefined $action. - $runner = $this - ->getMockBuilder( 'ActionScheduler_QueueRunner' ) - ->setConstructorArgs( array( $store ) ) - ->setMethods( array( 'schedule_next_instance' ) ) - ->getMock(); - $runner - ->expects( $this->never() ) - ->method( 'schedule_next_instance' ); - - $runner->run(); - - // Set up a mock store that will throw an exception when fetching actions. - $store2 = $this - ->getMockBuilder( 'ActionScheduler_wpPostStore' ) - ->setMethods( array( 'fetch_action' ) ) - ->getMock(); - $store2 - ->method( 'fetch_action' ) - ->with( $action_id ) - ->willReturn( null ); - - // Set up a mock queue runner to verify that schedule_next_instance() - // isn't called for an undefined $action. - $runner2 = $this - ->getMockBuilder( 'ActionScheduler_QueueRunner' ) - ->setConstructorArgs( array( $store ) ) - ->setMethods( array( 'schedule_next_instance' ) ) - ->getMock(); - $runner2 - ->expects( $this->never() ) - ->method( 'schedule_next_instance' ); - - $runner2->run(); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php b/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php deleted file mode 100644 index 4d1ee9a7991..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_CronSchedule_Test.php +++ /dev/null @@ -1,45 +0,0 @@ -assertEquals( $time, $schedule->next() ); - } - - public function test_next() { - $time = as_get_datetime_object('2013-06-14'); - $cron = CronExpression::factory('@daily'); - $schedule = new ActionScheduler_CronSchedule($time, $cron); - $this->assertEquals( as_get_datetime_object('tomorrow'), $schedule->next( as_get_datetime_object() ) ); - } - - public function test_is_recurring() { - $schedule = new ActionScheduler_CronSchedule(as_get_datetime_object('2013-06-14'), CronExpression::factory('@daily')); - $this->assertTrue( $schedule->is_recurring() ); - } - - public function test_cron_format() { - $time = as_get_datetime_object('2014-01-01'); - $cron = CronExpression::factory('0 0 10 10 *'); - $schedule = new ActionScheduler_CronSchedule($time, $cron); - $this->assertEquals( as_get_datetime_object('2014-10-10'), $schedule->next() ); - - $cron = CronExpression::factory('0 0 L 1/2 *'); - $schedule = new ActionScheduler_CronSchedule($time, $cron); - $this->assertEquals( as_get_datetime_object('2014-01-31'), $schedule->next() ); - $this->assertEquals( as_get_datetime_object('2014-07-31'), $schedule->next( as_get_datetime_object('2014-06-01') ) ); - $this->assertEquals( as_get_datetime_object('2028-11-30'), $schedule->next( as_get_datetime_object('2028-11-01') ) ); - - $cron = CronExpression::factory('30 14 * * MON#3 *'); - $schedule = new ActionScheduler_CronSchedule($time, $cron); - $this->assertEquals( as_get_datetime_object('2014-01-20 14:30:00'), $schedule->next() ); - $this->assertEquals( as_get_datetime_object('2014-05-19 14:30:00'), $schedule->next( as_get_datetime_object('2014-05-01') ) ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php b/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php deleted file mode 100644 index 2f68ccb2023..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_IntervalSchedule_Test.php +++ /dev/null @@ -1,28 +0,0 @@ -assertEquals( $time, $schedule->next() ); - } - - public function test_next() { - $now = time(); - $start = $now - 30; - $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS ); - $this->assertEquals( $start, $schedule->next()->getTimestamp() ); - $this->assertEquals( $now + MINUTE_IN_SECONDS, $schedule->next(as_get_datetime_object())->getTimestamp() ); - $this->assertEquals( $start, $schedule->next(as_get_datetime_object("@$start"))->getTimestamp() ); - } - - public function test_is_recurring() { - $start = time() - 30; - $schedule = new ActionScheduler_IntervalSchedule( as_get_datetime_object("@$start"), MINUTE_IN_SECONDS ); - $this->assertTrue( $schedule->is_recurring() ); - } -} diff --git a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php b/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php deleted file mode 100644 index cd2c601061b..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_NullSchedule_Test.php +++ /dev/null @@ -1,18 +0,0 @@ -assertNull( $schedule->next() ); - } - - public function test_is_recurring() { - $schedule = new ActionScheduler_NullSchedule(); - $this->assertFalse( $schedule->is_recurring() ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php b/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php deleted file mode 100644 index 022dd66aadc..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/schedules/ActionScheduler_SimpleSchedule_Test.php +++ /dev/null @@ -1,37 +0,0 @@ -assertEquals( $time, $schedule->next() ); - } - - public function test_past_date() { - $time = as_get_datetime_object('-1 day'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $this->assertEquals( $time, $schedule->next() ); - } - - public function test_future_date() { - $time = as_get_datetime_object('+1 day'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $this->assertEquals( $time, $schedule->next() ); - } - - public function test_grace_period_for_next() { - $time = as_get_datetime_object('3 seconds ago'); - $schedule = new ActionScheduler_SimpleSchedule($time); - $this->assertEquals( $time, $schedule->next() ); - } - - public function test_is_recurring() { - $schedule = new ActionScheduler_SimpleSchedule(as_get_datetime_object('+1 day')); - $this->assertFalse( $schedule->is_recurring() ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php b/includes/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php deleted file mode 100644 index 9e79e024595..00000000000 --- a/includes/libraries/action-scheduler/tests/phpunit/versioning/ActionScheduler_Versions_Test.php +++ /dev/null @@ -1,43 +0,0 @@ -register('1.0-dev', 'callback_1_dot_0_dev'); - $versions->register('1.0', 'callback_1_dot_0'); - - $registered = $versions->get_versions(); - - $this->assertArrayHasKey( '1.0-dev', $registered ); - $this->assertArrayHasKey( '1.0', $registered ); - $this->assertCount( 2, $registered ); - - $this->assertEquals( 'callback_1_dot_0_dev', $registered['1.0-dev'] ); - } - - public function test_duplicate_version() { - $versions = new ActionScheduler_Versions(); - $versions->register('1.0', 'callback_1_dot_0_a'); - $versions->register('1.0', 'callback_1_dot_0_b'); - - $registered = $versions->get_versions(); - - $this->assertArrayHasKey( '1.0', $registered ); - $this->assertCount( 1, $registered ); - } - - public function test_latest_version() { - $versions = new ActionScheduler_Versions(); - $this->assertEquals('__return_null', $versions->latest_version_callback() ); - $versions->register('1.2', 'callback_1_dot_2'); - $versions->register('1.3', 'callback_1_dot_3'); - $versions->register('1.0', 'callback_1_dot_0'); - - $this->assertEquals( '1.3', $versions->latest_version() ); - $this->assertEquals( 'callback_1_dot_3', $versions->latest_version_callback() ); - } -} - \ No newline at end of file diff --git a/includes/libraries/action-scheduler/tests/travis/setup.sh b/includes/libraries/action-scheduler/tests/travis/setup.sh deleted file mode 100755 index 068198af5f5..00000000000 --- a/includes/libraries/action-scheduler/tests/travis/setup.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -# WordPress test setup script for Travis CI -# -# Author: Benjamin J. Balter ( ben@balter.com | ben.balter.com ) -# License: GPL3 - -export WP_CORE_DIR=/tmp/wordpress -export WP_TESTS_DIR=/tmp/wordpress-tests/tests/phpunit - -if [[ "$1" = "5.6" || "$1" > "5.6" ]] -then - wget -c https://phar.phpunit.de/phpunit-5.7.phar - chmod +x phpunit-5.7.phar - mv phpunit-5.7.phar `which phpunit` -fi - -plugin_slug=$(basename $(pwd)) -plugin_dir=$WP_CORE_DIR/wp-content/plugins/$plugin_slug - -# Init database -mysql -e 'CREATE DATABASE wordpress_test;' -uroot - -# Grab specified version of WordPress from github -wget -nv -O /tmp/wordpress.tar.gz https://github.com/WordPress/WordPress/tarball/$WP_VERSION -mkdir -p $WP_CORE_DIR -tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR - -# Grab testing framework -svn co --quiet https://develop.svn.wordpress.org/tags/$WP_VERSION/ /tmp/wordpress-tests - -# Put various components in proper folders -cp tests/travis/wp-tests-config.php $WP_TESTS_DIR/wp-tests-config.php - -cd .. -mv $plugin_slug $plugin_dir - -cd $plugin_dir diff --git a/includes/libraries/action-scheduler/tests/travis/wp-tests-config.php b/includes/libraries/action-scheduler/tests/travis/wp-tests-config.php deleted file mode 100644 index f626da090a2..00000000000 --- a/includes/libraries/action-scheduler/tests/travis/wp-tests-config.php +++ /dev/null @@ -1,38 +0,0 @@ -