Changeset 3435839
- Timestamp:
- 01/09/2026 11:17:16 AM (2 months ago)
- Location:
- findkit
- Files:
-
- 2 added
- 16 edited
- 1 copied
-
tags/1.5.1 (copied) (copied from findkit/trunk)
-
tags/1.5.1/CHANGELOG.md (modified) (1 diff)
-
tags/1.5.1/plugin.php (modified) (1 diff)
-
tags/1.5.1/readme.txt (modified) (1 diff)
-
tags/1.5.1/src/CrawlerCompat.php (added)
-
tags/1.5.1/src/LiveUpdate.php (modified) (7 diffs)
-
tags/1.5.1/src/Loader.php (modified) (1 diff)
-
tags/1.5.1/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/1.5.1/vendor/composer/autoload_static.php (modified) (1 diff)
-
tags/1.5.1/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/plugin.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/CrawlerCompat.php (added)
-
trunk/src/LiveUpdate.php (modified) (7 diffs)
-
trunk/src/Loader.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_static.php (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
findkit/tags/1.5.1/CHANGELOG.md
r3412014 r3435839 1 ## v1.5.1 2 3 2026-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 8 All changes https://github.com/findkit/wp-findkit/compare/v1.5.0...v1.5.1 9 1 10 ## v1.5.0 2 11 -
findkit/tags/1.5.1/plugin.php
r3412014 r3435839 10 10 * Description: WordPress Plugin for Findkit Site Search. See findkit.com for details 11 11 * Author: Findkit Team <findkit@findkit.com> 12 * Version: 1.5. 012 * Version: 1.5.1 13 13 * License: GPLv2 or later 14 14 */ -
findkit/tags/1.5.1/readme.txt
r3412014 r3435839 4 4 Requires at least: 6.3 5 5 Tested up to: 6.9.0 6 Stable tag: 1.5. 06 Stable tag: 1.5.1 7 7 Requires PHP: 7.2 8 8 Donate link: https://www.findkit.com/ -
findkit/tags/1.5.1/src/LiveUpdate.php
r3370206 r3435839 22 22 23 23 /** 24 * Old statuses to detect unpublishing 25 */ 26 private static $old_statuses = []; 27 28 /** 24 29 * @var ApiClient 25 30 */ … … 33 38 function bind() 34 39 { 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. 37 43 \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'], 40 68 10, 41 69 3 42 70 ); 43 71 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 54 73 \add_action('shutdown', [$this, 'flush_updates']); 55 74 } 56 75 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) 79 80 { 80 81 if (!$post) { … … 86 87 } 87 88 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. 98 116 $is_rest_request = defined('REST_REQUEST') && REST_REQUEST; 99 117 … … 113 131 } 114 132 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 119 187 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' 123 190 ) { 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 */ 137 231 function enqueue_post(\WP_Post $post) 138 232 { 139 $is_development = defined('WP_ENV') && WP_ENV === 'development';140 141 233 $can_live_update = apply_filters( 142 234 '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(), 148 236 $post 149 237 ); … … 160 248 } 161 249 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 */ 162 275 static function is_live_update_enabled(): bool 163 276 { … … 176 289 } 177 290 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) 179 295 { 180 296 if (empty($postarr['ID'])) { 181 297 return $data; 182 298 } 299 183 300 $post_id = (int) $postarr['ID']; 184 301 $old_post = get_post($post_id); 302 185 303 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 189 310 return $data; 190 311 } 191 312 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 { 195 318 if ($post->post_status !== 'publish') { 196 319 return; … … 204 327 } 205 328 } 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 object215 );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 URL226 $this->pending_posts[] = $url;227 }228 329 } -
findkit/tags/1.5.1/src/Loader.php
r3067370 r3435839 53 53 (new RegisterBlocks())->bind(); 54 54 (new GutenbergSidebar())->bind(); 55 (new CrawlerCompat())->bind(); 55 56 } 56 57 } -
findkit/tags/1.5.1/vendor/composer/autoload_classmap.php
r3067370 r3435839 12 12 'Findkit\\ApiClient' => $baseDir . '/src/ApiClient.php', 13 13 'Findkit\\BugFixWpAdminHistoryState' => $baseDir . '/src/BugFixWpAdminHistoryState.php', 14 'Findkit\\CrawlerCompat' => $baseDir . '/src/CrawlerCompat.php', 14 15 'Findkit\\FindkitMetaBox' => $baseDir . '/src/FindkitMetaBox.php', 15 16 'Findkit\\GutenbergSidebar' => $baseDir . '/src/GutenbergSidebar.php', -
findkit/tags/1.5.1/vendor/composer/autoload_static.php
r3397920 r3435839 32 32 'Findkit\\ApiClient' => __DIR__ . '/../..' . '/src/ApiClient.php', 33 33 'Findkit\\BugFixWpAdminHistoryState' => __DIR__ . '/../..' . '/src/BugFixWpAdminHistoryState.php', 34 'Findkit\\CrawlerCompat' => __DIR__ . '/../..' . '/src/CrawlerCompat.php', 34 35 'Findkit\\FindkitMetaBox' => __DIR__ . '/../..' . '/src/FindkitMetaBox.php', 35 36 'Findkit\\GutenbergSidebar' => __DIR__ . '/../..' . '/src/GutenbergSidebar.php', -
findkit/tags/1.5.1/vendor/composer/installed.php
r3412014 r3435839 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 704d35d641b00106661099f404c8b4c408f57b33',6 'reference' => '85ea2bb3d31e050d268ef36300e3f911074606a2', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 704d35d641b00106661099f404c8b4c408f57b33',16 'reference' => '85ea2bb3d31e050d268ef36300e3f911074606a2', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
findkit/trunk/CHANGELOG.md
r3412014 r3435839 1 ## v1.5.1 2 3 2026-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 8 All changes https://github.com/findkit/wp-findkit/compare/v1.5.0...v1.5.1 9 1 10 ## v1.5.0 2 11 -
findkit/trunk/plugin.php
r3412014 r3435839 10 10 * Description: WordPress Plugin for Findkit Site Search. See findkit.com for details 11 11 * Author: Findkit Team <findkit@findkit.com> 12 * Version: 1.5. 012 * Version: 1.5.1 13 13 * License: GPLv2 or later 14 14 */ -
findkit/trunk/readme.txt
r3412014 r3435839 4 4 Requires at least: 6.3 5 5 Tested up to: 6.9.0 6 Stable tag: 1.5. 06 Stable tag: 1.5.1 7 7 Requires PHP: 7.2 8 8 Donate link: https://www.findkit.com/ -
findkit/trunk/src/LiveUpdate.php
r3370206 r3435839 22 22 23 23 /** 24 * Old statuses to detect unpublishing 25 */ 26 private static $old_statuses = []; 27 28 /** 24 29 * @var ApiClient 25 30 */ … … 33 38 function bind() 34 39 { 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. 37 43 \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'], 40 68 10, 41 69 3 42 70 ); 43 71 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 54 73 \add_action('shutdown', [$this, 'flush_updates']); 55 74 } 56 75 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) 79 80 { 80 81 if (!$post) { … … 86 87 } 87 88 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. 98 116 $is_rest_request = defined('REST_REQUEST') && REST_REQUEST; 99 117 … … 113 131 } 114 132 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 119 187 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' 123 190 ) { 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 */ 137 231 function enqueue_post(\WP_Post $post) 138 232 { 139 $is_development = defined('WP_ENV') && WP_ENV === 'development';140 141 233 $can_live_update = apply_filters( 142 234 '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(), 148 236 $post 149 237 ); … … 160 248 } 161 249 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 */ 162 275 static function is_live_update_enabled(): bool 163 276 { … … 176 289 } 177 290 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) 179 295 { 180 296 if (empty($postarr['ID'])) { 181 297 return $data; 182 298 } 299 183 300 $post_id = (int) $postarr['ID']; 184 301 $old_post = get_post($post_id); 302 185 303 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 189 310 return $data; 190 311 } 191 312 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 { 195 318 if ($post->post_status !== 'publish') { 196 319 return; … … 204 327 } 205 328 } 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 object215 );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 URL226 $this->pending_posts[] = $url;227 }228 329 } -
findkit/trunk/src/Loader.php
r3067370 r3435839 53 53 (new RegisterBlocks())->bind(); 54 54 (new GutenbergSidebar())->bind(); 55 (new CrawlerCompat())->bind(); 55 56 } 56 57 } -
findkit/trunk/vendor/composer/autoload_classmap.php
r3067370 r3435839 12 12 'Findkit\\ApiClient' => $baseDir . '/src/ApiClient.php', 13 13 'Findkit\\BugFixWpAdminHistoryState' => $baseDir . '/src/BugFixWpAdminHistoryState.php', 14 'Findkit\\CrawlerCompat' => $baseDir . '/src/CrawlerCompat.php', 14 15 'Findkit\\FindkitMetaBox' => $baseDir . '/src/FindkitMetaBox.php', 15 16 'Findkit\\GutenbergSidebar' => $baseDir . '/src/GutenbergSidebar.php', -
findkit/trunk/vendor/composer/autoload_static.php
r3397920 r3435839 32 32 'Findkit\\ApiClient' => __DIR__ . '/../..' . '/src/ApiClient.php', 33 33 'Findkit\\BugFixWpAdminHistoryState' => __DIR__ . '/../..' . '/src/BugFixWpAdminHistoryState.php', 34 'Findkit\\CrawlerCompat' => __DIR__ . '/../..' . '/src/CrawlerCompat.php', 34 35 'Findkit\\FindkitMetaBox' => __DIR__ . '/../..' . '/src/FindkitMetaBox.php', 35 36 'Findkit\\GutenbergSidebar' => __DIR__ . '/../..' . '/src/GutenbergSidebar.php', -
findkit/trunk/vendor/composer/installed.php
r3412014 r3435839 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 704d35d641b00106661099f404c8b4c408f57b33',6 'reference' => '85ea2bb3d31e050d268ef36300e3f911074606a2', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 704d35d641b00106661099f404c8b4c408f57b33',16 'reference' => '85ea2bb3d31e050d268ef36300e3f911074606a2', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.