admin_head.php
3 weeks ago
admin_init.php
3 weeks ago
admin_menu.php
3 weeks ago
admin_notices.php
3 weeks ago
init.php
3 weeks ago
pmxe_after_export.php
3 weeks ago
pmxe_before_export.php
3 weeks ago
pmxe_exported_post.php
3 weeks ago
wp_ajax_dismiss_export_warnings.php
3 weeks ago
wp_ajax_dismiss_review_modal.php
3 weeks ago
wp_ajax_dismiss_warnings.php
3 weeks ago
wp_ajax_generate_zapier_api_key.php
3 weeks ago
wp_ajax_redirect_after_addon_installed.php
3 weeks ago
wp_ajax_save_scheduling.php
3 weeks ago
wp_ajax_scheduling_dialog_content.php
3 weeks ago
wp_ajax_scheduling_subscribe_dialog_content.php
3 weeks ago
wp_ajax_send_feedback.php
3 weeks ago
wp_ajax_wpae_available_rules.php
3 weeks ago
wp_ajax_wpae_filtering.php
3 weeks ago
wp_ajax_wpae_filtering_count.php
3 weeks ago
wp_ajax_wpae_get_scheduling_connection_icon.php
3 weeks ago
wp_ajax_wpae_preview.php
3 weeks ago
wp_ajax_wpae_upgrade_notice.php
3 weeks ago
wp_ajax_wpallexport.php
3 weeks ago
wp_loaded.php
3 weeks ago
wpmu_new_blog.php
3 weeks ago
pmxe_before_export.php
45 lines
| 1 | <?php |
| 2 | |
| 3 | defined( 'ABSPATH' ) || exit; |
| 4 | |
| 5 | |
| 6 | function pmxe_pmxe_before_export($export_id) |
| 7 | { |
| 8 | $export = new PMXE_Export_Record(); |
| 9 | $export->getById($export_id); |
| 10 | |
| 11 | if ( ! $export->isEmpty() ) |
| 12 | { |
| 13 | if ( ! $export->options['export_only_new_stuff'] ) |
| 14 | { |
| 15 | $postList = new PMXE_Post_List(); |
| 16 | $missingPosts = $postList->getBy(array('export_id' => $export_id, 'iteration !=' => --$export->iteration)); |
| 17 | $missing_ids = array(); |
| 18 | if ( ! $missingPosts->isEmpty() ): |
| 19 | |
| 20 | foreach ($missingPosts as $missingPost) |
| 21 | { |
| 22 | $missing_ids[] = (int) $missingPost['post_id']; |
| 23 | } |
| 24 | |
| 25 | endif; |
| 26 | |
| 27 | if ( ! empty($missing_ids)) |
| 28 | { |
| 29 | global $wpdb; |
| 30 | // Delete records form pmxe_posts |
| 31 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $sql composed of $wpdb->prefix-derived table name and int-cast post id list; export_id bound via prepare() below |
| 32 | $sql = "DELETE FROM " . PMXE_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id IN (" . implode(',', $missing_ids) . ") AND export_id = %d"; |
| 33 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,PluginCheck.Security.DirectDB.UnescapedDBParameter -- plugin-owned pmxe_posts table cleanup; $sql composed of $wpdb->prefix-derived table name + int-cast post ids, export_id bound via prepare() |
| 34 | $wpdb->query( $wpdb->prepare( $sql, $export->id ) ); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | if ( empty($export->parent_id) ) |
| 39 | { |
| 40 | delete_option( 'wp_all_export_queue_' . $export->id ); |
| 41 | } |
| 42 | |
| 43 | delete_option( 'wp_all_export_acf_flexible_' . $export->id ); |
| 44 | } |
| 45 | } |