Changeset 3263883
- Timestamp:
- 03/29/2025 05:21:34 PM (12 months ago)
- Location:
- podcast-importer-secondline
- Files:
-
- 182 added
- 82 edited
-
tags/1.5.2 (added)
-
tags/1.5.2/app (added)
-
tags/1.5.2/app/ActionScheduler.php (added)
-
tags/1.5.2/app/AdminAssets.php (added)
-
tags/1.5.2/app/AdminMenu.php (added)
-
tags/1.5.2/app/Controller.php (added)
-
tags/1.5.2/app/Helper (added)
-
tags/1.5.2/app/Helper/Embed.php (added)
-
tags/1.5.2/app/Helper/FeedForm.php (added)
-
tags/1.5.2/app/Helper/Importer (added)
-
tags/1.5.2/app/Helper/Importer.php (added)
-
tags/1.5.2/app/Helper/Importer/FeedItem.php (added)
-
tags/1.5.2/app/Helper/Scheduler.php (added)
-
tags/1.5.2/app/Hooks.php (added)
-
tags/1.5.2/app/PostTypes.php (added)
-
tags/1.5.2/app/RestAPI (added)
-
tags/1.5.2/app/RestAPI.php (added)
-
tags/1.5.2/app/RestAPI/ACL.php (added)
-
tags/1.5.2/app/RestAPI/Response.php (added)
-
tags/1.5.2/app/Settings.php (added)
-
tags/1.5.2/app/SiteHealth.php (added)
-
tags/1.5.2/app/Template.php (added)
-
tags/1.5.2/assets (added)
-
tags/1.5.2/assets/css (added)
-
tags/1.5.2/assets/css/admin.css (added)
-
tags/1.5.2/assets/js (added)
-
tags/1.5.2/assets/js/admin.js (added)
-
tags/1.5.2/assets/loader-icon.png (added)
-
tags/1.5.2/autoload.php (added)
-
tags/1.5.2/definitions.php (added)
-
tags/1.5.2/functions.php (added)
-
tags/1.5.2/languages (added)
-
tags/1.5.2/languages/podcast-importer-secondline.pot (added)
-
tags/1.5.2/lib (added)
-
tags/1.5.2/lib/action-scheduler (added)
-
tags/1.5.2/lib/action-scheduler/README.md (added)
-
tags/1.5.2/lib/action-scheduler/action-scheduler.php (added)
-
tags/1.5.2/lib/action-scheduler/changelog.txt (added)
-
tags/1.5.2/lib/action-scheduler/classes (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_ActionClaim.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_ActionFactory.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_AdminView.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_Compatibility.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_DataController.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_DateTime.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_Exception.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_InvalidActionException.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_ListTable.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_LogEntry.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_NullLogEntry.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_OptionLock.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_QueueCleaner.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_QueueRunner.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_SystemInformation.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_Versions.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/ActionScheduler_wcSystemStatus.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action/Cancel_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action/Create_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action/Delete_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action/Generate_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action/Get_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action/List_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action/Next_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action/Run_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Clean_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_QueueRunner.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Action_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/Migration_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/ProgressBar.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/WP_CLI/System_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_ListTable.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_RecurringSchedule.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schema.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_Lock.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_Logger.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_Store.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_TimezoneHelper.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/abstracts/ActionScheduler_WPCLI_Command.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/actions (added)
-
tags/1.5.2/lib/action-scheduler/classes/actions/ActionScheduler_Action.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/actions/ActionScheduler_CanceledAction.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/actions/ActionScheduler_FinishedAction.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/actions/ActionScheduler_NullAction.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores/ActionScheduler_DBLogger.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores/ActionScheduler_wpCommentLogger.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_PostStatusRegistrar.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_PostTypeRegistrar.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_TaxonomyRegistrar.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/ActionMigrator.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/BatchFetcher.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/Config.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/Controller.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/DryRun_ActionMigrator.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/DryRun_LogMigrator.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/LogMigrator.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/Runner.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/migration/Scheduler.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/schedules (added)
-
tags/1.5.2/lib/action-scheduler/classes/schedules/ActionScheduler_CanceledSchedule.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/schedules/ActionScheduler_CronSchedule.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/schedules/ActionScheduler_IntervalSchedule.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/schedules/ActionScheduler_NullSchedule.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/schedules/ActionScheduler_Schedule.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/schedules/ActionScheduler_SimpleSchedule.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/schema (added)
-
tags/1.5.2/lib/action-scheduler/classes/schema/ActionScheduler_LoggerSchema.php (added)
-
tags/1.5.2/lib/action-scheduler/classes/schema/ActionScheduler_StoreSchema.php (added)
-
tags/1.5.2/lib/action-scheduler/deprecated (added)
-
tags/1.5.2/lib/action-scheduler/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php (added)
-
tags/1.5.2/lib/action-scheduler/deprecated/ActionScheduler_AdminView_Deprecated.php (added)
-
tags/1.5.2/lib/action-scheduler/deprecated/ActionScheduler_Schedule_Deprecated.php (added)
-
tags/1.5.2/lib/action-scheduler/deprecated/ActionScheduler_Store_Deprecated.php (added)
-
tags/1.5.2/lib/action-scheduler/deprecated/functions.php (added)
-
tags/1.5.2/lib/action-scheduler/functions.php (added)
-
tags/1.5.2/lib/action-scheduler/lib (added)
-
tags/1.5.2/lib/action-scheduler/lib/WP_Async_Request.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_DayOfWeekField.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_FieldFactory.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_FieldInterface.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_HoursField.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_MinutesField.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_MonthField.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/CronExpression_YearField.php (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/LICENSE (added)
-
tags/1.5.2/lib/action-scheduler/lib/cron-expression/README.md (added)
-
tags/1.5.2/lib/action-scheduler/license.txt (added)
-
tags/1.5.2/lib/action-scheduler/readme.txt (added)
-
tags/1.5.2/lib/action-scheduler/vendor (added)
-
tags/1.5.2/lib/action-scheduler/vendor/autoload.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/ClassLoader.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/InstalledVersions.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/LICENSE (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/autoload_classmap.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/autoload_namespaces.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/autoload_psr4.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/autoload_real.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/autoload_static.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/installed.json (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/installed.php (added)
-
tags/1.5.2/lib/action-scheduler/vendor/composer/platform_check.php (added)
-
tags/1.5.2/podcast-importer-secondline.php (added)
-
tags/1.5.2/readme.txt (added)
-
tags/1.5.2/templates (added)
-
tags/1.5.2/templates/_form-field.php (added)
-
tags/1.5.2/templates/importer-form.php (added)
-
tags/1.5.2/templates/importer-scheduled.php (added)
-
tags/1.5.2/templates/tools.php (added)
-
tags/1.5.2/templates/upgrade-plugin.php (added)
-
trunk/app/RestAPI/Response.php (modified) (1 diff)
-
trunk/lib/action-scheduler/action-scheduler.php (modified) (6 diffs)
-
trunk/lib/action-scheduler/changelog.txt (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/ActionScheduler_ActionClaim.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/ActionScheduler_ActionFactory.php (modified) (3 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_AdminView.php (modified) (12 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_Compatibility.php (modified) (4 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_DataController.php (modified) (4 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_DateTime.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/ActionScheduler_InvalidActionException.php (modified) (4 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_ListTable.php (modified) (24 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_LogEntry.php (modified) (4 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_NullLogEntry.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/ActionScheduler_OptionLock.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/ActionScheduler_QueueCleaner.php (modified) (10 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_QueueRunner.php (modified) (8 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_SystemInformation.php (added)
-
trunk/lib/action-scheduler/classes/ActionScheduler_Versions.php (modified) (2 diffs)
-
trunk/lib/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action/Cancel_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action/Create_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action/Delete_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action/Generate_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action/Get_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action/List_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action/Next_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action/Run_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Clean_Command.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_QueueRunner.php (modified) (11 diffs)
-
trunk/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php (modified) (6 diffs)
-
trunk/lib/action-scheduler/classes/WP_CLI/Action_Command.php (added)
-
trunk/lib/action-scheduler/classes/WP_CLI/Migration_Command.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/WP_CLI/ProgressBar.php (modified) (3 diffs)
-
trunk/lib/action-scheduler/classes/WP_CLI/System_Command.php (added)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler.php (modified) (15 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php (modified) (11 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_RecurringSchedule.php (modified) (6 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php (modified) (6 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schema.php (modified) (9 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Lock.php (modified) (2 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Logger.php (modified) (12 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Store.php (modified) (15 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_TimezoneHelper.php (modified) (7 diffs)
-
trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_WPCLI_Command.php (added)
-
trunk/lib/action-scheduler/classes/actions/ActionScheduler_Action.php (modified) (9 diffs)
-
trunk/lib/action-scheduler/classes/actions/ActionScheduler_CanceledAction.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/actions/ActionScheduler_FinishedAction.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/actions/ActionScheduler_NullAction.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_DBLogger.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php (modified) (39 diffs)
-
trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php (modified) (14 diffs)
-
trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpCommentLogger.php (modified) (10 diffs)
-
trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_PostStatusRegistrar.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_PostTypeRegistrar.php (modified) (2 diffs)
-
trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_TaxonomyRegistrar.php (modified) (2 diffs)
-
trunk/lib/action-scheduler/classes/migration/ActionMigrator.php (modified) (6 diffs)
-
trunk/lib/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php (modified) (3 diffs)
-
trunk/lib/action-scheduler/classes/migration/BatchFetcher.php (modified) (7 diffs)
-
trunk/lib/action-scheduler/classes/migration/Config.php (modified) (10 diffs)
-
trunk/lib/action-scheduler/classes/migration/Controller.php (modified) (4 diffs)
-
trunk/lib/action-scheduler/classes/migration/DryRun_ActionMigrator.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/migration/DryRun_LogMigrator.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/migration/LogMigrator.php (modified) (3 diffs)
-
trunk/lib/action-scheduler/classes/migration/Runner.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/migration/Scheduler.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/schedules/ActionScheduler_CanceledSchedule.php (modified) (3 diffs)
-
trunk/lib/action-scheduler/classes/schedules/ActionScheduler_CronSchedule.php (modified) (5 diffs)
-
trunk/lib/action-scheduler/classes/schedules/ActionScheduler_IntervalSchedule.php (modified) (4 diffs)
-
trunk/lib/action-scheduler/classes/schedules/ActionScheduler_NullSchedule.php (modified) (3 diffs)
-
trunk/lib/action-scheduler/classes/schedules/ActionScheduler_Schedule.php (modified) (1 diff)
-
trunk/lib/action-scheduler/classes/schedules/ActionScheduler_SimpleSchedule.php (modified) (3 diffs)
-
trunk/lib/action-scheduler/classes/schema/ActionScheduler_LoggerSchema.php (modified) (2 diffs)
-
trunk/lib/action-scheduler/classes/schema/ActionScheduler_StoreSchema.php (modified) (4 diffs)
-
trunk/lib/action-scheduler/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php (modified) (1 diff)
-
trunk/lib/action-scheduler/deprecated/ActionScheduler_AdminView_Deprecated.php (modified) (8 diffs)
-
trunk/lib/action-scheduler/deprecated/ActionScheduler_Schedule_Deprecated.php (modified) (1 diff)
-
trunk/lib/action-scheduler/deprecated/ActionScheduler_Store_Deprecated.php (modified) (1 diff)
-
trunk/lib/action-scheduler/deprecated/functions.php (modified) (10 diffs)
-
trunk/lib/action-scheduler/functions.php (modified) (3 diffs)
-
trunk/lib/action-scheduler/lib/WP_Async_Request.php (modified) (6 diffs)
-
trunk/lib/action-scheduler/lib/cron-expression/CronExpression.php (modified) (1 diff)
-
trunk/lib/action-scheduler/readme.txt (modified) (2 diffs)
-
trunk/lib/action-scheduler/vendor/autoload.php (modified) (1 diff)
-
trunk/lib/action-scheduler/vendor/composer/ClassLoader.php (modified) (25 diffs)
-
trunk/lib/action-scheduler/vendor/composer/InstalledVersions.php (modified) (4 diffs)
-
trunk/lib/action-scheduler/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/lib/action-scheduler/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/lib/action-scheduler/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/lib/action-scheduler/vendor/composer/platform_check.php (modified) (1 diff)
-
trunk/podcast-importer-secondline.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
podcast-importer-secondline/trunk/app/RestAPI/Response.php
r2744870 r3263883 51 51 $title = $importer->get_feed_title(); 52 52 53 if( 0 === post_exists($title , "", "", PODCAST_IMPORTER_SECONDLINE_POST_TYPE_IMPORT ) ) { 54 $import_post = [ 55 'post_title' => $title, 56 'post_type' => PODCAST_IMPORTER_SECONDLINE_POST_TYPE_IMPORT, 57 'post_status' => 'publish', 58 ]; 59 $post_import_id = wp_insert_post( $import_post ); 53 $import_post = [ 54 'post_title' => $title, 55 'post_type' => PODCAST_IMPORTER_SECONDLINE_POST_TYPE_IMPORT, 56 'post_status' => 'publish', 57 ]; 58 $post_import_id = wp_insert_post( $import_post ); 60 59 61 foreach( $meta_map as $k => $v )62 update_post_meta( $post_import_id, $k, $v );60 foreach( $meta_map as $k => $v ) 61 update_post_meta( $post_import_id, $k, $v ); 63 62 64 PIS_Helper_Scheduler::schedule_post_id( intval( $post_import_id ) );63 PIS_Helper_Scheduler::schedule_post_id( intval( $post_import_id ) ); 65 64 66 $messages[] = [ 67 'type' => 'success', 68 'message' => __( 'Saved podcast feed for continuous import.', 'podcast-importer-secondline' ) 69 ]; 70 } else { 71 $messages[] = [ 72 'type' => 'danger', 73 'message' => __('This podcast is already scheduled for import. Delete the previous schedule to create a new one.', 'podcast-importer-secondline' ) 74 ]; 75 } 65 $messages[] = [ 66 'type' => 'success', 67 'message' => __( 'Saved podcast feed for continuous import.', 'podcast-importer-secondline' ) 68 ]; 76 69 } 77 70 -
podcast-importer-secondline/trunk/lib/action-scheduler/action-scheduler.php
r3136104 r3263883 6 6 * Author: Automattic 7 7 * Author URI: https://automattic.com/ 8 * Version: 3. 8.18 * Version: 3.9.2 9 9 * License: GPLv3 10 * Requires at least: 6. 211 * Tested up to: 6. 512 * Requires PHP: 5.610 * Requires at least: 6.5 11 * Tested up to: 6.7 12 * Requires PHP: 7.1 13 13 * 14 14 * Copyright 2019 Automattic, Inc. (https://automattic.com/contact/) … … 30 30 */ 31 31 32 if ( ! function_exists( 'action_scheduler_register_3_dot_ 8_dot_1' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION.32 if ( ! function_exists( 'action_scheduler_register_3_dot_9_dot_2' ) && function_exists( 'add_action' ) ) { // WRCS: DEFINED_VERSION. 33 33 34 34 if ( ! class_exists( 'ActionScheduler_Versions', false ) ) { … … 37 37 } 38 38 39 add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_ 8_dot_1', 0, 0 ); // WRCS: DEFINED_VERSION.39 add_action( 'plugins_loaded', 'action_scheduler_register_3_dot_9_dot_2', 0, 0 ); // WRCS: DEFINED_VERSION. 40 40 41 41 // phpcs:disable Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace … … 43 43 * Registers this version of Action Scheduler. 44 44 */ 45 function action_scheduler_register_3_dot_ 8_dot_1() { // WRCS: DEFINED_VERSION.45 function action_scheduler_register_3_dot_9_dot_2() { // WRCS: DEFINED_VERSION. 46 46 $versions = ActionScheduler_Versions::instance(); 47 $versions->register( '3. 8.1', 'action_scheduler_initialize_3_dot_8_dot_1' ); // WRCS: DEFINED_VERSION.47 $versions->register( '3.9.2', 'action_scheduler_initialize_3_dot_9_dot_2' ); // WRCS: DEFINED_VERSION. 48 48 } 49 49 … … 52 52 * Initializes this version of Action Scheduler. 53 53 */ 54 function action_scheduler_initialize_3_dot_ 8_dot_1() { // WRCS: DEFINED_VERSION.54 function action_scheduler_initialize_3_dot_9_dot_2() { // WRCS: DEFINED_VERSION. 55 55 // A final safety check is required even here, because historic versions of Action Scheduler 56 56 // followed a different pattern (in some unusual cases, we could reach this point and the … … 64 64 // Support usage in themes - load this version if no plugin has loaded a version yet. 65 65 if ( did_action( 'plugins_loaded' ) && ! doing_action( 'plugins_loaded' ) && ! class_exists( 'ActionScheduler', false ) ) { 66 action_scheduler_initialize_3_dot_ 8_dot_1(); // WRCS: DEFINED_VERSION.66 action_scheduler_initialize_3_dot_9_dot_2(); // WRCS: DEFINED_VERSION. 67 67 do_action( 'action_scheduler_pre_theme_init' ); 68 68 ActionScheduler_Versions::initialize_latest_version(); -
podcast-importer-secondline/trunk/lib/action-scheduler/changelog.txt
r3136104 r3263883 1 1 *** Changelog *** 2 3 = 3.9.2 - 2025-02-03 = 4 * Fixed fatal errors by moving version info methods to a new class and deprecating conflicting ones in ActionScheduler_Versions 5 6 = 3.9.1 - 2025-01-21 = 7 * A number of new WP CLI commands have been added, making it easier to manage actions in the terminal and from scripts. 8 * New wp action-scheduler source command to help determine how Action Scheduler is being loaded. 9 * Additional information about the active instance of Action Scheduler is now available in the Help pull-down drawer. 10 * Make some other nullable parameters explicitly nullable. 11 * Set option value to `no` rather than deleting. 12 13 = 3.9.0 - 2024-11-14 = 14 * Minimum required version of PHP is now 7.1. 15 * Performance improvements for the `as_pending_actions_due()` function. 16 * Existing filter hook `action_scheduler_claim_actions_order_by` enhanced to provide callbacks with additional information. 17 * Improved compatibility with PHP 8.4, specifically by making implicitly nullable parameters explicitly nullable. 18 * A large number of coding standards-enhancements, to help reduce friction when submitting plugins to marketplaces and plugin directories. Special props @crstauf for this effort. 19 * Minor documentation tweaks and improvements. 20 21 = 3.8.2 - 2024-09-12 = 22 * Add missing parameter to the `pre_as_enqueue_async_action` hook. 23 * Bump minimum PHP version to 7.0. 24 * Bump minimum WordPress version to 6.4. 25 * Make the batch size adjustable during processing. 2 26 3 27 = 3.8.1 - 2024-06-20 = -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_ActionClaim.php
r2734765 r3263883 5 5 */ 6 6 class ActionScheduler_ActionClaim { 7 /** 8 * Claim ID. 9 * 10 * @var string 11 */ 7 12 private $id = ''; 13 14 /** 15 * Claimed action IDs. 16 * 17 * @var int[] 18 */ 8 19 private $action_ids = array(); 9 20 21 /** 22 * Construct. 23 * 24 * @param string $id Claim ID. 25 * @param int[] $action_ids Action IDs. 26 */ 10 27 public function __construct( $id, array $action_ids ) { 11 $this->id = $id;28 $this->id = $id; 12 29 $this->action_ids = $action_ids; 13 30 } 14 31 32 /** 33 * Get claim ID. 34 */ 15 35 public function get_id() { 16 36 return $this->id; 17 37 } 18 38 39 /** 40 * Get IDs of claimed actions. 41 */ 19 42 public function get_actions() { 20 43 return $this->action_ids; 21 44 } 22 45 } 23 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_ActionFactory.php
r3136104 r3263883 9 9 * Return stored actions for given params. 10 10 * 11 * @param string $status The action's status in the data store.12 * @param string $hook The hook to trigger when this action runs.13 * @param array $args Args to pass to callbacks when the hook is triggered.14 * @param ActionScheduler_Schedule $schedule The action's schedule.15 * @param string $group A group to put the action in.11 * @param string $status The action's status in the data store. 12 * @param string $hook The hook to trigger when this action runs. 13 * @param array $args Args to pass to callbacks when the hook is triggered. 14 * @param ActionScheduler_Schedule|null $schedule The action's schedule. 15 * @param string $group A group to put the action in. 16 16 * phpcs:ignore Squiz.Commenting.FunctionComment.ExtraParamComment 17 * @param int $priority The action priority.17 * @param int $priority The action priority. 18 18 * 19 19 * @return ActionScheduler_Action An instance of the stored action. 20 20 */ 21 public function get_stored_action( $status, $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {21 public function get_stored_action( $status, $hook, array $args = array(), ?ActionScheduler_Schedule $schedule = null, $group = '' ) { 22 22 // The 6th parameter ($priority) is not formally declared in the method signature to maintain compatibility with 23 23 // third-party subclasses created before this param was added. … … 308 308 309 309 default: 310 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 310 311 error_log( "Unknown action type '{$options['type']}' specified when trying to create an action for '{$options['hook']}'." ); 311 312 return 0; … … 319 320 $action_id = $options['unique'] ? $this->store_unique_action( $action ) : $this->store( $action ); 320 321 } catch ( Exception $e ) { 322 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 321 323 error_log( 322 324 sprintf( -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_AdminView.php
r3136104 r3263883 3 3 /** 4 4 * Class ActionScheduler_AdminView 5 * 5 6 * @codeCoverageIgnore 6 7 */ 7 8 class ActionScheduler_AdminView extends ActionScheduler_AdminView_Deprecated { 8 9 9 private static $admin_view = NULL; 10 10 /** 11 * Instance. 12 * 13 * @var null|self 14 */ 15 private static $admin_view = null; 16 17 /** 18 * Screen ID. 19 * 20 * @var string 21 */ 11 22 private static $screen_id = 'tools_page_action-scheduler'; 12 23 13 /** @var ActionScheduler_ListTable */ 24 /** 25 * ActionScheduler_ListTable instance. 26 * 27 * @var ActionScheduler_ListTable 28 */ 14 29 protected $list_table; 15 30 16 31 /** 32 * Get instance. 33 * 17 34 * @return ActionScheduler_AdminView 18 35 * @codeCoverageIgnore … … 21 38 22 39 if ( empty( self::$admin_view ) ) { 23 $class = apply_filters('action_scheduler_admin_view_class', 'ActionScheduler_AdminView');40 $class = apply_filters( 'action_scheduler_admin_view_class', 'ActionScheduler_AdminView' ); 24 41 self::$admin_view = new $class(); 25 42 } … … 29 46 30 47 /** 48 * Initialize. 49 * 31 50 * @codeCoverageIgnore 32 51 */ 33 52 public function init() { 34 if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || false ==DOING_AJAX ) ) {53 if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { 35 54 36 55 if ( class_exists( 'WooCommerce' ) ) { … … 46 65 } 47 66 67 /** 68 * Print system status report. 69 */ 48 70 public function system_status_report() { 49 71 $table = new ActionScheduler_wcSystemStatus( ActionScheduler::store() ); … … 79 101 array( $this, 'render_admin_ui' ) 80 102 ); 81 add_action( 'load-' . $hook_suffix , array( $this, 'process_admin_ui' ) );103 add_action( 'load-' . $hook_suffix, array( $this, 'process_admin_ui' ) ); 82 104 } 83 105 … … 120 142 public function maybe_check_pastdue_actions() { 121 143 122 #Filter to prevent checking actions (ex: inappropriate user).144 // Filter to prevent checking actions (ex: inappropriate user). 123 145 if ( ! apply_filters( 'action_scheduler_check_pastdue_actions', current_user_can( 'manage_options' ) ) ) { 124 146 return; 125 147 } 126 148 127 #Get last check transient.149 // Get last check transient. 128 150 $last_check = get_transient( 'action_scheduler_last_pastdue_actions_check' ); 129 151 130 #If transient exists, we're within interval, so bail.152 // If transient exists, we're within interval, so bail. 131 153 if ( ! empty( $last_check ) ) { 132 154 return; 133 155 } 134 156 135 #Perform the check.157 // Perform the check. 136 158 $this->check_pastdue_actions(); 137 159 } … … 139 161 /** 140 162 * Check past-due actions, and print notice. 141 *142 * @todo update $link_url to "Past-due" filter when released (see issue #510, PR #511)143 163 */ 144 164 protected function check_pastdue_actions() { 145 165 146 #Set thresholds.147 $threshold_seconds = ( int) apply_filters( 'action_scheduler_pastdue_actions_seconds', DAY_IN_SECONDS );148 $threshold_min = ( int) apply_filters( 'action_scheduler_pastdue_actions_min', 1 );166 // Set thresholds. 167 $threshold_seconds = (int) apply_filters( 'action_scheduler_pastdue_actions_seconds', DAY_IN_SECONDS ); 168 $threshold_min = (int) apply_filters( 'action_scheduler_pastdue_actions_min', 1 ); 149 169 150 170 // Set fallback value for past-due actions count. … … 159 179 } 160 180 161 #Scheduled actions query arguments.181 // Scheduled actions query arguments. 162 182 $query_args = array( 163 183 'date' => as_get_datetime_object( time() - $threshold_seconds ), … … 166 186 ); 167 187 168 #If no third-party preempted, run default check.188 // If no third-party preempted, run default check. 169 189 if ( is_null( $check ) ) { 170 $store = ActionScheduler_Store::instance();171 $num_pastdue_actions = ( int) $store->query_actions( $query_args, 'count' );172 173 #Check if past-due actions count is greater than or equal to threshold.190 $store = ActionScheduler_Store::instance(); 191 $num_pastdue_actions = (int) $store->query_actions( $query_args, 'count' ); 192 193 // Check if past-due actions count is greater than or equal to threshold. 174 194 $check = ( $num_pastdue_actions >= $threshold_min ); 175 $check = ( bool) apply_filters( 'action_scheduler_pastdue_actions_check', $check, $num_pastdue_actions, $threshold_seconds, $threshold_min );176 } 177 178 #If check failed, set transient and abort.195 $check = (bool) apply_filters( 'action_scheduler_pastdue_actions_check', $check, $num_pastdue_actions, $threshold_seconds, $threshold_min ); 196 } 197 198 // If check failed, set transient and abort. 179 199 if ( ! boolval( $check ) ) { 180 200 $interval = apply_filters( 'action_scheduler_pastdue_actions_check_interval', round( $threshold_seconds / 4 ), $threshold_seconds ); … … 184 204 } 185 205 186 $actions_url = add_query_arg( array( 187 'page' => 'action-scheduler', 188 'status' => 'past-due', 189 'order' => 'asc', 190 ), admin_url( 'tools.php' ) ); 191 192 # Print notice. 206 $actions_url = add_query_arg( 207 array( 208 'page' => 'action-scheduler', 209 'status' => 'past-due', 210 'order' => 'asc', 211 ), 212 admin_url( 'tools.php' ) 213 ); 214 215 // Print notice. 193 216 echo '<div class="notice notice-warning"><p>'; 194 217 printf( 195 // translators: 1) is the number of affected actions, 2) is a link to an admin screen. 196 _n( 197 '<strong>Action Scheduler:</strong> %1$d <a href="%2$s">past-due action</a> found; something may be wrong. <a href="https://actionscheduler.org/faq/#my-site-has-past-due-actions-what-can-i-do" target="_blank">Read documentation »</a>', 198 '<strong>Action Scheduler:</strong> %1$d <a href="%2$s">past-due actions</a> found; something may be wrong. <a href="https://actionscheduler.org/faq/#my-site-has-past-due-actions-what-can-i-do" target="_blank">Read documentation »</a>', 199 $num_pastdue_actions, 200 'action-scheduler' 218 wp_kses( 219 // translators: 1) is the number of affected actions, 2) is a link to an admin screen. 220 _n( 221 '<strong>Action Scheduler:</strong> %1$d <a href="%2$s">past-due action</a> found; something may be wrong. <a href="https://actionscheduler.org/faq/#my-site-has-past-due-actions-what-can-i-do" target="_blank">Read documentation »</a>', 222 '<strong>Action Scheduler:</strong> %1$d <a href="%2$s">past-due actions</a> found; something may be wrong. <a href="https://actionscheduler.org/faq/#my-site-has-past-due-actions-what-can-i-do" target="_blank">Read documentation »</a>', 223 $num_pastdue_actions, 224 'action-scheduler' 225 ), 226 array( 227 'strong' => array(), 228 'a' => array( 229 'href' => true, 230 'target' => true, 231 ), 232 ) 201 233 ), 202 $num_pastdue_actions,234 absint( $num_pastdue_actions ), 203 235 esc_attr( esc_url( $actions_url ) ) 204 236 ); 205 237 echo '</p></div>'; 206 238 207 #Facilitate third-parties to evaluate and print notices.239 // Facilitate third-parties to evaluate and print notices. 208 240 do_action( 'action_scheduler_pastdue_actions_extra_notices', $query_args ); 209 241 } … … 215 247 $screen = get_current_screen(); 216 248 217 if ( ! $screen || self::$screen_id != $screen->id ) { 218 return; 219 } 220 221 $as_version = ActionScheduler_Versions::instance()->latest_version(); 249 if ( ! $screen || self::$screen_id !== $screen->id ) { 250 return; 251 } 252 253 $as_version = ActionScheduler_Versions::instance()->latest_version(); 254 $as_source = ActionScheduler_SystemInformation::active_source(); 255 $as_source_path = ActionScheduler_SystemInformation::active_source_path(); 256 $as_source_markup = sprintf( '<code>%s</code>', esc_html( $as_source_path ) ); 257 258 if ( ! empty( $as_source ) ) { 259 $as_source_markup = sprintf( 260 '%s: <abbr title="%s">%s</abbr>', 261 ucfirst( $as_source['type'] ), 262 esc_attr( $as_source_path ), 263 esc_html( $as_source['name'] ) 264 ); 265 } 266 222 267 $screen->add_help_tab( 223 268 array( … … 229 274 '<p>' . 230 275 __( 'Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'action-scheduler' ) . 276 '</p>' . 277 '<h3>' . esc_html__( 'Source', 'action-scheduler' ) . '</h3>' . 278 '<p>' . 279 esc_html__( 'Action Scheduler is currently being loaded from the following location. This can be useful when debugging, or if requested by the support team.', 'action-scheduler' ) . 280 '</p>' . 281 '<p>' . $as_source_markup . '</p>' . 282 '<h3>' . esc_html__( 'WP CLI', 'action-scheduler' ) . '</h3>' . 283 '<p>' . 284 sprintf( 285 /* translators: %1$s is WP CLI command (not translatable) */ 286 esc_html__( 'WP CLI commands are available: execute %1$s for a list of available commands.', 'action-scheduler' ), 287 '<code>wp help action-scheduler</code>' 288 ) . 231 289 '</p>', 232 290 ) -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_AsyncRequest_QueueRunner.php
r2734765 r3263883 1 1 <?php 2 /**3 * ActionScheduler_AsyncRequest_QueueRunner4 */5 2 6 3 defined( 'ABSPATH' ) || exit; … … 15 12 * 16 13 * @var ActionScheduler_Store 17 * @access protected18 14 */ 19 15 protected $store; … … 23 19 * 24 20 * @var string 25 * @access protected26 21 */ 27 22 protected $prefix = 'as'; … … 31 26 * 32 27 * @var string 33 * @access protected34 28 */ 35 29 protected $action = 'async_request_queue_runner'; 36 30 37 31 /** 38 * Initiate new async request 32 * Initiate new async request. 33 * 34 * @param ActionScheduler_Store $store Store object. 39 35 */ 40 36 public function __construct( ActionScheduler_Store $store ) { … … 50 46 */ 51 47 protected function handle() { 52 do_action( 'action_scheduler_run_queue', 'Async Request' ); // run a queue in the same way as WP Cron, but declare the Async Request context 48 do_action( 'action_scheduler_run_queue', 'Async Request' ); // run a queue in the same way as WP Cron, but declare the Async Request context. 53 49 54 50 $sleep_seconds = $this->get_sleep_seconds(); -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_Compatibility.php
r2953658 r3263883 50 50 } 51 51 52 $current_limit = @ini_get( 'memory_limit' ); 52 $current_limit = @ini_get( 'memory_limit' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 53 53 $current_limit_int = self::convert_hr_to_bytes( $current_limit ); 54 54 … … 61 61 $filtered_limit = apply_filters( 'admin_memory_limit', $wp_max_limit ); 62 62 $filtered_limit_int = self::convert_hr_to_bytes( $filtered_limit ); 63 64 // phpcs:disable WordPress.PHP.IniSet.memory_limit_Blacklisted 65 // phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged 63 66 64 67 if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) { … … 75 78 } 76 79 } 80 81 // phpcs:enable 82 77 83 return false; 78 84 } … … 86 92 */ 87 93 public static function raise_time_limit( $limit = 0 ) { 88 $limit = (int) $limit;94 $limit = (int) $limit; 89 95 $max_execution_time = (int) ini_get( 'max_execution_time' ); 90 96 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_DataController.php
r2734765 r3263883 19 19 20 20 /** Logger data store class name. */ 21 const LOGGER_CLASS = 'ActionScheduler_DBLogger';21 const LOGGER_CLASS = 'ActionScheduler_DBLogger'; 22 22 23 23 /** Migration status option name. */ 24 const STATUS_FLAG = 'action_scheduler_migration_status';24 const STATUS_FLAG = 'action_scheduler_migration_status'; 25 25 26 26 /** Migration status option value. */ … … 30 30 const MIN_PHP_VERSION = '5.5'; 31 31 32 /** @var ActionScheduler_DataController */ 32 /** 33 * Instance. 34 * 35 * @var ActionScheduler_DataController 36 */ 33 37 private static $instance; 34 38 35 /** @var int */ 39 /** 40 * Sleep time in seconds. 41 * 42 * @var int 43 */ 36 44 private static $sleep_time = 0; 37 45 38 /** @var int */ 46 /** 47 * Tick count required for freeing memory. 48 * 49 * @var int 50 */ 39 51 private static $free_ticks = 50; 40 52 … … 138 150 139 151 /** 152 * Globals. 153 * 140 154 * @var $wpdb \wpdb 141 155 * @var $wp_object_cache \WP_Object_Cache … … 155 169 156 170 if ( is_callable( array( $wp_object_cache, '__remoteset' ) ) ) { 157 call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important 171 call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important! 158 172 } 159 173 } -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_DateTime.php
r2953658 r3263883 16 16 * @var int 17 17 */ 18 protected $utcOffset = 0; 18 protected $utcOffset = 0; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase 19 19 20 20 /** … … 35 35 * This represents a fixed offset instead of a timezone setting. 36 36 * 37 * @param $offset37 * @param string|int $offset UTC offset value. 38 38 */ 39 39 public function setUtcOffset( $offset ) { 40 $this->utcOffset = intval( $offset ); 40 $this->utcOffset = intval( $offset ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 41 41 } 42 42 … … 49 49 #[\ReturnTypeWillChange] 50 50 public function getOffset() { 51 return $this->utcOffset ? $this->utcOffset : parent::getOffset(); 51 return $this->utcOffset ? $this->utcOffset : parent::getOffset(); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 52 52 } 53 53 … … 55 55 * Set the TimeZone associated with the DateTime 56 56 * 57 * @param DateTimeZone $timezone 57 * @param DateTimeZone $timezone Timezone object. 58 58 * 59 59 * @return static … … 62 62 #[\ReturnTypeWillChange] 63 63 public function setTimezone( $timezone ) { 64 $this->utcOffset = 0; 64 $this->utcOffset = 0; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase 65 65 parent::setTimezone( $timezone ); 66 66 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php
r2734765 r3263883 5 5 */ 6 6 class ActionScheduler_FatalErrorMonitor { 7 /** @var ActionScheduler_ActionClaim */ 8 private $claim = NULL; 9 /** @var ActionScheduler_Store */ 10 private $store = NULL; 7 8 /** 9 * ActionScheduler_ActionClaim instance. 10 * 11 * @var ActionScheduler_ActionClaim 12 */ 13 private $claim = null; 14 15 /** 16 * ActionScheduler_Store instance. 17 * 18 * @var ActionScheduler_Store 19 */ 20 private $store = null; 21 22 /** 23 * Current action's ID. 24 * 25 * @var int 26 */ 11 27 private $action_id = 0; 12 28 29 /** 30 * Construct. 31 * 32 * @param ActionScheduler_Store $store Action store. 33 */ 13 34 public function __construct( ActionScheduler_Store $store ) { 14 35 $this->store = $store; 15 36 } 16 37 38 /** 39 * Start monitoring. 40 * 41 * @param ActionScheduler_ActionClaim $claim Claimed actions. 42 */ 17 43 public function attach( ActionScheduler_ActionClaim $claim ) { 18 44 $this->claim = $claim; 19 45 add_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) ); 20 46 add_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0, 1 ); 21 add_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0, 0 );22 add_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0, 0 );23 add_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0, 0 );47 add_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0, 0 ); 48 add_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0, 0 ); 49 add_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0, 0 ); 24 50 } 25 51 52 /** 53 * Stop monitoring. 54 */ 26 55 public function detach() { 27 $this->claim = NULL;56 $this->claim = null; 28 57 $this->untrack_action(); 29 58 remove_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) ); 30 59 remove_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0 ); 31 remove_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0 );32 remove_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0 );33 remove_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0 );60 remove_action( 'action_scheduler_after_execute', array( $this, 'untrack_action' ), 0 ); 61 remove_action( 'action_scheduler_execution_ignored', array( $this, 'untrack_action' ), 0 ); 62 remove_action( 'action_scheduler_failed_execution', array( $this, 'untrack_action' ), 0 ); 34 63 } 35 64 65 /** 66 * Track specified action. 67 * 68 * @param int $action_id Action ID to track. 69 */ 36 70 public function track_current_action( $action_id ) { 37 71 $this->action_id = $action_id; 38 72 } 39 73 74 /** 75 * Un-track action. 76 */ 40 77 public function untrack_action() { 41 78 $this->action_id = 0; 42 79 } 43 80 81 /** 82 * Handle unexpected shutdown. 83 */ 44 84 public function handle_unexpected_shutdown() { 45 if ( $error = error_get_last() ) { 46 if ( in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ) ) ) { 47 if ( !empty($this->action_id) ) { 85 $error = error_get_last(); 86 87 if ( $error ) { 88 if ( in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) { 89 if ( ! empty( $this->action_id ) ) { 48 90 $this->store->mark_failure( $this->action_id ); 49 91 do_action( 'action_scheduler_unexpected_shutdown', $this->action_id, $error ); 50 92 } 51 93 } 94 52 95 $this->store->release_claim( $this->claim ); 53 96 } -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_InvalidActionException.php
r2734765 r3263883 14 14 * 15 15 * @param string $action_id The action ID with bad args. 16 * @param mixed $schedule Passed schedule. 16 17 * @return static 17 18 */ … … 21 22 __( 'Action [%1$s] has an invalid schedule: %2$s', 'action-scheduler' ), 22 23 $action_id, 23 var_export( $schedule, true ) 24 var_export( $schedule, true ) // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export 24 25 ); 25 26 … … 30 31 * Create a new exception when the action's args cannot be decoded to an array. 31 32 * 32 * @author Jeremy Pry33 *34 33 * @param string $action_id The action ID with bad args. 34 * @param mixed $args Passed arguments. 35 35 * @return static 36 36 */ … … 40 40 __( 'Action [%1$s] has invalid arguments. It cannot be JSON decoded to an array. $args = %2$s', 'action-scheduler' ), 41 41 $action_id, 42 var_export( $args, true ) 42 var_export( $args, true ) // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export 43 43 ); 44 44 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_ListTable.php
r3055854 r3263883 3 3 /** 4 4 * Implements the admin view of the actions. 5 * 5 6 * @codeCoverageIgnore 6 7 */ … … 50 51 51 52 /** 52 * Bulk actions. The key of the array is the method name of the implementation: 53 * 54 * bulk_<key>(array $ids, string $sql_in). 53 * Bulk actions. The key of the array is the method name of the implementation. 54 * Example: bulk_<key>(array $ids, string $sql_in). 55 55 * 56 56 * See the comments in the parent class for further details … … 77 77 * Sets the current data store object into `store->action` and initialises the object. 78 78 * 79 * @param ActionScheduler_Store $store80 * @param ActionScheduler_Logger $logger81 * @param ActionScheduler_QueueRunner $runner 79 * @param ActionScheduler_Store $store Store object. 80 * @param ActionScheduler_Logger $logger Logger object. 81 * @param ActionScheduler_QueueRunner $runner Runner object. 82 82 */ 83 83 public function __construct( ActionScheduler_Store $store, ActionScheduler_Logger $logger, ActionScheduler_QueueRunner $runner ) { … … 119 119 if ( empty( $request_status ) ) { 120 120 $this->sort_by[] = 'status'; 121 } elseif ( in_array( $request_status, array( 'in-progress', 'failed' ) ) ) {121 } elseif ( in_array( $request_status, array( 'in-progress', 'failed' ), true ) ) { 122 122 $this->columns += array( 'claim_id' => __( 'Claim ID', 'action-scheduler' ) ); 123 123 $this->sort_by[] = 'claim_id'; … … 126 126 $this->row_actions = array( 127 127 'hook' => array( 128 'run' => array(129 'name' => __( 'Run', 'action-scheduler' ),130 'desc' => __( 'Process the action now as if it were run as part of a queue', 'action-scheduler' ),128 'run' => array( 129 'name' => __( 'Run', 'action-scheduler' ), 130 'desc' => __( 'Process the action now as if it were run as part of a queue', 'action-scheduler' ), 131 131 ), 132 132 'cancel' => array( … … 225 225 } 226 226 227 $output = ''; 228 229 for ( $time_period_index = 0, $periods_included = 0, $seconds_remaining = $interval; $time_period_index < count( self::$time_periods ) && $seconds_remaining > 0 && $periods_included < $periods_to_include; $time_period_index++ ) { 227 $output = ''; 228 $num_time_periods = count( self::$time_periods ); 229 230 for ( $time_period_index = 0, $periods_included = 0, $seconds_remaining = $interval; $time_period_index < $num_time_periods && $seconds_remaining > 0 && $periods_included < $periods_to_include; $time_period_index++ ) { 230 231 231 232 $periods_in_interval = floor( $seconds_remaining / self::$time_periods[ $time_period_index ]['seconds'] ); … … 235 236 $output .= ' '; 236 237 } 237 $output .= sprintf( translate_nooped_plural( self::$time_periods[ $time_period_index ]['names'], $periods_in_interval, 'action-scheduler' ), $periods_in_interval );238 $output .= sprintf( translate_nooped_plural( self::$time_periods[ $time_period_index ]['names'], $periods_in_interval, 'action-scheduler' ), $periods_in_interval ); 238 239 $seconds_remaining -= $periods_in_interval * self::$time_periods[ $time_period_index ]['seconds']; 239 240 $periods_included++; … … 247 248 * Returns the recurrence of an action or 'Non-repeating'. The output is human readable. 248 249 * 249 * @param ActionScheduler_Action $action 250 * @param ActionScheduler_Action $action Action object. 250 251 * 251 252 * @return string … … 270 271 * Serializes the argument of an action to render it in a human friendly format. 271 272 * 272 * @param array $row The array representation of the current row of the table 273 * @param array $row The array representation of the current row of the table. 273 274 * 274 275 * @return string … … 281 282 $row_html = '<ul>'; 282 283 foreach ( $row['args'] as $key => $value ) { 283 $row_html .= sprintf( '<li><code>%s => %s</code></li>', esc_html( var_export( $key, true ) ), esc_html( var_export( $value, true ) ) ); 284 $row_html .= sprintf( '<li><code>%s => %s</code></li>', esc_html( var_export( $key, true ) ), esc_html( var_export( $value, true ) ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export 284 285 } 285 286 $row_html .= '</ul>'; … … 312 313 * Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal. 313 314 * 314 * @param ActionScheduler_LogEntry $log_entry 315 * @param DateTimezone $timezone315 * @param ActionScheduler_LogEntry $log_entry Log entry object. 316 * @param DateTimezone $timezone Timestamp. 316 317 * @return string 317 318 */ … … 325 326 * Only display row actions for pending actions. 326 327 * 327 * @param array $row Row to render 328 * @param string $column_name Current row 328 * @param array $row Row to render. 329 * @param string $column_name Current row. 329 330 * 330 331 * @return string 331 332 */ 332 333 protected function maybe_render_actions( $row, $column_name ) { 333 if ( 'pending' === strtolower( $row[ 'status_name'] ) ) {334 if ( 'pending' === strtolower( $row['status_name'] ) ) { 334 335 return parent::maybe_render_actions( $row, $column_name ); 335 336 } … … 359 360 $found_tables = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->prefix}actionscheduler%'" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 360 361 foreach ( $table_list as $table_name ) { 361 if ( ! in_array( $wpdb->prefix . $table_name, $found_tables ) ) {362 if ( ! in_array( $wpdb->prefix . $table_name, $found_tables, true ) ) { 362 363 $this->admin_notices[] = array( 363 364 'class' => 'error', 364 'message' => __( 'It appears one or more database tables were missing. Attempting to re-create the missing table(s).' , 'action-scheduler' ),365 'message' => __( 'It appears one or more database tables were missing. Attempting to re-create the missing table(s).', 'action-scheduler' ), 365 366 ); 366 367 $this->recreate_tables(); … … 391 392 $async_request_lock_expiration = ActionScheduler::lock()->get_expiration( 'async-request-runner' ); 392 393 393 // No lock set or lock expired 394 // No lock set or lock expired. 394 395 if ( false === $async_request_lock_expiration || $async_request_lock_expiration < time() ) { 395 $in_progress_url = add_query_arg( 'status', 'in-progress', remove_query_arg( 'status' ) );396 $in_progress_url = add_query_arg( 'status', 'in-progress', remove_query_arg( 'status' ) ); 396 397 /* translators: %s: process URL */ 397 398 $async_request_message = sprintf( __( 'A new queue has begun processing. <a href="%s">View actions in-progress »</a>', 'action-scheduler' ), esc_url( $in_progress_url ) ); … … 412 413 delete_transient( 'action_scheduler_admin_notice' ); 413 414 414 $action = $this->store->fetch_action( $notification['action_id'] );415 $action = $this->store->fetch_action( $notification['action_id'] ); 415 416 $action_hook_html = '<strong><code>' . $action->get_hook() . '</code></strong>'; 416 if ( 1 == $notification['success'] ) { 417 418 if ( 1 === absint( $notification['success'] ) ) { 417 419 $class = 'updated'; 418 420 switch ( $notification['row_action_type'] ) { 419 case 'run' :421 case 'run': 420 422 /* translators: %s: action HTML */ 421 423 $action_message_html = sprintf( __( 'Successfully executed action: %s', 'action-scheduler' ), $action_hook_html ); 422 424 break; 423 case 'cancel' :425 case 'cancel': 424 426 /* translators: %s: action HTML */ 425 427 $action_message_html = sprintf( __( 'Successfully canceled action: %s', 'action-scheduler' ), $action_hook_html ); 426 428 break; 427 default :429 default: 428 430 /* translators: %s: action HTML */ 429 431 $action_message_html = sprintf( __( 'Successfully processed change for action: %s', 'action-scheduler' ), $action_hook_html ); … … 450 452 * Prints the scheduled date in a human friendly format. 451 453 * 452 * @param array $row The array representation of the current row of the table 454 * @param array $row The array representation of the current row of the table. 453 455 * 454 456 * @return string … … 461 463 * Get the scheduled date in a human friendly format. 462 464 * 463 * @param ActionScheduler_Schedule $schedule 465 * @param ActionScheduler_Schedule $schedule Action's schedule. 464 466 * @return string 465 467 */ … … 493 495 494 496 /** 495 * Bulk delete 497 * Bulk delete. 496 498 * 497 499 * Deletes actions based on their ID. This is the handler for the bulk delete. It assumes the data 498 500 * properly validated by the callee and it will delete the actions without any extra validation. 499 501 * 500 * @param array $ids501 * @param string $ids_sql Inherited and unused 502 * @param int[] $ids Action IDs. 503 * @param string $ids_sql Inherited and unused. 502 504 */ 503 505 protected function bulk_delete( array $ids, $ids_sql ) { … … 508 510 // A possible reason for an exception would include a scenario where the same action is deleted by a 509 511 // concurrent request. 512 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 510 513 error_log( 511 514 sprintf( … … 524 527 * parameters are valid. 525 528 * 526 * @param int $action_id 529 * @param int $action_id Action ID. 527 530 */ 528 531 protected function row_action_cancel( $action_id ) { … … 534 537 * parameters are valid. 535 538 * 536 * @param int $action_id 539 * @param int $action_id Action ID. 537 540 */ 538 541 protected function row_action_run( $action_id ) { … … 561 564 * Implements the logic behind processing an action once an action link is clicked on the list table. 562 565 * 563 * @param int $action_id566 * @param int $action_id Action ID. 564 567 * @param string $row_action_type The type of action to perform on the action. 565 568 */ … … 567 570 try { 568 571 switch ( $row_action_type ) { 569 case 'run' :572 case 'run': 570 573 $this->runner->process_action( $action_id, 'Admin List Table' ); 571 574 break; 572 case 'cancel' :575 case 'cancel': 573 576 $this->store->cancel_action( $action_id ); 574 577 break; 575 578 } 576 $success = 1;579 $success = 1; 577 580 $error_message = ''; 578 581 } catch ( Exception $e ) { 579 $success = 0;582 $success = 0; 580 583 $error_message = $e->getMessage(); 581 584 } … … 640 643 } 641 644 642 $this->set_pagination_args( array( 643 'total_items' => $total_items, 644 'per_page' => $per_page, 645 'total_pages' => ceil( $total_items / $per_page ), 646 ) ); 645 $this->set_pagination_args( 646 array( 647 'total_items' => $total_items, 648 'per_page' => $per_page, 649 'total_pages' => ceil( $total_items / $per_page ), 650 ) 651 ); 647 652 } 648 653 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_LogEntry.php
r2734765 r3263883 7 7 8 8 /** 9 * Action's ID for log entry. 10 * 9 11 * @var int $action_id 10 12 */ 11 protected $action_id = '';13 protected $action_id = ''; 12 14 13 15 /** 16 * Log entry's message. 17 * 14 18 * @var string $message 15 19 */ 16 protected $message = '';20 protected $message = ''; 17 21 18 22 /** 23 * Log entry's date. 24 * 19 25 * @var Datetime $date 20 26 */ … … 24 30 * Constructor 25 31 * 26 * @param mixed $action_id Action ID27 * @param string $message Message28 * @param Datetime $date Datetime object with the time when this log entry was created. If this parameter is29 * not provided a new Datetime object (with current time) will be created.32 * @param mixed $action_id Action ID. 33 * @param string $message Message. 34 * @param Datetime $date Datetime object with the time when this log entry was created. If this parameter is 35 * not provided a new Datetime object (with current time) will be created. 30 36 */ 31 37 public function __construct( $action_id, $message, $date = null ) { 32 33 38 /* 34 39 * ActionScheduler_wpCommentLogger::get_entry() previously passed a 3rd param of $comment->comment_type … … 45 50 $this->action_id = $action_id; 46 51 $this->message = $message; 47 $this->date = $date ? $date : new Datetime ;52 $this->date = $date ? $date : new Datetime(); 48 53 } 49 54 … … 57 62 } 58 63 64 /** 65 * Get action ID of log entry. 66 */ 59 67 public function get_action_id() { 60 68 return $this->action_id; 61 69 } 62 70 71 /** 72 * Get log entry message. 73 */ 63 74 public function get_message() { 64 75 return $this->message; -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_NullLogEntry.php
r2734765 r3263883 5 5 */ 6 6 class ActionScheduler_NullLogEntry extends ActionScheduler_LogEntry { 7 8 /** 9 * Construct. 10 * 11 * @param string $action_id Action ID. 12 * @param string $message Log entry. 13 */ 7 14 public function __construct( $action_id = '', $message = '' ) { 8 // nothing to see here 15 // nothing to see here. 9 16 } 17 10 18 } 11 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_OptionLock.php
r2953658 r3263883 6 6 * 7 7 * Class ActionScheduler_OptionLock 8 * 8 9 * @since 3.0.0 9 10 */ -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_QueueCleaner.php
r3136104 r3263883 6 6 class ActionScheduler_QueueCleaner { 7 7 8 /** @var int */ 8 /** 9 * The batch size. 10 * 11 * @var int 12 */ 9 13 protected $batch_size; 10 14 11 /** @var ActionScheduler_Store */ 15 /** 16 * ActionScheduler_Store instance. 17 * 18 * @var ActionScheduler_Store 19 */ 12 20 private $store = null; 13 21 … … 20 28 21 29 /** 22 * @var string[] Default list of statuses purged by the cleaner process. 23 */ 24 private $default_statuses_to_purge = [ 30 * Default list of statuses purged by the cleaner process. 31 * 32 * @var string[] 33 */ 34 private $default_statuses_to_purge = array( 25 35 ActionScheduler_Store::STATUS_COMPLETE, 26 36 ActionScheduler_Store::STATUS_CANCELED, 27 ];37 ); 28 38 29 39 /** 30 40 * ActionScheduler_QueueCleaner constructor. 31 41 * 32 * @param ActionScheduler_Store $store The store instance.33 * @param int $batch_size The batch size.34 */ 35 public function __construct( ActionScheduler_Store $store = null, $batch_size = 20 ) {36 $this->store = $store ? $store : ActionScheduler_Store::instance();42 * @param ActionScheduler_Store|null $store The store instance. 43 * @param int $batch_size The batch size. 44 */ 45 public function __construct( ?ActionScheduler_Store $store = null, $batch_size = 20 ) { 46 $this->store = $store ? $store : ActionScheduler_Store::instance(); 37 47 $this->batch_size = $batch_size; 38 48 } … … 67 77 } 68 78 69 70 79 /** 71 80 * Filter the statuses when cleaning the queue. … … 84 93 * @param DateTime $cutoff_date Date limit for selecting actions. Defaults to 31 days ago. 85 94 * @param int|null $batch_size Maximum number of actions per status to delete. Defaults to 20. 86 * @param string $context Calling process context. Defaults to `old`.95 * @param string $context Calling process context. Defaults to `old`. 87 96 * @return array Actions deleted. 88 97 */ 89 98 public function clean_actions( array $statuses_to_purge, DateTime $cutoff_date, $batch_size = null, $context = 'old' ) { 90 $batch_size = $batch_size !== null? $batch_size : $this->batch_size;91 $cutoff = $cutoff_date !== null? $cutoff_date : as_get_datetime_object( $this->month_in_seconds . ' seconds ago' );99 $batch_size = ! is_null( $batch_size ) ? $batch_size : $this->batch_size; 100 $cutoff = ! is_null( $cutoff_date ) ? $cutoff_date : as_get_datetime_object( $this->month_in_seconds . ' seconds ago' ); 92 101 $lifespan = time() - $cutoff->getTimestamp(); 102 93 103 if ( empty( $statuses_to_purge ) ) { 94 104 $statuses_to_purge = $this->default_statuses_to_purge; 95 105 } 96 106 97 $deleted_actions = []; 107 $deleted_actions = array(); 108 98 109 foreach ( $statuses_to_purge as $status ) { 99 $actions_to_delete = $this->store->query_actions( array( 100 'status' => $status, 101 'modified' => $cutoff, 102 'modified_compare' => '<=', 103 'per_page' => $batch_size, 104 'orderby' => 'none', 105 ) ); 110 $actions_to_delete = $this->store->query_actions( 111 array( 112 'status' => $status, 113 'modified' => $cutoff, 114 'modified_compare' => '<=', 115 'per_page' => $batch_size, 116 'orderby' => 'none', 117 ) 118 ); 106 119 107 120 $deleted_actions = array_merge( $deleted_actions, $this->delete_actions( $actions_to_delete, $lifespan, $context ) ); … … 112 125 113 126 /** 114 * @param int[] $actions_to_delete List of action IDs to delete. 115 * @param int $lifespan Minimum scheduled age in seconds of the actions being deleted. 127 * Delete actions. 128 * 129 * @param int[] $actions_to_delete List of action IDs to delete. 130 * @param int $lifespan Minimum scheduled age in seconds of the actions being deleted. 116 131 * @param string $context Context of the delete request. 117 132 * @return array Deleted action IDs. 118 133 */ 119 134 private function delete_actions( array $actions_to_delete, $lifespan = null, $context = 'old' ) { 120 $deleted_actions = []; 121 if ( $lifespan === null ) { 135 $deleted_actions = array(); 136 137 if ( is_null( $lifespan ) ) { 122 138 $lifespan = $this->month_in_seconds; 123 139 } … … 139 155 * @param int $count_of_actions_to_delete The number of old actions being deleted in this batch 140 156 * @since 2.0.0 141 *142 157 */ 143 158 do_action( "action_scheduler_failed_{$context}_action_deletion", $action_id, $e, $lifespan, count( $actions_to_delete ) ); … … 157 172 public function reset_timeouts( $time_limit = 300 ) { 158 173 $timeout = apply_filters( 'action_scheduler_timeout_period', $time_limit ); 174 159 175 if ( $timeout < 0 ) { 160 176 return; 161 177 } 162 $cutoff = as_get_datetime_object($timeout.' seconds ago'); 163 $actions_to_reset = $this->store->query_actions( array( 164 'status' => ActionScheduler_Store::STATUS_PENDING, 165 'modified' => $cutoff, 166 'modified_compare' => '<=', 167 'claimed' => true, 168 'per_page' => $this->get_batch_size(), 169 'orderby' => 'none', 170 ) ); 178 179 $cutoff = as_get_datetime_object( $timeout . ' seconds ago' ); 180 $actions_to_reset = $this->store->query_actions( 181 array( 182 'status' => ActionScheduler_Store::STATUS_PENDING, 183 'modified' => $cutoff, 184 'modified_compare' => '<=', 185 'claimed' => true, 186 'per_page' => $this->get_batch_size(), 187 'orderby' => 'none', 188 ) 189 ); 171 190 172 191 foreach ( $actions_to_reset as $action_id ) { … … 187 206 public function mark_failures( $time_limit = 300 ) { 188 207 $timeout = apply_filters( 'action_scheduler_failure_period', $time_limit ); 208 189 209 if ( $timeout < 0 ) { 190 210 return; 191 211 } 192 $cutoff = as_get_datetime_object($timeout.' seconds ago'); 193 $actions_to_reset = $this->store->query_actions( array( 194 'status' => ActionScheduler_Store::STATUS_RUNNING, 195 'modified' => $cutoff, 196 'modified_compare' => '<=', 197 'per_page' => $this->get_batch_size(), 198 'orderby' => 'none', 199 ) ); 212 213 $cutoff = as_get_datetime_object( $timeout . ' seconds ago' ); 214 $actions_to_reset = $this->store->query_actions( 215 array( 216 'status' => ActionScheduler_Store::STATUS_RUNNING, 217 'modified' => $cutoff, 218 'modified_compare' => '<=', 219 'per_page' => $this->get_batch_size(), 220 'orderby' => 'none', 221 ) 222 ); 200 223 201 224 foreach ( $actions_to_reset as $action_id ) { … … 209 232 * 210 233 * @param int $time_limit The number of seconds to use as the timeout and failure period. Default 300 (5 minutes). 211 * @author Jeremy Pry212 234 */ 213 235 public function clean( $time_limit = 300 ) { … … 220 242 * Get the batch size for cleaning the queue. 221 243 * 222 * @author Jeremy Pry223 244 * @return int 224 245 */ -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_QueueRunner.php
r3136104 r3263883 9 9 const WP_CRON_SCHEDULE = 'every_minute'; 10 10 11 /** @var ActionScheduler_AsyncRequest_QueueRunner */ 11 /** 12 * ActionScheduler_AsyncRequest_QueueRunner instance. 13 * 14 * @var ActionScheduler_AsyncRequest_QueueRunner 15 */ 12 16 protected $async_request; 13 17 14 /** @var ActionScheduler_QueueRunner */ 18 /** 19 * ActionScheduler_QueueRunner instance. 20 * 21 * @var ActionScheduler_QueueRunner 22 */ 15 23 private static $runner = null; 16 24 17 /** @var int */ 25 /** 26 * Number of processed actions. 27 * 28 * @var int 29 */ 18 30 private $processed_actions_count = 0; 19 31 20 32 /** 33 * Get instance. 34 * 21 35 * @return ActionScheduler_QueueRunner 22 36 * @codeCoverageIgnore 23 37 */ 24 38 public static function instance() { 25 if ( empty( self::$runner) ) {26 $class = apply_filters('action_scheduler_queue_runner_class', 'ActionScheduler_QueueRunner');39 if ( empty( self::$runner ) ) { 40 $class = apply_filters( 'action_scheduler_queue_runner_class', 'ActionScheduler_QueueRunner' ); 27 41 self::$runner = new $class(); 28 42 } 43 29 44 return self::$runner; 30 45 } … … 33 48 * ActionScheduler_QueueRunner constructor. 34 49 * 35 * @param ActionScheduler_Store $store 36 * @param ActionScheduler_FatalErrorMonitor $monitor 37 * @param ActionScheduler_QueueCleaner $cleaner 38 */ 39 public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null, ActionScheduler_AsyncRequest_QueueRunner $async_request = null ) { 50 * @param ActionScheduler_Store|null $store Store object. 51 * @param ActionScheduler_FatalErrorMonitor|null $monitor Monitor object. 52 * @param ActionScheduler_QueueCleaner|null $cleaner Cleaner object. 53 * @param ActionScheduler_AsyncRequest_QueueRunner|null $async_request Async request runner object. 54 */ 55 public function __construct( ?ActionScheduler_Store $store = null, ?ActionScheduler_FatalErrorMonitor $monitor = null, ?ActionScheduler_QueueCleaner $cleaner = null, ?ActionScheduler_AsyncRequest_QueueRunner $async_request = null ) { 40 56 parent::__construct( $store, $monitor, $cleaner ); 41 57 … … 48 64 49 65 /** 66 * Initialize. 67 * 50 68 * @codeCoverageIgnore 51 69 */ 52 70 public function init() { 53 71 54 add_filter( 'cron_schedules', array( self::instance(), 'add_wp_cron_schedule' ) ); 55 56 // Check for and remove any WP Cron hook scheduled by Action Scheduler < 3.0.0, which didn't include the $context param 72 add_filter( 'cron_schedules', array( self::instance(), 'add_wp_cron_schedule' ) ); // phpcs:ignore WordPress.WP.CronInterval.CronSchedulesInterval 73 74 // Check for and remove any WP Cron hook scheduled by Action Scheduler < 3.0.0, which didn't include the $context param. 57 75 $next_timestamp = wp_next_scheduled( self::WP_CRON_HOOK ); 58 76 if ( $next_timestamp ) { … … 121 139 * passed along with it. New code calling this method directly, or by triggering the self::WP_CRON_HOOK, 122 140 * should set a context as the first parameter. For an example of this, refer to the code seen in 141 * 123 142 * @see ActionScheduler_AsyncRequest_QueueRunner::handle() 124 143 * … … 135 154 $this->processed_actions_count = 0; 136 155 if ( false === $this->has_maximum_concurrent_batches() ) { 137 $batch_size = apply_filters( 'action_scheduler_queue_runner_batch_size', 25 );138 156 do { 157 $batch_size = apply_filters( 'action_scheduler_queue_runner_batch_size', 25 ); 139 158 $processed_actions_in_batch = $this->do_batch( $batch_size, $context ); 140 159 $this->processed_actions_count += $processed_actions_in_batch; 141 } while ( $processed_actions_in_batch > 0 && ! $this->batch_limits_exceeded( $this->processed_actions_count ) ); // keep going until we run out of actions, time, or memory 160 } while ( $processed_actions_in_batch > 0 && ! $this->batch_limits_exceeded( $this->processed_actions_count ) ); // keep going until we run out of actions, time, or memory. 142 161 } 143 162 … … 152 171 * size is completed, or memory or time limits are reached, defined by @see $this->batch_limits_exceeded(). 153 172 * 154 * @param int $size The maximum number of actions to process in the batch.173 * @param int $size The maximum number of actions to process in the batch. 155 174 * @param string $context Optional identifier for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' 156 * Generally, this should be capitalised and not localised as it's a proper noun.175 * Generally, this should be capitalised and not localised as it's a proper noun. 157 176 * @return int The number of actions processed. 158 177 */ 159 178 protected function do_batch( $size = 100, $context = '' ) { 160 $claim = $this->store->stake_claim( $size);161 $this->monitor->attach( $claim);179 $claim = $this->store->stake_claim( $size ); 180 $this->monitor->attach( $claim ); 162 181 $processed_actions = 0; 163 182 164 183 foreach ( $claim->get_actions() as $action_id ) { 165 // bail if we lost the claim 166 if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $claim->get_id() ) ) ) {184 // bail if we lost the claim. 185 if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $claim->get_id() ), true ) ) { 167 186 break; 168 187 } … … 174 193 } 175 194 } 176 $this->store->release_claim( $claim);195 $this->store->release_claim( $claim ); 177 196 $this->monitor->detach(); 178 197 $this->clear_caches(); … … 219 238 } 220 239 240 /** 241 * Add schedule to WP cron. 242 * 243 * @param array<string, array<string, int|string>> $schedules Schedules. 244 * @return array<string, array<string, int|string>> 245 */ 221 246 public function add_wp_cron_schedule( $schedules ) { 222 247 $schedules['every_minute'] = array( 223 'interval' => 60, // in seconds 248 'interval' => 60, // in seconds. 224 249 'display' => __( 'Every minute', 'action-scheduler' ), 225 250 ); -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_Versions.php
r2734765 r3263883 6 6 class ActionScheduler_Versions { 7 7 /** 8 * ActionScheduler_Versions instance. 9 * 8 10 * @var ActionScheduler_Versions 9 11 */ 10 private static $instance = NULL;12 private static $instance = null; 11 13 14 /** 15 * Versions. 16 * 17 * @var array<string, callable> 18 */ 12 19 private $versions = array(); 13 20 21 /** 22 * Registered sources. 23 * 24 * @var array<string, string> 25 */ 26 private $sources = array(); 27 28 /** 29 * Register version's callback. 30 * 31 * @param string $version_string Action Scheduler version. 32 * @param callable $initialization_callback Callback to initialize the version. 33 */ 14 34 public function register( $version_string, $initialization_callback ) { 15 if ( isset( $this->versions[$version_string]) ) {16 return FALSE;35 if ( isset( $this->versions[ $version_string ] ) ) { 36 return false; 17 37 } 18 $this->versions[$version_string] = $initialization_callback; 19 return TRUE; 38 39 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace 40 $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); 41 $source = $backtrace[0]['file']; 42 43 $this->versions[ $version_string ] = $initialization_callback; 44 $this->sources[ $source ] = $version_string; 45 return true; 20 46 } 21 47 48 /** 49 * Get all versions. 50 */ 22 51 public function get_versions() { 23 52 return $this->versions; 24 53 } 25 54 55 /** 56 * Get registered sources. 57 * 58 * Use with caution: this method is only available as of Action Scheduler's 3.9.1 59 * release and, owing to the way Action Scheduler is loaded, it's possible that the 60 * class definition used at runtime will belong to an earlier version. 61 * 62 * @since 3.9.1 63 * 64 * @return array<string, string> 65 */ 66 public function get_sources() { 67 return $this->sources; 68 } 69 70 /** 71 * Get latest version registered. 72 */ 26 73 public function latest_version() { 27 $keys = array_keys( $this->versions);28 if ( empty( $keys) ) {74 $keys = array_keys( $this->versions ); 75 if ( empty( $keys ) ) { 29 76 return false; 30 77 } 31 78 uasort( $keys, 'version_compare' ); 32 return end($keys); 33 } 34 35 public function latest_version_callback() { 36 $latest = $this->latest_version(); 37 if ( empty($latest) || !isset($this->versions[$latest]) ) { 38 return '__return_null'; 39 } 40 return $this->versions[$latest]; 79 return end( $keys ); 41 80 } 42 81 43 82 /** 83 * Get callback for latest registered version. 84 */ 85 public function latest_version_callback() { 86 $latest = $this->latest_version(); 87 88 if ( empty( $latest ) || ! isset( $this->versions[ $latest ] ) ) { 89 return '__return_null'; 90 } 91 92 return $this->versions[ $latest ]; 93 } 94 95 /** 96 * Get instance. 97 * 44 98 * @return ActionScheduler_Versions 45 99 * @codeCoverageIgnore 46 100 */ 47 101 public static function instance() { 48 if ( empty( self::$instance) ) {102 if ( empty( self::$instance ) ) { 49 103 self::$instance = new self(); 50 104 } … … 53 107 54 108 /** 109 * Initialize. 110 * 55 111 * @codeCoverageIgnore 56 112 */ 57 113 public static function initialize_latest_version() { 58 114 $self = self::instance(); 59 call_user_func($self->latest_version_callback()); 115 call_user_func( $self->latest_version_callback() ); 116 } 117 118 /** 119 * Returns information about the plugin or theme which contains the current active version 120 * of Action Scheduler. 121 * 122 * If this cannot be determined, or if Action Scheduler is being loaded via some other 123 * method, then it will return an empty array. Otherwise, if populated, the array will 124 * look like the following: 125 * 126 * [ 127 * 'type' => 'plugin', # or 'theme' 128 * 'name' => 'Name', 129 * ] 130 * 131 * @deprecated 3.9.2 Use ActionScheduler_SystemInformation::active_source(). 132 * 133 * @return array 134 */ 135 public function active_source(): array { 136 _deprecated_function( __METHOD__, '3.9.2', 'ActionScheduler_SystemInformation::active_source()' ); 137 return ActionScheduler_SystemInformation::active_source(); 138 } 139 140 /** 141 * Returns the directory path for the currently active installation of Action Scheduler. 142 * 143 * @deprecated 3.9.2 Use ActionScheduler_SystemInformation::active_source_path(). 144 * 145 * @return string 146 */ 147 public function active_source_path(): string { 148 _deprecated_function( __METHOD__, '3.9.2', 'ActionScheduler_SystemInformation::active_source_path()' ); 149 return ActionScheduler_SystemInformation::active_source_path(); 60 150 } 61 151 } 62 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php
r2734765 r3263883 43 43 // While there are orphaned logs left in the comments table, we need to attach the callbacks which filter comment counts. 44 44 add_action( 'pre_get_comments', array( self::$wp_comment_logger, 'filter_comment_queries' ), 10, 1 ); 45 add_action( 'wp_count_comments', array( self::$wp_comment_logger, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs 45 add_action( 'wp_count_comments', array( self::$wp_comment_logger, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs. 46 46 add_action( 'comment_feed_where', array( self::$wp_comment_logger, 'filter_comment_feed' ), 10, 2 ); 47 47 48 // Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen 48 // Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen. 49 49 add_action( 'load-tools_page_action-scheduler', array( __CLASS__, 'register_admin_notice' ) ); 50 50 add_action( 'load-woocommerce_page_wc-status', array( __CLASS__, 'register_admin_notice' ) ); … … 67 67 */ 68 68 public static function maybe_schedule_cleanup() { 69 if ( (bool) get_comments( array( 'type' => ActionScheduler_wpCommentLogger::TYPE, 'number' => 1, 'fields' => 'ids' ) ) ) { 70 update_option( self::$has_logs_option_key, 'yes' ); 69 $has_logs = 'no'; 70 71 $args = array( 72 'type' => ActionScheduler_wpCommentLogger::TYPE, 73 'number' => 1, 74 'fields' => 'ids', 75 ); 76 77 if ( (bool) get_comments( $args ) ) { 78 $has_logs = 'yes'; 71 79 72 80 if ( ! as_next_scheduled_action( self::$cleanup_hook ) ) { … … 74 82 } 75 83 } 84 85 update_option( self::$has_logs_option_key, $has_logs, true ); 76 86 } 77 87 … … 81 91 public static function delete_all_action_comments() { 82 92 global $wpdb; 83 $wpdb->delete( $wpdb->comments, array( 'comment_type' => ActionScheduler_wpCommentLogger::TYPE, 'comment_agent' => ActionScheduler_wpCommentLogger::AGENT ) ); 84 delete_option( self::$has_logs_option_key ); 93 94 $wpdb->delete( 95 $wpdb->comments, 96 array( 97 'comment_type' => ActionScheduler_wpCommentLogger::TYPE, 98 'comment_agent' => ActionScheduler_wpCommentLogger::AGENT, 99 ) 100 ); 101 102 update_option( self::$has_logs_option_key, 'no', true ); 85 103 } 86 104 … … 91 109 add_action( 'admin_notices', array( __CLASS__, 'print_admin_notice' ) ); 92 110 } 93 111 94 112 /** 95 113 * Prints details about the orphaned action logs and includes information on where to learn more. -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Clean_Command.php
r2953658 r3263883 42 42 $batches_completed = 0; 43 43 $actions_deleted = 0; 44 $unlimited = $batches === 0;44 $unlimited = 0 === $batches; 45 45 try { 46 46 $lifespan = as_get_datetime_object( $before ); … … 59 59 } 60 60 61 $deleted = count( $cleaner->clean_actions( $status, $lifespan, null, 'CLI' ) );61 $deleted = count( $cleaner->clean_actions( $status, $lifespan, null, 'CLI' ) ); 62 62 if ( $deleted <= 0 ) { 63 63 break; … … 80 80 * Print WP CLI message about how many batches of actions were processed. 81 81 * 82 * @param int $batches_processed 82 * @param int $batches_processed Number of batches processed. 83 83 */ 84 84 protected function print_total_batches( int $batches_processed ) { … … 96 96 * 97 97 * @param Exception $e The error object. 98 *99 * @throws \WP_CLI\ExitException100 98 */ 101 99 protected function print_error( Exception $e ) { … … 112 110 * Print a success message with the number of completed actions. 113 111 * 114 * @param int $actions_deleted 112 * @param int $actions_deleted Number of deleted actions. 115 113 */ 116 114 protected function print_success( int $actions_deleted ) { -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_QueueRunner.php
r2953658 r3263883 10 10 class ActionScheduler_WPCLI_QueueRunner extends ActionScheduler_Abstract_QueueRunner { 11 11 12 /** @var array */ 12 /** 13 * Claimed actions. 14 * 15 * @var array 16 */ 13 17 protected $actions; 14 18 15 /** @var ActionScheduler_ActionClaim */ 19 /** 20 * ActionScheduler_ActionClaim instance. 21 * 22 * @var ActionScheduler_ActionClaim 23 */ 16 24 protected $claim; 17 25 18 /** @var \cli\progress\Bar */ 26 /** 27 * Progress bar instance. 28 * 29 * @var \cli\progress\Bar 30 */ 19 31 protected $progress_bar; 20 32 … … 22 34 * ActionScheduler_WPCLI_QueueRunner constructor. 23 35 * 24 * @param ActionScheduler_Store $store25 * @param ActionScheduler_FatalErrorMonitor $monitor26 * @param ActionScheduler_QueueCleaner $cleaner36 * @param ActionScheduler_Store|null $store Store object. 37 * @param ActionScheduler_FatalErrorMonitor|null $monitor Monitor object. 38 * @param ActionScheduler_QueueCleaner|null $cleaner Cleaner object. 27 39 * 28 * @throws Exception When this is not run within WP CLI 40 * @throws Exception When this is not run within WP CLI. 29 41 */ 30 public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null,ActionScheduler_QueueCleaner $cleaner = null ) {42 public function __construct( ?ActionScheduler_Store $store = null, ?ActionScheduler_FatalErrorMonitor $monitor = null, ?ActionScheduler_QueueCleaner $cleaner = null ) { 31 43 if ( ! ( defined( 'WP_CLI' ) && WP_CLI ) ) { 32 44 /* translators: %s php class name */ … … 39 51 /** 40 52 * Set up the Queue before processing. 41 *42 * @author Jeremy Pry43 53 * 44 54 * @param int $batch_size The batch size to process. … … 73 83 /** 74 84 * Add our hooks to the appropriate actions. 75 *76 * @author Jeremy Pry77 85 */ 78 86 protected function add_hooks() { … … 84 92 /** 85 93 * Set up the WP CLI progress bar. 86 *87 * @author Jeremy Pry88 94 */ 89 95 protected function setup_progress_bar() { … … 99 105 * Process actions in the queue. 100 106 * 101 * @author Jeremy Pry102 *103 107 * @param string $context Optional runner context. Default 'WP CLI'. 104 108 * … … 110 114 foreach ( $this->actions as $action_id ) { 111 115 // Error if we lost the claim. 112 if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $this->claim->get_id() ) ) ) {116 if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $this->claim->get_id() ), true ) ) { 113 117 WP_CLI::warning( __( 'The claim has been lost. Aborting current batch.', 'action-scheduler' ) ); 114 118 break; … … 130 134 * Handle WP CLI message when the action is starting. 131 135 * 132 * @author Jeremy Pry 133 * 134 * @param $action_id 136 * @param int $action_id Action ID. 135 137 */ 136 138 public function before_execute( $action_id ) { … … 142 144 * Handle WP CLI message when the action has completed. 143 145 * 144 * @author Jeremy Pry 145 * 146 * @param int $action_id 146 * @param int $action_id ActionID. 147 147 * @param null|ActionScheduler_Action $action The instance of the action. Default to null for backward compatibility. 148 148 */ 149 149 public function after_execute( $action_id, $action = null ) { 150 // backward compatibility 150 // backward compatibility. 151 151 if ( null === $action ) { 152 152 $action = $this->store->fetch_action( $action_id ); … … 159 159 * Handle WP CLI message when the action has failed. 160 160 * 161 * @author Jeremy Pry 162 * 163 * @param int $action_id 164 * @param Exception $exception 161 * @param int $action_id Action ID. 162 * @param Exception $exception Exception. 165 163 * @throws \WP_CLI\ExitException With failure message. 166 164 */ … … 176 174 * Sleep and help avoid hitting memory limit 177 175 * 178 * @param int $sleep_time Amount of seconds to sleep 176 * @param int $sleep_time Amount of seconds to sleep. 179 177 * @deprecated 3.0.0 180 178 */ -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php
r2953658 r3263883 92 92 $batches_completed = 0; 93 93 $actions_completed = 0; 94 $unlimited = $batches === 0;95 if ( is_callable( [ ActionScheduler::store(), 'set_claim_filter' ]) ) {94 $unlimited = 0 === $batches; 95 if ( is_callable( array( ActionScheduler::store(), 'set_claim_filter' ) ) ) { 96 96 $exclude_groups = $this->parse_comma_separated_string( $exclude_groups ); 97 97 98 98 if ( ! empty( $exclude_groups ) ) { 99 ActionScheduler::store()->set_claim_filter( 'exclude-groups', $exclude_groups );99 ActionScheduler::store()->set_claim_filter( 'exclude-groups', $exclude_groups ); 100 100 } 101 101 } … … 105 105 $cleaner = new ActionScheduler_QueueCleaner( null, $clean ); 106 106 107 // Get the queue runner instance 107 // Get the queue runner instance. 108 108 $runner = new ActionScheduler_WPCLI_QueueRunner( null, null, $cleaner ); 109 109 … … 142 142 * Print WP CLI message about how many actions are about to be processed. 143 143 * 144 * @author Jeremy Pry 145 * 146 * @param int $total 144 * @param int $total Number of actions found. 147 145 */ 148 146 protected function print_total_actions( $total ) { … … 159 157 * Print WP CLI message about how many batches of actions were processed. 160 158 * 161 * @author Jeremy Pry 162 * 163 * @param int $batches_completed 159 * @param int $batches_completed Number of completed batches. 164 160 */ 165 161 protected function print_total_batches( $batches_completed ) { … … 176 172 * Convert an exception into a WP CLI error. 177 173 * 178 * @author Jeremy Pry179 *180 174 * @param Exception $e The error object. 181 175 * 182 * @throws \WP_CLI\ExitException 176 * @throws \WP_CLI\ExitException Under some conditions WP CLI may throw an exception. 183 177 */ 184 178 protected function print_error( Exception $e ) { … … 195 189 * Print a success message with the number of completed actions. 196 190 * 197 * @author Jeremy Pry 198 * 199 * @param int $actions_completed 191 * @param int $actions_completed Number of completed actions. 200 192 */ 201 193 protected function print_success( $actions_completed ) { -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/WP_CLI/Migration_Command.php
r2734765 r3263883 22 22 class Migration_Command extends WP_CLI_Command { 23 23 24 /** @var int */ 24 /** 25 * Number of actions migrated. 26 * 27 * @var int 28 */ 25 29 private $total_processed = 0; 26 30 … … 33 37 } 34 38 35 WP_CLI::add_command( 'action-scheduler migrate', [ $this, 'migrate' ], [ 36 'shortdesc' => 'Migrates actions to the DB tables store', 37 'synopsis' => [ 38 [ 39 'type' => 'assoc', 40 'name' => 'batch-size', 41 'optional' => true, 42 'default' => 100, 43 'description' => 'The number of actions to process in each batch', 44 ], 45 [ 46 'type' => 'assoc', 47 'name' => 'free-memory-on', 48 'optional' => true, 49 'default' => 50, 50 'description' => 'The number of actions to process between freeing memory. 0 disables freeing memory', 51 ], 52 [ 53 'type' => 'assoc', 54 'name' => 'pause', 55 'optional' => true, 56 'default' => 0, 57 'description' => 'The number of seconds to pause when freeing memory', 58 ], 59 [ 60 'type' => 'flag', 61 'name' => 'dry-run', 62 'optional' => true, 63 'description' => 'Reports on the actions that would have been migrated, but does not change any data', 64 ], 65 ], 66 ] ); 39 WP_CLI::add_command( 40 'action-scheduler migrate', 41 array( $this, 'migrate' ), 42 array( 43 'shortdesc' => 'Migrates actions to the DB tables store', 44 'synopsis' => array( 45 array( 46 'type' => 'assoc', 47 'name' => 'batch-size', 48 'optional' => true, 49 'default' => 100, 50 'description' => 'The number of actions to process in each batch', 51 ), 52 array( 53 'type' => 'assoc', 54 'name' => 'free-memory-on', 55 'optional' => true, 56 'default' => 50, 57 'description' => 'The number of actions to process between freeing memory. 0 disables freeing memory', 58 ), 59 array( 60 'type' => 'assoc', 61 'name' => 'pause', 62 'optional' => true, 63 'default' => 0, 64 'description' => 'The number of seconds to pause when freeing memory', 65 ), 66 array( 67 'type' => 'flag', 68 'name' => 'dry-run', 69 'optional' => true, 70 'description' => 'Reports on the actions that would have been migrated, but does not change any data', 71 ), 72 ), 73 ) 74 ); 67 75 } 68 76 … … 82 90 $runner->init_destination(); 83 91 84 $batch_size = isset( $assoc_args[ 'batch-size' ] ) ? (int) $assoc_args[ 'batch-size'] : 100;85 $free_on = isset( $assoc_args[ 'free-memory-on' ] ) ? (int) $assoc_args[ 'free-memory-on'] : 50;86 $sleep = isset( $assoc_args[ 'pause' ] ) ? (int) $assoc_args[ 'pause'] : 0;92 $batch_size = isset( $assoc_args['batch-size'] ) ? (int) $assoc_args['batch-size'] : 100; 93 $free_on = isset( $assoc_args['free-memory-on'] ) ? (int) $assoc_args['free-memory-on'] : 50; 94 $sleep = isset( $assoc_args['pause'] ) ? (int) $assoc_args['pause'] : 0; 87 95 \ActionScheduler_DataController::set_free_ticks( $free_on ); 88 96 \ActionScheduler_DataController::set_sleep_time( $sleep ); 89 97 90 98 do { 91 $actions_processed = $runner->run( $batch_size );99 $actions_processed = $runner->run( $batch_size ); 92 100 $this->total_processed += $actions_processed; 93 101 } while ( $actions_processed > 0 ); 94 102 95 103 if ( ! $config->get_dry_run() ) { 96 // let the scheduler know that there's nothing left to do 104 // let the scheduler know that there's nothing left to do. 97 105 $scheduler = new Scheduler(); 98 106 $scheduler->mark_complete(); … … 110 118 */ 111 119 private function get_migration_config( $args ) { 112 $args = wp_parse_args( $args, [ 113 'dry-run' => false, 114 ] ); 120 $args = wp_parse_args( 121 $args, 122 array( 123 'dry-run' => false, 124 ) 125 ); 115 126 116 127 $config = Controller::instance()->get_migration_config_object(); 117 $config->set_dry_run( ! empty( $args[ 'dry-run'] ) );128 $config->set_dry_run( ! empty( $args['dry-run'] ) ); 118 129 119 130 return $config; … … 124 135 */ 125 136 private function init_logging() { 126 add_action( 'action_scheduler/migrate_action_dry_run', function ( $action_id ) { 127 WP_CLI::debug( sprintf( 'Dry-run: migrated action %d', $action_id ) ); 128 }, 10, 1 ); 129 add_action( 'action_scheduler/no_action_to_migrate', function ( $action_id ) { 130 WP_CLI::debug( sprintf( 'No action found to migrate for ID %d', $action_id ) ); 131 }, 10, 1 ); 132 add_action( 'action_scheduler/migrate_action_failed', function ( $action_id ) { 133 WP_CLI::warning( sprintf( 'Failed migrating action with ID %d', $action_id ) ); 134 }, 10, 1 ); 135 add_action( 'action_scheduler/migrate_action_incomplete', function ( $source_id, $destination_id ) { 136 WP_CLI::warning( sprintf( 'Unable to remove source action with ID %d after migrating to new ID %d', $source_id, $destination_id ) ); 137 }, 10, 2 ); 138 add_action( 'action_scheduler/migrated_action', function ( $source_id, $destination_id ) { 139 WP_CLI::debug( sprintf( 'Migrated source action with ID %d to new store with ID %d', $source_id, $destination_id ) ); 140 }, 10, 2 ); 141 add_action( 'action_scheduler/migration_batch_starting', function ( $batch ) { 142 WP_CLI::debug( 'Beginning migration of batch: ' . print_r( $batch, true ) ); 143 }, 10, 1 ); 144 add_action( 'action_scheduler/migration_batch_complete', function ( $batch ) { 145 WP_CLI::log( sprintf( 'Completed migration of %d actions', count( $batch ) ) ); 146 }, 10, 1 ); 137 add_action( 138 'action_scheduler/migrate_action_dry_run', 139 function ( $action_id ) { 140 WP_CLI::debug( sprintf( 'Dry-run: migrated action %d', $action_id ) ); 141 } 142 ); 143 144 add_action( 145 'action_scheduler/no_action_to_migrate', 146 function ( $action_id ) { 147 WP_CLI::debug( sprintf( 'No action found to migrate for ID %d', $action_id ) ); 148 } 149 ); 150 151 add_action( 152 'action_scheduler/migrate_action_failed', 153 function ( $action_id ) { 154 WP_CLI::warning( sprintf( 'Failed migrating action with ID %d', $action_id ) ); 155 } 156 ); 157 158 add_action( 159 'action_scheduler/migrate_action_incomplete', 160 function ( $source_id, $destination_id ) { 161 WP_CLI::warning( sprintf( 'Unable to remove source action with ID %d after migrating to new ID %d', $source_id, $destination_id ) ); 162 }, 163 10, 164 2 165 ); 166 167 add_action( 168 'action_scheduler/migrated_action', 169 function ( $source_id, $destination_id ) { 170 WP_CLI::debug( sprintf( 'Migrated source action with ID %d to new store with ID %d', $source_id, $destination_id ) ); 171 }, 172 10, 173 2 174 ); 175 176 add_action( 177 'action_scheduler/migration_batch_starting', 178 function ( $batch ) { 179 WP_CLI::debug( 'Beginning migration of batch: ' . print_r( $batch, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r 180 } 181 ); 182 183 add_action( 184 'action_scheduler/migration_batch_complete', 185 function ( $batch ) { 186 WP_CLI::log( sprintf( 'Completed migration of %d actions', count( $batch ) ) ); 187 } 188 ); 147 189 } 148 190 } -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/WP_CLI/ProgressBar.php
r2734765 r3263883 18 18 class ProgressBar { 19 19 20 /** @var integer */ 20 /** 21 * Current number of ticks. 22 * 23 * @var integer 24 */ 21 25 protected $total_ticks; 22 26 23 /** @var integer */ 27 /** 28 * Total number of ticks. 29 * 30 * @var integer 31 */ 24 32 protected $count; 25 33 26 /** @var integer */ 34 /** 35 * Progress bar update interval. 36 * 37 * @var integer 38 */ 27 39 protected $interval; 28 40 29 /** @var string */ 41 /** 42 * Progress bar message. 43 * 44 * @var string 45 */ 30 46 protected $message; 31 47 32 /** @var \cli\progress\Bar */ 48 /** 49 * Instance. 50 * 51 * @var \cli\progress\Bar 52 */ 33 53 protected $progress_bar; 34 54 … … 39 59 * @param integer $count Total number of ticks to be performed. 40 60 * @param integer $interval Optional. The interval in milliseconds between updates. Default 100. 41 *42 * @throws Exception When this is not run within WP CLI61 * 62 * @throws \Exception When this is not run within WP CLI. 43 63 */ 44 64 public function __construct( $message, $count, $interval = 100 ) { … … 65 85 $this->total_ticks++; 66 86 67 do_action( 'action_scheduler/progress_tick', $this->total_ticks ); 87 do_action( 'action_scheduler/progress_tick', $this->total_ticks ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 68 88 } 69 89 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler.php
r2983163 r3263883 6 6 /** 7 7 * Class ActionScheduler 8 * 8 9 * @codeCoverageIgnore 9 10 */ 10 11 abstract class ActionScheduler { 12 13 /** 14 * Plugin file path. 15 * 16 * @var string 17 */ 11 18 private static $plugin_file = ''; 12 /** @var ActionScheduler_ActionFactory */ 13 private static $factory = NULL; 14 /** @var bool */ 19 20 /** 21 * ActionScheduler_ActionFactory instance. 22 * 23 * @var ActionScheduler_ActionFactory 24 */ 25 private static $factory = null; 26 27 /** 28 * Data store is initialized. 29 * 30 * @var bool 31 */ 15 32 private static $data_store_initialized = false; 16 33 34 /** 35 * Factory. 36 */ 17 37 public static function factory() { 18 if ( ! isset(self::$factory) ) {38 if ( ! isset( self::$factory ) ) { 19 39 self::$factory = new ActionScheduler_ActionFactory(); 20 40 } … … 22 42 } 23 43 44 /** 45 * Get Store instance. 46 */ 24 47 public static function store() { 25 48 return ActionScheduler_Store::instance(); 26 49 } 27 50 51 /** 52 * Get Lock instance. 53 */ 28 54 public static function lock() { 29 55 return ActionScheduler_Lock::instance(); 30 56 } 31 57 58 /** 59 * Get Logger instance. 60 */ 32 61 public static function logger() { 33 62 return ActionScheduler_Logger::instance(); 34 63 } 35 64 65 /** 66 * Get QueueRunner instance. 67 */ 36 68 public static function runner() { 37 69 return ActionScheduler_QueueRunner::instance(); 38 70 } 39 71 72 /** 73 * Get AdminView instance. 74 */ 40 75 public static function admin_view() { 41 76 return ActionScheduler_AdminView::instance(); … … 44 79 /** 45 80 * Get the absolute system path to the plugin directory, or a file therein 81 * 46 82 * @static 47 * @param string $path 83 * @param string $path Path relative to plugin directory. 48 84 * @return string 49 85 */ 50 86 public static function plugin_path( $path ) { 51 $base = dirname( self::$plugin_file);87 $base = dirname( self::$plugin_file ); 52 88 if ( $path ) { 53 return trailingslashit( $base).$path;89 return trailingslashit( $base ) . $path; 54 90 } else { 55 return untrailingslashit( $base);91 return untrailingslashit( $base ); 56 92 } 57 93 } … … 59 95 /** 60 96 * Get the absolute URL to the plugin directory, or a file therein 97 * 61 98 * @static 62 * @param string $path 99 * @param string $path Path relative to plugin directory. 63 100 * @return string 64 101 */ 65 102 public static function plugin_url( $path ) { 66 return plugins_url($path, self::$plugin_file); 67 } 68 103 return plugins_url( $path, self::$plugin_file ); 104 } 105 106 /** 107 * Autoload. 108 * 109 * @param string $class Class name. 110 */ 69 111 public static function autoload( $class ) { 70 112 $d = DIRECTORY_SEPARATOR; … … 92 134 } elseif ( strpos( $class, 'ActionScheduler' ) === 0 ) { 93 135 $segments = explode( '_', $class ); 94 $type = isset( $segments[ 1 ] ) ? $segments[ 1] : '';136 $type = isset( $segments[1] ) ? $segments[1] : ''; 95 137 96 138 switch ( $type ) { … … 120 162 121 163 if ( file_exists( $dir . "{$class}.php" ) ) { 122 include ( $dir . "{$class}.php" );164 include $dir . "{$class}.php"; 123 165 return; 124 166 } … … 129 171 * 130 172 * @static 131 * @param string $plugin_file 173 * @param string $plugin_file Plugin file path. 132 174 */ 133 175 public static function init( $plugin_file ) { … … 140 182 do_action( 'action_scheduler_pre_init' ); 141 183 142 require_once ( self::plugin_path( 'functions.php' ));184 require_once self::plugin_path( 'functions.php' ); 143 185 ActionScheduler_DataController::init(); 144 186 … … 150 192 // Ensure initialization on plugin activation. 151 193 if ( ! did_action( 'init' ) ) { 152 add_action( 'init', array( $admin_view, 'init' ), 0, 0 ); // run before $store::init() 194 // phpcs:ignore Squiz.PHP.CommentedOutCode 195 add_action( 'init', array( $admin_view, 'init' ), 0, 0 ); // run before $store::init(). 153 196 add_action( 'init', array( $store, 'init' ), 1, 0 ); 154 197 add_action( 'init', array( $logger, 'init' ), 1, 0 ); … … 192 235 193 236 if ( apply_filters( 'action_scheduler_load_deprecated_functions', true ) ) { 194 require_once ( self::plugin_path( 'deprecated/functions.php' ));237 require_once self::plugin_path( 'deprecated/functions.php' ); 195 238 } 196 239 … … 198 241 WP_CLI::add_command( 'action-scheduler', 'ActionScheduler_WPCLI_Scheduler_command' ); 199 242 WP_CLI::add_command( 'action-scheduler', 'ActionScheduler_WPCLI_Clean_Command' ); 243 WP_CLI::add_command( 'action-scheduler action', '\Action_Scheduler\WP_CLI\Action_Command' ); 244 WP_CLI::add_command( 'action-scheduler', '\Action_Scheduler\WP_CLI\System_Command' ); 200 245 if ( ! ActionScheduler_DataController::is_migration_complete() && Controller::instance()->allow_migration() ) { 201 246 $command = new Migration_Command(); … … 227 272 esc_attr( $function_name ) 228 273 ); 229 _doing_it_wrong( $function_name, $message, '3.1.6' );274 _doing_it_wrong( esc_html( $function_name ), esc_html( $message ), '3.1.6' ); 230 275 } 231 276 … … 254 299 'ActionScheduler_Store' => true, 255 300 'ActionScheduler_TimezoneHelper' => true, 301 'ActionScheduler_WPCLI_Command' => true, 256 302 ); 257 303 … … 282 328 283 329 $segments = explode( '_', $class ); 284 $segment = isset( $segments[ 1 ] ) ? $segments[ 1] : $class;330 $segment = isset( $segments[1] ) ? $segments[1] : $class; 285 331 286 332 return isset( $migration_segments[ $segment ] ) && $migration_segments[ $segment ]; … … 298 344 protected static function is_class_cli( $class ) { 299 345 static $cli_segments = array( 300 'QueueRunner' => true, 301 'Command' => true, 302 'ProgressBar' => true, 346 'QueueRunner' => true, 347 'Command' => true, 348 'ProgressBar' => true, 349 '\Action_Scheduler\WP_CLI\Action_Command' => true, 350 '\Action_Scheduler\WP_CLI\System_Command' => true, 303 351 ); 304 352 305 353 $segments = explode( '_', $class ); 306 $segment = isset( $segments[ 1 ] ) ? $segments[ 1] : $class;354 $segment = isset( $segments[1] ) ? $segments[1] : $class; 307 355 308 356 return isset( $cli_segments[ $segment ] ) && $cli_segments[ $segment ]; 309 357 } 310 358 359 /** 360 * Clone. 361 */ 311 362 final public function __clone() { 312 trigger_error("Singleton. No cloning allowed!", E_USER_ERROR); 313 } 314 363 trigger_error( 'Singleton. No cloning allowed!', E_USER_ERROR ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error 364 } 365 366 /** 367 * Wakeup. 368 */ 315 369 final public function __wakeup() { 316 trigger_error("Singleton. No serialization allowed!", E_USER_ERROR); 317 } 318 370 trigger_error( 'Singleton. No serialization allowed!', E_USER_ERROR ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error 371 } 372 373 /** 374 * Construct. 375 */ 319 376 final private function __construct() {} 320 377 321 378 /** Deprecated **/ 322 379 380 /** 381 * Get DateTime object. 382 * 383 * @param null|string $when Date/time string. 384 * @param string $timezone Timezone string. 385 */ 323 386 public static function get_datetime_object( $when = null, $timezone = 'UTC' ) { 324 387 _deprecated_function( __METHOD__, '2.0', 'wcs_add_months()' ); -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php
r3136104 r3263883 6 6 abstract class ActionScheduler_Abstract_QueueRunner extends ActionScheduler_Abstract_QueueRunner_Deprecated { 7 7 8 /** @var ActionScheduler_QueueCleaner */ 8 /** 9 * ActionScheduler_QueueCleaner instance. 10 * 11 * @var ActionScheduler_QueueCleaner 12 */ 9 13 protected $cleaner; 10 14 11 /** @var ActionScheduler_FatalErrorMonitor */ 15 /** 16 * ActionScheduler_FatalErrorMonitor instance. 17 * 18 * @var ActionScheduler_FatalErrorMonitor 19 */ 12 20 protected $monitor; 13 21 14 /** @var ActionScheduler_Store */ 22 /** 23 * ActionScheduler_Store instance. 24 * 25 * @var ActionScheduler_Store 26 */ 15 27 protected $store; 16 28 … … 28 40 * ActionScheduler_Abstract_QueueRunner constructor. 29 41 * 30 * @param ActionScheduler_Store $store31 * @param ActionScheduler_FatalErrorMonitor $monitor32 * @param ActionScheduler_QueueCleaner $cleaner33 */ 34 public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null,ActionScheduler_QueueCleaner $cleaner = null ) {42 * @param ActionScheduler_Store|null $store Store object. 43 * @param ActionScheduler_FatalErrorMonitor|null $monitor Monitor object. 44 * @param ActionScheduler_QueueCleaner|null $cleaner Cleaner object. 45 */ 46 public function __construct( ?ActionScheduler_Store $store = null, ?ActionScheduler_FatalErrorMonitor $monitor = null, ?ActionScheduler_QueueCleaner $cleaner = null ) { 35 47 36 48 $this->created_time = microtime( true ); … … 44 56 * Process an individual action. 45 57 * 46 * @param int $action_id The action ID to process.58 * @param int $action_id The action ID to process. 47 59 * @param string $context Optional identifier for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' 48 * Generally, this should be capitalised and not localised as it's a proper noun. 60 * Generally, this should be capitalised and not localised as it's a proper noun. 61 * @throws \Exception When error running action. 49 62 */ 50 63 public function process_action( $action_id, $context = '' ) { 51 64 // Temporarily override the error handler while we process the current action. 65 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler 52 66 set_error_handler( 53 67 /** … … 142 156 * Schedule the next instance of the action if necessary. 143 157 * 144 * @param ActionScheduler_Action $action 145 * @param int $action_id158 * @param ActionScheduler_Action $action Action. 159 * @param int $action_id Action ID. 146 160 */ 147 161 protected function schedule_next_instance( ActionScheduler_Action $action, $action_id ) { … … 193 207 'date_compare' => '<', 194 208 'per_page' => 1, 195 'offset' => $consistent_failure_threshold - 1 209 'offset' => $consistent_failure_threshold - 1, 196 210 ); 197 211 … … 223 237 /** 224 238 * Run the queue cleaner. 225 *226 * @author Jeremy Pry227 239 */ 228 240 protected function run_cleanup() { … … 257 269 $time_limit = 30; 258 270 259 // Apply deprecated filter from deprecated get_maximum_execution_time() method 271 // Apply deprecated filter from deprecated get_maximum_execution_time() method. 260 272 if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) { 261 273 _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' ); … … 289 301 * Check if the host's max execution time is (likely) to be exceeded if processing more actions. 290 302 * 291 * @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action 303 * @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action. 292 304 * @return bool 293 305 */ … … 319 331 $memory_limit = ini_get( 'memory_limit' ); 320 332 } else { 321 $memory_limit = '128M'; // Sensible default, and minimum required by WooCommerce 333 $memory_limit = '128M'; // Sensible default, and minimum required by WooCommerce. 322 334 } 323 335 … … 354 366 * Based on WC_Background_Process::batch_limits_exceeded() 355 367 * 356 * @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action 368 * @param int $processed_actions The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action. 357 369 * @return bool 358 370 */ … … 364 376 * Process actions in the queue. 365 377 * 366 * @author Jeremy Pry367 378 * @param string $context Optional identifier for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' 368 379 * Generally, this should be capitalised and not localised as it's a proper noun. -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_RecurringSchedule.php
r3136104 r3263883 16 16 * @var DateTime 17 17 */ 18 private $first_date = NULL;18 private $first_date = null; 19 19 20 20 /** … … 23 23 * @var int 24 24 */ 25 protected $first_timestamp = NULL;25 protected $first_timestamp = null; 26 26 27 27 /** … … 36 36 37 37 /** 38 * @param DateTime $date The date & time to run the action. 39 * @param mixed $recurrence The data used to determine the schedule's recurrence. 38 * Construct. 39 * 40 * @param DateTime $date The date & time to run the action. 41 * @param mixed $recurrence The data used to determine the schedule's recurrence. 40 42 * @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance. 41 43 */ 42 public function __construct( DateTime $date, $recurrence, DateTime $first = null ) {44 public function __construct( DateTime $date, $recurrence, ?DateTime $first = null ) { 43 45 parent::__construct( $date ); 44 46 $this->first_date = empty( $first ) ? $date : $first; … … 47 49 48 50 /** 51 * Schedule is recurring. 52 * 49 53 * @return bool 50 54 */ … … 63 67 64 68 /** 69 * Get the schedule's recurrence. 70 * 65 71 * @return string 66 72 */ … … 71 77 /** 72 78 * For PHP 5.2 compat, since DateTime objects can't be serialized 79 * 73 80 * @return array 74 81 */ 75 82 public function __sleep() { 76 $sleep_params = parent::__sleep();83 $sleep_params = parent::__sleep(); 77 84 $this->first_timestamp = $this->first_date->getTimestamp(); 78 return array_merge( $sleep_params, array( 79 'first_timestamp', 80 'recurrence' 81 ) ); 85 return array_merge( 86 $sleep_params, 87 array( 88 'first_timestamp', 89 'recurrence', 90 ) 91 ); 82 92 } 83 93 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php
r2734765 r3263883 11 11 * @var DateTime 12 12 */ 13 private $scheduled_date = NULL;13 private $scheduled_date = null; 14 14 15 15 /** … … 18 18 * @var int 19 19 */ 20 protected $scheduled_timestamp = NULL;20 protected $scheduled_timestamp = null; 21 21 22 22 /** 23 * Construct. 24 * 23 25 * @param DateTime $date The date & time to run the action. 24 26 */ … … 37 39 * Calculate when the next instance of this schedule would run based on a given date & time. 38 40 * 39 * @param DateTime $after 41 * @param DateTime $after Start timestamp. 40 42 * @return DateTime 41 43 */ … … 45 47 * Get the next date & time when this schedule should run after a given date & time. 46 48 * 47 * @param DateTime $after 49 * @param DateTime $after Start timestamp. 48 50 * @return DateTime|null 49 51 */ … … 67 69 68 70 /** 69 * For PHP 5.2 compat, since DateTime objects can't be serialized 71 * For PHP 5.2 compat, because DateTime objects can't be serialized 72 * 70 73 * @return array 71 74 */ … … 77 80 } 78 81 82 /** 83 * Wakeup. 84 */ 79 85 public function __wakeup() { 80 86 $this->scheduled_date = as_get_datetime_object( $this->scheduled_timestamp ); -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schema.php
r2953658 r3263883 14 14 15 15 /** 16 * @var int Increment this value in derived class to trigger a schema update. 16 * Increment this value in derived class to trigger a schema update. 17 * 18 * @var int 17 19 */ 18 20 protected $schema_version = 1; 19 21 20 22 /** 21 * @var string Schema version stored in database. 23 * Schema version stored in database. 24 * 25 * @var string 22 26 */ 23 27 protected $db_version; 24 28 25 29 /** 26 * @var array Names of tables that will be registered by this class. 30 * Names of tables that will be registered by this class. 31 * 32 * @var array 27 33 */ 28 34 protected $tables = array(); … … 44 50 global $wpdb; 45 51 46 // make WP aware of our tables 52 // make WP aware of our tables. 47 53 foreach ( $this->tables as $table ) { 48 54 $wpdb->tables[] = $table; … … 51 57 } 52 58 53 // create the tables 59 // create the tables. 54 60 if ( $this->schema_update_required() || $force_update ) { 55 61 foreach ( $this->tables as $table ) { … … 68 74 69 75 /** 70 * @param string $table The name of the table 76 * Get table definition. 77 * 78 * @param string $table The name of the table. 71 79 * 72 80 * @return string The CREATE TABLE statement, suitable for passing to dbDelta … … 85 93 $this->db_version = get_option( $option_name, 0 ); 86 94 87 // Check for schema option stored by the Action Scheduler Custom Tables plugin in case site has migrated from that plugin with an older schema 95 // Check for schema option stored by the Action Scheduler Custom Tables plugin in case site has migrated from that plugin with an older schema. 88 96 if ( 0 === $this->db_version ) { 89 97 … … 116 124 $option_name = 'schema-' . static::class; 117 125 118 // work around race conditions and ensure that our option updates 126 // work around race conditions and ensure that our option updates. 119 127 $value_to_save = (string) $this->schema_version . '.0.' . time(); 120 128 … … 125 133 * Update the schema for the given table 126 134 * 127 * @param string $table The name of the table to update 135 * @param string $table The name of the table to update. 128 136 * 129 137 * @return void … … 136 144 foreach ( $updated as $updated_table => $update_description ) { 137 145 if ( strpos( $update_description, 'Created table' ) === 0 ) { 138 do_action( 'action_scheduler/created_table', $updated_table, $table ); 146 do_action( 'action_scheduler/created_table', $updated_table, $table ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 139 147 } 140 148 } … … 143 151 144 152 /** 145 * @param string $table 153 * Get full table name. 154 * 155 * @param string $table Table name. 146 156 * 147 157 * @return string The full name of the table, including the -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Lock.php
r2953658 r3263883 8 8 abstract class ActionScheduler_Lock { 9 9 10 /** @var ActionScheduler_Lock */ 11 private static $locker = NULL; 10 /** 11 * Instance. 12 * 13 * @var ActionScheduler_Lock 14 */ 15 private static $locker = null; 12 16 13 /** @var int */ 17 /** 18 * Duration of lock. 19 * 20 * @var int 21 */ 14 22 protected static $lock_duration = MINUTE_IN_SECONDS; 15 23 … … 53 61 54 62 /** 63 * Get instance. 64 * 55 65 * @return ActionScheduler_Lock 56 66 */ 57 67 public static function instance() { 58 68 if ( empty( self::$locker ) ) { 59 $class = apply_filters( 'action_scheduler_lock_class', 'ActionScheduler_OptionLock' );69 $class = apply_filters( 'action_scheduler_lock_class', 'ActionScheduler_OptionLock' ); 60 70 self::$locker = new $class(); 61 71 } -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Logger.php
r3136104 r3263883 3 3 /** 4 4 * Class ActionScheduler_Logger 5 * 5 6 * @codeCoverageIgnore 6 7 */ 7 8 abstract class ActionScheduler_Logger { 8 private static $logger = NULL; 9 10 /** 9 10 /** 11 * Instance. 12 * 13 * @var null|self 14 */ 15 private static $logger = null; 16 17 /** 18 * Get instance. 19 * 11 20 * @return ActionScheduler_Logger 12 21 */ 13 22 public static function instance() { 14 if ( empty( self::$logger) ) {15 $class = apply_filters('action_scheduler_logger_class', 'ActionScheduler_wpCommentLogger');23 if ( empty( self::$logger ) ) { 24 $class = apply_filters( 'action_scheduler_logger_class', 'ActionScheduler_wpCommentLogger' ); 16 25 self::$logger = new $class(); 17 26 } … … 20 29 21 30 /** 22 * @param string $action_id 23 * @param string $message 24 * @param DateTime $date 31 * Create log entry. 32 * 33 * @param string $action_id Action ID. 34 * @param string $message Log message. 35 * @param DateTime|null $date Log date. 25 36 * 26 37 * @return string The log entry ID 27 38 */ 28 abstract public function log( $action_id, $message, DateTime $date = NULL ); 29 30 /** 31 * @param string $entry_id 39 abstract public function log( $action_id, $message, ?DateTime $date = null ); 40 41 /** 42 * Get action's log entry. 43 * 44 * @param string $entry_id Entry ID. 32 45 * 33 46 * @return ActionScheduler_LogEntry … … 36 49 37 50 /** 38 * @param string $action_id 51 * Get action's logs. 52 * 53 * @param string $action_id Action ID. 39 54 * 40 55 * @return ActionScheduler_LogEntry[] … … 44 59 45 60 /** 61 * Initialize. 62 * 46 63 * @codeCoverageIgnore 47 64 */ … … 61 78 } 62 79 80 /** 81 * Register callback for storing action. 82 */ 63 83 public function hook_stored_action() { 64 84 add_action( 'action_scheduler_stored_action', array( $this, 'log_stored_action' ) ); 65 85 } 66 86 87 /** 88 * Unhook callback for storing action. 89 */ 67 90 public function unhook_stored_action() { 68 91 remove_action( 'action_scheduler_stored_action', array( $this, 'log_stored_action' ) ); 69 92 } 70 93 94 /** 95 * Log action stored. 96 * 97 * @param int $action_id Action ID. 98 */ 71 99 public function log_stored_action( $action_id ) { 72 100 $this->log( $action_id, __( 'action created', 'action-scheduler' ) ); 73 101 } 74 102 103 /** 104 * Log action cancellation. 105 * 106 * @param int $action_id Action ID. 107 */ 75 108 public function log_canceled_action( $action_id ) { 76 109 $this->log( $action_id, __( 'action canceled', 'action-scheduler' ) ); 77 110 } 78 111 112 /** 113 * Log action start. 114 * 115 * @param int $action_id Action ID. 116 * @param string $context Action execution context. 117 */ 79 118 public function log_started_action( $action_id, $context = '' ) { 80 119 if ( ! empty( $context ) ) { … … 87 126 } 88 127 89 public function log_completed_action( $action_id, $action = NULL, $context = '' ) { 128 /** 129 * Log action completion. 130 * 131 * @param int $action_id Action ID. 132 * @param null|ActionScheduler_Action $action Action. 133 * @param string $context Action execution context. 134 */ 135 public function log_completed_action( $action_id, $action = null, $context = '' ) { 90 136 if ( ! empty( $context ) ) { 91 137 /* translators: %s: context */ … … 97 143 } 98 144 145 /** 146 * Log action failure. 147 * 148 * @param int $action_id Action ID. 149 * @param Exception $exception Exception. 150 * @param string $context Action execution context. 151 */ 99 152 public function log_failed_action( $action_id, Exception $exception, $context = '' ) { 100 153 if ( ! empty( $context ) ) { … … 108 161 } 109 162 163 /** 164 * Log action timeout. 165 * 166 * @param int $action_id Action ID. 167 * @param string $timeout Timeout. 168 */ 110 169 public function log_timed_out_action( $action_id, $timeout ) { 111 170 /* translators: %s: amount of time */ … … 113 172 } 114 173 174 /** 175 * Log unexpected shutdown. 176 * 177 * @param int $action_id Action ID. 178 * @param mixed[] $error Error. 179 */ 115 180 public function log_unexpected_shutdown( $action_id, $error ) { 116 181 if ( ! empty( $error ) ) { … … 120 185 } 121 186 187 /** 188 * Log action reset. 189 * 190 * @param int $action_id Action ID. 191 */ 122 192 public function log_reset_action( $action_id ) { 123 193 $this->log( $action_id, __( 'action reset', 'action-scheduler' ) ); 124 194 } 125 195 196 /** 197 * Log ignored action. 198 * 199 * @param int $action_id Action ID. 200 * @param string $context Action execution context. 201 */ 126 202 public function log_ignored_action( $action_id, $context = '' ) { 127 203 if ( ! empty( $context ) ) { … … 135 211 136 212 /** 137 * @param string $action_id138 * @param Exception|NULL $exception The exception which occurred when fetching the action. NULL by default for backward compatibility.139 * 140 * @ return ActionScheduler_LogEntry[]141 */ 142 public function log_failed_fetch_action( $action_id, Exception $exception = NULL) {213 * Log the failure of fetching the action. 214 * 215 * @param string $action_id Action ID. 216 * @param null|Exception $exception The exception which occurred when fetching the action. NULL by default for backward compatibility. 217 */ 218 public function log_failed_fetch_action( $action_id, ?Exception $exception = null ) { 143 219 144 220 if ( ! is_null( $exception ) ) { … … 152 228 } 153 229 230 /** 231 * Log the failure of scheduling the action's next instance. 232 * 233 * @param int $action_id Action ID. 234 * @param Exception $exception Exception object. 235 */ 154 236 public function log_failed_schedule_next_instance( $action_id, Exception $exception ) { 155 237 /* translators: %s: exception message */ -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_Store.php
r3136104 r3263883 3 3 /** 4 4 * Class ActionScheduler_Store 5 * 5 6 * @codeCoverageIgnore 6 7 */ … … 13 14 const DEFAULT_CLASS = 'ActionScheduler_wpPostStore'; 14 15 15 /** @var ActionScheduler_Store */ 16 private static $store = NULL; 17 18 /** @var int */ 16 /** 17 * ActionScheduler_Store instance. 18 * 19 * @var ActionScheduler_Store 20 */ 21 private static $store = null; 22 23 /** 24 * Maximum length of args. 25 * 26 * @var int 27 */ 19 28 protected static $max_args_length = 191; 20 29 21 30 /** 22 * @param ActionScheduler_Action $action 23 * @param DateTime $scheduled_date Optional Date of the first instance 24 * to store. Otherwise uses the first date of the action's 25 * schedule. 31 * Save action. 32 * 33 * @param ActionScheduler_Action $action Action to save. 34 * @param null|DateTime $scheduled_date Optional Date of the first instance 35 * to store. Otherwise uses the first date of the action's 36 * schedule. 26 37 * 27 38 * @return int The action ID 28 39 */ 29 abstract public function save_action( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ); 30 31 /** 32 * @param string $action_id 40 abstract public function save_action( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ); 41 42 /** 43 * Get action. 44 * 45 * @param string $action_id Action ID. 33 46 * 34 47 * @return ActionScheduler_Action … … 142 155 $extra_actions = array(); 143 156 144 $pastdue_action_counts = ( int ) $this->query_actions( array( 145 'status' => self::STATUS_PENDING, 146 'date' => as_get_datetime_object(), 147 ), 'count' ); 157 $pastdue_action_counts = (int) $this->query_actions( 158 array( 159 'status' => self::STATUS_PENDING, 160 'date' => as_get_datetime_object(), 161 ), 162 'count' 163 ); 148 164 149 165 if ( $pastdue_action_counts ) { … … 161 177 162 178 /** 163 * @param string $action_id 179 * Cancel action. 180 * 181 * @param string $action_id Action ID. 164 182 */ 165 183 abstract public function cancel_action( $action_id ); 166 184 167 185 /** 168 * @param string $action_id 186 * Delete action. 187 * 188 * @param string $action_id Action ID. 169 189 */ 170 190 abstract public function delete_action( $action_id ); 171 191 172 192 /** 173 * @param string $action_id 193 * Get action's schedule or run timestamp. 194 * 195 * @param string $action_id Action ID. 174 196 * 175 197 * @return DateTime The date the action is schedule to run, or the date that it ran. … … 179 201 180 202 /** 181 * @param int $max_actions 182 * @param DateTime $before_date Claim only actions schedule before the given date. Defaults to now. 183 * @param array $hooks Claim only actions with a hook or hooks. 184 * @param string $group Claim only actions in the given group. 203 * Make a claim. 204 * 205 * @param int $max_actions Maximum number of actions to claim. 206 * @param DateTime|null $before_date Claim only actions schedule before the given date. Defaults to now. 207 * @param array $hooks Claim only actions with a hook or hooks. 208 * @param string $group Claim only actions in the given group. 185 209 * 186 210 * @return ActionScheduler_ActionClaim 187 211 */ 188 abstract public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' ); 189 190 /** 212 abstract public function stake_claim( $max_actions = 10, ?DateTime $before_date = null, $hooks = array(), $group = '' ); 213 214 /** 215 * Get claim count. 216 * 191 217 * @return int 192 218 */ … … 194 220 195 221 /** 196 * @param ActionScheduler_ActionClaim $claim 222 * Release the claim. 223 * 224 * @param ActionScheduler_ActionClaim $claim Claim object. 197 225 */ 198 226 abstract public function release_claim( ActionScheduler_ActionClaim $claim ); 199 227 200 228 /** 201 * @param string $action_id 229 * Un-claim the action. 230 * 231 * @param string $action_id Action ID. 202 232 */ 203 233 abstract public function unclaim_action( $action_id ); 204 234 205 235 /** 206 * @param string $action_id 236 * Mark action as failed. 237 * 238 * @param string $action_id Action ID. 207 239 */ 208 240 abstract public function mark_failure( $action_id ); 209 241 210 242 /** 211 * @param string $action_id 243 * Log action's execution. 244 * 245 * @param string $action_id Actoin ID. 212 246 */ 213 247 abstract public function log_execution( $action_id ); 214 248 215 249 /** 216 * @param string $action_id 250 * Mark action as complete. 251 * 252 * @param string $action_id Action ID. 217 253 */ 218 254 abstract public function mark_complete( $action_id ); 219 255 220 256 /** 221 * @param string $action_id 222 * 257 * Get action's status. 258 * 259 * @param string $action_id Action ID. 223 260 * @return string 224 261 */ … … 226 263 227 264 /** 228 * @param string $action_id 265 * Get action's claim ID. 266 * 267 * @param string $action_id Action ID. 229 268 * @return mixed 230 269 */ … … 232 271 233 272 /** 234 * @param string $claim_id 273 * Find actions by claim ID. 274 * 275 * @param string $claim_id Claim ID. 235 276 * @return array 236 277 */ … … 238 279 239 280 /** 240 * @param string $comparison_operator 281 * Validate SQL operator. 282 * 283 * @param string $comparison_operator Operator. 241 284 * @return string 242 285 */ 243 286 protected function validate_sql_comparator( $comparison_operator ) { 244 if ( in_array( $comparison_operator, array( '!=', '>', '>=', '<', '<=', '=')) ) {287 if ( in_array( $comparison_operator, array( '!=', '>', '>=', '<', '<=', '=' ), true ) ) { 245 288 return $comparison_operator; 246 289 } 290 247 291 return '='; 248 292 } … … 251 295 * Get the time MySQL formatted date/time string for an action's (next) scheduled date. 252 296 * 253 * @param ActionScheduler_Action $action 254 * @param DateTime $scheduled_date (optional)297 * @param ActionScheduler_Action $action Action. 298 * @param null|DateTime $scheduled_date Action's schedule date (optional). 255 299 * @return string 256 300 */ 257 protected function get_scheduled_date_string( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) { 258 $next = null === $scheduled_date ? $action->get_schedule()->get_date() : $scheduled_date; 301 protected function get_scheduled_date_string( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) { 302 $next = is_null( $scheduled_date ) ? $action->get_schedule()->get_date() : $scheduled_date; 303 259 304 if ( ! $next ) { 260 305 $next = date_create(); 261 306 } 307 262 308 $next->setTimezone( new DateTimeZone( 'UTC' ) ); 263 309 … … 268 314 * Get the time MySQL formatted date/time string for an action's (next) scheduled date. 269 315 * 270 * @param ActionScheduler_Action $action271 * @param DateTime $scheduled_date (optional)316 * @param ActionScheduler_Action|null $action Action. 317 * @param null|DateTime $scheduled_date Action's scheduled date (optional). 272 318 * @return string 273 319 */ 274 protected function get_scheduled_date_string_local( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) { 275 $next = null === $scheduled_date ? $action->get_schedule()->get_date() : $scheduled_date; 320 protected function get_scheduled_date_string_local( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) { 321 $next = is_null( $scheduled_date ) ? $action->get_schedule()->get_date() : $scheduled_date; 322 276 323 if ( ! $next ) { 277 324 $next = date_create(); … … 387 434 * @since 3.0.0 388 435 * 389 * @param array$action_ids List of action IDs.436 * @param int[] $action_ids List of action IDs. 390 437 * 391 438 * @return void … … 400 447 401 448 /** 402 * @return array 449 * Get status labels. 450 * 451 * @return array<string, string> 403 452 */ 404 453 public function get_status_labels() { … … 415 464 * Check if there are any pending scheduled actions due to run. 416 465 * 417 * @param ActionScheduler_Action $action418 * @param DateTime $scheduled_date (optional)419 466 * @return string 420 467 */ 421 468 public function has_pending_actions_due() { 422 $pending_actions = $this->query_actions( array( 423 'date' => as_get_datetime_object(), 424 'status' => ActionScheduler_Store::STATUS_PENDING, 425 'orderby' => 'none', 426 ) ); 469 $pending_actions = $this->query_actions( 470 array( 471 'per_page' => 1, 472 'date' => as_get_datetime_object(), 473 'status' => self::STATUS_PENDING, 474 'orderby' => 'none', 475 ), 476 'count' 477 ); 427 478 428 479 return ! empty( $pending_actions ); … … 436 487 /** 437 488 * Callable function to mark an action as migrated optionally overridden in derived classes. 489 * 490 * @param int $action_id Action ID. 438 491 */ 439 492 public function mark_migrated( $action_id ) {} 440 493 441 494 /** 495 * Get instance. 496 * 442 497 * @return ActionScheduler_Store 443 498 */ 444 499 public static function instance() { 445 500 if ( empty( self::$store ) ) { 446 $class = apply_filters( 'action_scheduler_store_class', self::DEFAULT_CLASS );501 $class = apply_filters( 'action_scheduler_store_class', self::DEFAULT_CLASS ); 447 502 self::$store = new $class(); 448 503 } -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/abstracts/ActionScheduler_TimezoneHelper.php
r3055854 r3263883 5 5 */ 6 6 abstract class ActionScheduler_TimezoneHelper { 7 private static $local_timezone = NULL; 7 8 /** 9 * DateTimeZone object. 10 * 11 * @var null|DateTimeZone 12 */ 13 private static $local_timezone = null; 8 14 9 15 /** … … 13 19 * @since 2.1.0 14 20 * 15 * @param DateTime $date 21 * @param DateTime $date Timestamp. 16 22 * @return ActionScheduler_DateTime 17 23 */ 18 24 public static function set_local_timezone( DateTime $date ) { 19 25 20 // Accept a DateTime for easier backward compatibility, even though we require methods on ActionScheduler_DateTime 26 // Accept a DateTime for easier backward compatibility, even though we require methods on ActionScheduler_DateTime. 21 27 if ( ! is_a( $date, 'ActionScheduler_DateTime' ) ) { 22 28 $date = as_get_datetime_object( $date->format( 'U' ) ); … … 43 49 * 44 50 * @since 2.1.0 51 * @param bool $reset Unused. 45 52 * @return string PHP timezone string for the site or empty if no timezone string is available. 46 53 */ … … 76 83 } 77 84 78 // No timezone string 85 // No timezone string. 79 86 return ''; 80 87 } … … 98 105 99 106 /** 107 * Get local timezone. 108 * 109 * @param bool $reset Toggle to discard stored value. 100 110 * @deprecated 2.1.0 101 111 */ 102 public static function get_local_timezone( $reset = FALSE) {112 public static function get_local_timezone( $reset = false ) { 103 113 _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); 104 114 if ( $reset ) { 105 self::$local_timezone = NULL;115 self::$local_timezone = null; 106 116 } 107 if ( ! isset(self::$local_timezone) ) {108 $tzstring = get_option( 'timezone_string');117 if ( ! isset( self::$local_timezone ) ) { 118 $tzstring = get_option( 'timezone_string' ); 109 119 110 if ( empty( $tzstring) ) {111 $gmt_offset = get_option('gmt_offset');112 if ( $gmt_offset == 0) {120 if ( empty( $tzstring ) ) { 121 $gmt_offset = absint( get_option( 'gmt_offset' ) ); 122 if ( 0 === $gmt_offset ) { 113 123 $tzstring = 'UTC'; 114 124 } else { 115 125 $gmt_offset *= HOUR_IN_SECONDS; 116 $tzstring = timezone_name_from_abbr( '', $gmt_offset, 1 );126 $tzstring = timezone_name_from_abbr( '', $gmt_offset, 1 ); 117 127 118 128 // If there's no timezone string, try again with no DST. … … 126 136 foreach ( timezone_abbreviations_list() as $abbr ) { 127 137 foreach ( $abbr as $city ) { 128 if ( $city['dst'] == $is_dst && $city['offset']== $gmt_offset ) {138 if ( $city['dst'] === $is_dst && $city['offset'] === $gmt_offset ) { 129 139 // If there's no valid timezone ID, keep looking. 130 if ( null === $city['timezone_id']) {140 if ( is_null( $city['timezone_id'] ) ) { 131 141 continue; 132 142 } … … 146 156 } 147 157 148 self::$local_timezone = new DateTimeZone( $tzstring);158 self::$local_timezone = new DateTimeZone( $tzstring ); 149 159 } 150 160 return self::$local_timezone; -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/actions/ActionScheduler_Action.php
r2953658 r3263883 5 5 */ 6 6 class ActionScheduler_Action { 7 /** 8 * Action's hook. 9 * 10 * @var string 11 */ 7 12 protected $hook = ''; 13 14 /** 15 * Action's args. 16 * 17 * @var array<string, mixed> 18 */ 8 19 protected $args = array(); 9 /** @var ActionScheduler_Schedule */ 10 protected $schedule = NULL; 20 21 /** 22 * Action's schedule. 23 * 24 * @var ActionScheduler_Schedule 25 */ 26 protected $schedule = null; 27 28 /** 29 * Action's group. 30 * 31 * @var string 32 */ 11 33 protected $group = ''; 12 34 … … 24 46 protected $priority = 10; 25 47 26 public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) { 48 /** 49 * Construct. 50 * 51 * @param string $hook Action's hook. 52 * @param mixed[] $args Action's arguments. 53 * @param null|ActionScheduler_Schedule $schedule Action's schedule. 54 * @param string $group Action's group. 55 */ 56 public function __construct( $hook, array $args = array(), ?ActionScheduler_Schedule $schedule = null, $group = '' ) { 27 57 $schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule; 28 $this->set_hook( $hook);29 $this->set_schedule( $schedule);30 $this->set_args( $args);31 $this->set_group( $group);58 $this->set_hook( $hook ); 59 $this->set_schedule( $schedule ); 60 $this->set_args( $args ); 61 $this->set_group( $group ); 32 62 } 33 63 … … 58 88 59 89 /** 60 * @param string $hook 90 * Set action's hook. 91 * 92 * @param string $hook Action's hook. 61 93 */ 62 94 protected function set_hook( $hook ) { … … 64 96 } 65 97 98 /** 99 * Get action's hook. 100 */ 66 101 public function get_hook() { 67 102 return $this->hook; 68 103 } 69 104 105 /** 106 * Set action's schedule. 107 * 108 * @param ActionScheduler_Schedule $schedule Action's schedule. 109 */ 70 110 protected function set_schedule( ActionScheduler_Schedule $schedule ) { 71 111 $this->schedule = $schedule; … … 73 113 74 114 /** 115 * Action's schedule. 116 * 75 117 * @return ActionScheduler_Schedule 76 118 */ … … 79 121 } 80 122 123 /** 124 * Set action's args. 125 * 126 * @param mixed[] $args Action's arguments. 127 */ 81 128 protected function set_args( array $args ) { 82 129 $this->args = $args; 83 130 } 84 131 132 /** 133 * Get action's args. 134 */ 85 135 public function get_args() { 86 136 return $this->args; … … 88 138 89 139 /** 90 * @param string $group 140 * Section action's group. 141 * 142 * @param string $group Action's group. 91 143 */ 92 144 protected function set_group( $group ) { … … 95 147 96 148 /** 149 * Action's group. 150 * 97 151 * @return string 98 152 */ … … 102 156 103 157 /** 104 * @return bool If the action has been finished 158 * Action has not finished. 159 * 160 * @return bool 105 161 */ 106 162 public function is_finished() { 107 return FALSE;163 return false; 108 164 } 109 165 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/actions/ActionScheduler_CanceledAction.php
r2734765 r3263883 10 10 11 11 /** 12 * @param string $hook 13 * @param array $args 14 * @param ActionScheduler_Schedule $schedule 15 * @param string $group 12 * Construct. 13 * 14 * @param string $hook Action's hook. 15 * @param array $args Action's arguments. 16 * @param null|ActionScheduler_Schedule $schedule Action's schedule. 17 * @param string $group Action's group. 16 18 */ 17 public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {19 public function __construct( $hook, array $args = array(), ?ActionScheduler_Schedule $schedule = null, $group = '' ) { 18 20 parent::__construct( $hook, $args, $schedule, $group ); 19 21 if ( is_null( $schedule ) ) { -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/actions/ActionScheduler_FinishedAction.php
r2734765 r3263883 6 6 class ActionScheduler_FinishedAction extends ActionScheduler_Action { 7 7 8 /** 9 * Execute action. 10 */ 8 11 public function execute() { 9 // don't execute 12 // don't execute. 10 13 } 11 14 15 /** 16 * Get finished state. 17 */ 12 18 public function is_finished() { 13 return TRUE;19 return true; 14 20 } 15 21 } 16 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/actions/ActionScheduler_NullAction.php
r2734765 r3263883 6 6 class ActionScheduler_NullAction extends ActionScheduler_Action { 7 7 8 public function __construct( $hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL ) { 8 /** 9 * Construct. 10 * 11 * @param string $hook Action hook. 12 * @param mixed[] $args Action arguments. 13 * @param null|ActionScheduler_Schedule $schedule Action schedule. 14 */ 15 public function __construct( $hook = '', array $args = array(), ?ActionScheduler_Schedule $schedule = null ) { 9 16 $this->set_schedule( new ActionScheduler_NullSchedule() ); 10 17 } 11 18 19 /** 20 * Execute action. 21 */ 12 22 public function execute() { 13 // don't execute 23 // don't execute. 14 24 } 15 25 } 16 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_DBLogger.php
r3016908 r3263883 13 13 * Add a record to an action log. 14 14 * 15 * @param int $action_id Action ID.16 * @param string $message Message to be saved in the log entry.17 * @param DateTime $date Timestamp of the log entry.15 * @param int $action_id Action ID. 16 * @param string $message Message to be saved in the log entry. 17 * @param DateTime|null $date Timestamp of the log entry. 18 18 * 19 19 * @return int The log entry ID. 20 20 */ 21 public function log( $action_id, $message, DateTime $date = null ) {21 public function log( $action_id, $message, ?DateTime $date = null ) { 22 22 if ( empty( $date ) ) { 23 23 $date = as_get_datetime_object(); -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php
r3136104 r3263883 20 20 private $claim_before_date = null; 21 21 22 /** @var int */ 22 /** 23 * Maximum length of args. 24 * 25 * @var int 26 */ 23 27 protected static $max_args_length = 8000; 24 28 25 /** @var int */ 29 /** 30 * Maximum length of index. 31 * 32 * @var int 33 */ 26 34 protected static $max_index_length = 191; 27 35 28 /** @var array List of claim filters. */ 29 protected $claim_filters = [ 36 /** 37 * List of claim filters. 38 * 39 * @var array 40 */ 41 protected $claim_filters = array( 30 42 'group' => '', 31 43 'hooks' => '', 32 44 'exclude-groups' => '', 33 ];45 ); 34 46 35 47 /** … … 48 60 * 49 61 * @param ActionScheduler_Action $action Action object. 50 * @param \DateTime$scheduled_date Optional schedule date. Default null.62 * @param DateTime|null $scheduled_date Optional schedule date. Default null. 51 63 * 52 64 * @return int Action ID. 53 65 * @throws RuntimeException Throws exception when saving the action fails. 54 66 */ 55 public function save_unique_action( ActionScheduler_Action $action, \DateTime $scheduled_date = null ) {67 public function save_unique_action( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) { 56 68 return $this->save_action_to_db( $action, $scheduled_date, true ); 57 69 } … … 61 73 * 62 74 * @param ActionScheduler_Action $action Action object. 63 * @param \DateTime$scheduled_date Optional schedule date. Default null.75 * @param DateTime|null $scheduled_date Optional schedule date. Default null. 64 76 * 65 77 * @return int Action ID. 66 78 * @throws RuntimeException Throws exception when saving the action fails. 67 79 */ 68 public function save_action( ActionScheduler_Action $action, \DateTime $scheduled_date = null ) {80 public function save_action( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) { 69 81 return $this->save_action_to_db( $action, $scheduled_date, false ); 70 82 } … … 78 90 * 79 91 * @return int Action ID. 80 * @throws RuntimeException Throws exception when saving the action fails.81 */ 82 private function save_action_to_db( ActionScheduler_Action $action, DateTime $date = null, $unique = false ) {92 * @throws \RuntimeException Throws exception when saving the action fails. 93 */ 94 private function save_action_to_db( ActionScheduler_Action $action, ?DateTime $date = null, $unique = false ) { 83 95 global $wpdb; 84 96 … … 138 150 private function build_insert_sql( array $data, $unique ) { 139 151 global $wpdb; 152 140 153 $columns = array_keys( $data ); 141 154 $values = array_values( $data ); … … 147 160 $placeholder_sql = implode( ', ', $placeholders ); 148 161 $where_clause = $this->build_where_clause_for_insert( $data, $table_name, $unique ); 162 149 163 // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare -- $column_sql and $where_clause are already prepared. $placeholder_sql is hardcoded. 150 $insert_query = $wpdb->prepare(164 $insert_query = $wpdb->prepare( 151 165 " 152 166 INSERT INTO $table_name ( $column_sql ) … … 223 237 ); 224 238 225 return in_array( $column_name, $string_columns ) ? '%s' : '%d';239 return in_array( $column_name, $string_columns, true ) ? '%s' : '%d'; 226 240 } 227 241 … … 265 279 } 266 280 267 /** @var \wpdb $wpdb */ 281 /** 282 * Global. 283 * 284 * @var \wpdb $wpdb 285 */ 268 286 global $wpdb; 269 287 … … 291 309 */ 292 310 protected function create_group( $slug ) { 293 /** @var \wpdb $wpdb */ 294 global $wpdb; 311 /** 312 * Global. 313 * 314 * @var \wpdb $wpdb 315 */ 316 global $wpdb; 317 295 318 $wpdb->insert( $wpdb->actionscheduler_groups, array( 'slug' => $slug ) ); 296 319 … … 306 329 */ 307 330 public function fetch_action( $action_id ) { 308 /** @var \wpdb $wpdb */ 309 global $wpdb; 331 /** 332 * Global. 333 * 334 * @var \wpdb $wpdb 335 */ 336 global $wpdb; 337 310 338 $data = $wpdb->get_row( 311 339 $wpdb->prepare( … … 389 417 * 390 418 * @return string SQL statement already properly escaped. 391 * @throws InvalidArgumentException If the query is invalid. 419 * @throws \InvalidArgumentException If the query is invalid. 420 * @throws \RuntimeException When "unknown partial args matching value". 392 421 */ 393 422 protected function get_query_actions_sql( array $query, $select_or_count = 'select' ) { … … 397 426 } 398 427 399 $query = wp_parse_args( $query, array( 400 'hook' => '', 401 'args' => null, 402 'partial_args_matching' => 'off', // can be 'like' or 'json' 403 'date' => null, 404 'date_compare' => '<=', 405 'modified' => null, 406 'modified_compare' => '<=', 407 'group' => '', 408 'status' => '', 409 'claimed' => null, 410 'per_page' => 5, 411 'offset' => 0, 412 'orderby' => 'date', 413 'order' => 'ASC', 414 ) ); 415 416 /** @var \wpdb $wpdb */ 428 $query = wp_parse_args( 429 $query, 430 array( 431 'hook' => '', 432 'args' => null, 433 'partial_args_matching' => 'off', // can be 'like' or 'json'. 434 'date' => null, 435 'date_compare' => '<=', 436 'modified' => null, 437 'modified_compare' => '<=', 438 'group' => '', 439 'status' => '', 440 'claimed' => null, 441 'per_page' => 5, 442 'offset' => 0, 443 'orderby' => 'date', 444 'order' => 'ASC', 445 ) 446 ); 447 448 /** 449 * Global. 450 * 451 * @var \wpdb $wpdb 452 */ 417 453 global $wpdb; 418 454 … … 429 465 430 466 $sql = ( 'count' === $select_or_count ) ? 'SELECT count(a.action_id)' : 'SELECT a.action_id'; 431 $sql .= " FROM {$wpdb->actionscheduler_actions} a";467 $sql .= " FROM {$wpdb->actionscheduler_actions} a"; 432 468 $sql_params = array(); 433 469 … … 436 472 } 437 473 438 $sql .= " WHERE 1=1";474 $sql .= ' WHERE 1=1'; 439 475 440 476 if ( ! empty( $query['group'] ) ) { 441 $sql .= " AND g.slug=%s";477 $sql .= ' AND g.slug=%s'; 442 478 $sql_params[] = $query['group']; 443 479 } 444 480 445 481 if ( ! empty( $query['hook'] ) ) { 446 $sql .= " AND a.hook=%s";482 $sql .= ' AND a.hook=%s'; 447 483 $sql_params[] = $query['hook']; 448 484 } … … 467 503 $placeholder = isset( $supported_types[ $value_type ] ) ? $supported_types[ $value_type ] : false; 468 504 if ( ! $placeholder ) { 469 throw new \RuntimeException( sprintf( 470 /* translators: %s: provided value type */ 471 __( 'The value type for the JSON partial matching is not supported. Must be either integer, boolean, double or string. %s type provided.', 'action-scheduler' ), 472 $value_type 473 ) ); 505 throw new \RuntimeException( 506 sprintf( 507 /* translators: %s: provided value type */ 508 __( 'The value type for the JSON partial matching is not supported. Must be either integer, boolean, double or string. %s type provided.', 'action-scheduler' ), 509 $value_type 510 ) 511 ); 474 512 } 475 $sql .= ' AND JSON_EXTRACT(a.args, %s)='.$placeholder;476 $sql_params[] = '$.' .$key;513 $sql .= ' AND JSON_EXTRACT(a.args, %s)=' . $placeholder; 514 $sql_params[] = '$.' . $key; 477 515 $sql_params[] = $value; 478 516 } … … 480 518 case 'like': 481 519 foreach ( $query['args'] as $key => $value ) { 482 $sql .= ' AND a.args LIKE %s';520 $sql .= ' AND a.args LIKE %s'; 483 521 $json_partial = $wpdb->esc_like( trim( wp_json_encode( array( $key => $value ) ), '{}' ) ); 484 522 $sql_params[] = "%{$json_partial}%"; … … 486 524 break; 487 525 case 'off': 488 $sql .= " AND a.args=%s";526 $sql .= ' AND a.args=%s'; 489 527 $sql_params[] = $this->get_args_for_query( $query['args'] ); 490 528 break; … … 597 635 */ 598 636 public function query_actions( $query = array(), $query_type = 'select' ) { 599 /** @var wpdb $wpdb */ 637 /** 638 * Global. 639 * 640 * @var wpdb $wpdb 641 */ 600 642 global $wpdb; 601 643 … … 639 681 */ 640 682 public function cancel_action( $action_id ) { 641 /** @var \wpdb $wpdb */ 683 /** 684 * Global. 685 * 686 * @var \wpdb $wpdb 687 */ 642 688 global $wpdb; 643 689 … … 688 734 */ 689 735 protected function bulk_cancel_actions( $query_args ) { 690 /** @var \wpdb $wpdb */ 736 /** 737 * Global. 738 * 739 * @var \wpdb $wpdb 740 */ 691 741 global $wpdb; 692 742 … … 739 789 */ 740 790 public function delete_action( $action_id ) { 741 /** @var \wpdb $wpdb */ 742 global $wpdb; 791 /** 792 * Global. 793 * 794 * @var \wpdb $wpdb 795 */ 796 global $wpdb; 797 743 798 $deleted = $wpdb->delete( $wpdb->actionscheduler_actions, array( 'action_id' => $action_id ), array( '%d' ) ); 744 799 if ( empty( $deleted ) ) { … … 771 826 */ 772 827 protected function get_date_gmt( $action_id ) { 773 /** @var \wpdb $wpdb */ 774 global $wpdb; 828 /** 829 * Global. 830 * 831 * @var \wpdb $wpdb 832 */ 833 global $wpdb; 834 775 835 $record = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->actionscheduler_actions} WHERE action_id=%d", $action_id ) ); 776 836 if ( empty( $record ) ) { … … 788 848 * Stake a claim on actions. 789 849 * 790 * @param int $max_actions Maximum number of action to include in claim.791 * @param \DateTime$before_date Jobs must be schedule before this date. Defaults to now.792 * @param array $hooks Hooks to filter for.793 * @param string $group Group to filter for.850 * @param int $max_actions Maximum number of action to include in claim. 851 * @param DateTime|null $before_date Jobs must be schedule before this date. Defaults to now. 852 * @param array $hooks Hooks to filter for. 853 * @param string $group Group to filter for. 794 854 * 795 855 * @return ActionScheduler_ActionClaim 796 856 */ 797 public function stake_claim( $max_actions = 10, \DateTime $before_date = null, $hooks = array(), $group = '' ) {857 public function stake_claim( $max_actions = 10, ?DateTime $before_date = null, $hooks = array(), $group = '' ) { 798 858 $claim_id = $this->generate_claim_id(); 799 859 … … 812 872 */ 813 873 protected function generate_claim_id() { 814 /** @var \wpdb $wpdb */ 815 global $wpdb; 874 /** 875 * Global. 876 * 877 * @var \wpdb $wpdb 878 */ 879 global $wpdb; 880 816 881 $now = as_get_datetime_object(); 817 882 $wpdb->insert( $wpdb->actionscheduler_claims, array( 'date_created_gmt' => $now->format( 'Y-m-d H:i:s' ) ) ); … … 824 889 * 825 890 * @param string $filter_name Claim filter name. 826 * @param mixed $filter_values Values to filter.891 * @param mixed $filter_values Values to filter. 827 892 * @return void 828 893 */ … … 850 915 * Mark actions claimed. 851 916 * 852 * @param string $claim_id Claim Id.853 * @param int $limit Number of action to include in claim.854 * @param \DateTime$before_date Should use UTC timezone.855 * @param array $hooks Hooks to filter for.856 * @param string $group Group to filter for.917 * @param string $claim_id Claim Id. 918 * @param int $limit Number of action to include in claim. 919 * @param DateTime|null $before_date Should use UTC timezone. 920 * @param array $hooks Hooks to filter for. 921 * @param string $group Group to filter for. 857 922 * 858 923 * @return int The number of actions that were claimed. … … 860 925 * @throws \RuntimeException Throws RuntimeException if unable to claim action. 861 926 */ 862 protected function claim_actions( $claim_id, $limit, \DateTime $before_date = null, $hooks = array(), $group = '' ) { 863 /** @var \wpdb $wpdb */ 864 global $wpdb; 865 866 $now = as_get_datetime_object(); 867 $date = is_null( $before_date ) ? $now : clone $before_date; 927 protected function claim_actions( $claim_id, $limit, ?DateTime $before_date = null, $hooks = array(), $group = '' ) { 928 /** 929 * Global. 930 * 931 * @var \wpdb $wpdb 932 */ 933 global $wpdb; 934 935 $now = as_get_datetime_object(); 936 $date = is_null( $before_date ) ? $now : clone $before_date; 868 937 // can't use $wpdb->update() because of the <= condition. 869 938 $update = "UPDATE {$wpdb->actionscheduler_actions} SET claim_id=%d, last_attempt_gmt=%s, last_attempt_local=%s"; … … 892 961 if ( ! empty( $hooks ) ) { 893 962 $placeholders = array_fill( 0, count( $hooks ), '%s' ); 894 $where .= ' AND hook IN (' . join( ', ', $placeholders ) . ')';963 $where .= ' AND hook IN (' . join( ', ', $placeholders ) . ')'; 895 964 $params = array_merge( $params, array_values( $hooks ) ); 896 965 } … … 898 967 $group_operator = 'IN'; 899 968 if ( empty( $group ) ) { 900 $group = $this->get_claim_filter( 'exclude-groups' );969 $group = $this->get_claim_filter( 'exclude-groups' ); 901 970 $group_operator = 'NOT IN'; 902 971 } … … 922 991 923 992 $id_list = implode( ',', array_map( 'intval', $group_ids ) ); 924 $where .= " AND group_id {$group_operator} ( $id_list )";993 $where .= " AND group_id {$group_operator} ( $id_list )"; 925 994 } 926 995 … … 929 998 * 930 999 * @since 3.4.0 1000 * @since 3.8.3 Made $claim_id and $hooks available. 931 1001 * 932 1002 * @param string $order_by_sql 933 */ 934 $order = apply_filters( 'action_scheduler_claim_actions_order_by', 'ORDER BY priority ASC, attempts ASC, scheduled_date_gmt ASC, action_id ASC' ); 1003 * @param string $claim_id Claim Id. 1004 * @param array $hooks Hooks to filter for. 1005 */ 1006 $order = apply_filters( 'action_scheduler_claim_actions_order_by', 'ORDER BY priority ASC, attempts ASC, scheduled_date_gmt ASC, action_id ASC', $claim_id, $hooks ); 935 1007 $params[] = $limit; 936 1008 … … 975 1047 */ 976 1048 public function get_claim_id( $action_id ) { 977 /** @var \wpdb $wpdb */ 1049 /** 1050 * Global. 1051 * 1052 * @var \wpdb $wpdb 1053 */ 978 1054 global $wpdb; 979 1055 … … 991 1067 */ 992 1068 public function find_actions_by_claim_id( $claim_id ) { 993 /** @var \wpdb $wpdb */ 1069 /** 1070 * Global. 1071 * 1072 * @var \wpdb $wpdb 1073 */ 994 1074 global $wpdb; 995 1075 … … 1018 1098 * 1019 1099 * @param ActionScheduler_ActionClaim $claim Claim object. 1100 * @throws \RuntimeException When unable to release actions from claim. 1020 1101 */ 1021 1102 public function release_claim( ActionScheduler_ActionClaim $claim ) { 1022 /** @var \wpdb $wpdb */ 1023 global $wpdb; 1103 /** 1104 * Global. 1105 * 1106 * @var \wpdb $wpdb 1107 */ 1108 global $wpdb; 1109 1024 1110 /** 1025 1111 * Deadlock warning: This function modifies actions to release them from claims that have been processed. Earlier, we used to it in a atomic query, i.e. we would update all actions belonging to a particular claim_id with claim_id = 0. … … 1058 1144 */ 1059 1145 public function unclaim_action( $action_id ) { 1060 /** @var \wpdb $wpdb */ 1061 global $wpdb; 1146 /** 1147 * Global. 1148 * 1149 * @var \wpdb $wpdb 1150 */ 1151 global $wpdb; 1152 1062 1153 $wpdb->update( 1063 1154 $wpdb->actionscheduler_actions, … … 1076 1167 */ 1077 1168 public function mark_failure( $action_id ) { 1078 /** @var \wpdb $wpdb */ 1079 global $wpdb; 1169 /** 1170 * Global. 1171 1172 * @var \wpdb $wpdb 1173 */ 1174 global $wpdb; 1175 1080 1176 $updated = $wpdb->update( 1081 1177 $wpdb->actionscheduler_actions, … … 1101 1197 */ 1102 1198 public function log_execution( $action_id ) { 1103 /** @var \wpdb $wpdb */ 1199 /** 1200 * Global. 1201 * 1202 * @var \wpdb $wpdb 1203 */ 1104 1204 global $wpdb; 1105 1205 … … 1131 1231 */ 1132 1232 public function mark_complete( $action_id ) { 1133 /** @var \wpdb $wpdb */ 1134 global $wpdb; 1233 /** 1234 * Global. 1235 * 1236 * @var \wpdb $wpdb 1237 */ 1238 global $wpdb; 1239 1135 1240 $updated = $wpdb->update( 1136 1241 $wpdb->actionscheduler_actions, … … 1169 1274 */ 1170 1275 public function get_status( $action_id ) { 1171 /** @var \wpdb $wpdb */ 1172 global $wpdb; 1276 /** 1277 * Global. 1278 * 1279 * @var \wpdb $wpdb 1280 */ 1281 global $wpdb; 1282 1173 1283 $sql = "SELECT status FROM {$wpdb->actionscheduler_actions} WHERE action_id=%d"; 1174 1284 $sql = $wpdb->prepare( $sql, $action_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 1175 1285 $status = $wpdb->get_var( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 1176 1286 1177 if ( null === $status) {1287 if ( is_null( $status ) ) { 1178 1288 throw new \InvalidArgumentException( __( 'Invalid action ID. No status found.', 'action-scheduler' ) ); 1179 1289 } elseif ( empty( $status ) ) { -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php
r2734765 r3263883 16 16 const DEMARKATION_OPTION = 'action_scheduler_hybrid_store_demarkation'; 17 17 18 /** 19 * Primary store instance. 20 * 21 * @var ActionScheduler_Store 22 */ 18 23 private $primary_store; 24 25 /** 26 * Secondary store instance. 27 * 28 * @var ActionScheduler_Store 29 */ 19 30 private $secondary_store; 31 32 /** 33 * Runner instance. 34 * 35 * @var Action_Scheduler\Migration\Runner 36 */ 20 37 private $migration_runner; 21 38 22 39 /** 23 * @var int The dividing line between IDs of actions created 24 * by the primary and secondary stores. 40 * The dividing line between IDs of actions created 41 * by the primary and secondary stores. 42 * 43 * @var int 25 44 * 26 45 * Methods that accept an action ID will compare the ID against … … 36 55 * ActionScheduler_HybridStore constructor. 37 56 * 38 * @param Config $config Migration config object.39 */ 40 public function __construct( Config $config = null ) {57 * @param Config|null $config Migration config object. 58 */ 59 public function __construct( ?Config $config = null ) { 41 60 $this->demarkation_id = (int) get_option( self::DEMARKATION_OPTION, 0 ); 42 61 if ( empty( $config ) ) { … … 54 73 */ 55 74 public function init() { 56 add_action( 'action_scheduler/created_table', [ $this, 'set_autoincrement' ], 10, 2 );75 add_action( 'action_scheduler/created_table', array( $this, 'set_autoincrement' ), 10, 2 ); 57 76 $this->primary_store->init(); 58 77 $this->secondary_store->init(); 59 remove_action( 'action_scheduler/created_table', [ $this, 'set_autoincrement' ], 10 );78 remove_action( 'action_scheduler/created_table', array( $this, 'set_autoincrement' ), 10 ); 60 79 } 61 80 … … 65 84 * there are no ID collisions. 66 85 * 67 * @param string $table_name 68 * @param string $table_suffix 86 * @param string $table_name Table name. 87 * @param string $table_suffix Suffix of table name. 69 88 * 70 89 * @return void … … 76 95 $this->demarkation_id = $this->set_demarkation_id(); 77 96 } 78 /** @var \wpdb $wpdb */ 97 98 /** 99 * Global. 100 * 101 * @var \wpdb $wpdb 102 */ 79 103 global $wpdb; 104 80 105 /** 81 * A default date of '0000-00-00 00:00:00' is invalid in MySQL 5.7 when configured with 106 * A default date of '0000-00-00 00:00:00' is invalid in MySQL 5.7 when configured with 82 107 * sql_mode including both STRICT_TRANS_TABLES and NO_ZERO_DATE. 83 108 */ … … 89 114 $row_count = $wpdb->insert( 90 115 $wpdb->{ActionScheduler_StoreSchema::ACTIONS_TABLE}, 91 [116 array( 92 117 'action_id' => $this->demarkation_id, 93 118 'hook' => '', … … 97 122 'last_attempt_gmt' => $date_gmt, 98 123 'last_attempt_local' => $date_local, 99 ]124 ) 100 125 ); 101 126 if ( $row_count > 0 ) { 102 127 $wpdb->delete( 103 128 $wpdb->{ActionScheduler_StoreSchema::ACTIONS_TABLE}, 104 [ 'action_id' => $this->demarkation_id ]129 array( 'action_id' => $this->demarkation_id ) 105 130 ); 106 131 } … … 120 145 private function set_demarkation_id( $id = null ) { 121 146 if ( empty( $id ) ) { 122 /** @var \wpdb $wpdb */ 147 /** 148 * Global. 149 * 150 * @var \wpdb $wpdb 151 */ 123 152 global $wpdb; 153 124 154 $id = (int) $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->posts" ); 125 $id ++;155 $id++; 126 156 } 127 157 update_option( self::DEMARKATION_OPTION, $id ); … … 136 166 * the next matching action, so return the result thence. 137 167 * 138 * @param string $hook 139 * @param array $params 168 * @param string $hook Action's hook. 169 * @param array $params Action's arguments. 140 170 * 141 171 * @return string 142 172 */ 143 public function find_action( $hook, $params = []) {173 public function find_action( $hook, $params = array() ) { 144 174 $found_unmigrated_action = $this->secondary_store->find_action( $hook, $params ); 145 175 if ( ! empty( $found_unmigrated_action ) ) { 146 $this->migrate( [ $found_unmigrated_action ]);176 $this->migrate( array( $found_unmigrated_action ) ); 147 177 } 148 178 … … 155 185 * store will contain the canonical results. 156 186 * 157 * @param array $query187 * @param array $query Query arguments. 158 188 * @param string $query_type Whether to select or count the results. Default, select. 159 189 * 160 190 * @return int[] 161 191 */ 162 public function query_actions( $query = [], $query_type = 'select' ) {192 public function query_actions( $query = array(), $query_type = 'select' ) { 163 193 $found_unmigrated_actions = $this->secondary_store->query_actions( $query, 'select' ); 164 194 if ( ! empty( $found_unmigrated_actions ) ) { … … 204 234 * canonical claim. 205 235 * 206 * @param int $max_actions 207 * @param DateTime|null $before_date 236 * @param int $max_actions Maximum number of actions to claim. 237 * @param null|DateTime $before_date Latest timestamp of actions to claim. 238 * @param string[] $hooks Hook of actions to claim. 239 * @param string $group Group of actions to claim. 208 240 * 209 241 * @return ActionScheduler_ActionClaim 210 242 */ 211 public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' ) {243 public function stake_claim( $max_actions = 10, ?DateTime $before_date = null, $hooks = array(), $group = '' ) { 212 244 $claim = $this->secondary_store->stake_claim( $max_actions, $before_date, $hooks, $group ); 213 245 … … 235 267 * 236 268 * @param ActionScheduler_Action $action Action object to be saved. 237 * @param DateTime $date Optional. Schedule date. Default null.269 * @param DateTime|null $date Optional. Schedule date. Default null. 238 270 * 239 271 * @return int The action ID 240 272 */ 241 public function save_action( ActionScheduler_Action $action, DateTime $date = null ) {273 public function save_action( ActionScheduler_Action $action, ?DateTime $date = null ) { 242 274 return $this->primary_store->save_action( $action, $date ); 243 275 } … … 353 385 protected function get_store_from_action_id( $action_id, $primary_first = false ) { 354 386 if ( $primary_first ) { 355 $stores = [387 $stores = array( 356 388 $this->primary_store, 357 389 $this->secondary_store, 358 ];390 ); 359 391 } elseif ( $action_id < $this->demarkation_id ) { 360 $stores = [392 $stores = array( 361 393 $this->secondary_store, 362 394 $this->primary_store, 363 ];395 ); 364 396 } else { 365 $stores = [397 $stores = array( 366 398 $this->primary_store, 367 ];399 ); 368 400 } 369 401 … … 377 409 } 378 410 379 /* * * * * * * * * * * * * * * * * * * * * * * * * * * 411 /** 412 * * * * * * * * * * * * * * * * * * * * * * * * * * * 380 413 * All claim-related functions should operate solely 381 414 * on the primary store. 382 * * * * * * * * * * * * * * * * * * * * * * * * * * */ 415 * * * * * * * * * * * * * * * * * * * * * * * * * * * 416 */ 383 417 384 418 /** -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpCommentLogger.php
r2734765 r3263883 6 6 class ActionScheduler_wpCommentLogger extends ActionScheduler_Logger { 7 7 const AGENT = 'ActionScheduler'; 8 const TYPE = 'action_log'; 9 10 /** 11 * @param string $action_id 12 * @param string $message 13 * @param DateTime $date 8 const TYPE = 'action_log'; 9 10 /** 11 * Create log entry. 12 * 13 * @param string $action_id Action ID. 14 * @param string $message Action log's message. 15 * @param DateTime|null $date Action log's timestamp. 14 16 * 15 17 * @return string The log entry ID 16 18 */ 17 public function log( $action_id, $message, DateTime $date = NULL) {18 if ( empty( $date) ) {19 public function log( $action_id, $message, ?DateTime $date = null ) { 20 if ( empty( $date ) ) { 19 21 $date = as_get_datetime_object(); 20 22 } else { … … 25 27 } 26 28 29 /** 30 * Create comment. 31 * 32 * @param int $action_id Action ID. 33 * @param string $message Action log's message. 34 * @param DateTime $date Action log entry's timestamp. 35 */ 27 36 protected function create_wp_comment( $action_id, $message, DateTime $date ) { 28 37 29 $comment_date_gmt = $date->format( 'Y-m-d H:i:s');38 $comment_date_gmt = $date->format( 'Y-m-d H:i:s' ); 30 39 ActionScheduler_TimezoneHelper::set_local_timezone( $date ); 31 40 $comment_data = array( 32 'comment_post_ID' => $action_id,33 'comment_date' => $date->format('Y-m-d H:i:s'),41 'comment_post_ID' => $action_id, 42 'comment_date' => $date->format( 'Y-m-d H:i:s' ), 34 43 'comment_date_gmt' => $comment_date_gmt, 35 'comment_author' => self::AGENT,36 'comment_content' => $message,37 'comment_agent' => self::AGENT,38 'comment_type' => self::TYPE,44 'comment_author' => self::AGENT, 45 'comment_content' => $message, 46 'comment_agent' => self::AGENT, 47 'comment_type' => self::TYPE, 39 48 ); 40 return wp_insert_comment($comment_data); 41 } 42 43 /** 44 * @param string $entry_id 49 50 return wp_insert_comment( $comment_data ); 51 } 52 53 /** 54 * Get single log entry for action. 55 * 56 * @param string $entry_id Entry ID. 45 57 * 46 58 * @return ActionScheduler_LogEntry … … 48 60 public function get_entry( $entry_id ) { 49 61 $comment = $this->get_comment( $entry_id ); 50 if ( empty($comment) || $comment->comment_type != self::TYPE ) { 62 63 if ( empty( $comment ) || self::TYPE !== $comment->comment_type ) { 51 64 return new ActionScheduler_NullLogEntry(); 52 65 } … … 58 71 59 72 /** 60 * @param string $action_id 73 * Get action's logs. 74 * 75 * @param string $action_id Action ID. 61 76 * 62 77 * @return ActionScheduler_LogEntry[] … … 64 79 public function get_logs( $action_id ) { 65 80 $status = 'all'; 66 if ( get_post_status($action_id) == 'trash' ) { 81 $logs = array(); 82 83 if ( get_post_status( $action_id ) === 'trash' ) { 67 84 $status = 'post-trashed'; 68 85 } 69 $comments = get_comments(array( 70 'post_id' => $action_id, 71 'orderby' => 'comment_date_gmt', 72 'order' => 'ASC', 73 'type' => self::TYPE, 74 'status' => $status, 75 )); 76 $logs = array(); 86 87 $comments = get_comments( 88 array( 89 'post_id' => $action_id, 90 'orderby' => 'comment_date_gmt', 91 'order' => 'ASC', 92 'type' => self::TYPE, 93 'status' => $status, 94 ) 95 ); 96 77 97 foreach ( $comments as $c ) { 78 98 $entry = $this->get_entry( $c ); 79 if ( !empty($entry) ) { 99 100 if ( ! empty( $entry ) ) { 80 101 $logs[] = $entry; 81 102 } 82 103 } 104 83 105 return $logs; 84 106 } 85 107 108 /** 109 * Get comment. 110 * 111 * @param int $comment_id Comment ID. 112 */ 86 113 protected function get_comment( $comment_id ) { 87 114 return get_comment( $comment_id ); 88 115 } 89 116 90 91 92 /**93 * @param WP_Comment_Query $query 117 /** 118 * Filter comment queries. 119 * 120 * @param WP_Comment_Query $query Comment query object. 94 121 */ 95 122 public function filter_comment_queries( $query ) { 96 foreach ( array( 'ID', 'parent', 'post_author', 'post_name', 'post_parent', 'type', 'post_type', 'post_id', 'post_ID') as $key ) {97 if ( ! empty($query->query_vars[$key]) ) {98 return; // don't slow down queries that wouldn't include action_log comments anyway 99 } 100 } 101 $query->query_vars['action_log_filter'] = TRUE;123 foreach ( array( 'ID', 'parent', 'post_author', 'post_name', 'post_parent', 'type', 'post_type', 'post_id', 'post_ID' ) as $key ) { 124 if ( ! empty( $query->query_vars[ $key ] ) ) { 125 return; // don't slow down queries that wouldn't include action_log comments anyway. 126 } 127 } 128 $query->query_vars['action_log_filter'] = true; 102 129 add_filter( 'comments_clauses', array( $this, 'filter_comment_query_clauses' ), 10, 2 ); 103 130 } 104 131 105 132 /** 106 * @param array $clauses 107 * @param WP_Comment_Query $query 133 * Filter comment queries. 134 * 135 * @param array $clauses Query's clauses. 136 * @param WP_Comment_Query $query Query object. 108 137 * 109 138 * @return array 110 139 */ 111 140 public function filter_comment_query_clauses( $clauses, $query ) { 112 if ( ! empty($query->query_vars['action_log_filter']) ) {141 if ( ! empty( $query->query_vars['action_log_filter'] ) ) { 113 142 $clauses['where'] .= $this->get_where_clause(); 114 143 } … … 120 149 * the WP_Comment_Query class handled by @see self::filter_comment_queries(). 121 150 * 122 * @param string $where123 * @param WP_Query $query 151 * @param string $where Query's `where` clause. 152 * @param WP_Query $query Query object. 124 153 * 125 154 * @return string … … 145 174 * Remove action log entries from wp_count_comments() 146 175 * 147 * @param array $stats 148 * @param int $post_id176 * @param array $stats Comment count. 177 * @param int $post_id Post ID. 149 178 * 150 179 * @return object … … 171 200 172 201 if ( ! $stats ) { 173 $stats = array(); 174 175 $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN('order_note','action_log') GROUP BY comment_approved", ARRAY_A ); 176 177 $total = 0; 178 $stats = array(); 179 $approved = array( '0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed' ); 202 $stats = array(); 203 $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN('order_note','action_log') GROUP BY comment_approved", ARRAY_A ); 204 $total = 0; 205 $stats = array(); 206 $approved = array( 207 '0' => 'moderated', 208 '1' => 'approved', 209 'spam' => 'spam', 210 'trash' => 'trash', 211 'post-trashed' => 'post-trashed', 212 ); 180 213 181 214 foreach ( (array) $count as $row ) { 182 // Don't count post-trashed toward totals 183 if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {215 // Don't count post-trashed toward totals. 216 if ( 'post-trashed' !== $row['comment_approved'] && 'trash' !== $row['comment_approved'] ) { 184 217 $total += $row['num_comments']; 185 218 } … … 214 247 215 248 /** 249 * Initialize. 250 * 216 251 * @codeCoverageIgnore 217 252 */ … … 223 258 224 259 add_action( 'pre_get_comments', array( $this, 'filter_comment_queries' ), 10, 1 ); 225 add_action( 'wp_count_comments', array( $this, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs 260 add_action( 'wp_count_comments', array( $this, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs. 226 261 add_action( 'comment_feed_where', array( $this, 'filter_comment_feed' ), 10, 2 ); 227 262 228 // Delete comments count cache whenever there is a new comment or a comment status changes 263 // Delete comments count cache whenever there is a new comment or a comment status changes. 229 264 add_action( 'wp_insert_comment', array( $this, 'delete_comment_count_cache' ) ); 230 265 add_action( 'wp_set_comment_status', array( $this, 'delete_comment_count_cache' ) ); 231 266 } 232 267 268 /** 269 * Defer comment counting. 270 */ 233 271 public function disable_comment_counting() { 234 wp_defer_comment_counting(true); 235 } 272 wp_defer_comment_counting( true ); 273 } 274 275 /** 276 * Enable comment counting. 277 */ 236 278 public function enable_comment_counting() { 237 wp_defer_comment_counting( false);279 wp_defer_comment_counting( false ); 238 280 } 239 281 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php
r3136104 r3263883 31 31 * 32 32 * @param ActionScheduler_Action $action Scheduled Action. 33 * @param DateTime $scheduled_date Scheduled Date.33 * @param DateTime|null $scheduled_date Scheduled Date. 34 34 * 35 35 * @throws RuntimeException Throws an exception if the action could not be saved. 36 36 * @return int 37 37 */ 38 public function save_action( ActionScheduler_Action $action, DateTime $scheduled_date = null ) {38 public function save_action( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) { 39 39 try { 40 40 $this->validate_action( $action ); … … 55 55 * 56 56 * @param ActionScheduler_Action $action Scheduled Action. 57 * @param DateTime $scheduled_date Scheduled Date.57 * @param DateTime|null $scheduled_date Scheduled Date. 58 58 * 59 59 * @return array Returns an array of post data. 60 60 */ 61 protected function create_post_array( ActionScheduler_Action $action, DateTime $scheduled_date = null ) {61 protected function create_post_array( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) { 62 62 $post = array( 63 63 'post_type' => self::POST_TYPE, … … 574 574 * Stake claim. 575 575 * 576 * @param int $max_actions Maximum number of actions.577 * @param DateTime $before_date Jobs must be schedule before this date. Defaults to now.578 * @param array $hooks Claim only actions with a hook or hooks.579 * @param string $group Claim only actions in the given group.576 * @param int $max_actions Maximum number of actions. 577 * @param DateTime|null $before_date Jobs must be schedule before this date. Defaults to now. 578 * @param array $hooks Claim only actions with a hook or hooks. 579 * @param string $group Claim only actions in the given group. 580 580 * 581 581 * @return ActionScheduler_ActionClaim … … 583 583 * @throws InvalidArgumentException When the given group is not valid. 584 584 */ 585 public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' ) {585 public function stake_claim( $max_actions = 10, ?DateTime $before_date = null, $hooks = array(), $group = '' ) { 586 586 $this->claim_before_date = $before_date; 587 587 $claim_id = $this->generate_claim_id(); … … 623 623 * Claim actions. 624 624 * 625 * @param string $claim_id Claim ID.626 * @param int $limit Limit.627 * @param DateTime $before_date Should use UTC timezone.628 * @param array $hooks Claim only actions with a hook or hooks.629 * @param string $group Claim only actions in the given group.625 * @param string $claim_id Claim ID. 626 * @param int $limit Limit. 627 * @param DateTime|null $before_date Should use UTC timezone. 628 * @param array $hooks Claim only actions with a hook or hooks. 629 * @param string $group Claim only actions in the given group. 630 630 * 631 631 * @return int The number of actions that were claimed. 632 632 * @throws RuntimeException When there is a database error. 633 633 */ 634 protected function claim_actions( $claim_id, $limit, DateTime $before_date = null, $hooks = array(), $group = '' ) {634 protected function claim_actions( $claim_id, $limit, ?DateTime $before_date = null, $hooks = array(), $group = '' ) { 635 635 // Set up initial variables. 636 636 $date = null === $before_date ? as_get_datetime_object() : clone $before_date; -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_PostStatusRegistrar.php
r2734765 r3263883 3 3 /** 4 4 * Class ActionScheduler_wpPostStore_PostStatusRegistrar 5 * 5 6 * @codeCoverageIgnore 6 7 */ 7 8 class ActionScheduler_wpPostStore_PostStatusRegistrar { 9 10 /** 11 * Registrar. 12 */ 8 13 public function register() { 9 14 register_post_status( ActionScheduler_Store::STATUS_RUNNING, array_merge( $this->post_status_args(), $this->post_status_running_labels() ) ); -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_PostTypeRegistrar.php
r3136104 r3263883 3 3 /** 4 4 * Class ActionScheduler_wpPostStore_PostTypeRegistrar 5 * 5 6 * @codeCoverageIgnore 6 7 */ 7 8 class ActionScheduler_wpPostStore_PostTypeRegistrar { 9 /** 10 * Registrar. 11 */ 8 12 public function register() { 9 13 register_post_type( ActionScheduler_wpPostStore::POST_TYPE, $this->post_type_args() ); … … 17 21 protected function post_type_args() { 18 22 $args = array( 19 'label' => __( 'Scheduled Actions', 'action-scheduler' ),20 'description' => __( 'Scheduled actions are hooks triggered on a certain date and time.', 'action-scheduler' ),21 'public' => false,23 'label' => __( 'Scheduled Actions', 'action-scheduler' ), 24 'description' => __( 'Scheduled actions are hooks triggered on a certain date and time.', 'action-scheduler' ), 25 'public' => false, 22 26 'map_meta_cap' => true, 23 27 'hierarchical' => false, 24 'supports' => array('title', 'editor','comments'),25 'rewrite' => false,26 'query_var' => false,27 'can_export' => true,28 'ep_mask' => EP_NONE,29 'labels' => array(30 'name' => __( 'Scheduled Actions', 'action-scheduler' ),31 'singular_name' => __( 'Scheduled Action', 'action-scheduler' ),32 'menu_name' => _x( 'Scheduled Actions', 'Admin menu name', 'action-scheduler' ),33 'add_new' => __( 'Add', 'action-scheduler' ),34 'add_new_item' => __( 'Add New Scheduled Action', 'action-scheduler' ),35 'edit' => __( 'Edit', 'action-scheduler' ),36 'edit_item' => __( 'Edit Scheduled Action', 'action-scheduler' ),37 'new_item' => __( 'New Scheduled Action', 'action-scheduler' ),38 'view' => __( 'View Action', 'action-scheduler' ),39 'view_item' => __( 'View Action', 'action-scheduler' ),40 'search_items' => __( 'Search Scheduled Actions', 'action-scheduler' ),41 'not_found' => __( 'No actions found', 'action-scheduler' ),28 'supports' => array( 'title', 'editor', 'comments' ), 29 'rewrite' => false, 30 'query_var' => false, 31 'can_export' => true, 32 'ep_mask' => EP_NONE, 33 'labels' => array( 34 'name' => __( 'Scheduled Actions', 'action-scheduler' ), 35 'singular_name' => __( 'Scheduled Action', 'action-scheduler' ), 36 'menu_name' => _x( 'Scheduled Actions', 'Admin menu name', 'action-scheduler' ), 37 'add_new' => __( 'Add', 'action-scheduler' ), 38 'add_new_item' => __( 'Add New Scheduled Action', 'action-scheduler' ), 39 'edit' => __( 'Edit', 'action-scheduler' ), 40 'edit_item' => __( 'Edit Scheduled Action', 'action-scheduler' ), 41 'new_item' => __( 'New Scheduled Action', 'action-scheduler' ), 42 'view' => __( 'View Action', 'action-scheduler' ), 43 'view_item' => __( 'View Action', 'action-scheduler' ), 44 'search_items' => __( 'Search Scheduled Actions', 'action-scheduler' ), 45 'not_found' => __( 'No actions found', 'action-scheduler' ), 42 46 'not_found_in_trash' => __( 'No actions found in trash', 'action-scheduler' ), 43 47 ), 44 48 ); 45 49 46 $args = apply_filters( 'action_scheduler_post_type_args', $args);50 $args = apply_filters( 'action_scheduler_post_type_args', $args ); 47 51 return $args; 48 52 } 49 53 } 50 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore_TaxonomyRegistrar.php
r2734765 r3263883 3 3 /** 4 4 * Class ActionScheduler_wpPostStore_TaxonomyRegistrar 5 * 5 6 * @codeCoverageIgnore 6 7 */ 7 8 class ActionScheduler_wpPostStore_TaxonomyRegistrar { 9 10 /** 11 * Registrar. 12 */ 8 13 public function register() { 9 14 register_taxonomy( ActionScheduler_wpPostStore::GROUP_TAXONOMY, ActionScheduler_wpPostStore::POST_TYPE, $this->taxonomy_args() ); 10 15 } 11 16 17 /** 18 * Get taxonomy arguments. 19 */ 12 20 protected function taxonomy_args() { 13 21 $args = array( 14 'label' => __( 'Action Group', 'action-scheduler' ),15 'public' => false,16 'hierarchical' => false,22 'label' => __( 'Action Group', 'action-scheduler' ), 23 'public' => false, 24 'hierarchical' => false, 17 25 'show_admin_column' => true, 18 'query_var' => false,19 'rewrite' => false,26 'query_var' => false, 27 'rewrite' => false, 20 28 ); 21 29 … … 24 32 } 25 33 } 26 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/ActionMigrator.php
r3055854 r3263883 14 14 */ 15 15 class ActionMigrator { 16 /** var ActionScheduler_Store */ 16 /** 17 * Source store instance. 18 * 19 * @var ActionScheduler_Store 20 */ 17 21 private $source; 18 22 19 /** var ActionScheduler_Store */ 23 /** 24 * Destination store instance. 25 * 26 * @var ActionScheduler_Store 27 */ 20 28 private $destination; 21 29 22 /** var LogMigrator */ 30 /** 31 * LogMigrator instance. 32 * 33 * @var LogMigrator 34 */ 23 35 private $log_migrator; 24 36 … … 26 38 * ActionMigrator constructor. 27 39 * 28 * @param ActionScheduler_Store $source_store Source store object.29 * @param ActionScheduler_Store $destination_store Destination store object.30 * @param LogMigrator $log_migrator Log migrator object.40 * @param \ActionScheduler_Store $source_store Source store object. 41 * @param \ActionScheduler_Store $destination_store Destination store object. 42 * @param LogMigrator $log_migrator Log migrator object. 31 43 */ 32 44 public function __construct( \ActionScheduler_Store $source_store, \ActionScheduler_Store $destination_store, LogMigrator $log_migrator ) { … … 42 54 * 43 55 * @return int 0|new action ID 56 * @throws \RuntimeException When unable to delete action from the source store. 44 57 */ 45 58 public function migrate( $source_action_id ) { … … 53 66 54 67 if ( is_null( $action ) || empty( $status ) || ! $action->get_schedule()->get_date() ) { 55 // null action or empty status means the fetch operation failed or the action didn't exist 56 // null schedule means it's missing vital data 57 // delete it and move on 68 // null action or empty status means the fetch operation failed or the action didn't exist. 69 // null schedule means it's missing vital data. 70 // delete it and move on. 58 71 try { 59 72 $this->source->delete_action( $source_action_id ); 60 } catch ( \Exception $e ) { 61 // nothing to do, it didn't exist in the first place 73 } catch ( \Exception $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch 74 // nothing to do, it didn't exist in the first place. 62 75 } 63 do_action( 'action_scheduler/no_action_to_migrate', $source_action_id, $this->source, $this->destination ); 76 do_action( 'action_scheduler/no_action_to_migrate', $source_action_id, $this->source, $this->destination ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 64 77 65 78 return 0; … … 68 81 try { 69 82 70 // Make sure the last attempt date is set correctly for completed and failed actions 71 $last_attempt_date = ( $status !== \ActionScheduler_Store::STATUS_PENDING) ? $this->source->get_date( $source_action_id ) : null;83 // Make sure the last attempt date is set correctly for completed and failed actions. 84 $last_attempt_date = ( \ActionScheduler_Store::STATUS_PENDING !== $status ) ? $this->source->get_date( $source_action_id ) : null; 72 85 73 86 $destination_action_id = $this->destination->save_action( $action, null, $last_attempt_date ); 74 87 } catch ( \Exception $e ) { 75 do_action( 'action_scheduler/migrate_action_failed', $source_action_id, $this->source, $this->destination ); 88 do_action( 'action_scheduler/migrate_action_failed', $source_action_id, $this->source, $this->destination ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 76 89 77 return 0; // could not save the action in the new store 90 return 0; // could not save the action in the new store. 78 91 } 79 92 80 93 try { 81 94 switch ( $status ) { 82 case \ActionScheduler_Store::STATUS_FAILED :95 case \ActionScheduler_Store::STATUS_FAILED: 83 96 $this->destination->mark_failure( $destination_action_id ); 84 97 break; 85 case \ActionScheduler_Store::STATUS_CANCELED :98 case \ActionScheduler_Store::STATUS_CANCELED: 86 99 $this->destination->cancel_action( $destination_action_id ); 87 100 break; … … 96 109 throw new \RuntimeException( sprintf( __( 'Unable to remove source migrated action %s', 'action-scheduler' ), $source_action_id ) ); 97 110 } 98 do_action( 'action_scheduler/migrated_action', $source_action_id, $destination_action_id, $this->source, $this->destination ); 111 do_action( 'action_scheduler/migrated_action', $source_action_id, $destination_action_id, $this->source, $this->destination ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 99 112 100 113 return $destination_action_id; 101 114 } catch ( \Exception $e ) { 102 // could not delete from the old store 115 // could not delete from the old store. 103 116 $this->source->mark_migrated( $source_action_id ); 117 118 // phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores 104 119 do_action( 'action_scheduler/migrate_action_incomplete', $source_action_id, $destination_action_id, $this->source, $this->destination ); 105 120 do_action( 'action_scheduler/migrated_action', $source_action_id, $destination_action_id, $this->source, $this->destination ); 121 // phpcs:enable 106 122 107 123 return $destination_action_id; -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php
r3055854 r3263883 4 4 * Class ActionScheduler_DBStoreMigrator 5 5 * 6 * A class for direct saving of actions to the table data store during migration.6 * A class for direct saving of actions to the table data store during migration. 7 7 * 8 8 * @since 3.0.0 … … 17 17 * that when first saving the action. 18 18 * 19 * @param ActionScheduler_Action $action 20 * @param \DateTime$scheduled_date Optional date of the first instance to store.21 * @param \DateTime$last_attempt_date Optional date the action was last attempted.19 * @param ActionScheduler_Action $action Action to migrate. 20 * @param null|DateTime $scheduled_date Optional date of the first instance to store. 21 * @param null|DateTime $last_attempt_date Optional date the action was last attempted. 22 22 * 23 23 * @return string The action ID 24 24 * @throws \RuntimeException When the action is not saved. 25 25 */ 26 public function save_action( ActionScheduler_Action $action, \DateTime $scheduled_date = null, \DateTime $last_attempt_date = null ){26 public function save_action( ActionScheduler_Action $action, ?DateTime $scheduled_date = null, ?DateTime $last_attempt_date = null ) { 27 27 try { 28 /** @var \wpdb $wpdb */ 28 /** 29 * Global. 30 * 31 * @var \wpdb $wpdb 32 */ 29 33 global $wpdb; 30 34 … … 32 36 33 37 if ( null !== $last_attempt_date ) { 34 $data = [38 $data = array( 35 39 'last_attempt_gmt' => $this->get_scheduled_date_string( $action, $last_attempt_date ), 36 40 'last_attempt_local' => $this->get_scheduled_date_string_local( $action, $last_attempt_date ), 37 ];41 ); 38 42 39 43 $wpdb->update( $wpdb->actionscheduler_actions, $data, array( 'action_id' => $action_id ), array( '%s', '%s' ), array( '%d' ) ); -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/BatchFetcher.php
r2734765 r3263883 1 1 <?php 2 2 3 4 3 namespace Action_Scheduler\Migration; 5 6 4 7 5 use ActionScheduler_Store as Store; … … 17 15 */ 18 16 class BatchFetcher { 19 /** var ActionScheduler_Store */ 17 /** 18 * Store instance. 19 * 20 * @var ActionScheduler_Store 21 */ 20 22 private $store; 21 23 … … 32 34 * Retrieve a list of actions. 33 35 * 34 * @param int $count The number of actions to retrieve 36 * @param int $count The number of actions to retrieve. 35 37 * 36 38 * @return int[] A list of action IDs … … 44 46 } 45 47 46 return [];48 return array(); 47 49 } 48 50 … … 56 58 private function get_query_strategies( $count ) { 57 59 $now = as_get_datetime_object(); 58 $args = [60 $args = array( 59 61 'date' => $now, 60 62 'per_page' => $count, … … 62 64 'orderby' => 'date', 63 65 'order' => 'ASC', 64 ];66 ); 65 67 66 $priorities = [68 $priorities = array( 67 69 Store::STATUS_PENDING, 68 70 Store::STATUS_FAILED, … … 70 72 Store::STATUS_COMPLETE, 71 73 Store::STATUS_RUNNING, 72 '', // any other unanticipated status 73 ];74 '', // any other unanticipated status. 75 ); 74 76 75 77 foreach ( $priorities as $status ) { 76 yield wp_parse_args( [ 77 'status' => $status, 78 'date_compare' => '<=', 79 ], $args ); 80 yield wp_parse_args( [ 81 'status' => $status, 82 'date_compare' => '>=', 83 ], $args ); 78 yield wp_parse_args( 79 array( 80 'status' => $status, 81 'date_compare' => '<=', 82 ), 83 $args 84 ); 85 86 yield wp_parse_args( 87 array( 88 'status' => $status, 89 'date_compare' => '>=', 90 ), 91 $args 92 ); 84 93 } 85 94 } -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/Config.php
r3136104 r3263883 18 18 */ 19 19 class Config { 20 /** @var ActionScheduler_Store */ 20 /** 21 * Source store instance. 22 * 23 * @var ActionScheduler_Store 24 */ 21 25 private $source_store; 22 26 23 /** @var ActionScheduler_Logger */ 27 /** 28 * Source logger instance. 29 * 30 * @var ActionScheduler_Logger 31 */ 24 32 private $source_logger; 25 33 26 /** @var ActionScheduler_Store */ 34 /** 35 * Destination store instance. 36 * 37 * @var ActionScheduler_Store 38 */ 27 39 private $destination_store; 28 40 29 /** @var ActionScheduler_Logger */ 41 /** 42 * Destination logger instance. 43 * 44 * @var ActionScheduler_Logger 45 */ 30 46 private $destination_logger; 31 47 32 /** @var Progress bar */ 48 /** 49 * Progress bar object. 50 * 51 * @var Action_Scheduler\WP_CLI\ProgressBar 52 */ 33 53 private $progress_bar; 34 54 35 /** @var bool */ 55 /** 56 * Flag indicating a dryrun. 57 * 58 * @var bool 59 */ 36 60 private $dry_run = false; 37 61 … … 47 71 * 48 72 * @return ActionScheduler_Store 73 * @throws \RuntimeException When source store is not configured. 49 74 */ 50 75 public function get_source_store() { … … 69 94 * 70 95 * @return ActionScheduler_Logger 96 * @throws \RuntimeException When source logger is not configured. 71 97 */ 72 98 public function get_source_logger() { … … 81 107 * Set the configured source logger. 82 108 * 83 * @param ActionScheduler_Logger $logger 109 * @param ActionScheduler_Logger $logger Logger object. 84 110 */ 85 111 public function set_source_logger( Logger $logger ) { … … 91 117 * 92 118 * @return ActionScheduler_Store 119 * @throws \RuntimeException When destination store is not configured. 93 120 */ 94 121 public function get_destination_store() { … … 103 130 * Set the configured destination store. 104 131 * 105 * @param ActionScheduler_Store $store 132 * @param ActionScheduler_Store $store Action store object. 106 133 */ 107 134 public function set_destination_store( Store $store ) { … … 113 140 * 114 141 * @return ActionScheduler_Logger 142 * @throws \RuntimeException When destination logger is not configured. 115 143 */ 116 144 public function get_destination_logger() { … … 125 153 * Set the configured destination logger. 126 154 * 127 * @param ActionScheduler_Logger $logger 155 * @param ActionScheduler_Logger $logger Logger object. 128 156 */ 129 157 public function set_destination_logger( Logger $logger ) { … … 143 171 * Set flag indicating whether it's a dry run. 144 172 * 145 * @param bool $dry_run 173 * @param bool $dry_run Dry run toggle. 146 174 */ 147 175 public function set_dry_run( $dry_run ) { … … 161 189 * Set progress bar object. 162 190 * 163 * @param ActionScheduler\WPCLI\ProgressBar $progress_bar 191 * @param ActionScheduler\WPCLI\ProgressBar $progress_bar Progress bar object. 164 192 */ 165 193 public function set_progress_bar( ProgressBar $progress_bar ) { -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/Controller.php
r2734765 r3263883 20 20 */ 21 21 class Controller { 22 /** 23 * Instance. 24 * 25 * @var self 26 */ 22 27 private static $instance; 23 28 24 /** @var Action_Scheduler\Migration\Scheduler */ 29 /** 30 * Scheduler instance. 31 * 32 * @var Action_Scheduler\Migration\Scheduler 33 */ 25 34 private $migration_scheduler; 26 35 27 /** @var string */ 36 /** 37 * Class name of the store object. 38 * 39 * @var string 40 */ 28 41 private $store_classname; 29 42 30 /** @var string */ 43 /** 44 * Class name of the logger object. 45 * 46 * @var string 47 */ 31 48 private $logger_classname; 32 49 33 /** @var bool */ 50 /** 51 * Flag to indicate migrating custom store. 52 * 53 * @var bool 54 */ 34 55 private $migrate_custom_store; 35 56 … … 143 164 } 144 165 145 return apply_filters( 'action_scheduler/migration_config', $config ); 166 return apply_filters( 'action_scheduler/migration_config', $config ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 146 167 } 147 168 … … 172 193 add_action( 'wp_loaded', array( $this, 'schedule_migration' ) ); 173 194 174 // Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen 195 // Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen. 175 196 add_action( 'load-tools_page_action-scheduler', array( $this, 'hook_admin_notices' ), 10, 0 ); 176 197 add_action( 'load-woocommerce_page_wc-status', array( $this, 'hook_admin_notices' ), 10, 0 ); … … 179 200 /** 180 201 * Possibly hook the migration scheduler action. 181 *182 * @author Jeremy Pry183 202 */ 184 203 public function maybe_hook_migration() { -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/DryRun_ActionMigrator.php
r2734765 r3263883 22 22 */ 23 23 public function migrate( $source_action_id ) { 24 do_action( 'action_scheduler/migrate_action_dry_run', $source_action_id ); 24 do_action( 'action_scheduler/migrate_action_dry_run', $source_action_id ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 25 25 26 26 return 0; -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/DryRun_LogMigrator.php
r2734765 r3263883 19 19 */ 20 20 public function migrate( $source_action_id, $destination_action_id ) { 21 // no-op 21 // no-op. 22 22 } 23 23 } -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/LogMigrator.php
r2734765 r3263883 16 16 */ 17 17 class LogMigrator { 18 /** @var ActionScheduler_Logger */ 18 /** 19 * Source logger instance. 20 * 21 * @var ActionScheduler_Logger 22 */ 19 23 private $source; 20 24 21 /** @var ActionScheduler_Logger */ 25 /** 26 * Destination logger instance. 27 * 28 * @var ActionScheduler_Logger 29 */ 22 30 private $destination; 23 31 … … 26 34 * 27 35 * @param ActionScheduler_Logger $source_logger Source logger object. 28 * @param ActionScheduler_Logger $destination_ Logger Destination logger object.36 * @param ActionScheduler_Logger $destination_logger Destination logger object. 29 37 */ 30 public function __construct( ActionScheduler_Logger $source_logger, ActionScheduler_Logger $destination_ Logger ) {38 public function __construct( ActionScheduler_Logger $source_logger, ActionScheduler_Logger $destination_logger ) { 31 39 $this->source = $source_logger; 32 $this->destination = $destination_ Logger;40 $this->destination = $destination_logger; 33 41 } 34 42 … … 41 49 public function migrate( $source_action_id, $destination_action_id ) { 42 50 $logs = $this->source->get_logs( $source_action_id ); 51 43 52 foreach ( $logs as $log ) { 44 if ( $log->get_action_id() == $source_action_id) {53 if ( absint( $log->get_action_id() ) === absint( $source_action_id ) ) { 45 54 $this->destination->log( $destination_action_id, $log->get_message(), $log->get_date() ); 46 55 } -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/Runner.php
r2953658 r3263883 14 14 */ 15 15 class Runner { 16 /** @var ActionScheduler_Store */ 16 /** 17 * Source store instance. 18 * 19 * @var ActionScheduler_Store 20 */ 17 21 private $source_store; 18 22 19 /** @var ActionScheduler_Store */ 23 /** 24 * Destination store instance. 25 * 26 * @var ActionScheduler_Store 27 */ 20 28 private $destination_store; 21 29 22 /** @var ActionScheduler_Logger */ 30 /** 31 * Source logger instance. 32 * 33 * @var ActionScheduler_Logger 34 */ 23 35 private $source_logger; 24 36 25 /** @var ActionScheduler_Logger */ 37 /** 38 * Destination logger instance. 39 * 40 * @var ActionScheduler_Logger 41 */ 26 42 private $destination_logger; 27 43 28 /** @var BatchFetcher */ 44 /** 45 * Batch fetcher instance. 46 * 47 * @var BatchFetcher 48 */ 29 49 private $batch_fetcher; 30 50 31 /** @var ActionMigrator */ 51 /** 52 * Action migrator instance. 53 * 54 * @var ActionMigrator 55 */ 32 56 private $action_migrator; 33 57 34 /** @var LogMigrator */ 58 /** 59 * Log migrator instance. 60 * 61 * @var LogMigrator 62 */ 35 63 private $log_migrator; 36 64 37 /** @var ProgressBar */ 65 /** 66 * Progress bar instance. 67 * 68 * @var ProgressBar 69 */ 38 70 private $progress_bar; 39 71 … … 71 103 */ 72 104 public function run( $batch_size = 10 ) { 73 $batch = $this->batch_fetcher->fetch( $batch_size );105 $batch = $this->batch_fetcher->fetch( $batch_size ); 74 106 $batch_size = count( $batch ); 75 107 … … 95 127 */ 96 128 public function migrate_actions( array $action_ids ) { 97 do_action( 'action_scheduler/migration_batch_starting', $action_ids ); 129 do_action( 'action_scheduler/migration_batch_starting', $action_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 98 130 99 131 \ActionScheduler::logger()->unhook_stored_action(); … … 103 135 $destination_action_id = $this->action_migrator->migrate( $source_action_id ); 104 136 if ( $destination_action_id ) { 105 $this->destination_logger->log( $destination_action_id, sprintf( 106 /* translators: 1: source action ID 2: source store class 3: destination action ID 4: destination store class */ 107 __( 'Migrated action with ID %1$d in %2$s to ID %3$d in %4$s', 'action-scheduler' ), 108 $source_action_id, 109 get_class( $this->source_store ), 137 $this->destination_logger->log( 110 138 $destination_action_id, 111 get_class( $this->destination_store ) 112 ) ); 139 sprintf( 140 /* translators: 1: source action ID 2: source store class 3: destination action ID 4: destination store class */ 141 __( 'Migrated action with ID %1$d in %2$s to ID %3$d in %4$s', 'action-scheduler' ), 142 $source_action_id, 143 get_class( $this->source_store ), 144 $destination_action_id, 145 get_class( $this->destination_store ) 146 ) 147 ); 113 148 } 114 149 … … 124 159 \ActionScheduler::logger()->hook_stored_action(); 125 160 126 do_action( 'action_scheduler/migration_batch_complete', $action_ids ); 161 do_action( 'action_scheduler/migration_batch_complete', $action_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 127 162 } 128 163 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/migration/Scheduler.php
r2734765 r3263883 15 15 class Scheduler { 16 16 /** Migration action hook. */ 17 const HOOK = 'action_scheduler/migration_hook';17 const HOOK = 'action_scheduler/migration_hook'; 18 18 19 19 /** Migration action group. */ 20 const GROUP = 'action-scheduler-migration';20 const GROUP = 'action-scheduler-migration'; 21 21 22 22 /** … … 41 41 $count = $migration_runner->run( $this->get_batch_size() ); 42 42 43 if ( $count === 0) {43 if ( 0 === $count ) { 44 44 $this->mark_complete(); 45 45 } else { … … 55 55 56 56 \ActionScheduler_DataController::mark_migration_complete(); 57 do_action( 'action_scheduler/migration_complete' ); 57 do_action( 'action_scheduler/migration_complete' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 58 58 } 59 59 … … 103 103 */ 104 104 private function get_schedule_interval() { 105 return (int) apply_filters( 'action_scheduler/migration_interval', 0 ); 105 return (int) apply_filters( 'action_scheduler/migration_interval', 0 ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 106 106 } 107 107 … … 112 112 */ 113 113 private function get_batch_size() { 114 return (int) apply_filters( 'action_scheduler/migration_batch_size', 250 ); 114 return (int) apply_filters( 'action_scheduler/migration_batch_size', 250 ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 115 115 } 116 116 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/schedules/ActionScheduler_CanceledSchedule.php
r2734765 r3263883 8 8 /** 9 9 * Deprecated property @see $this->__wakeup() for details. 10 **/ 11 private $timestamp = NULL; 10 * 11 * @var null 12 */ 13 private $timestamp = null; 12 14 13 15 /** 14 * @param DateTime $after 16 * Calculate when the next instance of this schedule would run based on a given date & time. 17 * 18 * @param DateTime $after Timestamp. 15 19 * 16 20 * @return DateTime|null … … 24 28 * is called with $after < $this->scheduled_date. 25 29 * 26 * @param DateTime $after 30 * @param DateTime $after Timestamp. 27 31 * @return DateTime|null 28 32 */ … … 32 36 33 37 /** 38 * Action is not recurring. 39 * 34 40 * @return bool 35 41 */ -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/schedules/ActionScheduler_CronSchedule.php
r3136104 r3263883 8 8 /** 9 9 * Deprecated property @see $this->__wakeup() for details. 10 **/ 11 private $start_timestamp = NULL; 10 * 11 * @var null 12 */ 13 private $start_timestamp = null; 12 14 13 15 /** 14 16 * Deprecated property @see $this->__wakeup() for details. 15 **/ 16 private $cron = NULL; 17 * 18 * @var null 19 */ 20 private $cron = null; 17 21 18 22 /** … … 20 24 * objects $recurrence property. 21 25 * 22 * @param DateTime $start The date & time to run the action at or after. If $start aligns with the CronSchedule passed via $recurrence, it will be used. If it does not align, the first matching date after it will be used.26 * @param DateTime $start The date & time to run the action at or after. If $start aligns with the CronSchedule passed via $recurrence, it will be used. If it does not align, the first matching date after it will be used. 23 27 * @param CronExpression|string $recurrence The CronExpression used to calculate the schedule's next instance. 24 * @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance.28 * @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance. 25 29 */ 26 public function __construct( DateTime $start, $recurrence, DateTime $first = null ) {30 public function __construct( DateTime $start, $recurrence, ?DateTime $first = null ) { 27 31 if ( ! is_a( $recurrence, 'CronExpression' ) ) { 28 32 $recurrence = CronExpression::factory( $recurrence ); … … 42 46 * date & time using its the CronExpression. 43 47 * 44 * @param DateTime $after 48 * @param DateTime $after Timestamp. 45 49 * @return DateTime 46 50 */ … … 50 54 51 55 /** 56 * Get the schedule's recurrence. 57 * 52 58 * @return string 53 59 */ … … 76 82 $this->cron = $this->recurrence; 77 83 78 return array_merge( $sleep_params, array( 79 'start_timestamp', 80 'cron' 81 ) ); 84 return array_merge( 85 $sleep_params, 86 array( 87 'start_timestamp', 88 'cron', 89 ) 90 ); 82 91 } 83 92 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/schedules/ActionScheduler_IntervalSchedule.php
r3136104 r3263883 8 8 /** 9 9 * Deprecated property @see $this->__wakeup() for details. 10 **/ 11 private $start_timestamp = NULL; 10 * 11 * @var null 12 */ 13 private $start_timestamp = null; 12 14 13 15 /** 14 16 * Deprecated property @see $this->__wakeup() for details. 15 **/ 16 private $interval_in_seconds = NULL; 17 * 18 * @var null 19 */ 20 private $interval_in_seconds = null; 17 21 18 22 /** … … 20 24 * the number of seconds between recurrences. 21 25 * 22 * @param DateTime $after 26 * @param DateTime $after Timestamp. 23 27 * @return DateTime 24 28 */ … … 29 33 30 34 /** 35 * Schedule interval in seconds. 36 * 31 37 * @return int 32 38 */ … … 56 62 $this->interval_in_seconds = $this->recurrence; 57 63 58 return array_merge( $sleep_params, array( 59 'start_timestamp', 60 'interval_in_seconds' 61 ) ); 64 return array_merge( 65 $sleep_params, 66 array( 67 'start_timestamp', 68 'interval_in_seconds', 69 ) 70 ); 62 71 } 63 72 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/schedules/ActionScheduler_NullSchedule.php
r2953658 r3263883 6 6 class ActionScheduler_NullSchedule extends ActionScheduler_SimpleSchedule { 7 7 8 /** @var DateTime|null */ 8 /** 9 * DateTime instance. 10 * 11 * @var DateTime|null 12 */ 9 13 protected $scheduled_date; 10 14 … … 12 16 * Make the $date param optional and default to null. 13 17 * 14 * @param null $date The date & time to run the action.18 * @param null|DateTime $date The date & time to run the action. 15 19 */ 16 public function __construct( DateTime $date = null ) {20 public function __construct( ?DateTime $date = null ) { 17 21 $this->scheduled_date = null; 18 22 } 19 23 20 24 /** 21 * This schedule has no scheduled DateTime, so we need to override the parent __sleep() 25 * This schedule has no scheduled DateTime, so we need to override the parent __sleep(). 26 * 22 27 * @return array 23 28 */ … … 26 31 } 27 32 33 /** 34 * Wakeup. 35 */ 28 36 public function __wakeup() { 29 37 $this->scheduled_date = null; -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/schedules/ActionScheduler_Schedule.php
r2734765 r3263883 6 6 interface ActionScheduler_Schedule { 7 7 /** 8 * @param DateTime $after 8 * Get the date & time this schedule was created to run, or calculate when it should be run 9 * after a given date & time. 10 * 11 * @param null|DateTime $after Timestamp. 9 12 * @return DateTime|null 10 13 */ 11 public function next( DateTime $after = NULL);14 public function next( ?DateTime $after = null ); 12 15 13 16 /** 17 * Identify the schedule as (not) recurring. 18 * 14 19 * @return bool 15 20 */ 16 21 public function is_recurring(); 17 22 } 18 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/schedules/ActionScheduler_SimpleSchedule.php
r2734765 r3263883 8 8 /** 9 9 * Deprecated property @see $this->__wakeup() for details. 10 **/ 11 private $timestamp = NULL; 10 * 11 * @var null|DateTime 12 */ 13 private $timestamp = null; 12 14 13 15 /** 14 * @param DateTime $after 16 * Calculate when this schedule should start after a given date & time using 17 * the number of seconds between recurrences. 18 * 19 * @param DateTime $after Timestamp. 15 20 * 16 21 * @return DateTime|null … … 21 26 22 27 /** 28 * Schedule is not recurring. 29 * 23 30 * @return bool 24 31 */ … … 46 53 $this->timestamp = $this->scheduled_timestamp; 47 54 48 return array_merge( $sleep_params, array( 49 'timestamp', 50 ) ); 55 return array_merge( 56 $sleep_params, 57 array( 58 'timestamp', 59 ) 60 ); 51 61 } 52 62 -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/schema/ActionScheduler_LoggerSchema.php
r2953658 r3263883 12 12 13 13 /** 14 * @var int Increment this value to trigger a schema update. 14 * Schema version. 15 * 16 * Increment this value to trigger a schema update. 17 * 18 * @var int 15 19 */ 16 20 protected $schema_version = 3; 17 21 22 /** 23 * Construct. 24 */ 18 25 public function __construct() { 19 $this->tables = [26 $this->tables = array( 20 27 self::LOG_TABLE, 21 ];28 ); 22 29 } 23 30 … … 29 36 } 30 37 38 /** 39 * Get table definition. 40 * 41 * @param string $table Table name. 42 */ 31 43 protected function get_table_definition( $table ) { 32 44 global $wpdb; 33 $table_name = $wpdb->$table;34 $charset_collate = $wpdb->get_charset_collate();45 $table_name = $wpdb->$table; 46 $charset_collate = $wpdb->get_charset_collate(); 35 47 switch ( $table ) { 36 48 37 49 case self::LOG_TABLE: 38 39 50 $default_date = ActionScheduler_StoreSchema::DEFAULT_DATE; 40 51 return "CREATE TABLE $table_name ( -
podcast-importer-secondline/trunk/lib/action-scheduler/classes/schema/ActionScheduler_StoreSchema.php
r3016908 r3263883 15 15 16 16 /** 17 * @var int Increment this value to trigger a schema update. 17 * Schema version. 18 * 19 * Increment this value to trigger a schema update. 20 * 21 * @var int 18 22 */ 19 23 protected $schema_version = 7; 20 24 25 /** 26 * Construct. 27 */ 21 28 public function __construct() { 22 $this->tables = [29 $this->tables = array( 23 30 self::ACTIONS_TABLE, 24 31 self::CLAIMS_TABLE, 25 32 self::GROUPS_TABLE, 26 ];33 ); 27 34 } 28 35 … … 34 41 } 35 42 43 /** 44 * Get table definition. 45 * 46 * @param string $table Table name. 47 */ 36 48 protected function get_table_definition( $table ) { 37 49 global $wpdb; 38 $table_name = $wpdb->$table; 39 $charset_collate = $wpdb->get_charset_collate(); 50 $table_name = $wpdb->$table; 51 $charset_collate = $wpdb->get_charset_collate(); 52 $default_date = self::DEFAULT_DATE; 53 // phpcs:ignore Squiz.PHP.CommentedOutCode 40 54 $max_index_length = 191; // @see wp_get_db_schema() 55 41 56 $hook_status_scheduled_date_gmt_max_index_length = $max_index_length - 20 - 8; // - status, - scheduled_date_gmt 42 $default_date = self::DEFAULT_DATE; 57 43 58 switch ( $table ) { 44 59 45 60 case self::ACTIONS_TABLE: 46 47 61 return "CREATE TABLE {$table_name} ( 48 62 action_id bigint(20) unsigned NOT NULL auto_increment, … … 71 85 72 86 case self::CLAIMS_TABLE: 73 74 87 return "CREATE TABLE {$table_name} ( 75 88 claim_id bigint(20) unsigned NOT NULL auto_increment, … … 80 93 81 94 case self::GROUPS_TABLE: 82 83 95 return "CREATE TABLE {$table_name} ( 84 96 group_id bigint(20) unsigned NOT NULL auto_increment, -
podcast-importer-secondline/trunk/lib/action-scheduler/deprecated/ActionScheduler_Abstract_QueueRunner_Deprecated.php
r2734765 r3263883 17 17 $maximum_execution_time = 30; 18 18 19 // Apply deprecated filter 19 // Apply deprecated filter. 20 20 if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) { 21 21 _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' ); -
podcast-importer-secondline/trunk/lib/action-scheduler/deprecated/ActionScheduler_AdminView_Deprecated.php
r3136104 r3263883 11 11 class ActionScheduler_AdminView_Deprecated { 12 12 13 /** 14 * Adjust parameters for custom post type. 15 * 16 * @param array $args Args. 17 */ 13 18 public function action_scheduler_post_type_args( $args ) { 14 19 _deprecated_function( __METHOD__, '2.0.0' ); … … 69 74 * 70 75 * @param string $column_name The key for the column for which we should output our content. 71 * @param int $post_id The ID of the 'scheduled-action' post for which this row relates.76 * @param int $post_id The ID of the 'scheduled-action' post for which this row relates. 72 77 */ 73 78 public static function list_table_column_content( $column_name, $post_id ) { … … 80 85 * Hooked to the 'post_row_actions' filter. 81 86 * 82 * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. 87 * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. 88 * @param WP_Post $post The 'scheduled-action' post object. 83 89 * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. 84 90 */ … … 106 112 * Based on Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/ 107 113 * 108 * @param int $interval A interval in seconds. 109 * @return string A human friendly string representation of the interval. 114 * @return void 110 115 */ 111 116 public static function admin_notices() { … … 116 121 * Filter search queries to allow searching by Claim ID (i.e. post_password). 117 122 * 118 * @param string $orderby MySQL orderby string.119 * @param WP_Query $query Instance of a WP_Query object 120 * @return string MySQL orderby string.123 * @param string $orderby MySQL orderby string. 124 * @param WP_Query $query Instance of a WP_Query object. 125 * @return void 121 126 */ 122 public function custom_orderby( $orderby, $query ) {127 public function custom_orderby( $orderby, $query ) { 123 128 _deprecated_function( __METHOD__, '2.0.0' ); 124 129 } … … 127 132 * Filter search queries to allow searching by Claim ID (i.e. post_password). 128 133 * 129 * @param string $search MySQL search string.130 * @param WP_Query $query Instance of a WP_Query object 131 * @return string MySQL search string.134 * @param string $search MySQL search string. 135 * @param WP_Query $query Instance of a WP_Query object. 136 * @return void 132 137 */ 133 138 public function search_post_password( $search, $query ) { … … 138 143 * Change messages when a scheduled action is updated. 139 144 * 140 * @param array $messages 145 * @param array $messages Messages. 141 146 * @return array 142 147 */ … … 145 150 return $messages; 146 151 } 152 147 153 } -
podcast-importer-secondline/trunk/lib/action-scheduler/deprecated/ActionScheduler_Schedule_Deprecated.php
r2953658 r3263883 14 14 * @return DateTime|null 15 15 */ 16 public function next( DateTime $after = null ) {16 public function next( ?DateTime $after = null ) { 17 17 if ( empty( $after ) ) { 18 18 $return_value = $this->get_date(); -
podcast-importer-secondline/trunk/lib/action-scheduler/deprecated/ActionScheduler_Store_Deprecated.php
r2734765 r3263883 3 3 /** 4 4 * Class ActionScheduler_Store_Deprecated 5 * 5 6 * @codeCoverageIgnore 6 7 */ -
podcast-importer-secondline/trunk/lib/action-scheduler/deprecated/functions.php
r2734765 r3263883 1 1 <?php 2 3 2 /** 4 3 * Deprecated API functions for scheduling actions … … 7 6 * Action Scheduler being included in WooCommerce core, and it providing 8 7 * a different set of APIs for working with the action queue. 8 * 9 * @package ActionScheduler 9 10 */ 10 11 11 12 /** 12 * Schedule an action to run one time 13 * Schedule an action to run one time. 13 14 * 14 * @param int $timestamp When the job will run15 * @param string $hook The hook to trigger 16 * @param array $args Arguments to pass when the hook triggers17 * @param string $group The group to assign this job to 15 * @param int $timestamp When the job will run. 16 * @param string $hook The hook to trigger. 17 * @param array $args Arguments to pass when the hook triggers. 18 * @param string $group The group to assign this job to. 18 19 * 19 20 * @return string The job ID … … 25 26 26 27 /** 27 * Schedule a recurring action 28 * Schedule a recurring action. 28 29 * 29 * @param int $timestamp When the first instance of the job will run30 * @param int $interval_in_seconds How long to wait between runs31 * @param string $hook The hook to trigger 32 * @param array $args Arguments to pass when the hook triggers33 * @param string $group The group to assign this job to 30 * @param int $timestamp When the first instance of the job will run. 31 * @param int $interval_in_seconds How long to wait between runs. 32 * @param string $hook The hook to trigger. 33 * @param array $args Arguments to pass when the hook triggers. 34 * @param string $group The group to assign this job to. 34 35 * 35 36 * @deprecated 2.1.0 … … 45 46 * Schedule an action that recurs on a cron-like schedule. 46 47 * 47 * @param int $timestamp The schedule will start on or after this time48 * @param string $schedule A cron-link schedule string 48 * @param int $timestamp The schedule will start on or after this time. 49 * @param string $schedule A cron-link schedule string. 49 50 * @see http://en.wikipedia.org/wiki/Cron 50 51 * * * * * * * … … 57 58 * | +-------------------- hour (0 - 23) 58 59 * +------------------------- min (0 - 59) 59 * @param string $hook The hook to trigger 60 * @param array $args Arguments to pass when the hook triggers61 * @param string $group The group to assign this job to 60 * @param string $hook The hook to trigger. 61 * @param array $args Arguments to pass when the hook triggers. 62 * @param string $group The group to assign this job to. 62 63 * 63 64 * @deprecated 2.1.0 … … 73 74 * Cancel the next occurrence of a job. 74 75 * 75 * @param string $hook The hook that the job will trigger 76 * @param array $args Args that would have been passed to the job77 * @param string $group 76 * @param string $hook The hook that the job will trigger. 77 * @param array $args Args that would have been passed to the job. 78 * @param string $group Action's group. 78 79 * 79 80 * @deprecated 2.1.0 … … 85 86 86 87 /** 87 * @param string $hook 88 * @param array $args 89 * @param string $group 88 * Get next scheduled action. 89 * 90 * @param string $hook Action's hook. 91 * @param array $args Action's args. 92 * @param string $group Action's group. 90 93 * 91 94 * @deprecated 2.1.0 … … 93 96 * @return int|bool The timestamp for the next occurrence, or false if nothing was found 94 97 */ 95 function wc_next_scheduled_action( $hook, $args = NULL, $group = '' ) {98 function wc_next_scheduled_action( $hook, $args = null, $group = '' ) { 96 99 _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); 97 100 return as_next_scheduled_action( $hook, $args, $group ); … … 101 104 * Find scheduled actions 102 105 * 103 * @param array $args Possible arguments, with their default values:106 * @param array $args Possible arguments, with their default values: 104 107 * 'hook' => '' - the name of the action that will be triggered 105 108 * 'args' => NULL - the args array that will be passed with the action … … 114 117 * 'offset' => 0 115 118 * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date' 116 * 'order' => 'ASC' 117 * @param string $return_format OBJECT, ARRAY_A, or ids 119 * 'order' => 'ASC'. 120 * @param string $return_format OBJECT, ARRAY_A, or ids. 118 121 * 119 122 * @deprecated 2.1.0 -
podcast-importer-secondline/trunk/lib/action-scheduler/functions.php
r3136104 r3263883 36 36 * @param string $group Action group. 37 37 * @param int $priority Action priority. 38 * @param bool $unique Unique action. 38 39 */ 39 $pre = apply_filters( 'pre_as_enqueue_async_action', null, $hook, $args, $group, $priority );40 $pre = apply_filters( 'pre_as_enqueue_async_action', null, $hook, $args, $group, $priority, $unique ); 40 41 if ( null !== $pre ) { 41 42 return is_int( $pre ) ? $pre : 0; … … 127 128 // We expect an integer and allow it to be passed using float and string types, but otherwise 128 129 // should reject unexpected values. 130 // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison 129 131 if ( ! is_numeric( $interval_in_seconds ) || $interval_in_seconds != $interval ) { 130 132 _doing_it_wrong( … … 456 458 } 457 459 458 if ( ARRAY_A == $return_format ) {460 if ( ARRAY_A === $return_format ) { 459 461 foreach ( $actions as $action_id => $action_object ) { 460 462 $actions[ $action_id ] = get_object_vars( $action_object ); -
podcast-importer-secondline/trunk/lib/action-scheduler/lib/WP_Async_Request.php
r2953658 r3263883 5 5 * @package WP-Background-Processing 6 6 */ 7 7 8 /* 8 9 Library URI: https://github.com/deliciousbrains/wp-background-processing/blob/fbbc56f2480910d7959972ec9ec0819a13c6150a/classes/wp-async-request.php … … 28 29 * 29 30 * @var string 30 * @access protected31 31 */ 32 32 protected $prefix = 'wp'; … … 38 38 * 39 39 * @var string 40 * @access protected41 40 */ 42 41 protected $action = 'async_request'; … … 46 45 * 47 46 * @var mixed 48 * @access protected49 47 */ 50 48 protected $identifier; … … 56 54 * 57 55 * @var array 58 * @access protected59 56 */ 60 57 protected $data = array(); … … 170 167 */ 171 168 public function maybe_handle() { 172 // Don't lock up other requests while processing 169 // Don't lock up other requests while processing. 173 170 session_write_close(); 174 171 -
podcast-importer-secondline/trunk/lib/action-scheduler/lib/cron-expression/CronExpression.php
r2734765 r3263883 55 55 * @return CronExpression 56 56 */ 57 public static function factory($expression, CronExpression_FieldFactory $fieldFactory = null)57 public static function factory($expression, ?CronExpression_FieldFactory $fieldFactory = null) 58 58 { 59 59 $mappings = array( -
podcast-importer-secondline/trunk/lib/action-scheduler/readme.txt
r3136104 r3263883 2 2 Contributors: Automattic, wpmuguru, claudiosanches, peterfabian1000, vedjain, jamosova, obliviousharmony, konamiman, sadowski, royho, barryhughes-1 3 3 Tags: scheduler, cron 4 Stable tag: 3. 8.14 Stable tag: 3.9.2 5 5 License: GPLv3 6 Requires at least: 6. 37 Tested up to: 6. 58 Requires PHP: 7. 06 Requires at least: 6.5 7 Tested up to: 6.7 8 Requires PHP: 7.1 9 9 10 10 Action Scheduler - Job Queue for WordPress … … 47 47 48 48 == Changelog == 49 50 = 3.9.2 - 2025-02-03 = 51 * Fixed fatal errors by moving version info methods to a new class and deprecating conflicting ones in ActionScheduler_Versions 52 53 = 3.9.1 - 2025-01-21 = 54 * A number of new WP CLI commands have been added, making it easier to manage actions in the terminal and from scripts. 55 * New wp action-scheduler source command to help determine how Action Scheduler is being loaded. 56 * Additional information about the active instance of Action Scheduler is now available in the Help pull-down drawer. 57 * Make some other nullable parameters explicitly nullable. 58 * Set option value to `no` rather than deleting. 59 60 = 3.9.0 - 2024-11-14 = 61 * Minimum required version of PHP is now 7.1. 62 * Performance improvements for the `as_pending_actions_due()` function. 63 * Existing filter hook `action_scheduler_claim_actions_order_by` enhanced to provide callbacks with additional information. 64 * Improved compatibility with PHP 8.4, specifically by making implicitly nullable parameters explicitly nullable. 65 * A large number of coding standards-enhancements, to help reduce friction when submitting plugins to marketplaces and plugin directories. Special props @crstauf for this effort. 66 * Minor documentation tweaks and improvements. 67 68 = 3.8.2 - 2024-09-12 = 69 * Add missing parameter to the `pre_as_enqueue_async_action` hook. 70 * Bump minimum PHP version to 7.0. 71 * Bump minimum WordPress version to 6.4. 72 * Make the batch size adjustable during processing. 49 73 50 74 = 3.8.1 - 2024-06-20 = -
podcast-importer-secondline/trunk/lib/action-scheduler/vendor/autoload.php
r3136104 r3263883 4 4 5 5 if (PHP_VERSION_ID < 50600) { 6 echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; 7 exit(1); 6 if (!headers_sent()) { 7 header('HTTP/1.1 500 Internal Server Error'); 8 } 9 $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; 10 if (!ini_get('display_errors')) { 11 if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { 12 fwrite(STDERR, $err); 13 } elseif (!headers_sent()) { 14 echo $err; 15 } 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 8 21 } 9 22 10 23 require_once __DIR__ . '/composer/autoload_real.php'; 11 24 12 return ComposerAutoloaderInit 0ed398af1bd918658290810d69e2ba71::getLoader();25 return ComposerAutoloaderInit81fd3951ccfed0a222e6f4b949998df1::getLoader(); -
podcast-importer-secondline/trunk/lib/action-scheduler/vendor/composer/ClassLoader.php
r3016908 r3263883 43 43 class ClassLoader 44 44 { 45 /** @var ?string */ 45 /** @var \Closure(string):void */ 46 private static $includeFile; 47 48 /** @var string|null */ 46 49 private $vendorDir; 47 50 48 51 // PSR-4 49 52 /** 50 * @var array[] 51 * @psalm-var array<string, array<string, int>> 53 * @var array<string, array<string, int>> 52 54 */ 53 55 private $prefixLengthsPsr4 = array(); 54 56 /** 55 * @var array[] 56 * @psalm-var array<string, array<int, string>> 57 * @var array<string, list<string>> 57 58 */ 58 59 private $prefixDirsPsr4 = array(); 59 60 /** 60 * @var array[] 61 * @psalm-var array<string, string> 61 * @var list<string> 62 62 */ 63 63 private $fallbackDirsPsr4 = array(); … … 65 65 // PSR-0 66 66 /** 67 * @var array[] 68 * @psalm-var array<string, array<string, string[]>> 67 * List of PSR-0 prefixes 68 * 69 * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) 70 * 71 * @var array<string, array<string, list<string>>> 69 72 */ 70 73 private $prefixesPsr0 = array(); 71 74 /** 72 * @var array[] 73 * @psalm-var array<string, string> 75 * @var list<string> 74 76 */ 75 77 private $fallbackDirsPsr0 = array(); … … 79 81 80 82 /** 81 * @var string[] 82 * @psalm-var array<string, string> 83 * @var array<string, string> 83 84 */ 84 85 private $classMap = array(); … … 88 89 89 90 /** 90 * @var bool[] 91 * @psalm-var array<string, bool> 91 * @var array<string, bool> 92 92 */ 93 93 private $missingClasses = array(); 94 94 95 /** @var ?string*/95 /** @var string|null */ 96 96 private $apcuPrefix; 97 97 98 98 /** 99 * @var self[]99 * @var array<string, self> 100 100 */ 101 101 private static $registeredLoaders = array(); 102 102 103 103 /** 104 * @param ?string$vendorDir104 * @param string|null $vendorDir 105 105 */ 106 106 public function __construct($vendorDir = null) 107 107 { 108 108 $this->vendorDir = $vendorDir; 109 } 110 111 /** 112 * @return string[] 109 self::initializeIncludeClosure(); 110 } 111 112 /** 113 * @return array<string, list<string>> 113 114 */ 114 115 public function getPrefixes() … … 122 123 123 124 /** 124 * @return array[] 125 * @psalm-return array<string, array<int, string>> 125 * @return array<string, list<string>> 126 126 */ 127 127 public function getPrefixesPsr4() … … 131 131 132 132 /** 133 * @return array[] 134 * @psalm-return array<string, string> 133 * @return list<string> 135 134 */ 136 135 public function getFallbackDirs() … … 140 139 141 140 /** 142 * @return array[] 143 * @psalm-return array<string, string> 141 * @return list<string> 144 142 */ 145 143 public function getFallbackDirsPsr4() … … 149 147 150 148 /** 151 * @return string[] Array of classname => path 152 * @psalm-return array<string, string> 149 * @return array<string, string> Array of classname => path 153 150 */ 154 151 public function getClassMap() … … 158 155 159 156 /** 160 * @param string[] $classMap Class to filename map 161 * @psalm-param array<string, string> $classMap 157 * @param array<string, string> $classMap Class to filename map 162 158 * 163 159 * @return void … … 176 172 * appending or prepending to the ones previously set for this prefix. 177 173 * 178 * @param string $prefix The prefix179 * @param string[]|string $paths The PSR-0 root directories180 * @param bool $prepend Whether to prepend the directories174 * @param string $prefix The prefix 175 * @param list<string>|string $paths The PSR-0 root directories 176 * @param bool $prepend Whether to prepend the directories 181 177 * 182 178 * @return void … … 184 180 public function add($prefix, $paths, $prepend = false) 185 181 { 182 $paths = (array) $paths; 186 183 if (!$prefix) { 187 184 if ($prepend) { 188 185 $this->fallbackDirsPsr0 = array_merge( 189 (array)$paths,186 $paths, 190 187 $this->fallbackDirsPsr0 191 188 ); … … 193 190 $this->fallbackDirsPsr0 = array_merge( 194 191 $this->fallbackDirsPsr0, 195 (array)$paths192 $paths 196 193 ); 197 194 } … … 202 199 $first = $prefix[0]; 203 200 if (!isset($this->prefixesPsr0[$first][$prefix])) { 204 $this->prefixesPsr0[$first][$prefix] = (array)$paths;201 $this->prefixesPsr0[$first][$prefix] = $paths; 205 202 206 203 return; … … 208 205 if ($prepend) { 209 206 $this->prefixesPsr0[$first][$prefix] = array_merge( 210 (array)$paths,207 $paths, 211 208 $this->prefixesPsr0[$first][$prefix] 212 209 ); … … 214 211 $this->prefixesPsr0[$first][$prefix] = array_merge( 215 212 $this->prefixesPsr0[$first][$prefix], 216 (array)$paths213 $paths 217 214 ); 218 215 } … … 223 220 * appending or prepending to the ones previously set for this namespace. 224 221 * 225 * @param string $prefix The prefix/namespace, with trailing '\\'226 * @param string[]|string $paths The PSR-4 base directories227 * @param bool $prepend Whether to prepend the directories222 * @param string $prefix The prefix/namespace, with trailing '\\' 223 * @param list<string>|string $paths The PSR-4 base directories 224 * @param bool $prepend Whether to prepend the directories 228 225 * 229 226 * @throws \InvalidArgumentException … … 233 230 public function addPsr4($prefix, $paths, $prepend = false) 234 231 { 232 $paths = (array) $paths; 235 233 if (!$prefix) { 236 234 // Register directories for the root namespace. 237 235 if ($prepend) { 238 236 $this->fallbackDirsPsr4 = array_merge( 239 (array)$paths,237 $paths, 240 238 $this->fallbackDirsPsr4 241 239 ); … … 243 241 $this->fallbackDirsPsr4 = array_merge( 244 242 $this->fallbackDirsPsr4, 245 (array)$paths243 $paths 246 244 ); 247 245 } … … 253 251 } 254 252 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 255 $this->prefixDirsPsr4[$prefix] = (array)$paths;253 $this->prefixDirsPsr4[$prefix] = $paths; 256 254 } elseif ($prepend) { 257 255 // Prepend directories for an already registered namespace. 258 256 $this->prefixDirsPsr4[$prefix] = array_merge( 259 (array)$paths,257 $paths, 260 258 $this->prefixDirsPsr4[$prefix] 261 259 ); … … 264 262 $this->prefixDirsPsr4[$prefix] = array_merge( 265 263 $this->prefixDirsPsr4[$prefix], 266 (array)$paths264 $paths 267 265 ); 268 266 } … … 273 271 * replacing any others previously set for this prefix. 274 272 * 275 * @param string $prefix The prefix276 * @param string[]|string $paths The PSR-0 base directories273 * @param string $prefix The prefix 274 * @param list<string>|string $paths The PSR-0 base directories 277 275 * 278 276 * @return void … … 291 289 * replacing any others previously set for this namespace. 292 290 * 293 * @param string $prefix The prefix/namespace, with trailing '\\'294 * @param string[]|string $paths The PSR-4 base directories291 * @param string $prefix The prefix/namespace, with trailing '\\' 292 * @param list<string>|string $paths The PSR-4 base directories 295 293 * 296 294 * @throws \InvalidArgumentException … … 426 424 { 427 425 if ($file = $this->findFile($class)) { 428 includeFile($file); 426 $includeFile = self::$includeFile; 427 $includeFile($file); 429 428 430 429 return true; … … 477 476 478 477 /** 479 * Returns the currently registered loaders indexed by their corresponding vendor directories.480 * 481 * @return self[]478 * Returns the currently registered loaders keyed by their corresponding vendor directories. 479 * 480 * @return array<string, self> 482 481 */ 483 482 public static function getRegisteredLoaders() … … 556 555 return false; 557 556 } 557 558 /** 559 * @return void 560 */ 561 private static function initializeIncludeClosure() 562 { 563 if (self::$includeFile !== null) { 564 return; 565 } 566 567 /** 568 * Scope isolated include. 569 * 570 * Prevents access to $this/self from included files. 571 * 572 * @param string $file 573 * @return void 574 */ 575 self::$includeFile = \Closure::bind(static function($file) { 576 include $file; 577 }, null, null); 578 } 558 579 } 559 560 /**561 * Scope isolated include.562 *563 * Prevents access to $this/self from included files.564 *565 * @param string $file566 * @return void567 * @private568 */569 function includeFile($file)570 {571 include $file;572 } -
podcast-importer-secondline/trunk/lib/action-scheduler/vendor/composer/InstalledVersions.php
r3016908 r3263883 99 99 foreach (self::getInstalled() as $installed) { 100 100 if (isset($installed['versions'][$packageName])) { 101 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);101 return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; 102 102 } 103 103 } … … 120 120 public static function satisfies(VersionParser $parser, $packageName, $constraint) 121 121 { 122 $constraint = $parser->parseConstraints( $constraint);122 $constraint = $parser->parseConstraints((string) $constraint); 123 123 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 124 124 … … 329 329 $installed[] = self::$installedByVendor[$vendorDir]; 330 330 } elseif (is_file($vendorDir.'/composer/installed.php')) { 331 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; 331 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 332 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 333 335 self::$installed = $installed[count($installed) - 1]; … … 341 343 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 342 344 if (substr(__DIR__, -8, 1) !== 'C') { 343 self::$installed = require __DIR__ . '/installed.php'; 345 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 346 $required = require __DIR__ . '/installed.php'; 347 self::$installed = $required; 344 348 } else { 345 349 self::$installed = array(); 346 350 } 347 351 } 348 $installed[] = self::$installed; 352 353 if (self::$installed !== array()) { 354 $installed[] = self::$installed; 355 } 349 356 350 357 return $installed; -
podcast-importer-secondline/trunk/lib/action-scheduler/vendor/composer/autoload_real.php
r3136104 r3263883 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 0ed398af1bd918658290810d69e2ba715 class ComposerAutoloaderInit81fd3951ccfed0a222e6f4b949998df1 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 0ed398af1bd918658290810d69e2ba71', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit81fd3951ccfed0a222e6f4b949998df1', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 0ed398af1bd918658290810d69e2ba71', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit81fd3951ccfed0a222e6f4b949998df1', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 0ed398af1bd918658290810d69e2ba71::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit81fd3951ccfed0a222e6f4b949998df1::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
podcast-importer-secondline/trunk/lib/action-scheduler/vendor/composer/autoload_static.php
r3136104 r3263883 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 0ed398af1bd918658290810d69e2ba717 class ComposerStaticInit81fd3951ccfed0a222e6f4b949998df1 8 8 { 9 9 public static $classMap = array ( … … 14 14 { 15 15 return \Closure::bind(function () use ($loader) { 16 $loader->classMap = ComposerStaticInit 0ed398af1bd918658290810d69e2ba71::$classMap;16 $loader->classMap = ComposerStaticInit81fd3951ccfed0a222e6f4b949998df1::$classMap; 17 17 18 18 }, null, ClassLoader::class); -
podcast-importer-secondline/trunk/lib/action-scheduler/vendor/composer/installed.php
r3136104 r3263883 2 2 'root' => array( 3 3 'name' => 'woocommerce/action-scheduler', 4 'pretty_version' => 'dev-release/3. 8.1',5 'version' => 'dev-release/3. 8.1',6 'reference' => 'e 331b534d7de10402d7545a0de50177b874c0779',4 'pretty_version' => 'dev-release/3.9.2', 5 'version' => 'dev-release/3.9.2', 6 'reference' => 'efbb7953f72a433086335b249292f280dd43ddfe', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'woocommerce/action-scheduler' => array( 14 'pretty_version' => 'dev-release/3. 8.1',15 'version' => 'dev-release/3. 8.1',16 'reference' => 'e 331b534d7de10402d7545a0de50177b874c0779',14 'pretty_version' => 'dev-release/3.9.2', 15 'version' => 'dev-release/3.9.2', 16 'reference' => 'efbb7953f72a433086335b249292f280dd43ddfe', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
podcast-importer-secondline/trunk/lib/action-scheduler/vendor/composer/platform_check.php
r3016908 r3263883 5 5 $issues = array(); 6 6 7 if (!(PHP_VERSION_ID >= 50600)) {8 $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';7 if (!(PHP_VERSION_ID >= 70100)) { 8 $issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.0". You are running ' . PHP_VERSION . '.'; 9 9 } 10 10 -
podcast-importer-secondline/trunk/podcast-importer-secondline.php
r3136104 r3263883 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. 15 * Version: 1.5.2 6 6 * Author: SecondLineThemes 7 7 * Author URI: https://secondlinethemes.com/ … … 15 15 die; 16 16 17 define( 'PODCAST_IMPORTER_SECONDLINE_VERSION', '1.5. 1' );17 define( 'PODCAST_IMPORTER_SECONDLINE_VERSION', '1.5.2' ); 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
r3136104 r3263883 4 4 Tags: podcast, import, feed, rss, episodes 5 5 Requires at least: 4.8 6 Tested up to: 6. 66 Tested up to: 6.8 7 7 Requires PHP: 7.1 8 8 Stable tag: trunk … … 68 68 69 69 == Changelog == 70 71 = 1.5.2 = 72 * Fix: Support multiple feeds that share the same title. 73 * Updated: Action Scheduler version. 74 * Updated: Compatibility with WordPress 6.8. 70 75 71 76 = 1.5.1 =
Note: See TracChangeset
for help on using the changeset viewer.