Enhance Cron Schedule for Campaign Based#45
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the AI Content Writer plugin to support campaign-specific scheduling (frequency stored per campaign) and refactors cron execution and upgrade/install logic to accommodate the new scheduling model, along with version bumps to 2.2.5.
Changes:
- Add per-campaign frequency selection in add/edit campaign UI and persist it in campaign meta.
- Refactor cron execution into a per-campaign processing pipeline and introduce an
Installerfor activation/update migrations. - Bump plugin version to 2.2.5 and update i18n/readme metadata accordingly.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| readme.txt | Stable tag bump + changelog entry for 2.2.5. |
| package.json | Version bumped to 2.2.5. |
| package-lock.json | Lockfile version bumped to 2.2.5. |
| languages/ai-content-writer.pot | POT regenerated for new strings/line offsets. |
| includes/Plugin.php | Activation hook moved to Installer::install; adds get_version(); initializes Installer on load. |
| includes/Installer.php | New installer/updater with 2.2.5 migration and cron cleanup. |
| includes/functions.php | Adjust title-lookup helpers, campaign update calculations, adds campaign frequency list helper. |
| includes/Cron.php | Major cron refactor: per-campaign scheduling + pipeline processing. |
| includes/Campaigns/Articles.php | Replace str_contains with strpos for PHP compatibility. |
| includes/Admin/views/edit-campaign.php | Add frequency selector to edit campaign UI. |
| includes/Admin/views/add-campaign.php | Add frequency selector to add campaign UI. |
| includes/Admin/Settings.php | Remove legacy global “campaign frequency” setting UI. |
| includes/Admin/Actions.php | Save per-campaign frequency meta and schedule campaign cron on add/edit/run. |
| ai-content-writer.php | Version bump + plugin instance version updated to 2.2.5. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance Cron Schedule for Campaign-Based
This pull request introduces significant improvements to campaign scheduling and plugin updates in the AI Content Writer plugin. The main focus is on allowing users to set campaign frequencies directly per campaign, refactoring the update/installation logic for better maintainability, and improving code compatibility and clarity. It also removes legacy global campaign frequency settings and related UI, and updates the plugin version to 2.2.5.
Campaign Frequency and Scheduling:
Plugin Update and Installation Refactor:
Installerclass to handle plugin installation and versioned updates, including migration of campaign frequency meta and cleanup of old scheduled hooks during the 2.2.5 upgrade.Installer::installand refactored version management, moving version retrieval to a newget_versionmethod.Installerclass is initialized on plugin load for update checks and migrations.Campaign Execution Logic:
Cron::process_campaignmethod, streamlining instant campaign execution.Code Quality and Compatibility:
str_containswithstrposfor better compatibility with older PHP versions. [1] [2] [3]Version Update: