Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
workflows:
|
||||
version: 2
|
||||
main:
|
||||
jobs:
|
||||
- php72-build
|
||||
- php73-build
|
||||
- php74-build
|
||||
- php80-build
|
||||
|
||||
version: 2
|
||||
|
||||
job-references:
|
||||
mysql_image: &mysql_image
|
||||
cimg/mysql:5.7
|
||||
|
||||
setup_environment: &setup_environment
|
||||
name: "Setup Environment Variables"
|
||||
command: |
|
||||
echo "export PATH=$HOME/.composer/vendor/bin:$PATH" >> $BASH_ENV
|
||||
source /home/circleci/.bashrc
|
||||
|
||||
install_dependencies: &install_dependencies
|
||||
name: "Install Dependencies"
|
||||
command: |
|
||||
sudo apt-get update && sudo apt-get install mysql-client subversion
|
||||
|
||||
php_job: &php_job
|
||||
environment:
|
||||
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
|
||||
- WP_CORE_DIR: "/tmp/wordpress/"
|
||||
steps:
|
||||
- checkout
|
||||
- run: php --version
|
||||
- run: composer --version
|
||||
- run: *setup_environment
|
||||
- run: *install_dependencies
|
||||
- run:
|
||||
name: "Run Tests"
|
||||
command: |
|
||||
rm -rf $WP_TESTS_DIR $WP_CORE_DIR
|
||||
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 latest
|
||||
make test-unit
|
||||
WP_MULTISITE=1 make test-unit
|
||||
make test-style
|
||||
|
||||
jobs:
|
||||
php56-build:
|
||||
<<: *php_job
|
||||
docker:
|
||||
- image: cimg/php:5.6
|
||||
- image: *mysql_image
|
||||
|
||||
php70-build:
|
||||
<<: *php_job
|
||||
docker:
|
||||
- image: cimg/php:7.0
|
||||
- image: *mysql_image
|
||||
|
||||
php71-build:
|
||||
<<: *php_job
|
||||
docker:
|
||||
- image: cimg/php:7.1
|
||||
- image: *mysql_image
|
||||
|
||||
php72-build:
|
||||
<<: *php_job
|
||||
docker:
|
||||
- image: cimg/php:7.2
|
||||
- image: *mysql_image
|
||||
|
||||
php73-build:
|
||||
<<: *php_job
|
||||
docker:
|
||||
- image: cimg/php:7.3
|
||||
- image: *mysql_image
|
||||
|
||||
php74-build:
|
||||
<<: *php_job
|
||||
docker:
|
||||
- image: cimg/php:7.4
|
||||
- image: *mysql_image
|
||||
|
||||
php80-build:
|
||||
<<: *php_job
|
||||
docker:
|
||||
- image: cimg/php:8.0
|
||||
- image: *mysql_image
|
||||
|
||||
php81-build:
|
||||
<<: *php_job
|
||||
docker:
|
||||
- image: cimg/php:8.1
|
||||
- image: *mysql_image
|
65
wp-content/plugins/seo-by-rank-math/vendor/a5hleyrich/wp-background-processing/.phpcs.xml
vendored
Normal file
65
wp-content/plugins/seo-by-rank-math/vendor/a5hleyrich/wp-background-processing/.phpcs.xml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
|
||||
<description>Generally-applicable sniffs for WordPress plugins.</description>
|
||||
|
||||
<!-- What to scan -->
|
||||
<file>.</file>
|
||||
<exclude-pattern>/vendor/</exclude-pattern>
|
||||
<exclude-pattern>/node_modules/</exclude-pattern>
|
||||
<exclude-pattern>/tests/*</exclude-pattern>
|
||||
|
||||
<!-- How to scan -->
|
||||
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
|
||||
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
|
||||
<arg value="sp"/> <!-- Show sniff and progress -->
|
||||
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
|
||||
<arg name="colors"/>
|
||||
<arg name="extensions" value="php"/>
|
||||
<arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
|
||||
|
||||
<!-- Rules: Check PHP version compatibility -->
|
||||
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
|
||||
<config name="testVersion" value="5.6-"/>
|
||||
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
|
||||
<rule ref="PHPCompatibilityWP"/>
|
||||
|
||||
<!-- Rules: WordPress Coding Standards -->
|
||||
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
|
||||
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
|
||||
<config name="minimum_supported_wp_version" value="4.6"/>
|
||||
<rule ref="WordPress">
|
||||
<!-- Unable to fix -->
|
||||
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
|
||||
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound"/>
|
||||
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound"/>
|
||||
<exclude name="WordPress.DB.DirectDatabaseQuery.NoCaching"/>
|
||||
|
||||
<!-- TODO: Maybe fix -->
|
||||
<exclude name="WordPress.WP.CronInterval.ChangeDetected"/>
|
||||
<exclude name="WordPress.DB.DirectDatabaseQuery.DirectQuery"/>
|
||||
</rule>
|
||||
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
|
||||
<properties>
|
||||
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
|
||||
<property name="prefixes" type="array" value="wpbp"/>
|
||||
</properties>
|
||||
|
||||
<!-- TODO: Maybe fix -->
|
||||
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound"/>
|
||||
</rule>
|
||||
<rule ref="WordPress.WP.I18n">
|
||||
<properties>
|
||||
<!-- Value: replace the text domain used. -->
|
||||
<property name="text_domain" type="array" value="wp-background-processing"/>
|
||||
</properties>
|
||||
|
||||
<!-- TODO: Should fix -->
|
||||
<exclude name="WordPress.WP.I18n.MissingArgDomain"/>
|
||||
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment"/>
|
||||
</rule>
|
||||
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
|
||||
<properties>
|
||||
<property name="blank_line_check" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
18
wp-content/plugins/seo-by-rank-math/vendor/a5hleyrich/wp-background-processing/Makefile
vendored
Normal file
18
wp-content/plugins/seo-by-rank-math/vendor/a5hleyrich/wp-background-processing/Makefile
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
.PHONY: test
|
||||
test: test-unit test-style
|
||||
|
||||
.PHONY: test-unit
|
||||
test-unit: vendor
|
||||
vendor/bin/phpunit
|
||||
|
||||
.PHONY: test-style
|
||||
test-style: vendor
|
||||
vendor/bin/phpcs
|
||||
|
||||
vendor: composer.json
|
||||
composer install --ignore-platform-reqs
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf vendor
|
||||
rm -f tests/.phpunit.result.cache
|
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Async Request
|
||||
*
|
||||
* @package WP-Background-Processing
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract WP_Async_Request class.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
abstract class WP_Async_Request {
|
||||
|
||||
/**
|
||||
* Prefix
|
||||
*
|
||||
* (default value: 'wp')
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $prefix = 'wp';
|
||||
|
||||
/**
|
||||
* Action
|
||||
*
|
||||
* (default value: 'async_request')
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $action = 'async_request';
|
||||
|
||||
/**
|
||||
* Identifier
|
||||
*
|
||||
* @var mixed
|
||||
* @access protected
|
||||
*/
|
||||
protected $identifier;
|
||||
|
||||
/**
|
||||
* Data
|
||||
*
|
||||
* (default value: array())
|
||||
*
|
||||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $data = array();
|
||||
|
||||
/**
|
||||
* Initiate new async request.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->identifier = $this->prefix . '_' . $this->action;
|
||||
|
||||
add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) );
|
||||
add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data used during the request.
|
||||
*
|
||||
* @param array $data Data.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function data( $data ) {
|
||||
$this->data = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch the async request.
|
||||
*
|
||||
* @return array|WP_Error|false HTTP Response array, WP_Error on failure, or false if not attempted.
|
||||
*/
|
||||
public function dispatch() {
|
||||
$url = add_query_arg( $this->get_query_args(), $this->get_query_url() );
|
||||
$args = $this->get_post_args();
|
||||
|
||||
return wp_remote_post( esc_url_raw( $url ), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query args.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_query_args() {
|
||||
if ( property_exists( $this, 'query_args' ) ) {
|
||||
return $this->query_args;
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'action' => $this->identifier,
|
||||
'nonce' => wp_create_nonce( $this->identifier ),
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the post arguments used during an async request.
|
||||
*
|
||||
* @param array $url
|
||||
*/
|
||||
return apply_filters( $this->identifier . '_query_args', $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_query_url() {
|
||||
if ( property_exists( $this, 'query_url' ) ) {
|
||||
return $this->query_url;
|
||||
}
|
||||
|
||||
$url = admin_url( 'admin-ajax.php' );
|
||||
|
||||
/**
|
||||
* Filters the post arguments used during an async request.
|
||||
*
|
||||
* @param string $url
|
||||
*/
|
||||
return apply_filters( $this->identifier . '_query_url', $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post args.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_post_args() {
|
||||
if ( property_exists( $this, 'post_args' ) ) {
|
||||
return $this->post_args;
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'timeout' => 5,
|
||||
'blocking' => false,
|
||||
'body' => $this->data,
|
||||
'cookies' => $_COOKIE, // Passing cookies ensures request is performed as initiating user.
|
||||
'sslverify' => apply_filters( 'https_local_ssl_verify', false ), // Local requests, fine to pass false.
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the post arguments used during an async request.
|
||||
*
|
||||
* @param array $args
|
||||
*/
|
||||
return apply_filters( $this->identifier . '_post_args', $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Maybe handle a dispatched request.
|
||||
*
|
||||
* Check for correct nonce and pass to handler.
|
||||
*
|
||||
* @return void|mixed
|
||||
*/
|
||||
public function maybe_handle() {
|
||||
// Don't lock up other requests while processing.
|
||||
session_write_close();
|
||||
|
||||
check_ajax_referer( $this->identifier, 'nonce' );
|
||||
|
||||
$this->handle();
|
||||
|
||||
return $this->maybe_wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the process exit with wp_die?
|
||||
*
|
||||
* @param mixed $return What to return if filter says don't die, default is null.
|
||||
*
|
||||
* @return void|mixed
|
||||
*/
|
||||
protected function maybe_wp_die( $return = null ) {
|
||||
/**
|
||||
* Should wp_die be used?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
if ( apply_filters( $this->identifier . '_wp_die', true ) ) {
|
||||
wp_die();
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a dispatched request.
|
||||
*
|
||||
* Override this method to perform any actions required
|
||||
* during the async request.
|
||||
*/
|
||||
abstract protected function handle();
|
||||
}
|
@@ -0,0 +1,786 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Background Process
|
||||
*
|
||||
* @package WP-Background-Processing
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract WP_Background_Process class.
|
||||
*
|
||||
* @abstract
|
||||
* @extends WP_Async_Request
|
||||
*/
|
||||
abstract class WP_Background_Process extends WP_Async_Request {
|
||||
|
||||
/**
|
||||
* Action
|
||||
*
|
||||
* (default value: 'background_process')
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $action = 'background_process';
|
||||
|
||||
/**
|
||||
* Start time of current process.
|
||||
*
|
||||
* (default value: 0)
|
||||
*
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $start_time = 0;
|
||||
|
||||
/**
|
||||
* Cron_hook_identifier
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $cron_hook_identifier;
|
||||
|
||||
/**
|
||||
* Cron_interval_identifier
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $cron_interval_identifier;
|
||||
|
||||
/**
|
||||
* Restrict object instantiation when using unserialize.
|
||||
*
|
||||
* @var bool|array
|
||||
*/
|
||||
protected $allowed_batch_data_classes = true;
|
||||
|
||||
/**
|
||||
* The status set when process is cancelling.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const STATUS_CANCELLED = 1;
|
||||
|
||||
/**
|
||||
* The status set when process is paused or pausing.
|
||||
*
|
||||
* @var int;
|
||||
*/
|
||||
const STATUS_PAUSED = 2;
|
||||
|
||||
/**
|
||||
* Initiate new background process.
|
||||
*
|
||||
* @param bool|array $allowed_batch_data_classes Optional. Array of class names that can be unserialized. Default true (any class).
|
||||
*/
|
||||
public function __construct( $allowed_batch_data_classes = true ) {
|
||||
parent::__construct();
|
||||
|
||||
if ( empty( $allowed_batch_data_classes ) && false !== $allowed_batch_data_classes ) {
|
||||
$allowed_batch_data_classes = true;
|
||||
}
|
||||
|
||||
if ( ! is_bool( $allowed_batch_data_classes ) && ! is_array( $allowed_batch_data_classes ) ) {
|
||||
$allowed_batch_data_classes = true;
|
||||
}
|
||||
|
||||
// If allowed_batch_data_classes property set in subclass,
|
||||
// only apply override if not allowing any class.
|
||||
if ( true === $this->allowed_batch_data_classes || true !== $allowed_batch_data_classes ) {
|
||||
$this->allowed_batch_data_classes = $allowed_batch_data_classes;
|
||||
}
|
||||
|
||||
$this->cron_hook_identifier = $this->identifier . '_cron';
|
||||
$this->cron_interval_identifier = $this->identifier . '_cron_interval';
|
||||
|
||||
add_action( $this->cron_hook_identifier, array( $this, 'handle_cron_healthcheck' ) );
|
||||
add_filter( 'cron_schedules', array( $this, 'schedule_cron_healthcheck' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule the cron healthcheck and dispatch an async request to start processing the queue.
|
||||
*
|
||||
* @access public
|
||||
* @return array|WP_Error|false HTTP Response array, WP_Error on failure, or false if not attempted.
|
||||
*/
|
||||
public function dispatch() {
|
||||
if ( $this->is_processing() ) {
|
||||
// Process already running.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Schedule the cron healthcheck.
|
||||
$this->schedule_event();
|
||||
|
||||
// Perform remote post.
|
||||
return parent::dispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Push to the queue.
|
||||
*
|
||||
* Note, save must be called in order to persist queued items to a batch for processing.
|
||||
*
|
||||
* @param mixed $data Data.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function push_to_queue( $data ) {
|
||||
$this->data[] = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the queued items for future processing.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function save() {
|
||||
$key = $this->generate_key();
|
||||
|
||||
if ( ! empty( $this->data ) ) {
|
||||
update_site_option( $key, $this->data );
|
||||
}
|
||||
|
||||
// Clean out data so that new data isn't prepended with closed session's data.
|
||||
$this->data = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a batch's queued items.
|
||||
*
|
||||
* @param string $key Key.
|
||||
* @param array $data Data.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function update( $key, $data ) {
|
||||
if ( ! empty( $data ) ) {
|
||||
update_site_option( $key, $data );
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a batch of queued items.
|
||||
*
|
||||
* @param string $key Key.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function delete( $key ) {
|
||||
delete_site_option( $key );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete entire job queue.
|
||||
*/
|
||||
public function delete_all() {
|
||||
$batches = $this->get_batches();
|
||||
|
||||
foreach ( $batches as $batch ) {
|
||||
$this->delete( $batch->key );
|
||||
}
|
||||
|
||||
delete_site_option( $this->get_status_key() );
|
||||
|
||||
$this->cancelled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel job on next batch.
|
||||
*/
|
||||
public function cancel() {
|
||||
update_site_option( $this->get_status_key(), self::STATUS_CANCELLED );
|
||||
|
||||
// Just in case the job was paused at the time.
|
||||
$this->dispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the process been cancelled?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_cancelled() {
|
||||
$status = get_site_option( $this->get_status_key(), 0 );
|
||||
|
||||
return absint( $status ) === self::STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when background process has been cancelled.
|
||||
*/
|
||||
protected function cancelled() {
|
||||
do_action( $this->identifier . '_cancelled' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause job on next batch.
|
||||
*/
|
||||
public function pause() {
|
||||
update_site_option( $this->get_status_key(), self::STATUS_PAUSED );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the job paused?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_paused() {
|
||||
$status = get_site_option( $this->get_status_key(), 0 );
|
||||
|
||||
return absint( $status ) === self::STATUS_PAUSED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when background process has been paused.
|
||||
*/
|
||||
protected function paused() {
|
||||
do_action( $this->identifier . '_paused' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume job.
|
||||
*/
|
||||
public function resume() {
|
||||
delete_site_option( $this->get_status_key() );
|
||||
|
||||
$this->schedule_event();
|
||||
$this->dispatch();
|
||||
$this->resumed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when background process has been resumed.
|
||||
*/
|
||||
protected function resumed() {
|
||||
do_action( $this->identifier . '_resumed' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is queued?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_queued() {
|
||||
return ! $this->is_queue_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the tool currently active, e.g. starting, working, paused or cleaning up?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_active() {
|
||||
return $this->is_queued() || $this->is_processing() || $this->is_paused() || $this->is_cancelled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate key for a batch.
|
||||
*
|
||||
* Generates a unique key based on microtime. Queue items are
|
||||
* given a unique key so that they can be merged upon save.
|
||||
*
|
||||
* @param int $length Optional max length to trim key to, defaults to 64 characters.
|
||||
* @param string $key Optional string to append to identifier before hash, defaults to "batch".
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generate_key( $length = 64, $key = 'batch' ) {
|
||||
$unique = md5( microtime() . wp_rand() );
|
||||
$prepend = $this->identifier . '_' . $key . '_';
|
||||
|
||||
return substr( $prepend . $unique, 0, $length );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_status_key() {
|
||||
return $this->identifier . '_status';
|
||||
}
|
||||
|
||||
/**
|
||||
* Maybe process a batch of queued items.
|
||||
*
|
||||
* Checks whether data exists within the queue and that
|
||||
* the process is not already running.
|
||||
*/
|
||||
public function maybe_handle() {
|
||||
// Don't lock up other requests while processing.
|
||||
session_write_close();
|
||||
|
||||
if ( $this->is_processing() ) {
|
||||
// Background process already running.
|
||||
return $this->maybe_wp_die();
|
||||
}
|
||||
|
||||
if ( $this->is_cancelled() ) {
|
||||
$this->clear_scheduled_event();
|
||||
$this->delete_all();
|
||||
|
||||
return $this->maybe_wp_die();
|
||||
}
|
||||
|
||||
if ( $this->is_paused() ) {
|
||||
$this->clear_scheduled_event();
|
||||
$this->paused();
|
||||
|
||||
return $this->maybe_wp_die();
|
||||
}
|
||||
|
||||
if ( $this->is_queue_empty() ) {
|
||||
// No data to process.
|
||||
return $this->maybe_wp_die();
|
||||
}
|
||||
|
||||
check_ajax_referer( $this->identifier, 'nonce' );
|
||||
|
||||
$this->handle();
|
||||
|
||||
return $this->maybe_wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is queue empty?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function is_queue_empty() {
|
||||
return empty( $this->get_batch() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is process running?
|
||||
*
|
||||
* Check whether the current process is already running
|
||||
* in a background process.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated 1.1.0 Superseded.
|
||||
* @see is_processing()
|
||||
*/
|
||||
protected function is_process_running() {
|
||||
return $this->is_processing();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the background process currently running?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_processing() {
|
||||
if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
|
||||
// Process already running.
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock process.
|
||||
*
|
||||
* Lock the process so that multiple instances can't run simultaneously.
|
||||
* Override if applicable, but the duration should be greater than that
|
||||
* defined in the time_exceeded() method.
|
||||
*/
|
||||
protected function lock_process() {
|
||||
$this->start_time = time(); // Set start time of current process.
|
||||
|
||||
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
|
||||
$lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
|
||||
|
||||
set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock process.
|
||||
*
|
||||
* Unlock the process so that other instances can spawn.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function unlock_process() {
|
||||
delete_site_transient( $this->identifier . '_process_lock' );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get batch.
|
||||
*
|
||||
* @return stdClass Return the first batch of queued items.
|
||||
*/
|
||||
protected function get_batch() {
|
||||
return array_reduce(
|
||||
$this->get_batches( 1 ),
|
||||
static function ( $carry, $batch ) {
|
||||
return $batch;
|
||||
},
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get batches.
|
||||
*
|
||||
* @param int $limit Number of batches to return, defaults to all.
|
||||
*
|
||||
* @return array of stdClass
|
||||
*/
|
||||
public function get_batches( $limit = 0 ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( empty( $limit ) || ! is_int( $limit ) ) {
|
||||
$limit = 0;
|
||||
}
|
||||
|
||||
$table = $wpdb->options;
|
||||
$column = 'option_name';
|
||||
$key_column = 'option_id';
|
||||
$value_column = 'option_value';
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$table = $wpdb->sitemeta;
|
||||
$column = 'meta_key';
|
||||
$key_column = 'meta_id';
|
||||
$value_column = 'meta_value';
|
||||
}
|
||||
|
||||
$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
|
||||
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM ' . $table . '
|
||||
WHERE ' . $column . ' LIKE %s
|
||||
ORDER BY ' . $key_column . ' ASC
|
||||
';
|
||||
|
||||
$args = array( $key );
|
||||
|
||||
if ( ! empty( $limit ) ) {
|
||||
$sql .= ' LIMIT %d';
|
||||
|
||||
$args[] = $limit;
|
||||
}
|
||||
|
||||
$items = $wpdb->get_results( $wpdb->prepare( $sql, $args ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
|
||||
$batches = array();
|
||||
|
||||
if ( ! empty( $items ) ) {
|
||||
$allowed_classes = $this->allowed_batch_data_classes;
|
||||
|
||||
$batches = array_map(
|
||||
static function ( $item ) use ( $column, $value_column, $allowed_classes ) {
|
||||
$batch = new stdClass();
|
||||
$batch->key = $item->{$column};
|
||||
$batch->data = static::maybe_unserialize( $item->{$value_column}, $allowed_classes );
|
||||
|
||||
return $batch;
|
||||
},
|
||||
$items
|
||||
);
|
||||
}
|
||||
|
||||
return $batches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a dispatched request.
|
||||
*
|
||||
* Pass each queue item to the task handler, while remaining
|
||||
* within server memory and time limit constraints.
|
||||
*/
|
||||
protected function handle() {
|
||||
$this->lock_process();
|
||||
|
||||
/**
|
||||
* Number of seconds to sleep between batches. Defaults to 0 seconds, minimum 0.
|
||||
*
|
||||
* @param int $seconds
|
||||
*/
|
||||
$throttle_seconds = max(
|
||||
0,
|
||||
apply_filters(
|
||||
$this->identifier . '_seconds_between_batches',
|
||||
apply_filters(
|
||||
$this->prefix . '_seconds_between_batches',
|
||||
0
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
do {
|
||||
$batch = $this->get_batch();
|
||||
|
||||
foreach ( $batch->data as $key => $value ) {
|
||||
$task = $this->task( $value );
|
||||
|
||||
if ( false !== $task ) {
|
||||
$batch->data[ $key ] = $task;
|
||||
} else {
|
||||
unset( $batch->data[ $key ] );
|
||||
}
|
||||
|
||||
// Keep the batch up to date while processing it.
|
||||
if ( ! empty( $batch->data ) ) {
|
||||
$this->update( $batch->key, $batch->data );
|
||||
}
|
||||
|
||||
// Let the server breathe a little.
|
||||
sleep( $throttle_seconds );
|
||||
|
||||
// Batch limits reached, or pause or cancel request.
|
||||
if ( $this->time_exceeded() || $this->memory_exceeded() || $this->is_paused() || $this->is_cancelled() ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete current batch if fully processed.
|
||||
if ( empty( $batch->data ) ) {
|
||||
$this->delete( $batch->key );
|
||||
}
|
||||
} while ( ! $this->time_exceeded() && ! $this->memory_exceeded() && ! $this->is_queue_empty() && ! $this->is_paused() && ! $this->is_cancelled() );
|
||||
|
||||
$this->unlock_process();
|
||||
|
||||
// Start next batch or complete process.
|
||||
if ( ! $this->is_queue_empty() ) {
|
||||
$this->dispatch();
|
||||
} else {
|
||||
$this->complete();
|
||||
}
|
||||
|
||||
return $this->maybe_wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Memory exceeded?
|
||||
*
|
||||
* Ensures the batch process never exceeds 90%
|
||||
* of the maximum WordPress memory.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function memory_exceeded() {
|
||||
$memory_limit = $this->get_memory_limit() * 0.9; // 90% of max memory
|
||||
$current_memory = memory_get_usage( true );
|
||||
$return = false;
|
||||
|
||||
if ( $current_memory >= $memory_limit ) {
|
||||
$return = true;
|
||||
}
|
||||
|
||||
return apply_filters( $this->identifier . '_memory_exceeded', $return );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get memory limit in bytes.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function get_memory_limit() {
|
||||
if ( function_exists( 'ini_get' ) ) {
|
||||
$memory_limit = ini_get( 'memory_limit' );
|
||||
} else {
|
||||
// Sensible default.
|
||||
$memory_limit = '128M';
|
||||
}
|
||||
|
||||
if ( ! $memory_limit || -1 === intval( $memory_limit ) ) {
|
||||
// Unlimited, set to 32GB.
|
||||
$memory_limit = '32000M';
|
||||
}
|
||||
|
||||
return wp_convert_hr_to_bytes( $memory_limit );
|
||||
}
|
||||
|
||||
/**
|
||||
* Time limit exceeded?
|
||||
*
|
||||
* Ensures the batch never exceeds a sensible time limit.
|
||||
* A timeout limit of 30s is common on shared hosting.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function time_exceeded() {
|
||||
$finish = $this->start_time + apply_filters( $this->identifier . '_default_time_limit', 20 ); // 20 seconds
|
||||
$return = false;
|
||||
|
||||
if ( time() >= $finish ) {
|
||||
$return = true;
|
||||
}
|
||||
|
||||
return apply_filters( $this->identifier . '_time_exceeded', $return );
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete processing.
|
||||
*
|
||||
* Override if applicable, but ensure that the below actions are
|
||||
* performed, or, call parent::complete().
|
||||
*/
|
||||
protected function complete() {
|
||||
delete_site_option( $this->get_status_key() );
|
||||
|
||||
// Remove the cron healthcheck job from the cron schedule.
|
||||
$this->clear_scheduled_event();
|
||||
|
||||
$this->completed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when background process has completed.
|
||||
*/
|
||||
protected function completed() {
|
||||
do_action( $this->identifier . '_completed' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cron healthcheck interval in minutes.
|
||||
*
|
||||
* Default is 5 minutes, minimum is 1 minute.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_cron_interval() {
|
||||
$interval = 5;
|
||||
|
||||
if ( property_exists( $this, 'cron_interval' ) ) {
|
||||
$interval = $this->cron_interval;
|
||||
}
|
||||
|
||||
$interval = apply_filters( $this->cron_interval_identifier, $interval );
|
||||
|
||||
return is_int( $interval ) && 0 < $interval ? $interval : 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule the cron healthcheck job.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param mixed $schedules Schedules.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function schedule_cron_healthcheck( $schedules ) {
|
||||
$interval = $this->get_cron_interval();
|
||||
|
||||
if ( 1 === $interval ) {
|
||||
$display = __( 'Every Minute' );
|
||||
} else {
|
||||
$display = sprintf( __( 'Every %d Minutes' ), $interval );
|
||||
}
|
||||
|
||||
// Adds an "Every NNN Minute(s)" schedule to the existing cron schedules.
|
||||
$schedules[ $this->cron_interval_identifier ] = array(
|
||||
'interval' => MINUTE_IN_SECONDS * $interval,
|
||||
'display' => $display,
|
||||
);
|
||||
|
||||
return $schedules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle cron healthcheck event.
|
||||
*
|
||||
* Restart the background process if not already running
|
||||
* and data exists in the queue.
|
||||
*/
|
||||
public function handle_cron_healthcheck() {
|
||||
if ( $this->is_processing() ) {
|
||||
// Background process already running.
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( $this->is_queue_empty() ) {
|
||||
// No data to process.
|
||||
$this->clear_scheduled_event();
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->dispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule the cron healthcheck event.
|
||||
*/
|
||||
protected function schedule_event() {
|
||||
if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
|
||||
wp_schedule_event( time() + ( $this->get_cron_interval() * MINUTE_IN_SECONDS ), $this->cron_interval_identifier, $this->cron_hook_identifier );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear scheduled cron healthcheck event.
|
||||
*/
|
||||
protected function clear_scheduled_event() {
|
||||
$timestamp = wp_next_scheduled( $this->cron_hook_identifier );
|
||||
|
||||
if ( $timestamp ) {
|
||||
wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the background process.
|
||||
*
|
||||
* Stop processing queue items, clear cron job and delete batch.
|
||||
*
|
||||
* @deprecated 1.1.0 Superseded.
|
||||
* @see cancel()
|
||||
*/
|
||||
public function cancel_process() {
|
||||
$this->cancel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform task with queued item.
|
||||
*
|
||||
* Override this method to perform any actions required on each
|
||||
* queue item. Return the modified item for further processing
|
||||
* in the next pass through. Or, return false to remove the
|
||||
* item from the queue.
|
||||
*
|
||||
* @param mixed $item Queue item to iterate over.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected function task( $item );
|
||||
|
||||
/**
|
||||
* Maybe unserialize data, but not if an object.
|
||||
*
|
||||
* @param mixed $data Data to be unserialized.
|
||||
* @param bool|array $allowed_classes Array of class names that can be unserialized.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function maybe_unserialize( $data, $allowed_classes ) {
|
||||
if ( is_serialized( $data ) ) {
|
||||
$options = array();
|
||||
if ( is_bool( $allowed_classes ) || is_array( $allowed_classes ) ) {
|
||||
$options['allowed_classes'] = $allowed_classes;
|
||||
}
|
||||
|
||||
return @unserialize( $data, $options ); // @phpcs:ignore
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
280
wp-content/plugins/seo-by-rank-math/vendor/a5hleyrich/wp-background-processing/license.txt
vendored
Normal file
280
wp-content/plugins/seo-by-rank-math/vendor/a5hleyrich/wp-background-processing/license.txt
vendored
Normal file
@@ -0,0 +1,280 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) 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
|
||||
this service 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 make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE 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.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* WP-Background Processing
|
||||
*
|
||||
* @package WP-Background-Processing
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugin Name: WP Background Processing
|
||||
* Plugin URI: https://github.com/deliciousbrains/wp-background-processing
|
||||
* Description: Asynchronous requests and background processing in WordPress.
|
||||
* Author: Delicious Brains Inc.
|
||||
* Version: 1.0
|
||||
* Author URI: https://deliciousbrains.com/
|
||||
* GitHub Plugin URI: https://github.com/deliciousbrains/wp-background-processing
|
||||
* GitHub Branch: master
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'WP_Async_Request' ) ) {
|
||||
require_once plugin_dir_path( __FILE__ ) . 'classes/wp-async-request.php';
|
||||
}
|
||||
if ( ! class_exists( 'WP_Background_Process' ) ) {
|
||||
require_once plugin_dir_path( __FILE__ ) . 'classes/wp-background-process.php';
|
||||
}
|
Reference in New Issue
Block a user