This commit is contained in:
Javier Casares 2026-02-18 15:26:06 +00:00
commit 1e78bb1378
8 changed files with 181 additions and 22 deletions

View file

@ -487,20 +487,52 @@ class Settings_Page {
*/
public function render_worker_section() {
$worker_path = ROBOTSTXT_SMTP_NEWSLETTER_PATH . 'worker.php';
$is_multisite = is_multisite();
$site_url = get_site_url();
?>
<div class="notice notice-info inline">
<p><strong><?php esc_html_e( 'Important: Queue Processing', 'robotstxt-smtp-newsletter' ); ?></strong></p>
<p><?php esc_html_e( 'Newsletter emails are now queued to the database and require a worker process to send them.', 'robotstxt-smtp-newsletter' ); ?></p>
<h4><?php esc_html_e( 'Single Worker Command', 'robotstxt-smtp-newsletter' ); ?></h4>
<code style="display:block; padding:10px; background:#f5f5f5; overflow-x:auto; margin:10px 0; font-family:monospace;">
php <?php echo esc_html( $worker_path ); ?> 10 "w1"
</code>
<?php if ( $is_multisite ) : ?>
<div style="background:#fff3cd; border-left:4px solid #ffc107; padding:10px; margin:15px 0;">
<p style="margin:0;">
<strong><?php esc_html_e( 'MultiSite Detected:', 'robotstxt-smtp-newsletter' ); ?></strong>
<?php esc_html_e( 'This WordPress installation is running in MultiSite mode. Worker commands must include the --url parameter to specify which site to process.', 'robotstxt-smtp-newsletter' ); ?>
</p>
</div>
<h4><?php esc_html_e( 'Parallel Processing (10 workers)', 'robotstxt-smtp-newsletter' ); ?></h4>
<code style="display:block; padding:10px; background:#f5f5f5; overflow-x:auto; margin:10px 0; font-family:monospace;">
seq 1 10 | xargs -P10 -I{} php <?php echo esc_html( $worker_path ); ?> 10 "w{}"
</code>
<h4><?php esc_html_e( 'Single Worker Command (MultiSite)', 'robotstxt-smtp-newsletter' ); ?></h4>
<code style="display:block; padding:10px; background:#f5f5f5; overflow-x:auto; margin:10px 0; font-family:monospace;">
php <?php echo esc_html( $worker_path ); ?> 10 "w1" --url="<?php echo esc_html( $site_url ); ?>"
</code>
<h4><?php esc_html_e( 'Parallel Processing (10 workers) - MultiSite', 'robotstxt-smtp-newsletter' ); ?></h4>
<code style="display:block; padding:10px; background:#f5f5f5; overflow-x:auto; margin:10px 0; font-family:monospace;">
seq 1 10 | xargs -P10 -I{} php <?php echo esc_html( $worker_path ); ?> 10 "w{}" --url="<?php echo esc_html( $site_url ); ?>"
</code>
<p style="margin-top:10px; color:#856404;">
<strong><?php esc_html_e( 'Note:', 'robotstxt-smtp-newsletter' ); ?></strong>
<?php
printf(
/* translators: %s: site URL */
esc_html__( 'The commands above are configured for the current site: %s', 'robotstxt-smtp-newsletter' ),
'<code>' . esc_html( $site_url ) . '</code>'
);
?>
</p>
<?php else : ?>
<h4><?php esc_html_e( 'Single Worker Command', 'robotstxt-smtp-newsletter' ); ?></h4>
<code style="display:block; padding:10px; background:#f5f5f5; overflow-x:auto; margin:10px 0; font-family:monospace;">
php <?php echo esc_html( $worker_path ); ?> 10 "w1"
</code>
<h4><?php esc_html_e( 'Parallel Processing (10 workers)', 'robotstxt-smtp-newsletter' ); ?></h4>
<code style="display:block; padding:10px; background:#f5f5f5; overflow-x:auto; margin:10px 0; font-family:monospace;">
seq 1 10 | xargs -P10 -I{} php <?php echo esc_html( $worker_path ); ?> 10 "w{}"
</code>
<?php endif; ?>
<p style="margin-top:15px;">
<strong><?php esc_html_e( 'Recommended Setup:', 'robotstxt-smtp-newsletter' ); ?></strong>