← All changes
|
jetpack_vendor/automattic/jetpack-sync/src/modules/class-network-options.php
+16
-6
13.2.4
→
16.3-a.7
View file →
| @@ -8,8 +8,12 @@ | ||
| 8 | 8 | namespace Automattic\Jetpack\Sync\Modules; |
| 9 | 9 | |
| 10 | 10 | use Automattic\Jetpack\Sync\Defaults; |
| 11 | 11 | |
| 12 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | + exit( 0 ); | |
| 14 | +} | |
| 15 | + | |
| 12 | 16 | /** |
| 13 | 17 | * Class to handle sync for network options. |
| 14 | 18 | */ |
| 15 | 19 | class Network_Options extends Module { |
| @@ -119,19 +123,25 @@ | ||
| 119 | 123 | * |
| 120 | 124 | * @access public |
| 121 | 125 | * |
| 122 | 126 | * @param array $config Full sync configuration for this sync module. |
| 127 | + * @param array $status This module Full Sync status. | |
| 123 | 128 | * @param int $send_until The timestamp until the current request can send. |
| 124 | - * @param array $state This module Full Sync status. | |
| 129 | + * @param int $started The timestamp when the full sync started. | |
| 125 | 130 | * |
| 126 | 131 | * @return array This module Full Sync status. |
| 127 | 132 | */ |
| 128 | - public function send_full_sync_actions( $config, $send_until, $state ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable | |
| 133 | + public function send_full_sync_actions( $config, $status, $send_until, $started ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable | |
| 129 | 134 | // we call this instead of do_action when sending immediately. |
| 130 | - $this->send_action( 'jetpack_full_sync_network_options', array( true ) ); | |
| 135 | + $result = $this->send_action( 'jetpack_full_sync_network_options', array( true ) ); | |
| 131 | 136 | |
| 132 | - // The number of actions enqueued, and next module state (true == done). | |
| 133 | - return array( 'finished' => true ); | |
| 137 | + if ( is_wp_error( $result ) ) { | |
| 138 | + $status['error'] = true; | |
| 139 | + return $status; | |
| 140 | + } | |
| 141 | + $status['finished'] = true; | |
| 142 | + $status['sent'] = $status['total']; | |
| 143 | + return $status; | |
| 134 | 144 | } |
| 135 | 145 | |
| 136 | 146 | /** |
| 137 | 147 | * Retrieve an estimated number of actions that will be enqueued. |
| @@ -138,9 +148,9 @@ | ||
| 138 | 148 | * |
| 139 | 149 | * @access public |
| 140 | 150 | * |
| 141 | 151 | * @param array $config Full sync configuration for this sync module. |
| 142 | - * @return array Number of items yet to be enqueued. | |
| 152 | + * @return int Number of items yet to be enqueued. | |
| 143 | 153 | */ |
| 144 | 154 | public function estimate_full_sync_actions( $config ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 145 | 155 | return 1; |
| 146 | 156 | } |