Plugin Directory

Changeset 3435839


Ignore:
Timestamp:
01/09/2026 11:17:16 AM (2 months ago)
Author:
findkit
Message:

Update to version 1.5.1 from GitHub

Location:
findkit
Files:
2 added
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • findkit/tags/1.5.1/CHANGELOG.md

    r3412014 r3435839  
     1## v1.5.1
     2
     32026-01-09
     4
     5-   Change Live update logic to use different wordpress hooks to avoid race conditions on certain use cases [ed2f776](https://github.com/findkit/wp-findkit/commit/ed2f776) - Lauri Saarni
     6-   Add CrawlerCompat class to prevent WP url guess functionality when findkit crawls the site. [8f7b91c](https://github.com/findkit/wp-findkit/commit/8f7b91c) - Lauri Saarni
     7
     8All changes https://github.com/findkit/wp-findkit/compare/v1.5.0...v1.5.1
     9
    110## v1.5.0
    211
  • findkit/tags/1.5.1/plugin.php

    r3412014 r3435839  
    1010 * Description: WordPress Plugin for Findkit Site Search. See findkit.com for details
    1111 * Author: Findkit Team <findkit@findkit.com>
    12  * Version: 1.5.0
     12 * Version: 1.5.1
    1313 * License: GPLv2 or later
    1414 */
  • findkit/tags/1.5.1/readme.txt

    r3412014 r3435839  
    44Requires at least: 6.3
    55Tested up to: 6.9.0
    6 Stable tag: 1.5.0
     6Stable tag: 1.5.1
    77Requires PHP: 7.2
    88Donate link: https://www.findkit.com/
  • findkit/tags/1.5.1/src/LiveUpdate.php

    r3370206 r3435839  
    2222
    2323    /**
     24     * Old statuses to detect unpublishing
     25     */
     26    private static $old_statuses = [];
     27
     28    /**
    2429     * @var ApiClient
    2530     */
     
    3338    function bind()
    3439    {
    35         // This is called always when post is being saved even when the post status does
    36         // not actually change.
     40        // Primary live update hook using save_post instead of transition_post_status.
     41        // This ensures all post meta fields are saved before crawling.
     42        // Priority 999 guarantees this runs after all other save_post handlers.
    3743        \add_action(
    38             'transition_post_status',
    39             [$this, '__action_transition_post_status'],
     44            'save_post',
     45            [$this, '__action_save_post_live_update'],
     46            999,
     47            3
     48        );
     49
     50        // Handle posts moved to trash
     51        \add_action('trashed_post', [$this, '__action_trashed_post'], 10, 1);
     52
     53        // Handle permanently deleted posts
     54        \add_action('deleted_post', [$this, '__action_deleted_post'], 10, 2);
     55
     56        // Store old permalink and status before save to detect changes
     57        add_filter(
     58            'wp_insert_post_data',
     59            [__CLASS__, 'pre_save_store_old_data'],
     60            10,
     61            2
     62        );
     63
     64        // Handle permalink changes
     65        add_action(
     66            'save_post',
     67            [$this, 'on_save_post_permalink_change'],
    4068            10,
    4169            3
    4270        );
    4371
    44         add_filter(
    45             'wp_insert_post_data',
    46             [__CLASS__, 'pre_save_store_old_permalink'],
    47             10,
    48             2
    49         );
    50 
    51         add_action('save_post', [$this, 'on_save_post'], 10, 3);
    52 
    53         // Send updates on shutdown when we can be sure that post changes have been saved
     72        // Send all queued updates at the end of request
    5473        \add_action('shutdown', [$this, 'flush_updates']);
    5574    }
    5675
    57     function flush_updates()
    58     {
    59         if (empty($this->pending_posts)) {
    60             return;
    61         }
    62 
    63         $urls = [];
    64 
    65         foreach ($this->pending_posts as $item) {
    66             if ($item instanceof \WP_Post) {
    67                 $urls[] = Utils::get_public_permalink($item);
    68             } elseif (is_string($item)) {
    69                 $urls[] = $item;
    70             }
    71         }
    72 
    73         $urls = array_unique($urls);
    74 
    75         return $this->api_client->manual_crawl($urls);
    76     }
    77 
    78     function __action_transition_post_status($new_status, $old_status, $post)
     76    /**
     77     * Handle live update in save_post hook.
     78     */
     79    function __action_save_post_live_update($post_id, $post, $update)
    7980    {
    8081        if (!$post) {
     
    8687        }
    8788
    88         // We can bail out if the status is not publish or is not transitioning from or
    89         // to it eg. it's a draft or draft being moved to trash for example
    90         if ('publish' !== $new_status && 'publish' !== $old_status) {
    91             return;
    92         }
    93 
    94         // Gutenberg fires transition_post_status twice when saving a post.
    95         // Once to /wp-admin/post.php and once to the REST API. Ignore the
    96         // former to avoid duplicate live updates. We cannot ignore the latter
    97         // because then we would ignore legit standalone updates via REST API.
     89        if (\wp_is_post_revision($post_id)) {
     90            return;
     91        }
     92
     93        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
     94            return;
     95        }
     96
     97        $old_status = self::$old_statuses[$post_id] ?? null;
     98        $new_status = $post->post_status;
     99
     100        // Handle unpublishing: was published, now is not
     101        if ($old_status === 'publish' && $new_status !== 'publish') {
     102            $permalink = Utils::get_public_permalink($post);
     103            if ($permalink) {
     104                $this->enqueue_url($permalink);
     105            }
     106            return;
     107        }
     108
     109        // Only process currently published posts
     110        if ($new_status !== 'publish') {
     111            return;
     112        }
     113
     114        // Gutenberg fires save_post multiple times when saving a post.
     115        // We only want to process the REST API request to avoid duplicates.
    98116        $is_rest_request = defined('REST_REQUEST') && REST_REQUEST;
    99117
     
    113131        }
    114132
    115         // If not REST, and not a bulk/trash action, and using block editor, skip to avoid duplicate
    116         // BUT do not skip when cron is publishing a scheduled post (future -> publish).
    117         // wp-cron is not a REST request and not a bulk/trash action, and post types
    118         // often use the block editor, so without this guard we would miss scheduled publishes.
     133        // For block editor posts: only process REST API requests
     134        if (\use_block_editor_for_post_type($post->post_type)) {
     135            if (!$is_rest_request && !$is_bulk_or_trash_action) {
     136                return;
     137            }
     138
     139            // Skip meta-box-loader requests
     140            if ($is_rest_request && isset($_GET['meta-box-loader'])) {
     141                return;
     142            }
     143        }
     144
     145        // Skip CLI unless running cron (for scheduled posts)
     146        if (php_sapi_name() === 'cli' && !wp_doing_cron()) {
     147            return;
     148        }
     149
     150        $this->enqueue_post($post);
     151    }
     152
     153    /**
     154     * Handle posts moved to trash.
     155     */
     156    function __action_trashed_post($post_id)
     157    {
     158        $post = get_post($post_id);
     159
     160        if (!$post) {
     161            return;
     162        }
     163
     164        if (!self::is_live_update_enabled()) {
     165            return;
     166        }
     167
     168        $permalink = Utils::get_public_permalink($post);
     169        if ($permalink) {
     170            $this->enqueue_url($permalink);
     171        }
     172    }
     173
     174    /**
     175     * Handle permanently deleted posts.
     176     */
     177    function __action_deleted_post($post_id, $post)
     178    {
     179        if (!$post) {
     180            return;
     181        }
     182
     183        if (!self::is_live_update_enabled()) {
     184            return;
     185        }
     186
    119187        if (
    120             !$is_rest_request &&
    121             !$is_bulk_or_trash_action &&
    122             \use_block_editor_for_post_type($post->post_type)
     188            $post->post_status === 'publish' ||
     189            $post->post_status === 'trash'
    123190        ) {
    124             if (!function_exists('wp_doing_cron') || !wp_doing_cron()) {
    125                 return;
    126             }
    127         }
    128 
    129         // Revision are not public
    130         if (\wp_is_post_revision($post)) {
    131             return;
    132         }
    133 
    134         $this->enqueue_post($post);
    135     }
    136 
     191            $permalink = Utils::get_public_permalink($post);
     192            if ($permalink) {
     193                $this->enqueue_url($permalink);
     194            }
     195        }
     196    }
     197
     198    /**
     199     * Send all queued updates to Findkit API.
     200     */
     201    function flush_updates()
     202    {
     203        if (empty($this->pending_posts)) {
     204            return;
     205        }
     206
     207        $urls = [];
     208
     209        foreach ($this->pending_posts as $item) {
     210            if ($item instanceof \WP_Post) {
     211                $urls[] = Utils::get_public_permalink($item);
     212            } elseif (is_string($item)) {
     213                $urls[] = $item;
     214            }
     215        }
     216
     217        $urls = array_unique($urls);
     218        $urls = array_filter($urls);
     219        $urls = array_values($urls);
     220
     221        if (empty($urls)) {
     222            return;
     223        }
     224
     225        return $this->api_client->manual_crawl($urls);
     226    }
     227
     228    /**
     229     * Add a post to the update queue.
     230     */
    137231    function enqueue_post(\WP_Post $post)
    138232    {
    139         $is_development = defined('WP_ENV') && WP_ENV === 'development';
    140 
    141233        $can_live_update = apply_filters(
    142234            'findkit_can_live_update_post',
    143             // By default, do not enqueue post in cli because integrations might
    144             // cause unwanted live updates
    145             php_sapi_name() !== 'cli' &&
    146                 // Disable live update when in explicit development mode
    147                 !$is_development,
     235            php_sapi_name() !== 'cli' || wp_doing_cron(),
    148236            $post
    149237        );
     
    160248    }
    161249
     250    /**
     251     * Add a URL to the update queue.
     252     */
     253    function enqueue_url(string $url)
     254    {
     255        $can_live_update = apply_filters(
     256            'findkit_can_live_update_post',
     257            php_sapi_name() !== 'cli' || wp_doing_cron(),
     258            null
     259        );
     260
     261        if (!$can_live_update) {
     262            return;
     263        }
     264
     265        if ($this->pending_posts === null) {
     266            $this->pending_posts = [];
     267        }
     268
     269        $this->pending_posts[] = $url;
     270    }
     271
     272    /**
     273     * Check if live update is enabled.
     274     */
    162275    static function is_live_update_enabled(): bool
    163276    {
     
    176289    }
    177290
    178     public static function pre_save_store_old_permalink($data, $postarr)
     291    /**
     292     * Store old permalink and status before saving.
     293     */
     294    public static function pre_save_store_old_data($data, $postarr)
    179295    {
    180296        if (empty($postarr['ID'])) {
    181297            return $data;
    182298        }
     299
    183300        $post_id = (int) $postarr['ID'];
    184301        $old_post = get_post($post_id);
     302
    185303        if ($old_post) {
    186             $old_permalink = get_permalink($old_post);
    187             self::$old_permalinks[$post_id] = $old_permalink;
    188         }
     304            if ($old_post->post_status === 'publish') {
     305                self::$old_permalinks[$post_id] = get_permalink($old_post);
     306            }
     307            self::$old_statuses[$post_id] = $old_post->post_status;
     308        }
     309
    189310        return $data;
    190311    }
    191312
    192     public function on_save_post($post_id, $post, $update)
    193     {
    194         // Only for published posts
     313    /**
     314     * Handle permalink changes.
     315     */
     316    public function on_save_post_permalink_change($post_id, $post, $update)
     317    {
    195318        if ($post->post_status !== 'publish') {
    196319            return;
     
    204327        }
    205328    }
    206 
    207     function enqueue_url(string $url)
    208     {
    209         $is_development = defined('WP_ENV') && WP_ENV === 'development';
    210 
    211         $can_live_update = apply_filters(
    212             'findkit_can_live_update_post',
    213             php_sapi_name() !== 'cli' && !$is_development,
    214             null // No post object
    215         );
    216 
    217         if (!$can_live_update) {
    218             return;
    219         }
    220 
    221         if ($this->pending_posts === null) {
    222             $this->pending_posts = [];
    223         }
    224 
    225         // Store as a string URL
    226         $this->pending_posts[] = $url;
    227     }
    228329}
  • findkit/tags/1.5.1/src/Loader.php

    r3067370 r3435839  
    5353        (new RegisterBlocks())->bind();
    5454        (new GutenbergSidebar())->bind();
     55        (new CrawlerCompat())->bind();
    5556    }
    5657}
  • findkit/tags/1.5.1/vendor/composer/autoload_classmap.php

    r3067370 r3435839  
    1212    'Findkit\\ApiClient' => $baseDir . '/src/ApiClient.php',
    1313    'Findkit\\BugFixWpAdminHistoryState' => $baseDir . '/src/BugFixWpAdminHistoryState.php',
     14    'Findkit\\CrawlerCompat' => $baseDir . '/src/CrawlerCompat.php',
    1415    'Findkit\\FindkitMetaBox' => $baseDir . '/src/FindkitMetaBox.php',
    1516    'Findkit\\GutenbergSidebar' => $baseDir . '/src/GutenbergSidebar.php',
  • findkit/tags/1.5.1/vendor/composer/autoload_static.php

    r3397920 r3435839  
    3232        'Findkit\\ApiClient' => __DIR__ . '/../..' . '/src/ApiClient.php',
    3333        'Findkit\\BugFixWpAdminHistoryState' => __DIR__ . '/../..' . '/src/BugFixWpAdminHistoryState.php',
     34        'Findkit\\CrawlerCompat' => __DIR__ . '/../..' . '/src/CrawlerCompat.php',
    3435        'Findkit\\FindkitMetaBox' => __DIR__ . '/../..' . '/src/FindkitMetaBox.php',
    3536        'Findkit\\GutenbergSidebar' => __DIR__ . '/../..' . '/src/GutenbergSidebar.php',
  • findkit/tags/1.5.1/vendor/composer/installed.php

    r3412014 r3435839  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '704d35d641b00106661099f404c8b4c408f57b33',
     6        'reference' => '85ea2bb3d31e050d268ef36300e3f911074606a2',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '704d35d641b00106661099f404c8b4c408f57b33',
     16            'reference' => '85ea2bb3d31e050d268ef36300e3f911074606a2',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • findkit/trunk/CHANGELOG.md

    r3412014 r3435839  
     1## v1.5.1
     2
     32026-01-09
     4
     5-   Change Live update logic to use different wordpress hooks to avoid race conditions on certain use cases [ed2f776](https://github.com/findkit/wp-findkit/commit/ed2f776) - Lauri Saarni
     6-   Add CrawlerCompat class to prevent WP url guess functionality when findkit crawls the site. [8f7b91c](https://github.com/findkit/wp-findkit/commit/8f7b91c) - Lauri Saarni
     7
     8All changes https://github.com/findkit/wp-findkit/compare/v1.5.0...v1.5.1
     9
    110## v1.5.0
    211
  • findkit/trunk/plugin.php

    r3412014 r3435839  
    1010 * Description: WordPress Plugin for Findkit Site Search. See findkit.com for details
    1111 * Author: Findkit Team <findkit@findkit.com>
    12  * Version: 1.5.0
     12 * Version: 1.5.1
    1313 * License: GPLv2 or later
    1414 */
  • findkit/trunk/readme.txt

    r3412014 r3435839  
    44Requires at least: 6.3
    55Tested up to: 6.9.0
    6 Stable tag: 1.5.0
     6Stable tag: 1.5.1
    77Requires PHP: 7.2
    88Donate link: https://www.findkit.com/
  • findkit/trunk/src/LiveUpdate.php

    r3370206 r3435839  
    2222
    2323    /**
     24     * Old statuses to detect unpublishing
     25     */
     26    private static $old_statuses = [];
     27
     28    /**
    2429     * @var ApiClient
    2530     */
     
    3338    function bind()
    3439    {
    35         // This is called always when post is being saved even when the post status does
    36         // not actually change.
     40        // Primary live update hook using save_post instead of transition_post_status.
     41        // This ensures all post meta fields are saved before crawling.
     42        // Priority 999 guarantees this runs after all other save_post handlers.
    3743        \add_action(
    38             'transition_post_status',
    39             [$this, '__action_transition_post_status'],
     44            'save_post',
     45            [$this, '__action_save_post_live_update'],
     46            999,
     47            3
     48        );
     49
     50        // Handle posts moved to trash
     51        \add_action('trashed_post', [$this, '__action_trashed_post'], 10, 1);
     52
     53        // Handle permanently deleted posts
     54        \add_action('deleted_post', [$this, '__action_deleted_post'], 10, 2);
     55
     56        // Store old permalink and status before save to detect changes
     57        add_filter(
     58            'wp_insert_post_data',
     59            [__CLASS__, 'pre_save_store_old_data'],
     60            10,
     61            2
     62        );
     63
     64        // Handle permalink changes
     65        add_action(
     66            'save_post',
     67            [$this, 'on_save_post_permalink_change'],
    4068            10,
    4169            3
    4270        );
    4371
    44         add_filter(
    45             'wp_insert_post_data',
    46             [__CLASS__, 'pre_save_store_old_permalink'],
    47             10,
    48             2
    49         );
    50 
    51         add_action('save_post', [$this, 'on_save_post'], 10, 3);
    52 
    53         // Send updates on shutdown when we can be sure that post changes have been saved
     72        // Send all queued updates at the end of request
    5473        \add_action('shutdown', [$this, 'flush_updates']);
    5574    }
    5675
    57     function flush_updates()
    58     {
    59         if (empty($this->pending_posts)) {
    60             return;
    61         }
    62 
    63         $urls = [];
    64 
    65         foreach ($this->pending_posts as $item) {
    66             if ($item instanceof \WP_Post) {
    67                 $urls[] = Utils::get_public_permalink($item);
    68             } elseif (is_string($item)) {
    69                 $urls[] = $item;
    70             }
    71         }
    72 
    73         $urls = array_unique($urls);
    74 
    75         return $this->api_client->manual_crawl($urls);
    76     }
    77 
    78     function __action_transition_post_status($new_status, $old_status, $post)
     76    /**
     77     * Handle live update in save_post hook.
     78     */
     79    function __action_save_post_live_update($post_id, $post, $update)
    7980    {
    8081        if (!$post) {
     
    8687        }
    8788
    88         // We can bail out if the status is not publish or is not transitioning from or
    89         // to it eg. it's a draft or draft being moved to trash for example
    90         if ('publish' !== $new_status && 'publish' !== $old_status) {
    91             return;
    92         }
    93 
    94         // Gutenberg fires transition_post_status twice when saving a post.
    95         // Once to /wp-admin/post.php and once to the REST API. Ignore the
    96         // former to avoid duplicate live updates. We cannot ignore the latter
    97         // because then we would ignore legit standalone updates via REST API.
     89        if (\wp_is_post_revision($post_id)) {
     90            return;
     91        }
     92
     93        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
     94            return;
     95        }
     96
     97        $old_status = self::$old_statuses[$post_id] ?? null;
     98        $new_status = $post->post_status;
     99
     100        // Handle unpublishing: was published, now is not
     101        if ($old_status === 'publish' && $new_status !== 'publish') {
     102            $permalink = Utils::get_public_permalink($post);
     103            if ($permalink) {
     104                $this->enqueue_url($permalink);
     105            }
     106            return;
     107        }
     108
     109        // Only process currently published posts
     110        if ($new_status !== 'publish') {
     111            return;
     112        }
     113
     114        // Gutenberg fires save_post multiple times when saving a post.
     115        // We only want to process the REST API request to avoid duplicates.
    98116        $is_rest_request = defined('REST_REQUEST') && REST_REQUEST;
    99117
     
    113131        }
    114132
    115         // If not REST, and not a bulk/trash action, and using block editor, skip to avoid duplicate
    116         // BUT do not skip when cron is publishing a scheduled post (future -> publish).
    117         // wp-cron is not a REST request and not a bulk/trash action, and post types
    118         // often use the block editor, so without this guard we would miss scheduled publishes.
     133        // For block editor posts: only process REST API requests
     134        if (\use_block_editor_for_post_type($post->post_type)) {
     135            if (!$is_rest_request && !$is_bulk_or_trash_action) {
     136                return;
     137            }
     138
     139            // Skip meta-box-loader requests
     140            if ($is_rest_request && isset($_GET['meta-box-loader'])) {
     141                return;
     142            }
     143        }
     144
     145        // Skip CLI unless running cron (for scheduled posts)
     146        if (php_sapi_name() === 'cli' && !wp_doing_cron()) {
     147            return;
     148        }
     149
     150        $this->enqueue_post($post);
     151    }
     152
     153    /**
     154     * Handle posts moved to trash.
     155     */
     156    function __action_trashed_post($post_id)
     157    {
     158        $post = get_post($post_id);
     159
     160        if (!$post) {
     161            return;
     162        }
     163
     164        if (!self::is_live_update_enabled()) {
     165            return;
     166        }
     167
     168        $permalink = Utils::get_public_permalink($post);
     169        if ($permalink) {
     170            $this->enqueue_url($permalink);
     171        }
     172    }
     173
     174    /**
     175     * Handle permanently deleted posts.
     176     */
     177    function __action_deleted_post($post_id, $post)
     178    {
     179        if (!$post) {
     180            return;
     181        }
     182
     183        if (!self::is_live_update_enabled()) {
     184            return;
     185        }
     186
    119187        if (
    120             !$is_rest_request &&
    121             !$is_bulk_or_trash_action &&
    122             \use_block_editor_for_post_type($post->post_type)
     188            $post->post_status === 'publish' ||
     189            $post->post_status === 'trash'
    123190        ) {
    124             if (!function_exists('wp_doing_cron') || !wp_doing_cron()) {
    125                 return;
    126             }
    127         }
    128 
    129         // Revision are not public
    130         if (\wp_is_post_revision($post)) {
    131             return;
    132         }
    133 
    134         $this->enqueue_post($post);
    135     }
    136 
     191            $permalink = Utils::get_public_permalink($post);
     192            if ($permalink) {
     193                $this->enqueue_url($permalink);
     194            }
     195        }
     196    }
     197
     198    /**
     199     * Send all queued updates to Findkit API.
     200     */
     201    function flush_updates()
     202    {
     203        if (empty($this->pending_posts)) {
     204            return;
     205        }
     206
     207        $urls = [];
     208
     209        foreach ($this->pending_posts as $item) {
     210            if ($item instanceof \WP_Post) {
     211                $urls[] = Utils::get_public_permalink($item);
     212            } elseif (is_string($item)) {
     213                $urls[] = $item;
     214            }
     215        }
     216
     217        $urls = array_unique($urls);
     218        $urls = array_filter($urls);
     219        $urls = array_values($urls);
     220
     221        if (empty($urls)) {
     222            return;
     223        }
     224
     225        return $this->api_client->manual_crawl($urls);
     226    }
     227
     228    /**
     229     * Add a post to the update queue.
     230     */
    137231    function enqueue_post(\WP_Post $post)
    138232    {
    139         $is_development = defined('WP_ENV') && WP_ENV === 'development';
    140 
    141233        $can_live_update = apply_filters(
    142234            'findkit_can_live_update_post',
    143             // By default, do not enqueue post in cli because integrations might
    144             // cause unwanted live updates
    145             php_sapi_name() !== 'cli' &&
    146                 // Disable live update when in explicit development mode
    147                 !$is_development,
     235            php_sapi_name() !== 'cli' || wp_doing_cron(),
    148236            $post
    149237        );
     
    160248    }
    161249
     250    /**
     251     * Add a URL to the update queue.
     252     */
     253    function enqueue_url(string $url)
     254    {
     255        $can_live_update = apply_filters(
     256            'findkit_can_live_update_post',
     257            php_sapi_name() !== 'cli' || wp_doing_cron(),
     258            null
     259        );
     260
     261        if (!$can_live_update) {
     262            return;
     263        }
     264
     265        if ($this->pending_posts === null) {
     266            $this->pending_posts = [];
     267        }
     268
     269        $this->pending_posts[] = $url;
     270    }
     271
     272    /**
     273     * Check if live update is enabled.
     274     */
    162275    static function is_live_update_enabled(): bool
    163276    {
     
    176289    }
    177290
    178     public static function pre_save_store_old_permalink($data, $postarr)
     291    /**
     292     * Store old permalink and status before saving.
     293     */
     294    public static function pre_save_store_old_data($data, $postarr)
    179295    {
    180296        if (empty($postarr['ID'])) {
    181297            return $data;
    182298        }
     299
    183300        $post_id = (int) $postarr['ID'];
    184301        $old_post = get_post($post_id);
     302
    185303        if ($old_post) {
    186             $old_permalink = get_permalink($old_post);
    187             self::$old_permalinks[$post_id] = $old_permalink;
    188         }
     304            if ($old_post->post_status === 'publish') {
     305                self::$old_permalinks[$post_id] = get_permalink($old_post);
     306            }
     307            self::$old_statuses[$post_id] = $old_post->post_status;
     308        }
     309
    189310        return $data;
    190311    }
    191312
    192     public function on_save_post($post_id, $post, $update)
    193     {
    194         // Only for published posts
     313    /**
     314     * Handle permalink changes.
     315     */
     316    public function on_save_post_permalink_change($post_id, $post, $update)
     317    {
    195318        if ($post->post_status !== 'publish') {
    196319            return;
     
    204327        }
    205328    }
    206 
    207     function enqueue_url(string $url)
    208     {
    209         $is_development = defined('WP_ENV') && WP_ENV === 'development';
    210 
    211         $can_live_update = apply_filters(
    212             'findkit_can_live_update_post',
    213             php_sapi_name() !== 'cli' && !$is_development,
    214             null // No post object
    215         );
    216 
    217         if (!$can_live_update) {
    218             return;
    219         }
    220 
    221         if ($this->pending_posts === null) {
    222             $this->pending_posts = [];
    223         }
    224 
    225         // Store as a string URL
    226         $this->pending_posts[] = $url;
    227     }
    228329}
  • findkit/trunk/src/Loader.php

    r3067370 r3435839  
    5353        (new RegisterBlocks())->bind();
    5454        (new GutenbergSidebar())->bind();
     55        (new CrawlerCompat())->bind();
    5556    }
    5657}
  • findkit/trunk/vendor/composer/autoload_classmap.php

    r3067370 r3435839  
    1212    'Findkit\\ApiClient' => $baseDir . '/src/ApiClient.php',
    1313    'Findkit\\BugFixWpAdminHistoryState' => $baseDir . '/src/BugFixWpAdminHistoryState.php',
     14    'Findkit\\CrawlerCompat' => $baseDir . '/src/CrawlerCompat.php',
    1415    'Findkit\\FindkitMetaBox' => $baseDir . '/src/FindkitMetaBox.php',
    1516    'Findkit\\GutenbergSidebar' => $baseDir . '/src/GutenbergSidebar.php',
  • findkit/trunk/vendor/composer/autoload_static.php

    r3397920 r3435839  
    3232        'Findkit\\ApiClient' => __DIR__ . '/../..' . '/src/ApiClient.php',
    3333        'Findkit\\BugFixWpAdminHistoryState' => __DIR__ . '/../..' . '/src/BugFixWpAdminHistoryState.php',
     34        'Findkit\\CrawlerCompat' => __DIR__ . '/../..' . '/src/CrawlerCompat.php',
    3435        'Findkit\\FindkitMetaBox' => __DIR__ . '/../..' . '/src/FindkitMetaBox.php',
    3536        'Findkit\\GutenbergSidebar' => __DIR__ . '/../..' . '/src/GutenbergSidebar.php',
  • findkit/trunk/vendor/composer/installed.php

    r3412014 r3435839  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '704d35d641b00106661099f404c8b4c408f57b33',
     6        'reference' => '85ea2bb3d31e050d268ef36300e3f911074606a2',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '704d35d641b00106661099f404c8b4c408f57b33',
     16            'reference' => '85ea2bb3d31e050d268ef36300e3f911074606a2',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.