← All changes
|
includes/admin/tools/data/class-give-tools-delete-test-transactions.php
+28
-11
2.3.0
→
4.17.0
View file →
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * This class handles batch processing of deleting test transactions |
| 6 | 6 | * |
| 7 | 7 | * @subpackage Admin/Tools/Give_Tools_Delete_Test_Transactions |
| 8 | - * @copyright Copyright (c) 2016, WordImpress | |
| 8 | + * @copyright Copyright (c) 2016, GiveWP | |
| 9 | 9 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 10 | 10 | * @since 1.5 |
| 11 | 11 | */ |
| 12 | 12 | |
| @@ -23,8 +23,9 @@ | ||
| 23 | 23 | class Give_Tools_Delete_Test_Transactions extends Give_Batch_Export { |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Our export type. Used for export-type specific filters/actions |
| 27 | + * | |
| 27 | 28 | * @var string |
| 28 | 29 | * @since 1.5 |
| 29 | 30 | */ |
| 30 | 31 | public $export_type = ''; |
| @@ -30,8 +31,9 @@ | ||
| 30 | 31 | public $export_type = ''; |
| 31 | 32 | |
| 32 | 33 | /** |
| 33 | 34 | * Allows for a non-form batch processing to be run. |
| 35 | + * | |
| 34 | 36 | * @since 1.5 |
| 35 | 37 | * @var boolean |
| 36 | 38 | */ |
| 37 | 39 | public $is_void = true; |
| @@ -37,8 +39,9 @@ | ||
| 37 | 39 | public $is_void = true; |
| 38 | 40 | |
| 39 | 41 | /** |
| 40 | 42 | * Sets the number of items to pull on each step |
| 43 | + * | |
| 41 | 44 | * @since 1.5 |
| 42 | 45 | * @var integer |
| 43 | 46 | */ |
| 44 | 47 | public $per_step = 30; |
| @@ -69,9 +72,9 @@ | ||
| 69 | 72 | } |
| 70 | 73 | |
| 71 | 74 | $offset = ( $this->step - 1 ) * $this->per_step; |
| 72 | 75 | $step_items = array_slice( $items, $offset, $this->per_step ); |
| 73 | - $meta_table = __give_v20_bc_table_details( 'payment' ); | |
| 76 | + $meta_table = give_v20_bc_table_details( 'payment' ); | |
| 74 | 77 | |
| 75 | 78 | if ( $step_items ) { |
| 76 | 79 | foreach ( $step_items as $item ) { |
| 77 | 80 | // Delete the main payment. |
| @@ -91,9 +94,11 @@ | ||
| 91 | 94 | */ |
| 92 | 95 | public function get_percentage_complete() { |
| 93 | 96 | |
| 94 | 97 | $items = $this->get_stored_data( 'give_temp_delete_test_ids', false ); |
| 95 | - $total = count( $items ); | |
| 98 | + $total = is_array( $items ) | |
| 99 | + ? count( $items ) | |
| 100 | + : 0; | |
| 96 | 101 | |
| 97 | 102 | $percentage = 100; |
| 98 | 103 | |
| 99 | 104 | if ( $total > 0 ) { |
| @@ -183,14 +188,26 @@ | ||
| 183 | 188 | |
| 184 | 189 | if ( false === $items ) { |
| 185 | 190 | $items = array(); |
| 186 | 191 | |
| 187 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( | |
| 188 | - 'post_status' => 'any', | |
| 189 | - 'number' => - 1, | |
| 190 | - 'meta_key' => '_give_payment_mode', | |
| 191 | - 'meta_value' => 'test' | |
| 192 | - ) ); | |
| 192 | + $args = apply_filters( | |
| 193 | + 'give_tools_reset_stats_total_args', | |
| 194 | + array( | |
| 195 | + 'post_status' => 'any', | |
| 196 | + 'number' => - 1, | |
| 197 | + 'meta_query' => array( | |
| 198 | + 'relation' => 'OR', | |
| 199 | + array( | |
| 200 | + 'key' => '_give_payment_mode', | |
| 201 | + 'value' => 'test', | |
| 202 | + ), | |
| 203 | + array( | |
| 204 | + 'key' => '_give_payment_gateway', | |
| 205 | + 'value' => 'manual', | |
| 206 | + ), | |
| 207 | + ), | |
| 208 | + ) | |
| 209 | + ); | |
| 193 | 210 | |
| 194 | 211 | $posts = new Give_Payments_Query( $args ); |
| 195 | 212 | $payments = $posts->get_payments(); |
| 196 | 213 | |
| @@ -241,9 +258,9 @@ | ||
| 241 | 258 | * |
| 242 | 259 | * @since 1.5 |
| 243 | 260 | * |
| 244 | 261 | * @param string $key The option_name |
| 245 | - * @param mixed $value The value to store | |
| 262 | + * @param mixed $value The value to store | |
| 246 | 263 | * |
| 247 | 264 | * @return void |
| 248 | 265 | */ |
| 249 | 266 | private function store_data( $key, $value ) { |
| @@ -284,9 +301,9 @@ | ||
| 284 | 301 | * Unset the properties specific to the donors export. |
| 285 | 302 | * |
| 286 | 303 | * @since 2.3.0 |
| 287 | 304 | * |
| 288 | - * @param array $request | |
| 305 | + * @param array $request | |
| 289 | 306 | * @param Give_Batch_Export $export |
| 290 | 307 | */ |
| 291 | 308 | public function unset_properties( $request, $export ) { |
| 292 | 309 | if ( $export->done ) { |