Skip to content

Enhance Cron Schedule for Campaign Based#45

Merged
kawsarahmedr merged 11 commits into
masterfrom
enhance/cron
May 31, 2026
Merged

Enhance Cron Schedule for Campaign Based#45
kawsarahmedr merged 11 commits into
masterfrom
enhance/cron

Conversation

@kawsarahmedr
Copy link
Copy Markdown
Member

@kawsarahmedr kawsarahmedr commented May 25, 2026

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:

  • Added support for selecting campaign frequency (e.g., hourly, daily) directly in the add/edit campaign forms, storing this value per campaign and using it to schedule cron jobs accordingly. [1] [2] [3] [4] [5] [6] [7]
  • Removed the old global campaign frequency setting and its UI from the general settings, ensuring that frequency is now campaign-specific. [1] [2]

Plugin Update and Installation Refactor:

  • Introduced a new Installer class 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.
  • Changed the activation hook to use Installer::install and refactored version management, moving version retrieval to a new get_version method.
  • Ensured the Installer class is initialized on plugin load for update checks and migrations.

Campaign Execution Logic:

  • Simplified the campaign run logic by consolidating multiple cron calls into a single Cron::process_campaign method, streamlining instant campaign execution.

Code Quality and Compatibility:

  • Replaced usage of str_contains with strpos for better compatibility with older PHP versions. [1] [2] [3]
  • Minor doc and comment improvements for clarity and consistency. [1] [2]

Version Update:

  • Updated plugin version to 2.2.5 in all relevant locations. [1] [2]

@kawsarahmedr kawsarahmedr self-assigned this May 25, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Installer for 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.

Comment thread includes/functions.php
Comment thread includes/functions.php
Comment thread includes/functions.php
Comment thread includes/Cron.php
Comment thread includes/Cron.php
Comment thread includes/Cron.php
Comment thread includes/Installer.php
Comment thread includes/Installer.php
Comment thread includes/Admin/Actions.php
Comment thread includes/Admin/Actions.php
@kawsarahmedr kawsarahmedr merged commit 83c24d5 into master May 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants