Exception
8 years ago
Interval
8 years ago
Timezone
7 years ago
views
3 weeks ago
Config.php
8 years ago
Connection.php
8 years ago
Export.php
3 weeks ago
LicensingManager.php
1 year ago
Scheduling.php
1 year ago
SchedulingApi.php
3 years ago
Export.php
53 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Wpae\Scheduling; |
| 4 | |
| 5 | |
| 6 | class Export |
| 7 | { |
| 8 | |
| 9 | public function trigger($export) |
| 10 | { |
| 11 | $export->set(array( |
| 12 | 'triggered' => 1, |
| 13 | 'exported' => 0, |
| 14 | 'last_activity' => date('Y-m-d H:i:s') // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date -- DB timestamp must match local-timezone format used by Manage Exports UI readers (mysql2date / strtotime / human_time_diff) |
| 15 | ))->update(); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * @param $export |
| 20 | * @return array |
| 21 | */ |
| 22 | public function process($export) |
| 23 | { |
| 24 | // trigger update child exports with correct WHERE & JOIN filters |
| 25 | if (!empty($export->options['cpt']) and class_exists('WooCommerce') and in_array('shop_order', $export->options['cpt']) and empty($export->parent_id)) { |
| 26 | $queue_exports = \XmlExportWooCommerceOrder::prepare_child_exports($export, true); |
| 27 | |
| 28 | if (empty($queue_exports)) { |
| 29 | delete_option('wp_all_export_queue_' . $export->id); |
| 30 | } else { |
| 31 | update_option('wp_all_export_queue_' . $export->id, $queue_exports); |
| 32 | } |
| 33 | } |
| 34 | // remove child export from queue |
| 35 | if (!empty($export->parent_id)) { |
| 36 | $queue_exports = get_option('wp_all_export_queue_' . $export->parent_id); |
| 37 | |
| 38 | if (!empty($queue_exports)) { |
| 39 | foreach ($queue_exports as $key => $queue_export) { |
| 40 | if ($queue_export == $export->id) { |
| 41 | unset($queue_exports[$key]); |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | if (empty($queue_exports)) { |
| 47 | delete_option('wp_all_export_queue_' . $export->parent_id); |
| 48 | } else { |
| 49 | update_option('wp_all_export_queue_' . $export->parent_id, $queue_exports); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | } |