Changeset 3432432
- Timestamp:
- 01/05/2026 06:31:18 AM (3 months ago)
- Location:
- podcast-importer-secondline
- Files:
-
- 170 added
- 4 edited
-
tags/1.5.5 (added)
-
tags/1.5.5/app (added)
-
tags/1.5.5/app/ActionScheduler.php (added)
-
tags/1.5.5/app/AdminAssets.php (added)
-
tags/1.5.5/app/AdminMenu.php (added)
-
tags/1.5.5/app/Controller.php (added)
-
tags/1.5.5/app/Helper (added)
-
tags/1.5.5/app/Helper/Embed.php (added)
-
tags/1.5.5/app/Helper/FeedForm.php (added)
-
tags/1.5.5/app/Helper/Importer (added)
-
tags/1.5.5/app/Helper/Importer.php (added)
-
tags/1.5.5/app/Helper/Importer/FeedItem.php (added)
-
tags/1.5.5/app/Helper/Scheduler.php (added)
-
tags/1.5.5/app/Hooks.php (added)
-
tags/1.5.5/app/PostTypes.php (added)
-
tags/1.5.5/app/RestAPI (added)
-
tags/1.5.5/app/RestAPI.php (added)
-
tags/1.5.5/app/RestAPI/ACL.php (added)
-
tags/1.5.5/app/RestAPI/Response.php (added)
-
tags/1.5.5/app/Settings.php (added)
-
tags/1.5.5/app/SiteHealth.php (added)
-
tags/1.5.5/app/Template.php (added)
-
tags/1.5.5/assets (added)
-
tags/1.5.5/assets/css (added)
-
tags/1.5.5/assets/css/admin.css (added)
-
tags/1.5.5/assets/js (added)
-
tags/1.5.5/assets/js/admin.js (added)
-
tags/1.5.5/assets/loader-icon.png (added)
-
tags/1.5.5/autoload.php (added)
-
tags/1.5.5/definitions.php (added)
-
tags/1.5.5/functions.php (added)
-
tags/1.5.5/languages (added)
-
tags/1.5.5/languages/podcast-importer-secondline.pot (added)
-
tags/1.5.5/lib (added)
-
tags/1.5.5/lib/action-scheduler (added)
-
tags/1.5.5/lib/action-scheduler/README.md (added)
-
tags/1.5.5/lib/action-scheduler/action-scheduler.php (added)
-
tags/1.5.5/lib/action-scheduler/changelog.txt (added)
-
tags/1.5.5/lib/action-scheduler/classes (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_ActionClaim.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_ActionFactory.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_AdminView.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_Compatibility.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_DataController.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_DateTime.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_Exception.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_InvalidActionException.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_ListTable.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_LogEntry.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_NullLogEntry.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_OptionLock.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_QueueCleaner.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_QueueRunner.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_RecurringActionScheduler.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_SystemInformation.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_Versions.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/ActionScheduler_wcSystemStatus.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action/Cancel_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action/Create_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action/Delete_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action/Generate_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action/Get_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action/List_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action/Next_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action/Run_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Clean_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_QueueRunner.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Action_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/Migration_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/ProgressBar.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/WP_CLI/System_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_ListTable.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_RecurringSchedule.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schema.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_Lock.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_Logger.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_Store.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_TimezoneHelper.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/abstracts/ActionScheduler_WPCLI_Command.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/actions (added)
-
tags/1.5.5/lib/action-scheduler/classes/actions/ActionScheduler_Action.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/actions/ActionScheduler_CanceledAction.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/actions/ActionScheduler_FinishedAction.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/actions/ActionScheduler_NullAction.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores/ActionScheduler_DBLogger.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores/ActionScheduler_wpCommentLogger.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_PostStatusRegistrar.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_PostTypeRegistrar.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_TaxonomyRegistrar.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/ActionMigrator.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/BatchFetcher.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/Config.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/Controller.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/DryRun_ActionMigrator.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/DryRun_LogMigrator.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/LogMigrator.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/Runner.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/migration/Scheduler.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/schedules (added)
-
tags/1.5.5/lib/action-scheduler/classes/schedules/ActionScheduler_CanceledSchedule.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/schedules/ActionScheduler_CronSchedule.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/schedules/ActionScheduler_IntervalSchedule.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/schedules/ActionScheduler_NullSchedule.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/schedules/ActionScheduler_Schedule.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/schedules/ActionScheduler_SimpleSchedule.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/schema (added)
-
tags/1.5.5/lib/action-scheduler/classes/schema/ActionScheduler_LoggerSchema.php (added)
-
tags/1.5.5/lib/action-scheduler/classes/schema/ActionScheduler_StoreSchema.php (added)
-
tags/1.5.5/lib/action-scheduler/deprecated (added)
-
tags/1.5.5/lib/action-scheduler/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php (added)
-
tags/1.5.5/lib/action-scheduler/deprecated/ActionScheduler_AdminView_Deprecated.php (added)
-
tags/1.5.5/lib/action-scheduler/deprecated/ActionScheduler_Schedule_Deprecated.php (added)
-
tags/1.5.5/lib/action-scheduler/deprecated/ActionScheduler_Store_Deprecated.php (added)
-
tags/1.5.5/lib/action-scheduler/deprecated/functions.php (added)
-
tags/1.5.5/lib/action-scheduler/functions.php (added)
-
tags/1.5.5/lib/action-scheduler/lib (added)
-
tags/1.5.5/lib/action-scheduler/lib/WP_Async_Request.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_HoursField.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_MonthField.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/CronExpression_YearField.php (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/LICENSE (added)
-
tags/1.5.5/lib/action-scheduler/lib/cron-expression/README.md (added)
-
tags/1.5.5/lib/action-scheduler/license.txt (added)
-
tags/1.5.5/lib/action-scheduler/readme.txt (added)
-
tags/1.5.5/lib/action-scheduler/vendor (added)
-
tags/1.5.5/lib/action-scheduler/vendor/autoload.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/ClassLoader.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/InstalledVersions.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/LICENSE (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/autoload_classmap.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/autoload_namespaces.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/autoload_psr4.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/autoload_real.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/autoload_static.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/installed.json (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/installed.php (added)
-
tags/1.5.5/lib/action-scheduler/vendor/composer/platform_check.php (added)
-
tags/1.5.5/podcast-importer-secondline.php (added)
-
tags/1.5.5/readme.txt (added)
-
tags/1.5.5/templates (added)
-
tags/1.5.5/templates/_form-field.php (added)
-
tags/1.5.5/templates/importer-form.php (added)
-
tags/1.5.5/templates/importer-scheduled.php (added)
-
tags/1.5.5/templates/tools.php (added)
-
tags/1.5.5/templates/upgrade-plugin.php (added)
-
trunk/app/ActionScheduler.php (modified) (2 diffs)
-
trunk/app/Helper/Importer/FeedItem.php (modified) (3 diffs)
-
trunk/podcast-importer-secondline.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
podcast-importer-secondline/trunk/app/ActionScheduler.php
r3080347 r3432432 68 68 69 69 public function _image_sync( $post_id, $image_path ) { 70 $post_id = intval( $post_id ); 71 72 // Early exit if post no longer exists (deleted after queue) 73 if( !get_post_status( $post_id ) ) 74 return; 75 76 // Early exit if post already has a thumbnail (safety check for queued actions) 77 if( has_post_thumbnail( $post_id ) ) 78 return; 79 80 // Check retry count - stop after max retries to prevent infinite loop 81 $retry_count = intval( get_post_meta( $post_id, '_secondline_image_retry_count', true ) ); 82 $max_retries = apply_filters( 'podcast_importer_secondline_image_max_retries', 3 ); 83 84 if( $retry_count >= $max_retries ) { 85 // Max retries reached, mark as permanently failed and stop 86 update_post_meta( $post_id, '_secondline_image_import_failed', true ); 87 return; 88 } 89 70 90 if( !function_exists( 'media_sideload_image' ) ) { 71 91 require_once( ABSPATH . 'wp-admin/includes/media.php' ); … … 75 95 76 96 $corrected_image_path = str_replace('?.jpg', '?img.jpg', $image_path); 77 $image_contents = wp_remote_get( $corrected_image_path ); 78 $image_contents = wp_remote_retrieve_body( $image_contents ); 97 $image_response = wp_remote_get( $corrected_image_path ); 98 99 // Check for WP_Error from wp_remote_get 100 if( is_wp_error( $image_response ) ) { 101 update_post_meta( $post_id, '_secondline_image_retry_count', $retry_count + 1 ); 102 return; 103 } 104 105 $image_contents = wp_remote_retrieve_body( $image_response ); 106 107 if( empty( $image_contents ) ) { 108 update_post_meta( $post_id, '_secondline_image_retry_count', $retry_count + 1 ); 109 return; 110 } 111 112 $image_md5 = md5( $image_contents ); 79 113 80 114 global $wpdb; 81 115 82 $post_id = intval( $post_id );83 84 116 $attachment_post_id = $wpdb->get_var( 85 'SELECT post_id86 FROM ' . $wpdb->postmeta . '87 WHERE meta_key = "secondline_attachment_md5"88 AND meta_value = ' . $wpdb->prepare( "%s", md5( $image_contents ))117 $wpdb->prepare( 118 "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = 'secondline_attachment_md5' AND meta_value = %s", 119 $image_md5 120 ) 89 121 ); 90 122 91 123 if( null === $attachment_post_id ) { 92 $attachment_post_id = media_sideload_image( $corrected_image_path, $post_id, get_the_title( $post_id ), 'id' );124 $attachment_post_id = media_sideload_image( $corrected_image_path, $post_id, get_the_title( $post_id ), 'id' ); 93 125 94 update_post_meta( $attachment_post_id, 'secondline_attachment_md5', md5( $image_contents ) ); 126 if( is_wp_error( $attachment_post_id ) ) { 127 update_post_meta( $post_id, '_secondline_image_retry_count', $retry_count + 1 ); 128 return; 129 } 130 131 update_post_meta( $attachment_post_id, 'secondline_attachment_md5', $image_md5 ); 95 132 } else { 96 133 $attachment_post_id = intval( $attachment_post_id ); 97 134 } 98 135 99 set_post_thumbnail( $post_id, $attachment_post_id ); 136 $result = set_post_thumbnail( $post_id, $attachment_post_id ); 137 138 // If thumbnail was set successfully, clear retry count 139 if( $result ) { 140 delete_post_meta( $post_id, '_secondline_image_retry_count' ); 141 delete_post_meta( $post_id, '_secondline_image_import_failed' ); 142 } else { 143 // set_post_thumbnail failed 144 update_post_meta( $post_id, '_secondline_image_retry_count', $retry_count + 1 ); 145 } 100 146 } 101 147 -
podcast-importer-secondline/trunk/app/Helper/Importer/FeedItem.php
r3290687 r3432432 37 37 38 38 public $audio_url; 39 public $item_link_url = ''; 39 40 public $audio_feed_url = ''; 40 41 public $audio_feed_host = ''; … … 55 56 global $wpdb; 56 57 57 $this->current_post_id = intval($wpdb->get_var('SELECT post_id FROM ' . $wpdb->postmeta . ' WHERE ( meta_key = "secondline_imported_guid" AND meta_value LIKE "%' . esc_sql($wpdb->esc_like( $this->_guid )) . '%")' ) ); 58 $this->current_post_id = intval($wpdb->get_var( 59 $wpdb->prepare( 60 'SELECT post_id FROM ' . $wpdb->postmeta . ' WHERE meta_key = %s AND meta_value = %s LIMIT 1', 61 'secondline_imported_guid', 62 $this->_guid 63 ) 64 )); 58 65 59 66 $this->episode_number = podcast_importer_secondline_sanitize_feed_value($this->feed_item_itunes->episode ); … … 246 253 return; 247 254 255 // Skip if post already has a featured image 256 if( has_post_thumbnail( $this->current_post_id ) ) 257 return; 258 259 // Skip if image import has permanently failed for this post (max retries exceeded) 260 if( get_post_meta( $this->current_post_id, '_secondline_image_import_failed', true ) ) 261 return; 262 263 // Prevent duplicate queue entries for the same post/image combination 264 if( \PodcastImporterSecondLine\Helper\Scheduler::is_action_scheduled( 265 PODCAST_IMPORTER_SECONDLINE_ALIAS . '_scheduler_image_sync', 266 [ $this->current_post_id, $image_url ] 267 ) ) 268 return; 269 248 270 as_enqueue_async_action( PODCAST_IMPORTER_SECONDLINE_ALIAS . '_scheduler_image_sync', [ $this->current_post_id, $image_url ], PODCAST_IMPORTER_SECONDLINE_ALIAS ); 249 271 } -
podcast-importer-secondline/trunk/podcast-importer-secondline.php
r3377272 r3432432 3 3 * Plugin Name: Podcast Importer SecondLine 4 4 * Description: A simple podcast import plugin with ongoing podcast feed import features. 5 * Version: 1.5. 45 * Version: 1.5.5 6 6 * Author: SecondLineThemes 7 7 * Author URI: https://secondlinethemes.com/ … … 15 15 die; 16 16 17 define( 'PODCAST_IMPORTER_SECONDLINE_VERSION', '1.5. 4' );17 define( 'PODCAST_IMPORTER_SECONDLINE_VERSION', '1.5.5' ); 18 18 define( "PODCAST_IMPORTER_SECONDLINE_BASE_FILE_PATH", __FILE__ ); 19 19 define( "PODCAST_IMPORTER_SECONDLINE_BASE_PATH", dirname( PODCAST_IMPORTER_SECONDLINE_BASE_FILE_PATH ) ); -
podcast-importer-secondline/trunk/readme.txt
r3377272 r3432432 4 4 Tags: podcast, import, feed, rss, episodes 5 5 Requires at least: 4.8 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 7.1 8 8 Stable tag: trunk … … 68 68 69 69 == Changelog == 70 71 = 1.5.5 = 72 * Improved: Episode image imports now retry up to 3 times before stopping, preventing infinite loops on broken image URLs. 73 * Improved: Prevented duplicate tasks from being queued during feed syncs. 70 74 71 75 = 1.5.4 =
Note: See TracChangeset
for help on using the changeset viewer.