diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bb39f7..444c8fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,14 @@ jobs: matrix: php-version: [ "8.3", "8.4" ] + # Redis for the RedisQueue tests (atomic pop, parallel workers). + services: + redis: + image: redis:7-alpine + ports: + - 6379:6379 + options: --health-cmd="redis-cli ping" --health-interval=5s --health-timeout=3s --health-retries=5 + steps: - name: Checkout uses: actions/checkout@v4 @@ -26,6 +34,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} + extensions: redis coverage: pcov tools: composer:v2 @@ -43,8 +52,18 @@ jobs: - name: Validate composer.json run: composer validate --no-check-all --no-check-lock - - name: Run Unit tests + - name: Run Unit tests (phpredis) run: ./vendor/bin/pest tests/Unit + env: + WP_QUEUE_TEST_REDIS_HOST: 127.0.0.1 + WP_QUEUE_TEST_REDIS_PORT: 6379 + + - name: Run Redis tests (Predis) + run: ./vendor/bin/pest tests/Unit/RedisQueueTest.php --no-coverage + env: + WP_QUEUE_TEST_REDIS_CLIENT: predis + WP_QUEUE_TEST_REDIS_HOST: 127.0.0.1 + WP_QUEUE_TEST_REDIS_PORT: 6379 e2e: name: E2E Tests (WordPress ${{ matrix.wordpress-version }}) diff --git a/README.md b/README.md index 8c2d6fb..6b3a6d7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ ## Features - 🚀 **Laravel-style API** — Clean, fluent job dispatching with PHP 8 attributes -- 📦 **Multiple Drivers** — Database, Redis, Memcached, Sync (auto-detection) +- 📦 **Multiple Drivers** — Database, Redis, Memcached; runner (daemon, loopback, WP-Cron, sync) chosen in the admin or picked automatically - 🔄 **Auto Retries** — Exponential backoff for failed jobs - ⏰ **Scheduling** — Cron-like job scheduling - 👁️ **WP-Cron Monitor** — View, run, pause, resume, edit cron events @@ -288,25 +288,37 @@ POST /wp-json/wp-queue/v1/cron/delete GET /wp-json/wp-queue/v1/system ``` -## Queue Drivers +## Queue Drivers and Runners -WP Queue supports multiple storage backends: +Two independent settings, both chosen in **Queues → Drivers** and **System → Status** (or with `wp queue config`): + +* **Storage driver** — where jobs are kept. +* **Runner** — what executes them. Exactly one runner is active; the others register no hooks and send no requests. | Driver | Description | Requirements | |--------|-------------|-------------| -| `database` | Uses wp_options table (default) | None | -| `redis` | Redis server | phpredis extension | -| `memcached` | Memcached server | memcached extension | -| `sync` | Synchronous execution | None | -| `auto` | Auto-detect best available | None | +| `database` | `{prefix}queue_jobs` table, atomic claim (default) | None | +| `redis` | Lua scripts: atomic claim, delayed/reserved sets, crash recovery | phpredis or Predis (Redis Object Cache) | +| `memcached` | Not recommended: jobs can't be listed or moved | memcached extension | + +| Runner | How jobs start | +|--------|----------------| +| `auto` (default) | Fastest available: `daemon` if its heartbeat is fresh (< 10 min), else `loopback`, `wp_cron`, `sync`. The admin shows the actual runner and why | +| `daemon` | System cron or a daemon runs `wp queue work --all` (crontab line and heartbeat are shown in the admin) | +| `loopback` | Non-blocking POST to `admin-ajax.php` after dispatch (like Action Scheduler) | +| `wp_cron` | `wp_queue_process` WP-Cron event | +| `sync` | At the end of the request that dispatched the job | + +Switching the driver with **Make active** moves waiting jobs (ready and delayed) to the new backend under the global worker lock; it is refused while jobs are being executed. ### Configuration -Add to `wp-config.php`: +Precedence: constant in `wp-config.php` → plugin option → default. ```php -// Select queue driver -define('WP_QUEUE_DRIVER', 'redis'); // or 'memcached', 'database', 'sync', 'auto' +define('WP_QUEUE_DRIVER', 'redis'); // database | redis | memcached +define('WP_QUEUE_RUNNER', 'daemon'); // auto | daemon | loopback | wp_cron | sync +// Legacy, still honoured: WP_QUEUE_RUNTIME_MODE ('daemon' | 'cron_loopback'), WP_QUEUE_LOOPBACK (false disables loopback) // Redis settings (compatible with redis-cache plugin) define('WP_REDIS_HOST', 'redis'); // or '127.0.0.1' @@ -320,6 +332,25 @@ define('WP_MEMCACHED_HOST', '127.0.0.1'); define('WP_MEMCACHED_PORT', 11211); ``` +A constant anywhere in `wp-config.php` locks the setting in the admin ("set in wp-config.php"). Constants inside the plugin's own block stay editable from the admin: + +```php +// BEGIN WP Queue +// Managed by WP Queue (Tools > Queues). Edit in the admin or here. +define('WP_QUEUE_DRIVER', 'redis'); +// END WP Queue +``` + +The plugin rewrites only this block: temp file + atomic rename, owner and permissions preserved, backup, PHP syntax check and a WordPress load check over HTTP; on failure the backup is restored. If the file is not writable, the admin shows the block to paste manually. Requires `manage_options`; every form has a nonce. + +```bash +wp queue config # show driver, runner, reason, heartbeat +wp queue config --driver=redis --store=wp-config # move jobs, save in the WP Queue block +wp queue config --runner=daemon # save in the plugin option +``` + +See [docs/runners-and-drivers.md](docs/runners-and-drivers.md) for details. + ### Programmatic Configuration ```php diff --git a/README.ru.md b/README.ru.md index 430dce4..7e1e13e 100644 --- a/README.ru.md +++ b/README.ru.md @@ -32,7 +32,7 @@ ## Возможности - 🚀 **API в стиле Laravel** — Чистый, fluent API для отправки задач с атрибутами PHP 8 -- 📦 **Несколько драйверов** — Database, Redis, Memcached, Sync (автоопределение) +- 📦 **Несколько драйверов** — Database, Redis, Memcached; обработчик (daemon, loopback, WP-Cron, sync) выбирается в админке или автоматически - 🔄 **Автоматические повторы** — Экспоненциальная задержка для неудачных задач - ⏰ **Планирование** — Cron-подобное планирование задач - 👁️ **Монитор WP-Cron** — Просмотр, запуск, пауза, возобновление, редактирование cron событий @@ -288,25 +288,37 @@ POST /wp-json/wp-queue/v1/cron/delete GET /wp-json/wp-queue/v1/system ``` -## Драйверы очередей +## Драйверы и обработчики очередей -WP Queue поддерживает несколько бэкендов хранения: +Две независимые настройки, обе выбираются в **Очереди → Драйверы** и **Система → Состояние** (или `wp queue config`): + +* **Драйвер хранения** — где лежат задачи. +* **Обработчик** — кто их выполняет. Активен ровно один; остальные не регистрируют хуки и не шлют запросы. | Драйвер | Описание | Требования | |---------|---------|-----------| -| `database` | Использует таблицу wp_options (по умолчанию) | Нет | -| `redis` | Сервер Redis | расширение phpredis | -| `memcached` | Сервер Memcached | расширение memcached | -| `sync` | Синхронное выполнение | Нет | -| `auto` | Автоопределение лучшего доступного | Нет | +| `database` | Таблица `{prefix}queue_jobs`, атомарный захват (по умолчанию) | Нет | +| `redis` | Lua-скрипты: атомарный захват, отложенные/зарезервированные, восстановление после падения воркера | phpredis или Predis (Redis Object Cache) | +| `memcached` | Не рекомендуется: задачи нельзя перечислить и перенести | расширение memcached | + +| Обработчик | Как запускаются задачи | +|------------|------------------------| +| `auto` (по умолчанию) | Самый быстрый доступный: `daemon`, если свежий heartbeat (< 10 мин), иначе `loopback`, `wp_cron`, `sync`. В админке видно фактический обработчик и причину | +| `daemon` | Системный cron или демон запускает `wp queue work --all` (строка crontab и heartbeat видны в админке) | +| `loopback` | Неблокирующий POST в `admin-ajax.php` после dispatch (как Action Scheduler) | +| `wp_cron` | Событие WP-Cron `wp_queue_process` | +| `sync` | В конце запроса, который поставил задачу | + +Кнопка **Сделать активным** переносит ожидающие задачи (готовые и отложенные) в новый бэкенд под глобальной блокировкой воркера; пока задачи выполняются, переключение отклоняется. ### Конфигурация -Добавьте в `wp-config.php`: +Приоритет: константа в `wp-config.php` → опция плагина → значение по умолчанию. ```php -// Выбор драйвера очереди -define('WP_QUEUE_DRIVER', 'redis'); // или 'memcached', 'database', 'sync', 'auto' +define('WP_QUEUE_DRIVER', 'redis'); // database | redis | memcached +define('WP_QUEUE_RUNNER', 'daemon'); // auto | daemon | loopback | wp_cron | sync +// Старые константы работают: WP_QUEUE_RUNTIME_MODE ('daemon' | 'cron_loopback'), WP_QUEUE_LOOPBACK (false — выключить loopback) // Настройки Redis (совместимо с плагином redis-cache) define('WP_REDIS_HOST', 'redis'); // или '127.0.0.1' @@ -320,6 +332,25 @@ define('WP_MEMCACHED_HOST', '127.0.0.1'); define('WP_MEMCACHED_PORT', 11211); ``` +Константа в любом месте `wp-config.php` блокирует настройку в админке («задано в wp-config.php»). Константы внутри собственного блока плагина остаются редактируемыми из админки: + +```php +// BEGIN WP Queue +// Managed by WP Queue (Tools > Queues). Edit in the admin or here. +define('WP_QUEUE_DRIVER', 'redis'); +// END WP Queue +``` + +Плагин переписывает только этот блок: временный файл + атомарный rename, владелец и права сохраняются, бэкап, проверка синтаксиса PHP и загрузки WordPress по HTTP; при ошибке бэкап восстанавливается. Если файл недоступен для записи, админка показывает блок для ручной вставки. Нужны права `manage_options`, во всех формах nonce. + +```bash +wp queue config # драйвер, обработчик, причина, heartbeat +wp queue config --driver=redis --store=wp-config # перенести задачи, сохранить в блоке WP Queue +wp queue config --runner=daemon # сохранить в опции плагина +``` + +Подробнее: [docs/runners-and-drivers.md](docs/runners-and-drivers.md). + ### Программная конфигурация ```php diff --git a/composer.json b/composer.json index d288046..e93c81a 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,8 @@ "laravel/pint": "^1.18", "mockery/mockery": "^1.6", "brain/monkey": "^2.6", - "yoast/phpunit-polyfills": "^3.0" + "yoast/phpunit-polyfills": "^3.0", + "predis/predis": "^2.2" }, "autoload": { "psr-4": { @@ -59,4 +60,4 @@ }, "minimum-stability": "stable", "prefer-stable": true -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index 26a4d21..b235dcf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d65f241d25ca49fce5d3e883e193b676", + "content-hash": "0d660a5d7e61313a38800f6bab5d4e82", "packages": [], "packages-dev": [ { @@ -2071,6 +2071,69 @@ ], "time": "2025-08-16T05:19:02+00:00" }, + { + "name": "predis/predis", + "version": "v2.4.1", + "source": { + "type": "git", + "url": "https://github.com/predis/predis.git", + "reference": "07105e050622ed80bd60808367ced9e379f31530" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/predis/predis/zipball/07105e050622ed80bd60808367ced9e379f31530", + "reference": "07105e050622ed80bd60808367ced9e379f31530", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.3", + "phpstan/phpstan": "^1.9", + "phpunit/phpcov": "^6.0 || ^8.0", + "phpunit/phpunit": "^8.0 || ^9.4" + }, + "suggest": { + "ext-relay": "Faster connection with in-memory caching (>=0.6.2)" + }, + "type": "library", + "autoload": { + "psr-4": { + "Predis\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Till Krüss", + "homepage": "https://till.im", + "role": "Maintainer" + } + ], + "description": "A flexible and feature-complete Redis/Valkey client for PHP.", + "homepage": "http://github.com/predis/predis", + "keywords": [ + "nosql", + "predis", + "redis" + ], + "support": { + "issues": "https://github.com/predis/predis/issues", + "source": "https://github.com/predis/predis/tree/v2.4.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tillkruss", + "type": "github" + } + ], + "time": "2025-11-12T18:00:11+00:00", + "published-time": "2025-11-12T18:01:06+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -4314,5 +4377,5 @@ "php": ">=8.3" }, "platform-dev": {}, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.11.0" } diff --git a/docs/runners-and-drivers.md b/docs/runners-and-drivers.md new file mode 100644 index 0000000..966654e --- /dev/null +++ b/docs/runners-and-drivers.md @@ -0,0 +1,73 @@ +# Драйверы и обработчики очередей (1.4.0) + +## Резюме + +Раньше выбор был размазан: `sync` числился драйвером, режим работы задавался только константами +(`WP_QUEUE_RUNTIME_MODE`, `WP_QUEUE_LOOPBACK`), а при каждом dispatch одновременно могли сработать +WP-Cron, `spawn_cron()` и loopback. С 1.4.0: + +* **Драйвер** — только хранилище: `database` (по умолчанию), `redis`, `memcached`. +* **Обработчик** — ровно один из `daemon`, `loopback`, `wp_cron`, `sync`; по умолчанию `auto`. + Невыбранные обработчики не регистрируют хуки (`wp_queue_process`, `wp_ajax_nopriv_wp_queue_loopback`) + и не шлют запросов. Глобальная блокировка воркера из 1.3.0 остаётся страховкой. +* `auto`: `daemon`, если heartbeat `wp queue work` свежее 10 минут; иначе `loopback` + (если проверка admin-ajax не провалилась и loopback не выключен константой), затем `wp_cron` + (если нет `DISABLE_WP_CRON`), затем `sync`. В админке показан фактический обработчик и причина. +* `wp queue work` в ручном режиме `loopback`/`wp_cron`/`sync` пропускает работу (только записывает heartbeat), + `--force` — обработать всё равно. + +## Где хранится выбор + +Приоритет: константа → опция `wp_queue_settings` → значение по умолчанию. + +| Источник | Как выглядит в админке | +|----------|-----------------------| +| Константа вне блока плагина | поле заблокировано, «задано в wp-config.php» | +| Константа в блоке `// BEGIN WP Queue … // END WP Queue` | редактируется из админки, плагин переписывает блок | +| Опция | «выбрано в админке» | + +Константы: `WP_QUEUE_DRIVER`, `WP_QUEUE_RUNNER`; старые `WP_QUEUE_RUNTIME_MODE` (`daemon`, `cron_loopback`) +и `WP_QUEUE_LOOPBACK=false` продолжают работать. + +Запись блока (`ConfigFile::write`): только имена `WP_QUEUE_*`, значения экранируются; временный файл +рядом с wp-config.php, сохранение владельца/группы/прав (иначе отказ), проверка синтаксиса, +атомарный `rename`, сброс opcache, проверка загрузки WordPress через admin-ajax (`wp_queue_config_probe` +с одноразовым токеном). При ошибке — откат из бэкапа, при успехе бэкап удаляется. Если файл или каталог +недоступен для записи (или wp-config смонтирован read-only), админка показывает блок для ручной вставки. +Все действия — `manage_options` + nonce. + +## Смена драйвера + +Решение: **переносить задачи**, а не запрещать смену при непустой очереди — на живом сайте очередь +почти никогда не пуста, запрет сделал бы переключение невозможным. + +* Перенос (`DriverSwitcher`) идёт под глобальной блокировкой воркера; если воркер работает или есть + зарезервированные задачи — отказ «попробуйте через минуту». +* Переносятся готовые и отложенные задачи (остаток задержки сохраняется), пачками по 200; при ошибке + задачи возвращаются обратно. +* Задачи, которые параллельные запросы успели положить в старый драйвер, воркер дотягивает в течение суток + (`wp_queue_previous_driver`). +* Memcached не умеет перечислять задачи, поэтому уйти с него можно только при пустой очереди. + +## Redis + +Драйвер переписан на Lua-скриптах: `ready` list, `delayed` и `reserved` zset, `data` hash. +POP атомарно переносит созревшие отложенные и зависшие (> 300 с) зарезервированные задачи и резервирует +одну. Работает через phpredis и Predis (Redis Object Cache). Старые ключи `jobs:{queue}` импортируются. +Тест: 4 параллельных процесса × 120 задач — каждая выполнена ровно один раз. + +## Прочее + +* Проверка loopback в «Состоянии» теперь ходит в admin-ajax (`wp_queue_ping`), а не в wp-cron.php + (раньше она запускала все просроченные события WP-Cron). +* В списке очередей видны все известные очереди, включая пустые (реестр `wp_queue_known_queues` + логи). +* В режиме `wp_cron` из WP-CLI `spawn_cron()` не вызывается (запрос терялся, а его блокировка держала WP-Cron минуту). +* Loopback: после серии dispatch в одном запросе воркер «пинается» ещё раз на shutdown. + +## План проверки + +1. Unit: phpredis и Predis с Redis, без Redis (CI: сервис redis:7). +2. Тестовый стенд WordPress + MySQL + Redis: «Сделать активным» Redis с записью блока в wp-config, + перенос 255 задач, откат на Database (файл побайтно совпал с исходным); auto → daemon / loopback / + wp_cron; ручной WP-Cron и sync; в режиме daemon нет loopback и wp-cron запросов. +3. Прод rwsite: Database + daemon (системный cron), константы перенесены в опцию. diff --git a/languages/wp-queue-ru_RU.l10n.php b/languages/wp-queue-ru_RU.l10n.php index b8e0123..38e350c 100644 --- a/languages/wp-queue-ru_RU.l10n.php +++ b/languages/wp-queue-ru_RU.l10n.php @@ -2,4 +2,4 @@ declare(strict_types=1); -return ['project-id-version' => 'WP Queue 1.0.0', 'report-msgid-bugs-to' => 'https://github.com/rwsite/wp-queue/issues', 'pot-creation-date' => '2025-12-06 01:35+0000', 'po-revision-date' => '2026-07-25 21:14+0000', 'last-translator' => '', 'language-team' => 'Русский', 'language' => 'ru_RU', 'mime-version' => '1.0', 'content-type' => 'text/plain; charset=UTF-8', 'content-transfer-encoding' => '8bit', 'plural-forms' => 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);', 'x-generator' => 'Loco https://localise.biz/', 'x-loco-version' => '2.8.0; wp-6.9; php-8.3.28', 'messages' => ['%d entries' => '%d записей', '%d tasks' => '%d задач', '(configured)' => '(настроено)', '--memory limits the PHP memory for the worker process. Adjust the value to your needs.' => '--memory ограничивает память PHP для процесса воркера. Подберите значение под свои задачи.', '1. Enable daemon runtime mode' => '1. Включите режим демона', '2. Run the worker' => '2. Запустите воркер', '3. Keep it running' => '3. Держите процесс запущенным', '4. Check status' => '4. Проверьте статус', 'A background process (Worker) constantly checks the queue for new jobs.' => 'Фоновый процесс (Worker) постоянно проверяет очередь на наличие новых заданий.', 'A daemon worker is expected to process queues. WP-Cron and loopback are disabled.' => 'Для обработки очередей ожидается демон-воркер. WP-Cron и loopback отключены.', 'A list of all active queues with their size, status (idle/pending/running/paused), and control buttons (pause/resume, clear all tasks).' => 'Список всех активных очередей с указанием их размера, статуса (простой/ожидание/выполнение/приостановка) и кнопок управления (пауза/возобновление, очистить все задачи).', 'A plugin creates a "Job" (a task) and pushes it to the queue.' => 'Плагин создает «Задание» (задачу) и помещает его в очередь.', 'A real cron job configured on your server (Linux) that calls WordPress every minute. This is reliable and precise. Ideally, you should disable default WP-Cron and use System Cron.' => 'На вашем сервере (Linux) должна быть настроена настоящая задача cron, которая будет запускать WordPress каждую минуту. Это надежно и точно. В идеале следует отключить стандартный WP-Cron и использовать системный Cron.', 'A separate table for events that are temporarily disabled.' => 'Отдельная таблица для событий, которые временно отключены.', 'A table of all available intervals (hourly, daily, etc.) with their duration.' => 'Таблица со всеми доступными интервалами (почасовыми, суточным и т. д.) и их продолжительностью.', 'About WP Queue' => 'О WP Queue', 'Action completed successfully' => 'Действие успешно завершено.', 'Action Scheduler' => 'Планировщик действий', 'Actions' => 'Действия', 'Active' => 'Активный', 'Add this to wp-config.php:' => 'Добавьте в wp-config.php:', 'Add to wp-config.php:' => 'Добавьте в файл wp-config.php:', 'ago (overdue)' => 'давно (просрочено)', 'Aleksei Tikhomirov' => 'Алексей Тихомиров', 'All' => 'Все', 'All queues' => 'Все очереди', 'All systems are healthy.' => 'Все системы работают исправно.', 'Alternate Cron' => 'Альтернативный Cron', 'An error occurred' => 'Произошла ошибка.', 'Are you sure you want to clear this queue?' => 'Вы уверены, что хотите очистить эту очередь?', 'Attempts' => 'Попытки', 'Author Website' => 'Веб-сайт автора', 'Available From' => 'Доступно с', 'Background job processing and WP-Cron management for WordPress. Schedule tasks, manage queues, and monitor cron events.' => 'Обработка фоновых задач и управление WP-Cron для WordPress. Планируйте задачи, управляйте очередями и отслеживайте cron-события.', 'Basic Usage' => 'Основные правила использования', 'Button to delete old log entries to avoid cluttering the database.' => 'Кнопка для удаления старых записей журнала во избежание засорения базы данных.', 'Buttons to show all entries, only completed, or only failed jobs.' => 'Кнопки для отображения всех записей, только завершенных или только неудачно завершенных заданий.', 'By default, WordPress executes all actions during the page load request. If a plugin needs to send 100 emails or sync 500 products with an external API, the user has to wait until it finishes. This leads to slow page loads or timeouts.' => 'По умолчанию WordPress выполняет все действия во время запроса на загрузку страницы. Если плагину необходимо отправить 100 электронных писем или синхронизировать 500 товаров с внешним API, пользователю приходится ждать завершения процесса. Это приводит к медленной загрузке страниц или таймаутам.', 'By default, WP Queue stores jobs in the WordPress database (wp_options or custom tables). For high-performance sites, you can use Redis. Redis is an in-memory data store that is much faster than a SQL database for queue operations. It reduces load on your database and speeds up job processing.' => 'По умолчанию WP Queue хранит задания в базе данных WordPress (в папке wp_options или в пользовательских таблицах). Для высокопроизводительных сайтов можно использовать Redis. Redis — это хранилище данных в оперативной памяти, которое намного быстрее, чем база данных SQL, при работе с очередями. Оно снижает нагрузку на базу данных и ускоряет обработку заданий.', 'Cancel' => 'Отмена', 'Cannot connect to Memcached at %s:%d - %s' => 'Не удалось подключиться к Memcached на %s:%d - %s', 'Cannot connect to Redis at %s:%d - %s' => 'Не удалось подключиться к Redis на %s:%d - %s', 'Check basic system requirements that affect queue stability.' => 'Проверьте основные системные требования, влияющие на стабильность очереди.', 'Check driver settings.' => 'Проверьте настройки драйвера.', 'Check logs when encountering errors in background processes.' => 'При обнаружении ошибок в фоновых процессах проверяйте журналы.', 'Check this tab when setting up your server or debugging queue issues.' => 'Проверьте эту вкладку при настройке сервера или отладке проблем с очередями.', 'Checking for disablement (DISABLE_WP_CRON), alternative cron, loopback requests.' => 'Проверка на отключение (DISABLE_WP_CRON), альтернативный cron, запросы обратной связи.', 'Checking system requirements and environment for stable queue operation.' => 'Проверка системных требований и среды для обеспечения стабильной работы очереди.', 'Clear' => 'Очистить', 'Clear All' => 'Очистить все', 'Clear All Logs' => 'Очистить все журналы', 'Clear All Queues' => 'Очистить все очереди', 'Clear Logs' => 'Очистить журналы', 'Clear logs' => 'Очистить журналы', 'Clear old' => 'Удалить старые', 'Close' => 'Закрыть', 'Comparison of server time, WordPress, and GMT offset for diagnosing scheduling issues.' => 'Сравнение серверного времени, времени WordPress и смещения GMT для диагностики проблем с планированием.', 'Completed' => 'Завершенные', 'Component Status' => 'Состояние компонента', 'Configure' => 'Настройка', 'Configure automatic retries on errors:' => 'Настройте автоматическое повторение попыток при возникновении ошибок:', 'Configure Memcached' => 'Настройка Memcached', 'Configure Redis' => 'Настройка Redis', 'Configure system cron' => 'Настройте системный cron.', 'Connected to Memcached at %s:%d' => 'Подключено к Memcached на %s:%d', 'Connected to Redis at %s:%d (phpredis)' => 'Подключено к Redis по адресу %s:%d (phpredis)', 'Connected to Redis at %s:%d (Predis)' => 'Подключено к Redis по адресу %s:%d (Predis)', 'Connected to Redis at %s:%d (via redis-cache plugin)' => 'Подключено к Redis по адресу %s:%d (через плагин redis-cache)', 'Create a job class and dispatch it to the queue:' => 'Создайте класс задания и отправьте его в очередь:', 'Critical for understanding why tasks are not running on time.' => 'Это крайне важно для понимания причин, по которым задачи не выполняются в срок.', 'Cron event paused' => 'Cron-событие приостановлено', 'Cron event resumed' => 'Cron-событие возобновлено', 'Cron event updated' => 'Cron-событие обновлено', 'Cron Events' => 'События Cron', 'Current Memory Usage' => 'Текущее использование памяти', 'Current storage backend:' => 'Текущая система хранения данных:', 'Custom driver' => 'Пользовательский драйвер', 'Daemon process' => 'Демон-процесс', 'Daemon worker' => 'Демон-воркер', 'Dashboard' => 'Панель управления', 'Dashboard – quick overview of queues, number of jobs and recent activity.' => 'Панель управления – краткий обзор очередей, количества заданий и недавней активности.', 'Delayed Jobs' => 'Задержка с выполнением заданий', 'Delete' => 'Удалить', 'Delete all' => 'Удалить все', 'Deletes all job execution logs' => 'Удаляет все журналы выполнения заданий.', 'Deletes all jobs from all queues' => 'Удаляет все задания из всех очередей.', 'Deletes logs older than 7 days' => 'Удаляет журналы старше 7 дней.', 'Description' => 'Описание', 'Detailed description of the panel tabs' => 'Подробное описание вкладок панели', 'Details' => 'Подробности', 'Developers can dispatch their own jobs to the queue, choose drivers (Database, Sync, Redis), configure retries and schedules. See the documentation and examples on GitHub for integration details.' => 'Разработчики могут отправлять свои собственные задания в очередь, выбирать драйверы (база данных, синхронизация, Redis), настраивать повторные попытки и расписание. Подробную информацию об интеграции см. в документации и примерах на GitHub.', 'DISABLE_WP_CRON is set to true. Background tasks will not run automatically.' => 'Параметр DISABLE_WP_CRON установлен в значение true. Фоновые задачи не будут выполняться автоматически.', 'Disabled' => 'Отключен', 'Dispatch' => 'Отправлять', 'Display' => 'Показ', 'Displays a table of scheduled recurring tasks (PHP classes) registered in WP Queue: job class, execution interval, queue assignment, and next run time. Allows you to run any task manually.' => 'Отображает таблицу запланированных повторяющихся задач (PHP-классов), зарегистрированных в WP Queue: класс задачи, интервал выполнения, назначение в очередь и время следующего запуска. Позволяет запускать любую задачу вручную.', 'Displays all registered PHP job classes with their configuration.' => 'Отображает все зарегистрированные классы заданий PHP с их конфигурацией.', 'Displays environment information (PHP and WordPress versions, memory limits, execution time, timezone), WP-Cron status (disabled, alternative cron, loopback checks). If Action Scheduler is installed - its statistics. Server and WordPress time.' => 'Отображает информацию об окружении (версии PHP и WordPress, ограничения памяти, время выполнения, часовой пояс), статус WP-Cron (отключен, альтернативный cron, проверки обратной связи). Если установлен Action Scheduler — его статистика. Время сервера и WordPress.', 'Displays the last 200 entries by default or all completed/failed.' => 'По умолчанию отображаются последние 200 записей или все завершенные/незавершенные.', 'Displays the total number of tasks in different statuses (pending, running, completed, failed).' => 'Отображает общее количество задач в различных статусах (ожидание, выполнение, завершено, сбой).', 'Displays when the job should run next or marks overdue jobs.' => 'Отображает время следующего запуска задания или помечает просроченные задания.', 'Distribute jobs across different queues:' => 'Распределите задания по разным очередям:', 'Documentation on GitHub' => 'Документация на GitHub', 'Driver:' => 'Драйвер:', 'Drivers' => 'Драйверы', 'Edit' => 'Редактировать', 'Edit Cron Event' => 'Редактировать событие Cron', 'Edit Schedule' => 'Редактировать расписание', 'Enabled' => 'Включено', 'Environment' => 'Environment', 'Error' => 'Ошибка', 'Error message' => 'Сообщение об ошибке', 'Errors' => 'Ошибки', 'Event actions' => 'Действия события', 'Event hook, next run time, schedule (single/hourly/daily), source, arguments.' => 'Перехватчик событий, время следующего запуска, расписание (однократное/ежечасное/ежедневное), источник, аргументы.', 'Event statistics' => 'Статистика событий', 'Event table' => 'Таблица событий', 'events' => 'события', 'Events by Source' => 'События по источникам', 'Every %d Minutes' => 'Каждые %d минут', 'Example Plugin on GitHub' => 'Пример плагина на GitHub', 'Execution time, status (completed/failed/retrying), job class, queue, error message.' => 'Время выполнения, статус (завершено/сбой/повторная попытка), класс задания, очередь, сообщение об ошибке.', 'Failed' => 'Ошибки', 'Failed Actions' => 'Неудачные действия', 'Failed to pause event' => 'Не удалось приостановить событие', 'Failed to resume event' => 'Не удалось возобновить событие', 'Failed to update event' => 'Не удалось обновить событие', 'For developers' => 'Для разработчиков', 'For more information:' => 'Для получения дополнительной информации:', 'For Redis/Memcached to work, you need the PHP extension installed and a server available. If not, the system will automatically use the "database" driver.' => 'Для работы Redis/Memcached необходимо установить расширение PHP и иметь доступный сервер. В противном случае система автоматически будет использовать драйвер "database".', 'For site administrators' => 'Для администраторов сайта', 'Forces processing of all queues' => 'Принудительная обработка всех очередей', 'from now' => 'с настоящего момента', 'Full documentation and code examples are available on GitHub: %s.' => 'Полная документация и примеры кода доступны на GitHub: %s.', 'GitHub Repository' => 'Репозиторий GitHub', 'GMT Offset' => 'GMT Offset', 'Help' => 'Помощь', 'History' => 'История', 'History of all job executions for diagnostics and debugging.' => 'История всех выполненных заданий для диагностики и отладки.', 'Hook' => 'Хук', 'How Queues Work' => 'Как работают очереди', 'How to change the storage backend?' => 'Как изменить хранилище для данных?', 'How to run WP Queue as a long-running background process.' => 'Как запустить WP Queue в виде долгоживущего фонового процесса.', 'https://github.com/rwsite/wp-queue' => 'https://github.com/rwsite/wp-queue', 'https://rwsite.ru' => 'https://rwsite.ru', 'ID' => 'ID', 'Idle' => 'Idle', 'If installed, displays version and statistics (pending/running/failed actions).' => 'Если установлено, отображает версию и статистику (ожидающие/выполняемые/неудачные действия).', 'If the worker is not running, queues will not be processed in daemon mode. Make sure the process is started and monitored.' => 'Если воркер не запущен, очереди в режиме демона обрабатываться не будут. Убедитесь, что процесс запущен и мониторится.', 'If WP-CLI is not available, create a PHP script that boots WordPress and runs the worker loop:' => 'Если WP-CLI недоступен, создайте PHP-скрипт, который загружает WordPress и запускает цикл воркера:', 'If you installed WP Queue because another plugin requires it, you usually do not need to configure anything here. Use these tabs mainly for monitoring and troubleshooting.' => 'Если вы установили WP Queue, потому что он требуется другому плагину, обычно здесь ничего настраивать не нужно. Используйте эти вкладки в основном для мониторинга и устранения неполадок.', 'Important:' => 'Важно:', 'In Queue' => 'В очереди', 'In this mode WP-Cron scheduling and loopback requests are disabled automatically.' => 'В этом режиме планирование WP-Cron и loopback-запросы отключаются автоматически.', 'Inspect and manage WP-Cron events for WP Queue and other plugins.' => 'Проверяйте и управляйте событиями WP-Cron для WP Queue и других плагинов.', 'Install: pecl install memcached' => 'Установите: pecl install memcached', 'Install: pecl install redis' => 'Установите: pecl install redis', 'Interval' => 'Интервал', 'Job' => 'Задача', 'Job Class' => 'Job Class', 'Job class, execution interval (e.g., "hourly", "daily"), queue assignment, next run time.' => 'Класс Job, интервал выполнения (например, "ежечасно", "ежедневно"), назначение в очередь, время следующего запуска.', 'Job Details' => 'Job Details', 'Job information' => 'Job information', 'Job list' => 'Список Job', 'jobs' => 'задачи', 'Jobs in Queue' => 'Задачи в очереди', 'Log table' => 'Таблица логов', 'Logs' => 'Логи', 'Logs – history of completed and failed jobs that helps to diagnose problems.' => 'Логи — история выполненных и неудачных заданий, которая помогает диагностировать проблемы.', 'Loopback' => 'Обратная связь', 'Loopback is disabled. Jobs will be processed only by WP-Cron, which can delay execution by up to one minute. Run a daemon worker for instant processing.' => 'Loopback отключен. Задачи будут обрабатываться только WP-Cron с задержкой до минуты. Запустите демон-воркер для мгновенной обработки.', 'Loopback is enabled and working. Jobs start immediately after dispatch.' => 'Loopback включен и работает. Задачи запускаются сразу после отправки.', 'Loopback is inactive. Jobs will be processed only by WP-Cron, which can delay execution by up to one minute. Enable loopback or run a daemon worker for instant processing.' => 'Loopback неактивен. Задачи будут обрабатываться только WP-Cron с задержкой до минуты. Включите loopback или запустите демон-воркер для мгновенной обработки.', 'Loopback issue: %s' => 'Проблема обратной связи: %s', 'Loopback Request' => 'Запрос обратной связи', 'Loopback request successful' => 'Запрос обратной связи выполнен успешно', 'Manage queues from command line:' => 'Управление очередями из командной строки:', 'Management of scheduled recurring tasks.' => 'Управление запланированными повторяющимися задачами.', 'Management of WordPress system timers that trigger background processes.' => 'Управление системными таймерами WordPress, запускающими фоновые процессы.', 'Manual run' => 'Ручной запуск', 'Max Execution Time' => 'Максимальное время выполнения', 'Memory Limit' => 'Ограничение памяти', 'Memory usage is above 80%.' => 'Использование памяти выше 80%.', 'Message' => 'Сообщение', 'Monitor which background jobs are queued and running right now.' => 'Отслеживайте, какие фоновые задачи находятся в очереди и выполняются в данный момент.', 'More documentation' => 'Дополнительная документация', 'Name' => 'Имя', 'Named Queues' => 'Именованные очереди', 'Next Run' => 'Следующий запуск', 'Next run status' => 'Статус следующего запуска', 'No activity' => 'Нет активности', 'No cron events found.' => 'Событий cron не обнаружено.', 'No errors' => 'Ошибок нет.', 'No extension' => 'Нет расширения', 'No logs found' => 'Журналы не найдены', 'No paused events' => 'Нет приостановленных событий', 'No scheduled events' => 'Мероприятия не запланированы.', 'No scheduled jobs found.' => 'Запланированных заданий не найдено.', 'No server' => 'Нет сервера', 'Notifications of critical issues (low memory, disabled WP-Cron).' => 'Уведомления о критических проблемах (недостаток памяти, отключение WP-Cron).', 'Now' => 'Сейчас', 'Number of entries' => 'Количество записей', 'OK' => 'OK', 'One-time' => 'Один раз', 'Option A: systemd service' => 'Вариант A: сервис systemd', 'Option B: Supervisor' => 'Вариант B: Supervisor', 'Option C: Docker Compose' => 'Вариант C: Docker Compose', 'Option D: plain PHP script' => 'Вариант D: простой PHP-скрипт', 'Overdue' => 'Просрочено', 'Overview' => 'Обзор', 'Pause' => 'Пауза', 'Pause this queue?' => 'Приостановить выполнение этой очереди?', 'Paused' => 'Приостановлено', 'Paused At' => 'Приостановлено на', 'Paused Events' => 'Приостановленные события', 'Paused events' => 'Приостановленные события', 'Paused Since' => 'Приостановлено с', 'Pending' => 'В ожидании', 'Pending Actions' => 'Ожидающие действия', 'PHP' => 'PHP', 'PHP and WordPress versions, memory limits (current usage), maximum execution time, timezone.' => 'Версии PHP и WordPress, ограничения памяти (текущее использование), максимальное время выполнения, часовой пояс.', 'PHP extension "memcached" is not installed' => 'PHP-расширение "memcached" не установлено', 'PHP extension "redis" (phpredis) is not installed' => 'PHP-расширение "redis" (phpredis) не установлено', 'PHP max_execution_time is less than 30 seconds.' => 'PHP max_execution_time меньше 30 секунд.', 'PHP Version' => 'Версия PHP', 'Plugins' => 'Плагины', 'Predis library is not available' => 'Библиотека Predis недоступна', 'Process' => 'Процесс', 'Process Now' => 'Обработать сейчас', 'Process Queues' => 'Обработочные очереди', 'Processing' => 'Обработка', 'Queue' => 'Очередь', 'Queue handler' => 'Обработчик очереди', 'Queue is empty' => 'Очередь пуста', 'Queue statistics' => 'Статистика очереди', 'Queue Storage backend' => 'бэкэнд хранилища очередей', 'Queue table' => 'Таблица очереди', 'Queue: %s' => 'Очередь: %s', 'Queues' => 'Очереди', 'Quick Start' => 'Быстрый старт', 'Quickly see if any jobs are failing and view recent log entries.' => 'Быстро проверьте, не завершаются ли какие-либо задания с ошибкой, и просмотрите последние записи в журнале.', 'Ready' => 'Готово', 'Recent Activity' => 'Последние события', 'Recent activity' => 'Последние события', 'Redis connection failed' => 'Подключение к Redis не удалось.', 'Redis is disabled via WP_REDIS_DISABLED' => 'Redis отключен с помощью WP_REDIS_DISABLED', 'Redis Support' => 'Поддержка Redis', 'Registered Schedules' => 'Зарегистрированные расписания', 'Registered schedules' => 'Зарегистрированные расписания', 'Report an Issue' => 'Сообщить о проблеме', 'Report Issues' => 'Сообщить о проблемах', 'Resume' => 'Резюме', 'Retry Attempts' => 'Повторные попытки', 'Run' => 'Запуск', 'Run Now' => 'Запустите сейчас', 'Run now, edit schedule, pause, delete. Modal window for changing interval.' => 'Запустить сейчас, отредактировать расписание, приостановить, удалить. Модальное окно для изменения интервала.', 'Run tasks on schedule:' => 'Выполнить задачи по расписанию:', 'Running' => 'Запущено', 'Running Actions' => 'Выполнение действий', 'Save as /etc/systemd/system/wp-queue-worker.service, then run systemctl enable --now wp-queue-worker.' => 'Сохраните как /etc/systemd/system/wp-queue-worker.service, затем выполните systemctl enable --now wp-queue-worker.', 'Save Changes' => 'Сохранить изменения', 'Save the script, make it executable and run it in the background:' => 'Сохраните скрипт, сделайте его исполняемым и запустите в фоне:', 'Schedule' => 'Расписание', 'Schedule a job to run after a specific time:' => 'Настройте выполнение задания по истечении определенного времени:', 'Scheduled' => 'Запланировано', 'Scheduled Jobs' => 'Запланированные задания', 'Scheduled Jobs – list of recurring background jobs added by your theme or plugins.' => 'Запланированные задания — список повторяющихся фоновых заданий, добавленных вашей темой или плагинами.', 'Scheduler' => 'Планировщик', 'Server Time' => 'Время сервера', 'Server time' => 'Время сервера', 'Single' => 'Один', 'Single (run once)' => 'Один (запуск один раз)', 'Source' => 'Источник', 'Start the worker from the WordPress root:' => 'Запустите воркер из корня WordPress:', 'Status' => 'Статус', 'Status filters' => 'Фильтры состояния', 'Storage' => 'Хранилище', 'Storage backend' => 'бэкэнд хранилища', 'Storage backend "%s" is configured in wp-config.php, but not available. Falling back to "%s".' => 'В файле wp-config.php настроен бэкэнд хранилища "%s", но он недоступен. Используется резервный вариант "%s".', 'Synchronous execution (no queue)' => 'Синхронное выполнение (без очереди)', 'System' => 'Система', 'System Cron (Recommended)' => 'Системный планировщик задач (рекомендуется)', 'System health' => 'Здоровье системы', 'System Issues Detected:' => 'Обнаружены системные неполадки:', 'System Status' => 'Состояние системы', 'System – checks PHP version, WP-Cron status and other important settings.' => 'Система проверяет версию PHP, статус WP-Cron и другие важные настройки.', 'The "Run Now" button allows you to run any job immediately, without waiting for the schedule.' => 'Кнопка «Запустить сейчас» позволяет немедленно запустить любое задание, не дожидаясь расписания.', 'The command above must stay alive. In production use one of the options below.' => 'Команда выше должна оставаться запущенной. В продакшене используйте один из вариантов ниже.', 'The job is saved in the database (or Redis) waiting to be picked up.' => 'Задание сохраняется в базе данных (или Redis) в ожидании обработки.', 'The last 10 log entries for quick tracking of queue activity.' => 'Последние 10 записей в журнале для быстрого отслеживания активности в очереди.', 'The main tab for monitoring queue status in real-time.' => 'Главная вкладка для мониторинга состояния очереди в режиме реального времени.', 'The plugin itself does not add new features to the frontend. It provides a reliable queue that other plugins or your custom code can use for background work.' => 'Сам плагин не добавляет новых функций на фронтенд. Он предоставляет надежную очередь, которую другие плагины или ваш пользовательский код могут использовать для фоновой работы.', 'The worker picks up the job and executes it. If it succeeds, it is marked as "Completed". If it fails, it can be retried.' => 'Работник берет задание и выполняет его. Если оно выполняется успешно, оно помечается как «Завершено». Если оно не выполняется, его можно повторить.', 'This section is under development.' => 'Этот раздел находится в разработке.', 'Time' => 'Время', 'Timeout' => 'Тайм-аут', 'Timezone' => 'Часовой пояс', 'To add your own background jobs, use the WP Queue PHP API from your plugin or theme. You can dispatch jobs to different queues, set delays and retries. Full code examples are available in the README on GitHub.' => 'Чтобы добавить собственные фоновые задачи, используйте PHP API WP Queue из вашего плагина или темы. Вы можете отправлять задачи в разные очереди, устанавливать задержки и повторные попытки. Полные примеры кода доступны в файле README на GitHub .', 'to get a list of available commands.' => 'чтобы получить список доступных команд.', 'To process the queue, WordPress needs a trigger. There are two ways to do this:' => 'Для обработки очереди WordPress необходим триггер. Это можно сделать двумя способами:', 'Tools' => 'Инструменты', 'Total' => 'Всего', 'Total errors' => 'Общее количество ошибок', 'Total Events' => 'Всего событий', 'Total Jobs' => 'Общее количество рабочих мест', 'Total number of events, overdue, grouped by source (WordPress, WooCommerce, WP Queue, plugins).' => 'Общее количество просроченных событий, сгруппированных по источнику (WordPress, WooCommerce, WP Queue, плагины).', 'Unavailable' => 'Недоступно', 'Unexpected response code: %d' => 'Неожиданный код ответа: %d', 'Unknown' => 'Неизвестно', 'Unknown driver' => 'Неизвестный драйвер', 'Upcoming Events' => 'Предстоящие события', 'Usage' => 'Использование', 'Use a daemon worker on VPS, Docker or dedicated servers where you can keep a process running. It polls the queue continuously and starts jobs immediately. Without a daemon, WP Queue relies on WP-Cron and/or loopback, which can delay jobs by up to a minute.' => 'Запускайте демон-воркер на VPS, Docker или выделенном сервере, где можно держать процесс запущенным. Он постоянно опрашивает очередь и сразу запускает задания. Без демона WP Queue полагается на WP-Cron и/или loopback, что может задерживать задания до минуты.', 'Use system cron' => 'Используйте системный cron', 'Use the script from step 2 (Without WP-CLI) inside screen, tmux or a simple cron-based restart loop. Remember that the script must stay alive to act as a daemon.' => 'Используйте скрипт из шага 2 (Без WP-CLI) внутри screen, tmux или простого цикла перезапуска через cron. Помните, что скрипт должен оставаться запущенным, чтобы работать как демон.', 'Use this tab for quick checks of queue performance and identifying stuck processes.' => 'Используйте эту вкладку для быстрой проверки производительности очереди и выявления зависших процессов.', 'Used' => 'Использовал', 'Useful for testing jobs and forcing synchronizations.' => 'Полезно для тестирования заданий и принудительной синхронизации.', 'Useful Links' => 'Полезные ссылки', 'Uses wp_options table' => 'Использует таблицу wp_options', 'Version' => 'Версия', 'Versions' => 'Версии', 'Warning' => 'Предупреждение', 'What you can use it for' => 'Для чего его можно использовать', 'When to use a daemon' => 'Когда использовать демон', 'Why is it needed?' => 'Зачем это нужно?', 'With WP-CLI' => 'С WP-CLI', 'Without WP-CLI' => 'Без WP-CLI', 'WooCommerce' => 'WooCommerce', 'WordPress' => 'WordPress', 'WordPress checks for scheduled tasks on every page load. This works out of the box but has downsides: on low-traffic sites, tasks might not run on time; on high-traffic sites, it can cause performance issues. It is "fake" cron.' => 'WordPress проверяет наличие запланированных задач при каждой загрузке страницы. Это работает «из коробки», но имеет свои недостатки: на сайтах с низкой посещаемостью задачи могут не выполняться вовремя; на сайтах с высокой посещаемостью это может вызывать проблемы с производительностью. Это «поддельный» cron.', 'WordPress Time' => 'Время WordPress', 'WordPress Version' => 'Версия WordPress', 'Worker' => 'Воркер', 'WP Queue' => 'WP Queue', 'WP Queue allows executing tasks asynchronously in the background without blocking the main WordPress execution flow.' => 'WP Queue позволяет выполнять задачи асинхронно в фоновом режиме, не блокируя основной поток выполнения WordPress.', 'WP Queue helps your site run heavy or regular tasks in the background (emails, synchronizations, cleanups) so that pages load faster for visitors.' => 'WP Queue помогает вашему сайту выполнять ресурсоемкие или регулярно выполняемые задачи в фоновом режиме (отправка электронной почты, синхронизация, очистка), благодаря чему страницы загружаются быстрее для посетителей.', 'WP Queue is a robust background processing library for WordPress. It allows you to offload time-consuming tasks (like sending emails, syncing data, or generating reports) to be processed asynchronously, ensuring your site remains fast and responsive for visitors.' => 'WP Queue — это мощная библиотека для фоновой обработки данных в WordPress. Она позволяет переносить трудоемкие задачи (например, отправку электронных писем, синхронизацию данных или создание отчетов) на асинхронную обработку, обеспечивая быструю и отзывчивую работу вашего сайта для посетителей.', 'WP Queue solves this by pushing these tasks to a "Queue" and processing them later in the background. The user gets an instant response, and the heavy work happens behind the scenes.' => 'WP Queue решает эту проблему, отправляя эти задачи в "очередь" и обрабатывая их позже в фоновом режиме. Пользователь получает мгновенный ответ, а основная работа происходит за кулисами.', 'WP Queue — Queue System for WordPress' => 'WP Queue — система очередей для WordPress', 'WP-CLI' => 'WP-CLI', 'WP-CLI Commands' => 'Команды WP-CLI', 'WP-CLI команды' => 'Команда WP-CLI', 'WP-Cron' => 'WP-Cron', 'WP-Cron (Default)' => 'WP-Cron (по умолчанию)', 'WP-Cron + Loopback' => 'WP-Cron + Loopback', 'WP-Cron checks the queue every minute as a fallback.' => 'WP-Cron раз в минуту проверяет очередь как подстраховку.', 'WP-Cron Disabled' => 'WP-Cron отключен', 'WP-Cron is disabled. Background tasks may not run automatically.' => 'WP-Cron отключен. Фоновые задачи могут не выполняться автоматически.', 'WP-Cron only' => 'Только WP-Cron', 'WP-Cron Status' => 'Статус WP-Cron', 'WP-Cron status' => 'статус WP-Cron', 'WP-Cron vs System Cron' => 'WP-Cron против System Cron', 'WP-Cron – list of cron events with the ability to run, pause or delete them.' => 'WP-Cron – список событий cron с возможностью их запуска, приостановки или удаления.', 'WP-Cron:' => 'WP-Cron:', '⚠️ Warning:' => '⚠️ Предупреждение:']]; +return ['domain' => null, 'plural-forms' => 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);', 'language' => 'ru_RU', 'project-id-version' => 'WP Queue 1.0.0', 'pot-creation-date' => '2026-11-11T14:53:28+00:00', 'po-revision-date' => '2026-07-25 21:14+0000', 'x-generator' => 'Loco https://localise.biz/', 'messages' => ['https://github.com/rwsite/wp-queue' => 'https://github.com/rwsite/wp-queue', 'Background job processing and WP-Cron management for WordPress. Schedule tasks, manage queues, and monitor cron events.' => 'Обработка фоновых задач и управление WP-Cron для WordPress. Планируйте задачи, управляйте очередями и отслеживайте cron-события.', 'Aleksei Tikhomirov' => 'Алексей Тихомиров', 'https://rwsite.ru' => 'https://rwsite.ru', 'Queues' => 'Очереди', 'Scheduler' => 'Планировщик', 'System' => 'Система', 'Overview' => 'Обзор', 'Jobs in Queue' => 'Задачи в очереди', 'History' => 'История', 'Failed' => 'Ошибки', 'Drivers' => 'Драйверы', 'Cron Events' => 'События Cron', 'Scheduled' => 'Запланировано', 'Paused' => 'Приостановлено', 'System Status' => 'Состояние системы', 'Daemon worker' => 'Демон-воркер', 'Tools' => 'Инструменты', 'Help' => 'Помощь', 'WP Queue' => 'WP Queue', 'About WP Queue' => 'О WP Queue', 'Usage' => 'Использование', 'WP-CLI' => 'WP-CLI', 'WP Queue helps your site run heavy or regular tasks in the background (emails, synchronizations, cleanups) so that pages load faster for visitors.' => 'WP Queue помогает вашему сайту выполнять ресурсоемкие или регулярно выполняемые задачи в фоновом режиме (отправка электронной почты, синхронизация, очистка), благодаря чему страницы загружаются быстрее для посетителей.', 'The plugin itself does not add new features to the frontend. It provides a reliable queue that other plugins or your custom code can use for background work.' => 'Сам плагин не добавляет новых функций на фронтенд. Он предоставляет надежную очередь, которую другие плагины или ваш пользовательский код могут использовать для фоновой работы.', 'What you can use it for' => 'Для чего его можно использовать', 'Monitor which background jobs are queued and running right now.' => 'Отслеживайте, какие фоновые задачи находятся в очереди и выполняются в данный момент.', 'Quickly see if any jobs are failing and view recent log entries.' => 'Быстро проверьте, не завершаются ли какие-либо задания с ошибкой, и просмотрите последние записи в журнале.', 'Inspect and manage WP-Cron events for WP Queue and other plugins.' => 'Проверяйте и управляйте событиями WP-Cron для WP Queue и других плагинов.', 'Check basic system requirements that affect queue stability.' => 'Проверьте основные системные требования, влияющие на стабильность очереди.', 'For developers' => 'Для разработчиков', 'Developers can dispatch their own jobs to the queue, choose drivers (Database, Sync, Redis), configure retries and schedules. See the documentation and examples on GitHub for integration details.' => 'Разработчики могут отправлять свои собственные задания в очередь, выбирать драйверы (база данных, синхронизация, Redis), настраивать повторные попытки и расписание. Подробную информацию об интеграции см. в документации и примерах на GitHub.', 'Basic Usage' => 'Основные правила использования', 'For site administrators' => 'Для администраторов сайта', 'Dashboard – quick overview of queues, number of jobs and recent activity.' => 'Панель управления – краткий обзор очередей, количества заданий и недавней активности.', 'Scheduled Jobs – list of recurring background jobs added by your theme or plugins.' => 'Запланированные задания — список повторяющихся фоновых заданий, добавленных вашей темой или плагинами.', 'Logs – history of completed and failed jobs that helps to diagnose problems.' => 'Логи — история выполненных и неудачных заданий, которая помогает диагностировать проблемы.', 'WP-Cron – list of cron events with the ability to run, pause or delete them.' => 'WP-Cron – список событий cron с возможностью их запуска, приостановки или удаления.', 'System – checks PHP version, WP-Cron status and other important settings.' => 'Система проверяет версию PHP, статус WP-Cron и другие важные настройки.', 'If you installed WP Queue because another plugin requires it, you usually do not need to configure anything here. Use these tabs mainly for monitoring and troubleshooting.' => 'Если вы установили WP Queue, потому что он требуется другому плагину, обычно здесь ничего настраивать не нужно. Используйте эти вкладки в основном для мониторинга и устранения неполадок.', 'To add your own background jobs, use the WP Queue PHP API from your plugin or theme. You can dispatch jobs to different queues, set delays and retries. Full code examples are available in the README on GitHub.' => 'Чтобы добавить собственные фоновые задачи, используйте PHP API WP Queue из вашего плагина или темы. Вы можете отправлять задачи в разные очереди, устанавливать задержки и повторные попытки. Полные примеры кода доступны в файле README на GitHub .', 'WP-CLI Commands' => 'Команды WP-CLI', 'Run' => 'Запуск', 'to get a list of available commands.' => 'чтобы получить список доступных команд.', 'For more information:' => 'Для получения дополнительной информации:', 'GitHub Repository' => 'Репозиторий GitHub', 'Report Issues' => 'Сообщить о проблемах', 'Author Website' => 'Веб-сайт автора', 'Are you sure you want to clear this queue?' => 'Вы уверены, что хотите очистить эту очередь?', 'Pause this queue?' => 'Приостановить выполнение этой очереди?', 'Action completed successfully' => 'Действие успешно завершено.', 'An error occurred' => 'Произошла ошибка.', 'This section is under development.' => 'Этот раздел находится в разработке.', 'Idle' => 'Idle', 'Pending' => 'В ожидании', 'Running' => 'Запущено', 'Completed' => 'Завершенные', 'In Queue' => 'В очереди', 'Driver:' => 'Драйвер:', 'Configure' => 'Настройка', 'Runner:' => 'Обработчик:', 'jobs' => 'задачи', 'Recent Activity' => 'Последние события', 'Queue: %s' => 'Очередь: %s', 'Processing' => 'Обработка', 'Active' => 'Активный', 'Resume' => 'Резюме', 'Pause' => 'Пауза', 'Process Now' => 'Обработать сейчас', 'Clear' => 'Очистить', 'Total Jobs' => 'Общее количество рабочих мест', 'ID' => 'ID', 'Job Class' => 'Job Class', 'Attempts' => 'Попытки', 'Available From' => 'Доступно с', 'Status' => 'Статус', 'Actions' => 'Действия', 'Queue is empty' => 'Очередь пуста', 'Unknown' => 'Неизвестно', 'from now' => 'с настоящего момента', 'Now' => 'Сейчас', 'Details' => 'Подробности', 'Delete' => 'Удалить', '%d tasks' => '%d задач', 'Job Details' => 'Job Details', 'Close' => 'Закрыть', 'Displays a table of scheduled recurring tasks (PHP classes) registered in WP Queue: job class, execution interval, queue assignment, and next run time. Allows you to run any task manually.' => 'Отображает таблицу запланированных повторяющихся задач (PHP-классов), зарегистрированных в WP Queue: класс задачи, интервал выполнения, назначение в очередь и время следующего запуска. Позволяет запускать любую задачу вручную.', 'Job' => 'Задача', 'Schedule' => 'Расписание', 'Queue' => 'Очередь', 'Next Run' => 'Следующий запуск', 'No scheduled jobs found.' => 'Запланированных заданий не найдено.', 'ago (overdue)' => 'давно (просрочено)', 'Run Now' => 'Запустите сейчас', 'WP Queue is a robust background processing library for WordPress. It allows you to offload time-consuming tasks (like sending emails, syncing data, or generating reports) to be processed asynchronously, ensuring your site remains fast and responsive for visitors.' => 'WP Queue — это мощная библиотека для фоновой обработки данных в WordPress. Она позволяет переносить трудоемкие задачи (например, отправку электронных писем, синхронизацию данных или создание отчетов) на асинхронную обработку, обеспечивая быструю и отзывчивую работу вашего сайта для посетителей.', 'Why is it needed?' => 'Зачем это нужно?', 'By default, WordPress executes all actions during the page load request. If a plugin needs to send 100 emails or sync 500 products with an external API, the user has to wait until it finishes. This leads to slow page loads or timeouts.' => 'По умолчанию WordPress выполняет все действия во время запроса на загрузку страницы. Если плагину необходимо отправить 100 электронных писем или синхронизировать 500 товаров с внешним API, пользователю приходится ждать завершения процесса. Это приводит к медленной загрузке страниц или таймаутам.', 'WP Queue solves this by pushing these tasks to a "Queue" and processing them later in the background. The user gets an instant response, and the heavy work happens behind the scenes.' => 'WP Queue решает эту проблему, отправляя эти задачи в "очередь" и обрабатывая их позже в фоновом режиме. Пользователь получает мгновенный ответ, а основная работа происходит за кулисами.', 'How Queues Work' => 'Как работают очереди', 'Dispatch' => 'Отправлять', 'A plugin creates a "Job" (a task) and pushes it to the queue.' => 'Плагин создает «Задание» (задачу) и помещает его в очередь.', 'Storage' => 'Хранилище', 'The job is saved in the database (or Redis) waiting to be picked up.' => 'Задание сохраняется в базе данных (или Redis) в ожидании обработки.', 'Worker' => 'Воркер', 'A background process (Worker) constantly checks the queue for new jobs.' => 'Фоновый процесс (Worker) постоянно проверяет очередь на наличие новых заданий.', 'Process' => 'Процесс', 'The worker picks up the job and executes it. If it succeeds, it is marked as "Completed". If it fails, it can be retried.' => 'Работник берет задание и выполняет его. Если оно выполняется успешно, оно помечается как «Завершено». Если оно не выполняется, его можно повторить.', 'WP-Cron vs System Cron' => 'WP-Cron против System Cron', 'To process the queue, WordPress needs a trigger. There are two ways to do this:' => 'Для обработки очереди WordPress необходим триггер. Это можно сделать двумя способами:', 'WP-Cron (Default)' => 'WP-Cron (по умолчанию)', 'WordPress checks for scheduled tasks on every page load. This works out of the box but has downsides: on low-traffic sites, tasks might not run on time; on high-traffic sites, it can cause performance issues. It is "fake" cron.' => 'WordPress проверяет наличие запланированных задач при каждой загрузке страницы. Это работает «из коробки», но имеет свои недостатки: на сайтах с низкой посещаемостью задачи могут не выполняться вовремя; на сайтах с высокой посещаемостью это может вызывать проблемы с производительностью. Это «поддельный» cron.', 'System Cron (Recommended)' => 'Системный планировщик задач (рекомендуется)', 'A real cron job configured on your server (Linux) that calls WordPress every minute. This is reliable and precise. Ideally, you should disable default WP-Cron and use System Cron.' => 'На вашем сервере (Linux) должна быть настроена настоящая задача cron, которая будет запускать WordPress каждую минуту. Это надежно и точно. В идеале следует отключить стандартный WP-Cron и использовать системный Cron.', 'Redis Support' => 'Поддержка Redis', 'By default, WP Queue stores jobs in the WordPress database (wp_options or custom tables). For high-performance sites, you can use Redis. Redis is an in-memory data store that is much faster than a SQL database for queue operations. It reduces load on your database and speeds up job processing.' => 'По умолчанию WP Queue хранит задания в базе данных WordPress (в папке wp_options или в пользовательских таблицах). Для высокопроизводительных сайтов можно использовать Redis. Redis — это хранилище данных в оперативной памяти, которое намного быстрее, чем база данных SQL, при работе с очередями. Оно снижает нагрузку на базу данных и ускоряет обработку заданий.', 'Detailed description of the panel tabs' => 'Подробное описание вкладок панели', 'Dashboard' => 'Панель управления', 'The main tab for monitoring queue status in real-time.' => 'Главная вкладка для мониторинга состояния очереди в режиме реального времени.', 'Queue statistics' => 'Статистика очереди', 'Displays the total number of tasks in different statuses (pending, running, completed, failed).' => 'Отображает общее количество задач в различных статусах (ожидание, выполнение, завершено, сбой).', 'Queue table' => 'Таблица очереди', 'A list of all active queues with their size, status (idle/pending/running/paused), and control buttons (pause/resume, clear all tasks).' => 'Список всех активных очередей с указанием их размера, статуса (простой/ожидание/выполнение/приостановка) и кнопок управления (пауза/возобновление, очистить все задачи).', 'Recent activity' => 'Последние события', 'The last 10 log entries for quick tracking of queue activity.' => 'Последние 10 записей в журнале для быстрого отслеживания активности в очереди.', 'Use this tab for quick checks of queue performance and identifying stuck processes.' => 'Используйте эту вкладку для быстрой проверки производительности очереди и выявления зависших процессов.', 'Scheduled Jobs' => 'Запланированные задания', 'Management of scheduled recurring tasks.' => 'Управление запланированными повторяющимися задачами.', 'Job list' => 'Список Job', 'Displays all registered PHP job classes with their configuration.' => 'Отображает все зарегистрированные классы заданий PHP с их конфигурацией.', 'Job information' => 'Job information', 'Job class, execution interval (e.g., "hourly", "daily"), queue assignment, next run time.' => 'Класс Job, интервал выполнения (например, "ежечасно", "ежедневно"), назначение в очередь, время следующего запуска.', 'Manual run' => 'Ручной запуск', 'The "Run Now" button allows you to run any job immediately, without waiting for the schedule.' => 'Кнопка «Запустить сейчас» позволяет немедленно запустить любое задание, не дожидаясь расписания.', 'Next run status' => 'Статус следующего запуска', 'Displays when the job should run next or marks overdue jobs.' => 'Отображает время следующего запуска задания или помечает просроченные задания.', 'Useful for testing jobs and forcing synchronizations.' => 'Полезно для тестирования заданий и принудительной синхронизации.', 'Logs' => 'Логи', 'History of all job executions for diagnostics and debugging.' => 'История всех выполненных заданий для диагностики и отладки.', 'Status filters' => 'Фильтры состояния', 'Buttons to show all entries, only completed, or only failed jobs.' => 'Кнопки для отображения всех записей, только завершенных или только неудачно завершенных заданий.', 'Log table' => 'Таблица логов', 'Execution time, status (completed/failed/retrying), job class, queue, error message.' => 'Время выполнения, статус (завершено/сбой/повторная попытка), класс задания, очередь, сообщение об ошибке.', 'Clear logs' => 'Очистить журналы', 'Button to delete old log entries to avoid cluttering the database.' => 'Кнопка для удаления старых записей журнала во избежание засорения базы данных.', 'Number of entries' => 'Количество записей', 'Displays the last 200 entries by default or all completed/failed.' => 'По умолчанию отображаются последние 200 записей или все завершенные/незавершенные.', 'Check logs when encountering errors in background processes.' => 'При обнаружении ошибок в фоновых процессах проверяйте журналы.', 'WP-Cron' => 'WP-Cron', 'Management of WordPress system timers that trigger background processes.' => 'Управление системными таймерами WordPress, запускающими фоновые процессы.', 'Event statistics' => 'Статистика событий', 'Total number of events, overdue, grouped by source (WordPress, WooCommerce, WP Queue, plugins).' => 'Общее количество просроченных событий, сгруппированных по источнику (WordPress, WooCommerce, WP Queue, плагины).', 'Event table' => 'Таблица событий', 'Event hook, next run time, schedule (single/hourly/daily), source, arguments.' => 'Перехватчик событий, время следующего запуска, расписание (однократное/ежечасное/ежедневное), источник, аргументы.', 'Event actions' => 'Действия события', 'Run now, edit schedule, pause, delete. Modal window for changing interval.' => 'Запустить сейчас, отредактировать расписание, приостановить, удалить. Модальное окно для изменения интервала.', 'Paused events' => 'Приостановленные события', 'A separate table for events that are temporarily disabled.' => 'Отдельная таблица для событий, которые временно отключены.', 'Registered schedules' => 'Зарегистрированные расписания', 'A table of all available intervals (hourly, daily, etc.) with their duration.' => 'Таблица со всеми доступными интервалами (почасовыми, суточным и т. д.) и их продолжительностью.', 'Critical for understanding why tasks are not running on time.' => 'Это крайне важно для понимания причин, по которым задачи не выполняются в срок.', 'Checking system requirements and environment for stable queue operation.' => 'Проверка системных требований и среды для обеспечения стабильной работы очереди.', 'System health' => 'Здоровье системы', 'Notifications of critical issues (low memory, disabled WP-Cron).' => 'Уведомления о критических проблемах (недостаток памяти, отключение WP-Cron).', 'Environment' => 'Environment', 'PHP and WordPress versions, memory limits (current usage), maximum execution time, timezone.' => 'Версии PHP и WordPress, ограничения памяти (текущее использование), максимальное время выполнения, часовой пояс.', 'WP-Cron status' => 'статус WP-Cron', 'Checking for disablement (DISABLE_WP_CRON), alternative cron, loopback requests.' => 'Проверка на отключение (DISABLE_WP_CRON), альтернативный cron, запросы обратной связи.', 'Action Scheduler' => 'Планировщик действий', 'If installed, displays version and statistics (pending/running/failed actions).' => 'Если установлено, отображает версию и статистику (ожидающие/выполняемые/неудачные действия).', 'Server time' => 'Время сервера', 'Comparison of server time, WordPress, and GMT offset for diagnosing scheduling issues.' => 'Сравнение серверного времени, времени WordPress и смещения GMT для диагностики проблем с планированием.', 'Check this tab when setting up your server or debugging queue issues.' => 'Проверьте эту вкладку при настройке сервера или отладке проблем с очередями.', 'More documentation' => 'Дополнительная документация', 'Full documentation and code examples are available on GitHub: %s.' => 'Полная документация и примеры кода доступны на GitHub: %s.', 'All' => 'Все', 'All queues' => 'Все очереди', 'Deletes logs older than 7 days' => 'Удаляет журналы старше 7 дней.', 'Clear old' => 'Удалить старые', 'Delete all' => 'Удалить все', 'Time' => 'Время', 'Message' => 'Сообщение', 'No logs found' => 'Журналы не найдены', '%d entries' => '%d записей', 'Total errors' => 'Общее количество ошибок', 'Error message' => 'Сообщение об ошибке', 'No errors' => 'Ошибок нет.', '⚠️ Warning:' => '⚠️ Предупреждение:', 'Storage backend "%1$s" is selected, but not available. Falling back to "%2$s".' => 'Выбран бэкенд хранения «%1$s», но он недоступен. Используется «%2$s».', 'Check driver settings.' => 'Проверьте настройки драйвера.', 'Current storage backend:' => 'Текущая система хранения данных:', 'The storage backend only keeps jobs. How they are executed is chosen in System → Status → Queue runner.' => 'Бэкенд только хранит задачи. Как они выполняются, выбирается в Система → Состояние → Обработчик очереди.', 'Storage backend' => 'бэкэнд хранилища', 'Description' => 'Описание', 'Install: pecl install redis, or the Redis Object Cache plugin (Predis).' => 'Установите: pecl install redis или плагин Redis Object Cache (Predis).', 'Install: pecl install memcached' => 'Установите: pecl install memcached', 'Set in wp-config.php' => 'Задано в wp-config.php', 'Make active' => 'Сделать активным', 'Switch the storage backend? Waiting jobs will be moved to it.' => 'Переключить бэкенд хранения? Ожидающие задачи будут перенесены.', 'How switching works' => 'Как работает переключение', 'Waiting jobs (ready and delayed) are moved to the new backend under the global worker lock, so nothing is lost or run twice.' => 'Ожидающие задачи (готовые и отложенные) переносятся в новый бэкенд под глобальной блокировкой воркера: ничего не теряется и не выполняется дважды.', 'Switching is refused while a worker is running or jobs are being executed; try again in a minute.' => 'Пока работает воркер или выполняются задачи, переключение отклоняется; повторите через минуту.', 'Jobs that other requests add to the previous backend during the switch are moved by the worker within a day.' => 'Задачи, которые другие запросы добавят в прежний бэкенд во время переключения, воркер перенесёт в течение суток.', 'If WP_QUEUE_DRIVER is defined in wp-config.php, it has priority. Inside the "// BEGIN WP Queue" block it is edited by the plugin (atomically, with a backup and verification); anywhere else it locks this choice.' => 'Если WP_QUEUE_DRIVER задан в wp-config.php, он имеет приоритет. Внутри блока «// BEGIN WP Queue» его правит плагин (атомарно, с бэкапом и проверкой); в любом другом месте он блокирует этот выбор.', 'Redis connection' => 'Подключение к Redis', 'Uses the Redis Object Cache constants (WP_REDIS_HOST, WP_REDIS_PORT, WP_REDIS_PASSWORD, WP_REDIS_DATABASE, WP_REDIS_PREFIX). Jobs are claimed with an atomic Lua script, so every job goes to exactly one worker.' => 'Используются константы Redis Object Cache (WP_REDIS_HOST, WP_REDIS_PORT, WP_REDIS_PASSWORD, WP_REDIS_DATABASE, WP_REDIS_PREFIX). Задачи захватываются атомарным Lua-скриптом, поэтому каждая достаётся ровно одному воркеру.', 'Works everywhere. Atomic claim with a conditional UPDATE.' => 'Работает везде. Атомарный захват условным UPDATE.', 'Fast, keeps the database small. Needs a Redis server.' => 'Быстро, не раздувает базу. Нужен сервер Redis.', 'Not recommended: jobs cannot be listed or moved and may be evicted.' => 'Не рекомендуется: задачи нельзя перечислить или перенести, они могут быть вытеснены.', 'set in wp-config.php (%s)' => 'задано в wp-config.php (%s)', 'set in the WP Queue block of wp-config.php (editable here)' => 'задано в блоке WP Queue в wp-config.php (можно менять здесь)', 'selected in the admin' => 'выбрано в админке', 'default' => 'по умолчанию', 'Ready' => 'Готово', 'No extension' => 'Нет расширения', 'No server' => 'Нет сервера', 'Unavailable' => 'Недоступно', 'No activity' => 'Нет активности', 'Total Events' => 'Всего событий', 'Overdue' => 'Просрочено', 'WP-Cron:' => 'WP-Cron:', 'Disabled' => 'Отключен', 'Use system cron' => 'Используйте системный cron', 'Events by Source' => 'События по источникам', 'events' => 'события', 'Upcoming Events' => 'Предстоящие события', 'No scheduled events' => 'Мероприятия не запланированы.', 'Hook' => 'Хук', 'Source' => 'Источник', 'Total' => 'Всего', 'WordPress' => 'WordPress', 'WooCommerce' => 'WooCommerce', 'Plugins' => 'Плагины', 'No cron events found.' => 'Событий cron не обнаружено.', 'Single' => 'Один', 'Edit Schedule' => 'Редактировать расписание', 'Edit' => 'Редактировать', 'Paused Events' => 'Приостановленные события', 'Paused At' => 'Приостановлено на', 'Registered Schedules' => 'Зарегистрированные расписания', 'Name' => 'Имя', 'Interval' => 'Интервал', 'Display' => 'Показ', 'Edit Cron Event' => 'Редактировать событие Cron', 'Single (run once)' => 'Один (запуск один раз)', 'Save Changes' => 'Сохранить изменения', 'Cancel' => 'Отмена', 'Displays environment information (PHP and WordPress versions, memory limits, execution time, timezone), WP-Cron status (disabled, alternative cron, loopback checks). If Action Scheduler is installed - its statistics. Server and WordPress time.' => 'Отображает информацию об окружении (версии PHP и WordPress, ограничения памяти, время выполнения, часовой пояс), статус WP-Cron (отключен, альтернативный cron, проверки обратной связи). Если установлен Action Scheduler — его статистика. Время сервера и WordPress.', 'System Issues Detected:' => 'Обнаружены системные неполадки:', 'All systems are healthy.' => 'Все системы работают исправно.', 'PHP Version' => 'Версия PHP', 'WordPress Version' => 'Версия WordPress', 'Memory Limit' => 'Ограничение памяти', 'Current Memory Usage' => 'Текущее использование памяти', 'Max Execution Time' => 'Максимальное время выполнения', 'Timezone' => 'Часовой пояс', 'WP-Cron Status' => 'Статус WP-Cron', 'WP-Cron Disabled' => 'WP-Cron отключен', 'DISABLE_WP_CRON is set to true. Background tasks will not run automatically.' => 'Параметр DISABLE_WP_CRON установлен в значение true. Фоновые задачи не будут выполняться автоматически.', 'Enabled' => 'Включено', 'Alternate Cron' => 'Альтернативный Cron', 'Loopback Request' => 'Запрос обратной связи', 'OK' => 'OK', 'Warning' => 'Предупреждение', 'Error' => 'Ошибка', 'Version' => 'Версия', 'Pending Actions' => 'Ожидающие действия', 'Running Actions' => 'Выполнение действий', 'Failed Actions' => 'Неудачные действия', 'Server Time' => 'Время сервера', 'WordPress Time' => 'Время WordPress', 'GMT Offset' => 'GMT Offset', 'Errors' => 'Ошибки', 'Timeout' => 'Тайм-аут', 'Versions' => 'Версии', 'PHP' => 'PHP', 'Component Status' => 'Состояние компонента', 'Queue Storage backend' => 'бэкэнд хранилища очередей', 'Change' => 'Изменить', 'Queue runner' => 'Обработчик очереди', '(auto)' => '(авто)', 'Crontab line (as the web server user):' => 'Строка crontab (от пользователя веб-сервера):', 'Last run of the worker (heartbeat):' => 'Последний запуск воркера (heartbeat):', 'never' => 'никогда', '%1$s ago, jobs: %2$d' => '%1$s назад, задач: %2$d', 'skipped: another runner is selected or a worker was busy' => 'пропущено: выбран другой обработчик или воркер был занят', 'Set in wp-config.php (%s). Remove the constant to choose here.' => 'Задано в wp-config.php (%s). Удалите константу, чтобы выбирать здесь.', 'Save runner' => 'Сохранить обработчик', 'Used by the runner' => 'Используется обработчиком', 'Not used by the runner' => 'Не используется обработчиком', 'WordPress WP-Cron is disabled (DISABLE_WP_CRON).' => 'WP-Cron WordPress выключен (DISABLE_WP_CRON).', 'WordPress WP-Cron is enabled.' => 'WP-Cron WordPress включён.', 'Loopback' => 'Обратная связь', 'check OK' => 'проверка пройдена', 'check: warning' => 'проверка: предупреждение', 'check failed' => 'проверка не пройдена', 'not checked' => 'не проверялось', 'Used' => 'Использовал', 'Clear Logs' => 'Очистить журналы', 'Deletes all job execution logs' => 'Удаляет все журналы выполнения заданий.', 'Clear All Logs' => 'Очистить все журналы', 'Process Queues' => 'Обработочные очереди', 'Forces processing of all queues' => 'Принудительная обработка всех очередей', 'Clear All Queues' => 'Очистить все очереди', 'Deletes all jobs from all queues' => 'Удаляет все задания из всех очередей.', 'Clear All' => 'Очистить все', 'WP Queue — Queue System for WordPress' => 'WP Queue — система очередей для WordPress', 'WP Queue allows executing tasks asynchronously in the background without blocking the main WordPress execution flow.' => 'WP Queue позволяет выполнять задачи асинхронно в фоновом режиме, не блокируя основной поток выполнения WordPress.', 'Quick Start' => 'Быстрый старт', 'Create a job class and dispatch it to the queue:' => 'Создайте класс задания и отправьте его в очередь:', 'Delayed Jobs' => 'Задержка с выполнением заданий', 'Schedule a job to run after a specific time:' => 'Настройте выполнение задания по истечении определенного времени:', 'Named Queues' => 'Именованные очереди', 'Distribute jobs across different queues:' => 'Распределите задания по разным очередям:', 'Retry Attempts' => 'Повторные попытки', 'Configure automatic retries on errors:' => 'Настройте автоматическое повторение попыток при возникновении ошибок:', 'Run tasks on schedule:' => 'Выполнить задачи по расписанию:', 'WP-CLI команды' => 'Команда WP-CLI', 'Manage queues from command line:' => 'Управление очередями из командной строки:', 'Useful Links' => 'Полезные ссылки', 'Documentation on GitHub' => 'Документация на GitHub', 'Report an Issue' => 'Сообщить о проблеме', 'Example Plugin on GitHub' => 'Пример плагина на GitHub', 'No paused events' => 'Нет приостановленных событий', 'Paused Since' => 'Приостановлено с', 'One-time' => 'Один раз', 'How to run WP Queue as a long-running background process.' => 'Как запустить WP Queue в виде долгоживущего фонового процесса.', 'When to use a daemon' => 'Когда использовать демон', 'Use a daemon worker on VPS, Docker or dedicated servers where you can keep a process running. It polls the queue continuously and starts jobs immediately. Without a daemon, WP Queue relies on WP-Cron and/or loopback, which can delay jobs by up to a minute.' => 'Запускайте демон-воркер на VPS, Docker или выделенном сервере, где можно держать процесс запущенным. Он постоянно опрашивает очередь и сразу запускает задания. Без демона WP Queue полагается на WP-Cron и/или loopback, что может задерживать задания до минуты.', '1. Select the daemon runner' => '1. Выберите обработчик «демон»', 'In System → Status → Queue runner choose "Daemon / system cron" (or keep "Auto": a running worker is detected by its heartbeat). The same can be forced in wp-config.php:' => 'В Система → Состояние → Обработчик очереди выберите «Демон / системный cron» (или оставьте «Авто»: работающий воркер определяется по heartbeat). То же можно жёстко задать в wp-config.php:', 'With this runner WP-Cron scheduling and loopback requests are not used.' => 'С этим обработчиком планирование WP-Cron и loopback-запросы не используются.', 'Simplest option — system cron every minute:' => 'Проще всего — системный cron раз в минуту:', '2. Run the worker' => '2. Запустите воркер', 'With WP-CLI' => 'С WP-CLI', 'Start the worker from the WordPress root:' => 'Запустите воркер из корня WordPress:', '--memory limits the PHP memory for the worker process. Adjust the value to your needs.' => '--memory ограничивает память PHP для процесса воркера. Подберите значение под свои задачи.', 'Without WP-CLI' => 'Без WP-CLI', 'If WP-CLI is not available, create a PHP script that boots WordPress and runs the worker loop:' => 'Если WP-CLI недоступен, создайте PHP-скрипт, который загружает WordPress и запускает цикл воркера:', 'Save the script, make it executable and run it in the background:' => 'Сохраните скрипт, сделайте его исполняемым и запустите в фоне:', '3. Keep it running' => '3. Держите процесс запущенным', 'The command above must stay alive. In production use one of the options below.' => 'Команда выше должна оставаться запущенной. В продакшене используйте один из вариантов ниже.', 'Option A: systemd service' => 'Вариант A: сервис systemd', 'Save as /etc/systemd/system/wp-queue-worker.service, then run systemctl enable --now wp-queue-worker.' => 'Сохраните как /etc/systemd/system/wp-queue-worker.service, затем выполните systemctl enable --now wp-queue-worker.', 'Option B: Supervisor' => 'Вариант B: Supervisor', 'Option C: Docker Compose' => 'Вариант C: Docker Compose', 'Option D: plain PHP script' => 'Вариант D: простой PHP-скрипт', 'Use the script from step 2 (Without WP-CLI) inside screen, tmux or a simple cron-based restart loop. Remember that the script must stay alive to act as a daemon.' => 'Используйте скрипт из шага 2 (Без WP-CLI) внутри screen, tmux или простого цикла перезапуска через cron. Помните, что скрипт должен оставаться запущенным, чтобы работать как демон.', '4. Check status' => '4. Проверьте статус', 'If the worker is not running, queues will not be processed in daemon mode. Make sure the process is started and monitored.' => 'Если воркер не запущен, очереди в режиме демона обрабатываться не будут. Убедитесь, что процесс запущен и мониторится.', 'Cron event paused' => 'Cron-событие приостановлено', 'Failed to pause event' => 'Не удалось приостановить событие', 'Cron event resumed' => 'Cron-событие возобновлено', 'Failed to resume event' => 'Не удалось возобновить событие', 'Cron event updated' => 'Cron-событие обновлено', 'Failed to update event' => 'Не удалось обновить событие', 'Unknown runner.' => 'Неизвестный обработчик.', 'No fresh heartbeat from the daemon / system cron yet: add the crontab line shown below, otherwise jobs will not run.' => 'Свежего heartbeat от демона / системного cron пока нет: добавьте строку crontab, показанную ниже, иначе задачи не будут выполняться.', 'Store in wp-config.php (WP Queue block; edited atomically with a backup and a check)' => 'Хранить в wp-config.php (блок WP Queue; правится атомарно, с бэкапом и проверкой)', 'You are not allowed to change WP Queue settings.' => 'У вас нет прав менять настройки WP Queue.', 'admin-ajax.php answered, but not with the WP Queue ping response' => 'admin-ajax.php ответил, но не ответом WP Queue на ping', 'Unexpected response code: %d' => 'Неожиданный код ответа: %d', 'Loopback request successful' => 'Запрос обратной связи выполнен успешно', 'WP-Cron is disabled. Background tasks may not run automatically.' => 'WP-Cron отключен. Фоновые задачи могут не выполняться автоматически.', 'Loopback issue: %s' => 'Проблема обратной связи: %s', 'Memory usage is above 80%.' => 'Использование памяти выше 80%.', 'PHP max_execution_time is less than 30 seconds.' => 'PHP max_execution_time меньше 30 секунд.', 'Jobs are stored in the %s table' => 'Задачи хранятся в таблице %s', 'Synchronous execution (no queue)' => 'Синхронное выполнение (без очереди)', 'Custom driver' => 'Пользовательский драйвер', 'Unknown driver' => 'Неизвестный драйвер', 'Redis is disabled via WP_REDIS_DISABLED' => 'Redis отключен с помощью WP_REDIS_DISABLED', 'PHP extension "redis" (phpredis) is not installed' => 'PHP-расширение "redis" (phpredis) не установлено', 'Connected to Redis at %1$s:%2$d (phpredis)' => 'Подключено к Redis %1$s:%2$d (phpredis)', 'Cannot connect to Redis at %1$s:%2$d - %3$s' => 'Не удаётся подключиться к Redis %1$s:%2$d — %3$s', 'Connected to Redis at %1$s:%2$d (via redis-cache plugin)' => 'Подключено к Redis %1$s:%2$d (через плагин redis-cache)', 'Redis connection failed' => 'Подключение к Redis не удалось.', 'Predis library is not available' => 'Библиотека Predis недоступна', 'Connected to Redis at %1$s:%2$d (Predis)' => 'Подключено к Redis %1$s:%2$d (Predis)', 'PHP extension "memcached" is not installed' => 'PHP-расширение "memcached" не установлено', 'Connected to Memcached at %1$s:%2$d' => 'Подключено к Memcached %1$s:%2$d', 'Cannot connect to Memcached at %1$s:%2$d - %3$s' => 'Не удаётся подключиться к Memcached %1$s:%2$d — %3$s', 'Queue driver "%s" is not supported.' => 'Драйвер очереди «%s» не поддерживается.', 'Selected manually.' => 'Выбран вручную.', 'Selected manually, but: %s' => 'Выбран вручную, но: %s', 'No other runner is available.' => 'Другие обработчики недоступны.', 'Daemon / system cron is alive: last run %s ago.' => 'Демон / системный cron работает: последний запуск %s назад.', 'No daemon / system cron heartbeat yet.' => 'Heartbeat от демона / системного cron ещё не было.', 'Daemon / system cron heartbeat is stale (%s ago).' => 'Heartbeat демона / системного cron устарел (%s назад).', 'Loopback is disabled by WP_QUEUE_LOOPBACK in wp-config.php.' => 'Loopback выключен константой WP_QUEUE_LOOPBACK в wp-config.php.', 'Loopback request failed: %s' => 'Loopback-запрос не прошёл: %s', 'Loopback requests to admin-ajax.php work.' => 'Loopback-запросы к admin-ajax.php работают.', 'WP-Cron is disabled (DISABLE_WP_CRON); it runs only if a system cron calls wp-cron.php.' => 'WP-Cron выключен (DISABLE_WP_CRON); он работает, только если системный cron вызывает wp-cron.php.', 'WP-Cron runs on site visits.' => 'WP-Cron запускается при посещениях сайта.', 'Jobs run at the end of the request that dispatched them.' => 'Задачи выполняются в конце запроса, который их поставил.', 'Auto' => 'Авто', 'Daemon / system cron' => 'Демон / системный cron', 'Loopback (admin-ajax)' => 'Loopback (admin-ajax)', 'Synchronous (in request)' => 'Синхронно (в запросе)', 'Uses the fastest available runner: daemon / system cron if its heartbeat is fresh, then loopback, WP-Cron, synchronous.' => 'Использует самый быстрый доступный обработчик: демон / системный cron при свежем heartbeat, затем loopback, WP-Cron, синхронный.', 'Fastest and most reliable. A system cron runs `wp queue work` every minute (or a daemon runs continuously). WP-Cron and loopback are not used.' => 'Самый быстрый и надёжный. Системный cron запускает `wp queue work` каждую минуту (или постоянно работает демон). WP-Cron и loopback не используются.', 'After a job is dispatched, a non-blocking request to admin-ajax.php starts a worker, like Action Scheduler. Good for shared hosting. Delayed jobs run on the next dispatch.' => 'После постановки задачи неблокирующий запрос к admin-ajax.php запускает воркер, как в Action Scheduler. Подходит для виртуального хостинга. Отложенные задачи выполняются при следующей постановке.', 'WP-Cron checks the queue every minute; needs site traffic or a system cron calling wp-cron.php.' => 'WP-Cron проверяет очередь каждую минуту; нужен трафик на сайте или системный cron, вызывающий wp-cron.php.', 'Jobs run at the end of the request that dispatched them. No background processing; slows that request down.' => 'Задачи выполняются в конце запроса, который их поставил. Без фоновой обработки; замедляет этот запрос.', '%d s' => '%d с', '%d min' => '%d мин', '%d h' => '%d ч', 'Every %d Minutes' => 'Каждые %d минут', 'wp-config.php was not found.' => 'wp-config.php не найден.', 'wp-config.php (or its directory) is not writable. Paste this block into wp-config.php manually, above the "That\'s all, stop editing!" line:' => 'wp-config.php (или его каталог) недоступен для записи. Вставьте этот блок в wp-config.php вручную, выше строки «That\'s all, stop editing!»:', 'Could not find where to insert the block in wp-config.php. Add it manually above the "That\'s all, stop editing!" line:' => 'Не удалось найти место для блока в wp-config.php. Добавьте его вручную выше строки «That\'s all, stop editing!»:', 'wp-config.php is already up to date.' => 'wp-config.php уже актуален.', 'The resulting wp-config.php would not be valid PHP; nothing was changed.' => 'Получившийся wp-config.php был бы некорректным PHP; ничего не изменено.', 'Could not create a backup of wp-config.php; nothing was changed.' => 'Не удалось создать бэкап wp-config.php; ничего не изменено.', 'Could not write a temporary file next to wp-config.php; nothing was changed.' => 'Не удалось записать временный файл рядом с wp-config.php; ничего не изменено.', 'Could not keep the owner/permissions of wp-config.php; nothing was changed. Paste the block manually:' => 'Не удалось сохранить владельца/права wp-config.php; ничего не изменено. Вставьте блок вручную:', 'Could not replace wp-config.php (read-only or bind-mounted file); nothing was changed. Paste the block manually:' => 'Не удалось заменить wp-config.php (файл только для чтения или смонтирован); ничего не изменено. Вставьте блок вручную:', 'WordPress did not load with the new wp-config.php (%s); the previous file was restored.' => 'WordPress не загрузился с новым wp-config.php (%s); прежний файл восстановлен.', 'wp-config.php updated and verified.' => 'wp-config.php обновлён и проверен.', 'HTTP %d' => 'HTTP %d', '%s has an unexpected value' => '%s имеет неожиданное значение', 'Unknown storage driver.' => 'Неизвестный драйвер хранения.', 'The storage driver is defined in wp-config.php and cannot be changed here.' => 'Драйвер хранения задан в wp-config.php, здесь его изменить нельзя.', 'This storage driver is already active.' => 'Этот драйвер хранения уже активен.', 'The storage driver is not available: %s' => 'Драйвер хранения недоступен: %s', 'A worker is processing jobs right now. Try again in a minute.' => 'Сейчас воркер обрабатывает задачи. Повторите через минуту.', 'Storage driver switched to %1$s. Jobs moved: %2$d.' => 'Драйвер хранения переключён на %1$s. Перенесено задач: %2$d.', '%1$d job(s) in queue "%2$s" are being executed. Try again when they finish.' => 'В очереди «%2$s» выполняется задач: %1$d. Повторите, когда они завершатся.', 'The current storage driver cannot move its jobs. Wait until its queues are empty, then switch.' => 'Текущий драйвер хранения не умеет переносить задачи. Дождитесь, пока очереди опустеют, затем переключайте.', 'Defined in wp-config.php (%s). Change it there.' => 'Задано в wp-config.php (%s). Меняйте там.', 'Saved to wp-config.php (WP Queue block).' => 'Сохранено в wp-config.php (блок WP Queue).', 'Saved.' => 'Сохранено.']]; diff --git a/languages/wp-queue-ru_RU.mo b/languages/wp-queue-ru_RU.mo index f40724a..4a6e5ec 100644 Binary files a/languages/wp-queue-ru_RU.mo and b/languages/wp-queue-ru_RU.mo differ diff --git a/languages/wp-queue-ru_RU.po b/languages/wp-queue-ru_RU.po index 1f920d1..e5c2e96 100644 --- a/languages/wp-queue-ru_RU.po +++ b/languages/wp-queue-ru_RU.po @@ -4,8 +4,8 @@ msgid "" msgstr "" "Project-Id-Version: WP Queue 1.0.0\n" -"Report-Msgid-Bugs-To: https://github.com/rwsite/wp-queue/issues\n" -"POT-Creation-Date: 2025-12-06 01:35+0000\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/app\n" +"POT-Creation-Date: 2026-11-11T14:53:28+00:00\n" "PO-Revision-Date: 2026-07-25 21:14+0000\n" "Last-Translator: \n" "Language-Team: Русский\n" @@ -13,1748 +13,1927 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " -"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Loco https://localise.biz/\n" -"X-Loco-Version: 2.8.0; wp-6.9; php-8.3.28" +"X-Loco-Version: 2.8.0; wp-6.9; php-8.3.28\n" -#: src/Admin/AdminPage.php:913 -msgid "%d entries" -msgstr "%d записей" - -#: src/Admin/AdminPage.php:545 -msgid "%d tasks" -msgstr "%d задач" +#. Plugin Name of the plugin +#: wp-queue.php +msgid "Queue Manager" +msgstr "" -#: src/Admin/AdminPage.php:1071 -msgid "(configured)" -msgstr "(настроено)" +#. Plugin URI of the plugin +#: wp-queue.php +msgid "https://github.com/rwsite/wp-queue" +msgstr "https://github.com/rwsite/wp-queue" -#: src/Admin/AdminPage.php:2306 -msgid "" -"--memory limits the PHP memory for the worker process. Adjust the value to " -"your needs." -msgstr "" -"--memory ограничивает память PHP для процесса воркера. Подберите значение " -"под свои задачи." +#. Description of the plugin +#: wp-queue.php +msgid "Background job processing and WP-Cron management for WordPress. Schedule tasks, manage queues, and monitor cron events." +msgstr "Обработка фоновых задач и управление WP-Cron для WordPress. Планируйте задачи, управляйте очередями и отслеживайте cron-события." -#: src/Admin/AdminPage.php:2296 -msgid "1. Enable daemon runtime mode" -msgstr "1. Включите режим демона" +#. Author of the plugin +#: wp-queue.php +msgid "Aleksei Tikhomirov" +msgstr "Алексей Тихомиров" -#: src/Admin/AdminPage.php:2301 -msgid "2. Run the worker" -msgstr "2. Запустите воркер" +#. Author URI of the plugin +#: wp-queue.php +msgid "https://rwsite.ru" +msgstr "https://rwsite.ru" -#: src/Admin/AdminPage.php:2328 -msgid "3. Keep it running" -msgstr "3. Держите процесс запущенным" +#: src/Admin/AdminPage.php:41 src/Admin/AdminPage.php:384 +msgid "Queues" +msgstr "Очереди" -#: src/Admin/AdminPage.php:2367 -msgid "4. Check status" -msgstr "4. Проверьте статус" +#: src/Admin/AdminPage.php:42 src/Admin/AdminPage.php:2249 +msgid "Scheduler" +msgstr "Планировщик" -#: src/Admin/AdminPage.php:669 -msgid "A background process (Worker) constantly checks the queue for new jobs." -msgstr "" -"Фоновый процесс (Worker) постоянно проверяет очередь на наличие новых " -"заданий." +#: src/Admin/AdminPage.php:43 src/Admin/AdminPage.php:795 +msgid "System" +msgstr "Система" -#: src/Admin/AdminPage.php:1867 -msgid "" -"A daemon worker is expected to process queues. WP-Cron and loopback are " -"disabled." -msgstr "" -"Для обработки очередей ожидается демон-воркер. WP-Cron и loopback отключены." +#: src/Admin/AdminPage.php:48 src/Admin/AdminPage.php:55 +#: src/Admin/AdminPage.php:257 +msgid "Overview" +msgstr "Обзор" -#: src/Admin/AdminPage.php:719 -msgid "" -"A list of all active queues with their size, status " -"(idle/pending/running/paused), and control buttons (pause/resume, clear all " -"tasks)." -msgstr "" -"Список всех активных очередей с указанием их размера, статуса " -"(простой/ожидание/выполнение/приостановка) и кнопок управления " -"(пауза/возобновление, очистить все задачи)." +#: src/Admin/AdminPage.php:49 +msgid "Jobs in Queue" +msgstr "Задачи в очереди" -#: src/Admin/AdminPage.php:667 -msgid "A plugin creates a \"Job\" (a task) and pushes it to the queue." -msgstr "Плагин создает «Задание» (задачу) и помещает его в очередь." +#: src/Admin/AdminPage.php:50 +msgid "History" +msgstr "История" -#: src/Admin/AdminPage.php:691 -msgid "" -"A real cron job configured on your server (Linux) that calls WordPress every " -"minute. This is reliable and precise. Ideally, you should disable default WP-" -"Cron and use System Cron." -msgstr "" -"На вашем сервере (Linux) должна быть настроена настоящая задача cron, " -"которая будет запускать WordPress каждую минуту. Это надежно и точно. В " -"идеале следует отключить стандартный WP-Cron и использовать системный Cron." +#: src/Admin/AdminPage.php:51 src/Admin/AdminPage.php:334 +#: src/Admin/AdminPage.php:363 src/Admin/AdminPage.php:864 +msgid "Failed" +msgstr "Ошибки" -#: src/Admin/AdminPage.php:768 -msgid "A separate table for events that are temporarily disabled." -msgstr "Отдельная таблица для событий, которые временно отключены." +#: src/Admin/AdminPage.php:52 +msgid "Drivers" +msgstr "Драйверы" -#: src/Admin/AdminPage.php:769 -msgid "" -"A table of all available intervals (hourly, daily, etc.) with their duration." -msgstr "" -"Таблица со всеми доступными интервалами (почасовыми, суточным и т. д.) и их " -"продолжительностью." +#: src/Admin/AdminPage.php:56 +msgid "Cron Events" +msgstr "События Cron" -#: src/Admin/AdminPage.php:88 src/Admin/AdminPage.php:109 -#: src/Admin/AdminPage.php:641 -msgid "About WP Queue" -msgstr "О WP Queue" +#: src/Admin/AdminPage.php:57 src/Admin/AdminPage.php:1389 +msgid "Scheduled" +msgstr "Запланировано" -#: src/Admin/AdminPage.php:201 -msgid "Action completed successfully" -msgstr "Действие успешно завершено." +#: src/Admin/AdminPage.php:58 src/Admin/AdminPage.php:332 +#: src/Admin/AdminPage.php:441 src/Admin/AdminPage.php:1397 +msgid "Paused" +msgstr "Приостановлено" -#: src/Admin/AdminPage.php:785 src/Admin/AdminPage.php:1746 -#: src/Admin/AdminPage.php:1984 -msgid "Action Scheduler" -msgstr "Планировщик действий" +#: src/Admin/AdminPage.php:61 +msgid "System Status" +msgstr "Состояние системы" -#: src/Admin/AdminPage.php:484 src/Admin/AdminPage.php:597 -#: src/Admin/AdminPage.php:1486 src/Admin/AdminPage.php:1561 -#: src/Admin/AdminPage.php:2255 -msgid "Actions" -msgstr "Действия" +#: src/Admin/AdminPage.php:62 src/Admin/AdminPage.php:2380 +msgid "Daemon worker" +msgstr "Демон-воркер" -#: src/Admin/AdminPage.php:431 src/Admin/AdminPage.php:1058 -#: src/Admin/AdminPage.php:1370 src/Admin/AdminPage.php:1911 -msgid "Active" -msgstr "Активный" +#: src/Admin/AdminPage.php:63 src/Admin/AdminPage.php:2111 +msgid "Tools" +msgstr "Инструменты" -#: src/Admin/AdminPage.php:2297 -msgid "Add this to wp-config.php:" -msgstr "Добавьте в wp-config.php:" +#: src/Admin/AdminPage.php:64 +msgid "Help" +msgstr "Помощь" -#: src/Admin/AdminPage.php:1103 -msgid "Add to wp-config.php:" -msgstr "Добавьте в файл wp-config.php:" +#: src/Admin/AdminPage.php:72 src/Admin/AdminPage.php:73 +#: src/Admin/AdminPage.php:1510 src/Admin/AdminPage.php:1893 +msgid "WP Queue" +msgstr "WP Queue" -#: src/Admin/AdminPage.php:618 -msgid "ago (overdue)" -msgstr "давно (просрочено)" +#: src/Admin/AdminPage.php:92 src/Admin/AdminPage.php:113 +#: src/Admin/AdminPage.php:659 +msgid "About WP Queue" +msgstr "О WP Queue" -#. Author of the plugin -msgid "Aleksei Tikhomirov" -msgstr "Алексей Тихомиров" +#: src/Admin/AdminPage.php:98 +msgid "Usage" +msgstr "Использование" -#: src/Admin/AdminPage.php:840 src/Admin/AdminPage.php:1462 -msgid "All" -msgstr "Все" +#: src/Admin/AdminPage.php:104 +msgid "WP-CLI" +msgstr "WP-CLI" -#: src/Admin/AdminPage.php:851 -msgid "All queues" -msgstr "Все очереди" +#: src/Admin/AdminPage.php:114 +msgid "WP Queue helps your site run heavy or regular tasks in the background (emails, synchronizations, cleanups) so that pages load faster for visitors." +msgstr "WP Queue помогает вашему сайту выполнять ресурсоемкие или регулярно выполняемые задачи в фоновом режиме (отправка электронной почты, синхронизация, очистка), благодаря чему страницы загружаются быстрее для посетителей." -#: src/Admin/AdminPage.php:1660 -msgid "All systems are healthy." -msgstr "Все системы работают исправно." +#: src/Admin/AdminPage.php:115 +msgid "The plugin itself does not add new features to the frontend. It provides a reliable queue that other plugins or your custom code can use for background work." +msgstr "Сам плагин не добавляет новых функций на фронтенд. Он предоставляет надежную очередь, которую другие плагины или ваш пользовательский код могут использовать для фоновой работы." -#: src/Admin/AdminPage.php:1712 -msgid "Alternate Cron" -msgstr "Альтернативный Cron" +#: src/Admin/AdminPage.php:116 +msgid "What you can use it for" +msgstr "Для чего его можно использовать" -#: src/Admin/AdminPage.php:202 -msgid "An error occurred" -msgstr "Произошла ошибка." +#: src/Admin/AdminPage.php:118 +msgid "Monitor which background jobs are queued and running right now." +msgstr "Отслеживайте, какие фоновые задачи находятся в очереди и выполняются в данный момент." -#: src/Admin/AdminPage.php:199 -msgid "Are you sure you want to clear this queue?" -msgstr "Вы уверены, что хотите очистить эту очередь?" +#: src/Admin/AdminPage.php:119 +msgid "Quickly see if any jobs are failing and view recent log entries." +msgstr "Быстро проверьте, не завершаются ли какие-либо задания с ошибкой, и просмотрите последние записи в журнале." -#: src/Admin/AdminPage.php:481 src/Admin/AdminPage.php:963 -msgid "Attempts" -msgstr "Попытки" +#: src/Admin/AdminPage.php:120 +msgid "Inspect and manage WP-Cron events for WP Queue and other plugins." +msgstr "Проверяйте и управляйте событиями WP-Cron для WP Queue и других плагинов." -#: src/Admin/AdminPage.php:170 -msgid "Author Website" -msgstr "Веб-сайт автора" +#: src/Admin/AdminPage.php:121 +msgid "Check basic system requirements that affect queue stability." +msgstr "Проверьте основные системные требования, влияющие на стабильность очереди." -#: src/Admin/AdminPage.php:482 -msgid "Available From" -msgstr "Доступно с" +#: src/Admin/AdminPage.php:123 src/Admin/AdminPage.php:139 +msgid "For developers" +msgstr "Для разработчиков" -#. Description of the plugin -msgid "" -"Background job processing and WP-Cron management for WordPress. Schedule " -"tasks, manage queues, and monitor cron events." -msgstr "" -"Обработка фоновых задач и управление WP-Cron для WordPress. Планируйте " -"задачи, управляйте очередями и отслеживайте cron-события." +#: src/Admin/AdminPage.php:124 +msgid "Developers can dispatch their own jobs to the queue, choose drivers (Database, Sync, Redis), configure retries and schedules. See the documentation and examples on GitHub for integration details." +msgstr "Разработчики могут отправлять свои собственные задания в очередь, выбирать драйверы (база данных, синхронизация, Redis), настраивать повторные попытки и расписание. Подробную информацию об интеграции см. в документации и примерах на GitHub." -#: src/Admin/AdminPage.php:125 +#: src/Admin/AdminPage.php:129 msgid "Basic Usage" msgstr "Основные правила использования" -#: src/Admin/AdminPage.php:751 -msgid "Button to delete old log entries to avoid cluttering the database." -msgstr "" -"Кнопка для удаления старых записей журнала во избежание засорения базы " -"данных." +#: src/Admin/AdminPage.php:130 +msgid "For site administrators" +msgstr "Для администраторов сайта" -#: src/Admin/AdminPage.php:749 -msgid "Buttons to show all entries, only completed, or only failed jobs." -msgstr "" -"Кнопки для отображения всех записей, только завершенных или только неудачно " -"завершенных заданий." +#: src/Admin/AdminPage.php:132 +msgid "Dashboard – quick overview of queues, number of jobs and recent activity." +msgstr "Панель управления – краткий обзор очередей, количества заданий и недавней активности." -#: src/Admin/AdminPage.php:653 -msgid "" -"By default, WordPress executes all actions during the page load request. If " -"a plugin needs to send 100 emails or sync 500 products with an external API, " -"the user has to wait until it finishes. This leads to slow page loads or " -"timeouts." -msgstr "" -"По умолчанию WordPress выполняет все действия во время запроса на загрузку " -"страницы. Если плагину необходимо отправить 100 электронных писем или " -"синхронизировать 500 товаров с внешним API, пользователю приходится ждать " -"завершения процесса. Это приводит к медленной загрузке страниц или таймаутам." +#: src/Admin/AdminPage.php:133 +msgid "Scheduled Jobs – list of recurring background jobs added by your theme or plugins." +msgstr "Запланированные задания — список повторяющихся фоновых заданий, добавленных вашей темой или плагинами." -#: src/Admin/AdminPage.php:701 -msgid "" -"By default, WP Queue stores jobs in the WordPress database (wp_options or " -"custom tables). For high-performance sites, you can use Redis. Redis is an " -"in-memory data store that is much faster than a SQL database for queue " -"operations. It reduces load on your database and speeds up job processing." -msgstr "" -"По умолчанию WP Queue хранит задания в базе данных WordPress (в папке " -"wp_options или в пользовательских таблицах). Для высокопроизводительных " -"сайтов можно использовать Redis. Redis — это хранилище данных в оперативной " -"памяти, которое намного быстрее, чем база данных SQL, при работе с очередями." -" Оно снижает нагрузку на базу данных и ускоряет обработку заданий." +#: src/Admin/AdminPage.php:134 +msgid "Logs – history of completed and failed jobs that helps to diagnose problems." +msgstr "Логи — история выполненных и неудачных заданий, которая помогает диагностировать проблемы." -#: src/Admin/AdminPage.php:1626 -msgid "Cancel" -msgstr "Отмена" +#: src/Admin/AdminPage.php:135 +msgid "WP-Cron – list of cron events with the ability to run, pause or delete them." +msgstr "WP-Cron – список событий cron с возможностью их запуска, приостановки или удаления." -#: src/QueueManager.php:500 -#, php-format -msgid "Cannot connect to Memcached at %s:%d - %s" -msgstr "Не удалось подключиться к Memcached на %s:%d - %s" +#: src/Admin/AdminPage.php:136 +msgid "System – checks PHP version, WP-Cron status and other important settings." +msgstr "Система проверяет версию PHP, статус WP-Cron и другие важные настройки." + +#: src/Admin/AdminPage.php:138 +msgid "If you installed WP Queue because another plugin requires it, you usually do not need to configure anything here. Use these tabs mainly for monitoring and troubleshooting." +msgstr "Если вы установили WP Queue, потому что он требуется другому плагину, обычно здесь ничего настраивать не нужно. Используйте эти вкладки в основном для мониторинга и устранения неполадок." -#: src/QueueManager.php:297 src/QueueManager.php:375 src/QueueManager.php:448 +#. translators: %s: URL to GitHub repository +#: src/Admin/AdminPage.php:142 #, php-format -msgid "Cannot connect to Redis at %s:%d - %s" -msgstr "Не удалось подключиться к Redis на %s:%d - %s" +msgid "To add your own background jobs, use the WP Queue PHP API from your plugin or theme. You can dispatch jobs to different queues, set delays and retries. Full code examples are available in the README on GitHub." +msgstr "Чтобы добавить собственные фоновые задачи, используйте PHP API WP Queue из вашего плагина или темы. Вы можете отправлять задачи в разные очереди, устанавливать задержки и повторные попытки. Полные примеры кода доступны в файле README на GitHub ." -#: src/Admin/AdminPage.php:117 -msgid "Check basic system requirements that affect queue stability." -msgstr "" -"Проверьте основные системные требования, влияющие на стабильность очереди." +#: src/Admin/AdminPage.php:149 src/Admin/AdminPage.php:2133 +msgid "WP-CLI Commands" +msgstr "Команды WP-CLI" -#: src/Admin/AdminPage.php:1040 -msgid "Check driver settings." -msgstr "Проверьте настройки драйвера." +#: src/Admin/AdminPage.php:150 src/Admin/AdminPage.php:1560 +msgid "Run" +msgstr "Запуск" -#: src/Admin/AdminPage.php:754 -msgid "Check logs when encountering errors in background processes." -msgstr "При обнаружении ошибок в фоновых процессах проверяйте журналы." +#: src/Admin/AdminPage.php:150 +msgid "to get a list of available commands." +msgstr "чтобы получить список доступных команд." -#: src/Admin/AdminPage.php:788 -msgid "Check this tab when setting up your server or debugging queue issues." -msgstr "" -"Проверьте эту вкладку при настройке сервера или отладке проблем с очередями." +#: src/Admin/AdminPage.php:171 +msgid "For more information:" +msgstr "Для получения дополнительной информации:" -#: src/Admin/AdminPage.php:784 -msgid "" -"Checking for disablement (DISABLE_WP_CRON), alternative cron, loopback " -"requests." -msgstr "" -"Проверка на отключение (DISABLE_WP_CRON), альтернативный cron, запросы " -"обратной связи." +#: src/Admin/AdminPage.php:172 +msgid "GitHub Repository" +msgstr "Репозиторий GitHub" -#: src/Admin/AdminPage.php:780 -msgid "" -"Checking system requirements and environment for stable queue operation." -msgstr "" -"Проверка системных требований и среды для обеспечения стабильной работы " -"очереди." +#: src/Admin/AdminPage.php:173 +msgid "Report Issues" +msgstr "Сообщить о проблемах" -#: src/Admin/AdminPage.php:454 -msgid "Clear" -msgstr "Очистить" +#: src/Admin/AdminPage.php:174 +msgid "Author Website" +msgstr "Веб-сайт автора" -#: src/Admin/AdminPage.php:2037 -msgid "Clear All" -msgstr "Очистить все" +#: src/Admin/AdminPage.php:203 +msgid "Are you sure you want to clear this queue?" +msgstr "Вы уверены, что хотите очистить эту очередь?" -#: src/Admin/AdminPage.php:2025 -msgid "Clear All Logs" -msgstr "Очистить все журналы" +#: src/Admin/AdminPage.php:204 +msgid "Pause this queue?" +msgstr "Приостановить выполнение этой очереди?" -#: src/Admin/AdminPage.php:2035 -msgid "Clear All Queues" -msgstr "Очистить все очереди" +#: src/Admin/AdminPage.php:205 +msgid "Action completed successfully" +msgstr "Действие успешно завершено." -#: src/Admin/AdminPage.php:2023 -msgid "Clear Logs" -msgstr "Очистить журналы" +#: src/Admin/AdminPage.php:206 +msgid "An error occurred" +msgstr "Произошла ошибка." -#: src/Admin/AdminPage.php:751 -msgid "Clear logs" -msgstr "Очистить журналы" +#: src/Admin/AdminPage.php:321 +msgid "This section is under development." +msgstr "Этот раздел находится в разработке." -#: src/Admin/AdminPage.php:863 -msgid "Clear old" -msgstr "Удалить старые" +#: src/Admin/AdminPage.php:329 +msgid "Idle" +msgstr "Idle" -#: src/Admin/AdminPage.php:570 -msgid "Close" -msgstr "Закрыть" +#: src/Admin/AdminPage.php:330 src/Admin/AdminPage.php:481 +#: src/Admin/AdminPage.php:2085 +msgid "Pending" +msgstr "В ожидании" -#: src/Admin/AdminPage.php:786 -msgid "" -"Comparison of server time, WordPress, and GMT offset for diagnosing " -"scheduling issues." -msgstr "" -"Сравнение серверного времени, времени WordPress и смещения GMT для " -"диагностики проблем с планированием." +#: src/Admin/AdminPage.php:331 src/Admin/AdminPage.php:355 +#: src/Admin/AdminPage.php:1950 +msgid "Running" +msgstr "Запущено" -#: src/Admin/AdminPage.php:329 src/Admin/AdminPage.php:355 -#: src/Admin/AdminPage.php:843 src/Admin/AdminPage.php:1823 +#: src/Admin/AdminPage.php:333 src/Admin/AdminPage.php:359 +#: src/Admin/AdminPage.php:861 src/Admin/AdminPage.php:1872 msgid "Completed" msgstr "Завершенные" -#: src/Admin/AdminPage.php:1885 -msgid "Component Status" -msgstr "Состояние компонента" +#: src/Admin/AdminPage.php:351 +msgid "In Queue" +msgstr "В очереди" + +#: src/Admin/AdminPage.php:370 +msgid "Driver:" +msgstr "Драйвер:" -#: src/Admin/AdminPage.php:369 +#: src/Admin/AdminPage.php:373 src/Admin/AdminPage.php:379 msgid "Configure" msgstr "Настройка" -#: src/Admin/AdminPage.php:2137 -msgid "Configure automatic retries on errors:" -msgstr "Настройте автоматическое повторение попыток при возникновении ошибок:" +#: src/Admin/AdminPage.php:376 +msgid "Runner:" +msgstr "Обработчик:" -#: src/Admin/AdminPage.php:1112 -msgid "Configure Memcached" -msgstr "Настройка Memcached" - -#: src/Admin/AdminPage.php:1106 -msgid "Configure Redis" -msgstr "Настройка Redis" +#: src/Admin/AdminPage.php:397 +msgid "jobs" +msgstr "задачи" -#: src/Admin/AdminPage.php:1909 -msgid "Configure system cron" -msgstr "Настройте системный cron." +#: src/Admin/AdminPage.php:408 +msgid "Recent Activity" +msgstr "Последние события" -#: src/QueueManager.php:489 +#. translators: %s: Queue name. +#: src/Admin/AdminPage.php:435 #, php-format -msgid "Connected to Memcached at %s:%d" -msgstr "Подключено к Memcached на %s:%d" +msgid "Queue: %s" +msgstr "Очередь: %s" -#: src/QueueManager.php:289 -#, php-format -msgid "Connected to Redis at %s:%d (phpredis)" -msgstr "Подключено к Redis по адресу %s:%d (phpredis)" +#: src/Admin/AdminPage.php:443 src/Admin/AdminPage.php:485 +msgid "Processing" +msgstr "Обработка" -#: src/QueueManager.php:440 -#, php-format -msgid "Connected to Redis at %s:%d (Predis)" -msgstr "Подключено к Redis по адресу %s:%d (Predis)" +#: src/Admin/AdminPage.php:445 src/Admin/AdminPage.php:1083 +#: src/Admin/AdminPage.php:1111 src/Admin/AdminPage.php:1409 +msgid "Active" +msgstr "Активный" -#: src/QueueManager.php:349 src/QueueManager.php:367 -#, php-format -msgid "Connected to Redis at %s:%d (via redis-cache plugin)" -msgstr "Подключено к Redis по адресу %s:%d (через плагин redis-cache)" +#: src/Admin/AdminPage.php:454 src/Admin/AdminPage.php:1613 +#: src/Admin/AdminPage.php:2360 +msgid "Resume" +msgstr "Резюме" -#: src/Admin/AdminPage.php:2080 -msgid "Create a job class and dispatch it to the queue:" -msgstr "Создайте класс задания и отправьте его в очередь:" +#: src/Admin/AdminPage.php:459 src/Admin/AdminPage.php:1574 +#: src/Admin/AdminPage.php:1575 +msgid "Pause" +msgstr "Пауза" -#: src/Admin/AdminPage.php:771 -msgid "Critical for understanding why tasks are not running on time." -msgstr "" -"Это крайне важно для понимания причин, по которым задачи не выполняются в " -"срок." +#: src/Admin/AdminPage.php:464 src/Admin/AdminPage.php:2123 +msgid "Process Now" +msgstr "Обработать сейчас" -#: src/Admin/RestApi.php:523 -msgid "Cron event paused" -msgstr "Cron-событие приостановлено" +#: src/Admin/AdminPage.php:468 +msgid "Clear" +msgstr "Очистить" -#: src/Admin/RestApi.php:537 -msgid "Cron event resumed" -msgstr "Cron-событие возобновлено" +#: src/Admin/AdminPage.php:477 +msgid "Total Jobs" +msgstr "Общее количество рабочих мест" -#: src/Admin/RestApi.php:554 -msgid "Cron event updated" -msgstr "Cron-событие обновлено" +#: src/Admin/AdminPage.php:493 +msgid "ID" +msgstr "ID" -#: src/Admin/AdminPage.php:52 -msgid "Cron Events" -msgstr "События Cron" +#: src/Admin/AdminPage.php:494 +msgid "Job Class" +msgstr "Job Class" -#: src/Admin/AdminPage.php:1680 -msgid "Current Memory Usage" -msgstr "Текущее использование памяти" +#: src/Admin/AdminPage.php:495 src/Admin/AdminPage.php:985 +msgid "Attempts" +msgstr "Попытки" -#: src/Admin/AdminPage.php:1046 -msgid "Current storage backend:" -msgstr "Текущая система хранения данных:" +#: src/Admin/AdminPage.php:496 +msgid "Available From" +msgstr "Доступно с" -#: src/QueueManager.php:207 src/QueueManager.php:533 src/QueueManager.php:535 -msgid "Custom driver" -msgstr "Пользовательский драйвер" +#: src/Admin/AdminPage.php:497 src/Admin/AdminPage.php:894 +#: src/Admin/AdminPage.php:1081 src/Admin/AdminPage.php:1210 +msgid "Status" +msgstr "Статус" + +#: src/Admin/AdminPage.php:498 src/Admin/AdminPage.php:615 +#: src/Admin/AdminPage.php:1525 src/Admin/AdminPage.php:1600 +#: src/Admin/AdminPage.php:2347 +msgid "Actions" +msgstr "Действия" -#: src/Admin/AdminPage.php:1865 -msgid "Daemon process" -msgstr "Демон-процесс" +#: src/Admin/AdminPage.php:504 +msgid "Queue is empty" +msgstr "Очередь пуста" -#: src/Admin/AdminPage.php:58 src/Admin/AdminPage.php:2288 -msgid "Daemon worker" -msgstr "Демон-воркер" +#: src/Admin/AdminPage.php:511 src/Admin/AdminPage.php:1306 +msgid "Unknown" +msgstr "Неизвестно" -#: src/Admin/AdminPage.php:713 -msgid "Dashboard" -msgstr "Панель управления" +#: src/Admin/AdminPage.php:521 src/Admin/AdminPage.php:636 +msgid "from now" +msgstr "с настоящего момента" -#: src/Admin/AdminPage.php:128 -msgid "" -"Dashboard – quick overview of queues, number of jobs and recent activity." -msgstr "" -"Панель управления – краткий обзор очередей, количества заданий и недавней " -"активности." +#: src/Admin/AdminPage.php:523 +msgid "Now" +msgstr "Сейчас" -#: src/Admin/AdminPage.php:2098 -msgid "Delayed Jobs" -msgstr "Задержка с выполнением заданий" +#: src/Admin/AdminPage.php:541 +msgid "Details" +msgstr "Подробности" -#: src/Admin/AdminPage.php:530 src/Admin/AdminPage.php:1542 -#: src/Admin/AdminPage.php:1543 +#: src/Admin/AdminPage.php:544 src/Admin/AdminPage.php:1581 +#: src/Admin/AdminPage.php:1582 msgid "Delete" msgstr "Удалить" -#: src/Admin/AdminPage.php:867 -msgid "Delete all" -msgstr "Удалить все" +#. translators: %d: Number of tasks. +#: src/Admin/AdminPage.php:561 +#, php-format +msgid "%d tasks" +msgstr "%d задач" -#: src/Admin/AdminPage.php:2024 -msgid "Deletes all job execution logs" -msgstr "Удаляет все журналы выполнения заданий." +#: src/Admin/AdminPage.php:585 +msgid "Job Details" +msgstr "Job Details" -#: src/Admin/AdminPage.php:2036 -msgid "Deletes all jobs from all queues" -msgstr "Удаляет все задания из всех очередей." +#: src/Admin/AdminPage.php:588 +msgid "Close" +msgstr "Закрыть" -#: src/Admin/AdminPage.php:861 -msgid "Deletes logs older than 7 days" -msgstr "Удаляет журналы старше 7 дней." +#: src/Admin/AdminPage.php:603 +msgid "Displays a table of scheduled recurring tasks (PHP classes) registered in WP Queue: job class, execution interval, queue assignment, and next run time. Allows you to run any task manually." +msgstr "Отображает таблицу запланированных повторяющихся задач (PHP-классов), зарегистрированных в WP Queue: класс задачи, интервал выполнения, назначение в очередь и время следующего запуска. Позволяет запускать любую задачу вручную." -#: src/Admin/AdminPage.php:1057 -msgid "Description" -msgstr "Описание" +#: src/Admin/AdminPage.php:611 src/Admin/AdminPage.php:895 +#: src/Admin/AdminPage.php:983 src/Admin/AdminPage.php:1211 +msgid "Job" +msgstr "Задача" + +#: src/Admin/AdminPage.php:612 src/Admin/AdminPage.php:1523 +#: src/Admin/AdminPage.php:1598 src/Admin/AdminPage.php:1652 +#: src/Admin/AdminPage.php:2345 +msgid "Schedule" +msgstr "Расписание" + +#: src/Admin/AdminPage.php:613 src/Admin/AdminPage.php:896 +#: src/Admin/AdminPage.php:984 +msgid "Queue" +msgstr "Очередь" + +#: src/Admin/AdminPage.php:614 src/Admin/AdminPage.php:1445 +#: src/Admin/AdminPage.php:1522 +msgid "Next Run" +msgstr "Следующий запуск" + +#: src/Admin/AdminPage.php:621 +msgid "No scheduled jobs found." +msgstr "Запланированных заданий не найдено." + +#: src/Admin/AdminPage.php:636 +msgid "ago (overdue)" +msgstr "давно (просрочено)" + +#: src/Admin/AdminPage.php:643 src/Admin/AdminPage.php:1559 +msgid "Run Now" +msgstr "Запустите сейчас" + +#: src/Admin/AdminPage.php:661 +msgid "WP Queue is a robust background processing library for WordPress. It allows you to offload time-consuming tasks (like sending emails, syncing data, or generating reports) to be processed asynchronously, ensuring your site remains fast and responsive for visitors." +msgstr "WP Queue — это мощная библиотека для фоновой обработки данных в WordPress. Она позволяет переносить трудоемкие задачи (например, отправку электронных писем, синхронизацию данных или создание отчетов) на асинхронную обработку, обеспечивая быструю и отзывчивую работу вашего сайта для посетителей." + +#: src/Admin/AdminPage.php:669 +msgid "Why is it needed?" +msgstr "Зачем это нужно?" + +#: src/Admin/AdminPage.php:671 +msgid "By default, WordPress executes all actions during the page load request. If a plugin needs to send 100 emails or sync 500 products with an external API, the user has to wait until it finishes. This leads to slow page loads or timeouts." +msgstr "По умолчанию WordPress выполняет все действия во время запроса на загрузку страницы. Если плагину необходимо отправить 100 электронных писем или синхронизировать 500 товаров с внешним API, пользователю приходится ждать завершения процесса. Это приводит к медленной загрузке страниц или таймаутам." + +#: src/Admin/AdminPage.php:677 +msgid "WP Queue solves this by pushing these tasks to a \"Queue\" and processing them later in the background. The user gets an instant response, and the heavy work happens behind the scenes." +msgstr "WP Queue решает эту проблему, отправляя эти задачи в \"очередь\" и обрабатывая их позже в фоновом режиме. Пользователь получает мгновенный ответ, а основная работа происходит за кулисами." + +#: src/Admin/AdminPage.php:683 +msgid "How Queues Work" +msgstr "Как работают очереди" + +#: src/Admin/AdminPage.php:685 +msgid "Dispatch" +msgstr "Отправлять" + +#: src/Admin/AdminPage.php:685 +msgid "A plugin creates a \"Job\" (a task) and pushes it to the queue." +msgstr "Плагин создает «Задание» (задачу) и помещает его в очередь." + +#: src/Admin/AdminPage.php:686 +msgid "Storage" +msgstr "Хранилище" + +#: src/Admin/AdminPage.php:686 +msgid "The job is saved in the database (or Redis) waiting to be picked up." +msgstr "Задание сохраняется в базе данных (или Redis) в ожидании обработки." + +#: src/Admin/AdminPage.php:687 +msgid "Worker" +msgstr "Воркер" + +#: src/Admin/AdminPage.php:687 +msgid "A background process (Worker) constantly checks the queue for new jobs." +msgstr "Фоновый процесс (Worker) постоянно проверяет очередь на наличие новых заданий." + +#: src/Admin/AdminPage.php:688 +msgid "Process" +msgstr "Процесс" + +#: src/Admin/AdminPage.php:688 +msgid "The worker picks up the job and executes it. If it succeeds, it is marked as \"Completed\". If it fails, it can be retried." +msgstr "Работник берет задание и выполняет его. Если оно выполняется успешно, оно помечается как «Завершено». Если оно не выполняется, его можно повторить." + +#: src/Admin/AdminPage.php:691 +msgid "WP-Cron vs System Cron" +msgstr "WP-Cron против System Cron" + +#: src/Admin/AdminPage.php:693 +msgid "To process the queue, WordPress needs a trigger. There are two ways to do this:" +msgstr "Для обработки очереди WordPress необходим триггер. Это можно сделать двумя способами:" + +#: src/Admin/AdminPage.php:699 +msgid "WP-Cron (Default)" +msgstr "WP-Cron (по умолчанию)" + +#: src/Admin/AdminPage.php:701 +msgid "WordPress checks for scheduled tasks on every page load. This works out of the box but has downsides: on low-traffic sites, tasks might not run on time; on high-traffic sites, it can cause performance issues. It is \"fake\" cron." +msgstr "WordPress проверяет наличие запланированных задач при каждой загрузке страницы. Это работает «из коробки», но имеет свои недостатки: на сайтах с низкой посещаемостью задачи могут не выполняться вовремя; на сайтах с высокой посещаемостью это может вызывать проблемы с производительностью. Это «поддельный» cron." + +#: src/Admin/AdminPage.php:707 +msgid "System Cron (Recommended)" +msgstr "Системный планировщик задач (рекомендуется)" #: src/Admin/AdminPage.php:709 +msgid "A real cron job configured on your server (Linux) that calls WordPress every minute. This is reliable and precise. Ideally, you should disable default WP-Cron and use System Cron." +msgstr "На вашем сервере (Linux) должна быть настроена настоящая задача cron, которая будет запускать WordPress каждую минуту. Это надежно и точно. В идеале следует отключить стандартный WP-Cron и использовать системный Cron." + +#: src/Admin/AdminPage.php:717 +msgid "Redis Support" +msgstr "Поддержка Redis" + +#: src/Admin/AdminPage.php:719 +msgid "By default, WP Queue stores jobs in the WordPress database (wp_options or custom tables). For high-performance sites, you can use Redis. Redis is an in-memory data store that is much faster than a SQL database for queue operations. It reduces load on your database and speeds up job processing." +msgstr "По умолчанию WP Queue хранит задания в базе данных WordPress (в папке wp_options или в пользовательских таблицах). Для высокопроизводительных сайтов можно использовать Redis. Redis — это хранилище данных в оперативной памяти, которое намного быстрее, чем база данных SQL, при работе с очередями. Оно снижает нагрузку на базу данных и ускоряет обработку заданий." + +#: src/Admin/AdminPage.php:727 msgid "Detailed description of the panel tabs" msgstr "Подробное описание вкладок панели" -#: src/Admin/AdminPage.php:527 -msgid "Details" -msgstr "Подробности" +#: src/Admin/AdminPage.php:731 +msgid "Dashboard" +msgstr "Панель управления" -#: src/Admin/AdminPage.php:120 -msgid "" -"Developers can dispatch their own jobs to the queue, choose drivers " -"(Database, Sync, Redis), configure retries and schedules. See the " -"documentation and examples on GitHub for integration details." -msgstr "" -"Разработчики могут отправлять свои собственные задания в очередь, выбирать " -"драйверы (база данных, синхронизация, Redis), настраивать повторные попытки " -"и расписание. Подробную информацию об интеграции см. в документации и " -"примерах на GitHub." +#: src/Admin/AdminPage.php:734 +msgid "The main tab for monitoring queue status in real-time." +msgstr "Главная вкладка для мониторинга состояния очереди в режиме реального времени." -#: src/Admin/AdminPage.php:1705 -msgid "" -"DISABLE_WP_CRON is set to true. Background tasks will not run automatically." -msgstr "" -"Параметр DISABLE_WP_CRON установлен в значение true. Фоновые задачи не будут " -"выполняться автоматически." +#: src/Admin/AdminPage.php:736 +msgid "Queue statistics" +msgstr "Статистика очереди" -#: src/Admin/AdminPage.php:1367 src/Admin/AdminPage.php:1704 -#: src/Admin/AdminPage.php:1717 src/Admin/AdminPage.php:1908 -msgid "Disabled" -msgstr "Отключен" +#: src/Admin/AdminPage.php:736 +msgid "Displays the total number of tasks in different statuses (pending, running, completed, failed)." +msgstr "Отображает общее количество задач в различных статусах (ожидание, выполнение, завершено, сбой)." -#: src/Admin/AdminPage.php:667 -msgid "Dispatch" -msgstr "Отправлять" +#: src/Admin/AdminPage.php:737 +msgid "Queue table" +msgstr "Таблица очереди" -#: src/Admin/AdminPage.php:1589 -msgid "Display" -msgstr "Показ" +#: src/Admin/AdminPage.php:737 +msgid "A list of all active queues with their size, status (idle/pending/running/paused), and control buttons (pause/resume, clear all tasks)." +msgstr "Список всех активных очередей с указанием их размера, статуса (простой/ожидание/выполнение/приостановка) и кнопок управления (пауза/возобновление, очистить все задачи)." -#: src/Admin/AdminPage.php:585 -msgid "" -"Displays a table of scheduled recurring tasks (PHP classes) registered in WP " -"Queue: job class, execution interval, queue assignment, and next run time. " -"Allows you to run any task manually." -msgstr "" -"Отображает таблицу запланированных повторяющихся задач (PHP-классов), " -"зарегистрированных в WP Queue: класс задачи, интервал выполнения, назначение " -"в очередь и время следующего запуска. Позволяет запускать любую задачу " -"вручную." +#: src/Admin/AdminPage.php:738 +msgid "Recent activity" +msgstr "Последние события" + +#: src/Admin/AdminPage.php:738 +msgid "The last 10 log entries for quick tracking of queue activity." +msgstr "Последние 10 записей в журнале для быстрого отслеживания активности в очереди." + +#: src/Admin/AdminPage.php:740 +msgid "Use this tab for quick checks of queue performance and identifying stuck processes." +msgstr "Используйте эту вкладку для быстрой проверки производительности очереди и выявления зависших процессов." + +#: src/Admin/AdminPage.php:746 +msgid "Scheduled Jobs" +msgstr "Запланированные задания" + +#: src/Admin/AdminPage.php:749 +msgid "Management of scheduled recurring tasks." +msgstr "Управление запланированными повторяющимися задачами." + +#: src/Admin/AdminPage.php:751 +msgid "Job list" +msgstr "Список Job" -#: src/Admin/AdminPage.php:733 +#: src/Admin/AdminPage.php:751 msgid "Displays all registered PHP job classes with their configuration." -msgstr "" -"Отображает все зарегистрированные классы заданий PHP с их конфигурацией." +msgstr "Отображает все зарегистрированные классы заданий PHP с их конфигурацией." -#: src/Admin/AdminPage.php:1644 -msgid "" -"Displays environment information (PHP and WordPress versions, memory limits, " -"execution time, timezone), WP-Cron status (disabled, alternative cron, " -"loopback checks). If Action Scheduler is installed - its statistics. Server " -"and WordPress time." -msgstr "" -"Отображает информацию об окружении (версии PHP и WordPress, ограничения " -"памяти, время выполнения, часовой пояс), статус WP-Cron (отключен, " -"альтернативный cron, проверки обратной связи). Если установлен Action " -"Scheduler — его статистика. Время сервера и WordPress." +#: src/Admin/AdminPage.php:752 +msgid "Job information" +msgstr "Job information" #: src/Admin/AdminPage.php:752 -msgid "Displays the last 200 entries by default or all completed/failed." -msgstr "" -"По умолчанию отображаются последние 200 записей или все " -"завершенные/незавершенные." +msgid "Job class, execution interval (e.g., \"hourly\", \"daily\"), queue assignment, next run time." +msgstr "Класс Job, интервал выполнения (например, \"ежечасно\", \"ежедневно\"), назначение в очередь, время следующего запуска." -#: src/Admin/AdminPage.php:718 -msgid "" -"Displays the total number of tasks in different statuses (pending, running, " -"completed, failed)." -msgstr "" -"Отображает общее количество задач в различных статусах (ожидание, выполнение," -" завершено, сбой)." +#: src/Admin/AdminPage.php:753 +msgid "Manual run" +msgstr "Ручной запуск" -#: src/Admin/AdminPage.php:736 +#: src/Admin/AdminPage.php:753 +msgid "The \"Run Now\" button allows you to run any job immediately, without waiting for the schedule." +msgstr "Кнопка «Запустить сейчас» позволяет немедленно запустить любое задание, не дожидаясь расписания." + +#: src/Admin/AdminPage.php:754 +msgid "Next run status" +msgstr "Статус следующего запуска" + +#: src/Admin/AdminPage.php:754 msgid "Displays when the job should run next or marks overdue jobs." -msgstr "" -"Отображает время следующего запуска задания или помечает просроченные " -"задания." +msgstr "Отображает время следующего запуска задания или помечает просроченные задания." -#: src/Admin/AdminPage.php:2119 -msgid "Distribute jobs across different queues:" -msgstr "Распределите задания по разным очередям:" +#: src/Admin/AdminPage.php:756 +msgid "Useful for testing jobs and forcing synchronizations." +msgstr "Полезно для тестирования заданий и принудительной синхронизации." -#: src/Admin/AdminPage.php:2206 -msgid "Documentation on GitHub" -msgstr "Документация на GitHub" +#: src/Admin/AdminPage.php:762 +msgid "Logs" +msgstr "Логи" -#: src/Admin/AdminPage.php:366 -msgid "Driver:" -msgstr "Драйвер:" +#: src/Admin/AdminPage.php:765 +msgid "History of all job executions for diagnostics and debugging." +msgstr "История всех выполненных заданий для диагностики и отладки." -#: src/Admin/AdminPage.php:48 -msgid "Drivers" -msgstr "Драйверы" +#: src/Admin/AdminPage.php:767 +msgid "Status filters" +msgstr "Фильтры состояния" -#: src/Admin/AdminPage.php:1529 -msgid "Edit" -msgstr "Редактировать" +#: src/Admin/AdminPage.php:767 +msgid "Buttons to show all entries, only completed, or only failed jobs." +msgstr "Кнопки для отображения всех записей, только завершенных или только неудачно завершенных заданий." -#: src/Admin/AdminPage.php:1606 -msgid "Edit Cron Event" -msgstr "Редактировать событие Cron" +#: src/Admin/AdminPage.php:768 +msgid "Log table" +msgstr "Таблица логов" -#: src/Admin/AdminPage.php:1528 -msgid "Edit Schedule" -msgstr "Редактировать расписание" +#: src/Admin/AdminPage.php:768 +msgid "Execution time, status (completed/failed/retrying), job class, queue, error message." +msgstr "Время выполнения, статус (завершено/сбой/повторная попытка), класс задания, очередь, сообщение об ошибке." -#: src/Admin/AdminPage.php:1707 src/Admin/AdminPage.php:1715 -msgid "Enabled" -msgstr "Включено" +#: src/Admin/AdminPage.php:769 +msgid "Clear logs" +msgstr "Очистить журналы" -#: src/Admin/AdminPage.php:783 src/Admin/AdminPage.php:1664 -msgid "Environment" -msgstr "Environment" +#: src/Admin/AdminPage.php:769 +msgid "Button to delete old log entries to avoid cluttering the database." +msgstr "Кнопка для удаления старых записей журнала во избежание засорения базы данных." -#: src/Admin/AdminPage.php:1732 src/Admin/AdminPage.php:1927 -msgid "Error" -msgstr "Ошибка" +#: src/Admin/AdminPage.php:770 +msgid "Number of entries" +msgstr "Количество записей" -#: src/Admin/AdminPage.php:964 -msgid "Error message" -msgstr "Сообщение об ошибке" +#: src/Admin/AdminPage.php:770 +msgid "Displays the last 200 entries by default or all completed/failed." +msgstr "По умолчанию отображаются последние 200 записей или все завершенные/незавершенные." -#: src/Admin/AdminPage.php:1827 -msgid "Errors" -msgstr "Ошибки" +#: src/Admin/AdminPage.php:772 +msgid "Check logs when encountering errors in background processes." +msgstr "При обнаружении ошибок в фоновых процессах проверяйте журналы." -#: src/Admin/AdminPage.php:767 -msgid "Event actions" -msgstr "Действия события" +#: src/Admin/AdminPage.php:778 src/Admin/AdminPage.php:2000 +#: src/Runtime/Runner.php:245 +msgid "WP-Cron" +msgstr "WP-Cron" -#: src/Admin/AdminPage.php:766 -msgid "" -"Event hook, next run time, schedule (single/hourly/daily), source, arguments." -msgstr "" -"Перехватчик событий, время следующего запуска, расписание " -"(однократное/ежечасное/ежедневное), источник, аргументы." +#: src/Admin/AdminPage.php:781 +msgid "Management of WordPress system timers that trigger background processes." +msgstr "Управление системными таймерами WordPress, запускающими фоновые процессы." -#: src/Admin/AdminPage.php:765 +#: src/Admin/AdminPage.php:783 msgid "Event statistics" msgstr "Статистика событий" -#: src/Admin/AdminPage.php:766 +#: src/Admin/AdminPage.php:783 +msgid "Total number of events, overdue, grouped by source (WordPress, WooCommerce, WP Queue, plugins)." +msgstr "Общее количество просроченных событий, сгруппированных по источнику (WordPress, WooCommerce, WP Queue, плагины)." + +#: src/Admin/AdminPage.php:784 msgid "Event table" msgstr "Таблица событий" +#: src/Admin/AdminPage.php:784 +msgid "Event hook, next run time, schedule (single/hourly/daily), source, arguments." +msgstr "Перехватчик событий, время следующего запуска, расписание (однократное/ежечасное/ежедневное), источник, аргументы." + +#: src/Admin/AdminPage.php:785 +msgid "Event actions" +msgstr "Действия события" + +#: src/Admin/AdminPage.php:785 +msgid "Run now, edit schedule, pause, delete. Modal window for changing interval." +msgstr "Запустить сейчас, отредактировать расписание, приостановить, удалить. Модальное окно для изменения интервала." + +#: src/Admin/AdminPage.php:786 +msgid "Paused events" +msgstr "Приостановленные события" + +#: src/Admin/AdminPage.php:786 +msgid "A separate table for events that are temporarily disabled." +msgstr "Отдельная таблица для событий, которые временно отключены." + +#: src/Admin/AdminPage.php:787 +msgid "Registered schedules" +msgstr "Зарегистрированные расписания" + +#: src/Admin/AdminPage.php:787 +msgid "A table of all available intervals (hourly, daily, etc.) with their duration." +msgstr "Таблица со всеми доступными интервалами (почасовыми, суточным и т. д.) и их продолжительностью." + +#: src/Admin/AdminPage.php:789 +msgid "Critical for understanding why tasks are not running on time." +msgstr "Это крайне важно для понимания причин, по которым задачи не выполняются в срок." + +#: src/Admin/AdminPage.php:798 +msgid "Checking system requirements and environment for stable queue operation." +msgstr "Проверка системных требований и среды для обеспечения стабильной работы очереди." + +#: src/Admin/AdminPage.php:800 +msgid "System health" +msgstr "Здоровье системы" + +#: src/Admin/AdminPage.php:800 +msgid "Notifications of critical issues (low memory, disabled WP-Cron)." +msgstr "Уведомления о критических проблемах (недостаток памяти, отключение WP-Cron)." + +#: src/Admin/AdminPage.php:801 src/Admin/AdminPage.php:1708 +msgid "Environment" +msgstr "Environment" + +#: src/Admin/AdminPage.php:801 +msgid "PHP and WordPress versions, memory limits (current usage), maximum execution time, timezone." +msgstr "Версии PHP и WordPress, ограничения памяти (текущее использование), максимальное время выполнения, часовой пояс." + +#: src/Admin/AdminPage.php:802 +msgid "WP-Cron status" +msgstr "статус WP-Cron" + +#: src/Admin/AdminPage.php:802 +msgid "Checking for disablement (DISABLE_WP_CRON), alternative cron, loopback requests." +msgstr "Проверка на отключение (DISABLE_WP_CRON), альтернативный cron, запросы обратной связи." + +#: src/Admin/AdminPage.php:803 src/Admin/AdminPage.php:1790 +#: src/Admin/AdminPage.php:2076 +msgid "Action Scheduler" +msgstr "Планировщик действий" + +#: src/Admin/AdminPage.php:803 +msgid "If installed, displays version and statistics (pending/running/failed actions)." +msgstr "Если установлено, отображает версию и статистику (ожидающие/выполняемые/неудачные действия)." + +#: src/Admin/AdminPage.php:804 +msgid "Server time" +msgstr "Время сервера" + +#: src/Admin/AdminPage.php:804 +msgid "Comparison of server time, WordPress, and GMT offset for diagnosing scheduling issues." +msgstr "Сравнение серверного времени, времени WordPress и смещения GMT для диагностики проблем с планированием." + +#: src/Admin/AdminPage.php:806 +msgid "Check this tab when setting up your server or debugging queue issues." +msgstr "Проверьте эту вкладку при настройке сервера или отладке проблем с очередями." + +#: src/Admin/AdminPage.php:811 +msgid "More documentation" +msgstr "Дополнительная документация" + +#. translators: %s: URL to GitHub repository +#: src/Admin/AdminPage.php:816 +#, php-format +msgid "Full documentation and code examples are available on GitHub: %s." +msgstr "Полная документация и примеры кода доступны на GitHub: %s." + +#: src/Admin/AdminPage.php:858 src/Admin/AdminPage.php:1501 +msgid "All" +msgstr "Все" + +#: src/Admin/AdminPage.php:869 +msgid "All queues" +msgstr "Все очереди" + +#: src/Admin/AdminPage.php:879 +msgid "Deletes logs older than 7 days" +msgstr "Удаляет журналы старше 7 дней." + +#: src/Admin/AdminPage.php:881 +msgid "Clear old" +msgstr "Удалить старые" + +#: src/Admin/AdminPage.php:885 +msgid "Delete all" +msgstr "Удалить все" + +#: src/Admin/AdminPage.php:893 src/Admin/AdminPage.php:982 +#: src/Admin/AdminPage.php:1209 src/Admin/AdminPage.php:2052 +msgid "Time" +msgstr "Время" + +#: src/Admin/AdminPage.php:897 +msgid "Message" +msgstr "Сообщение" + +#: src/Admin/AdminPage.php:903 +msgid "No logs found" +msgstr "Журналы не найдены" + +#. translators: %d: Number of log entries. +#: src/Admin/AdminPage.php:933 +#, php-format +msgid "%d entries" +msgstr "%d записей" + +#: src/Admin/AdminPage.php:975 +msgid "Total errors" +msgstr "Общее количество ошибок" + +#: src/Admin/AdminPage.php:986 +msgid "Error message" +msgstr "Сообщение об ошибке" + +#: src/Admin/AdminPage.php:992 +msgid "No errors" +msgstr "Ошибок нет." + +#: src/Admin/AdminPage.php:1056 +msgid "⚠️ Warning:" +msgstr "⚠️ Предупреждение:" + +#. translators: 1: Configured storage backend, 2: Fallback storage backend. +#: src/Admin/AdminPage.php:1059 +#, php-format +msgid "Storage backend \"%1$s\" is selected, but not available. Falling back to \"%2$s\"." +msgstr "Выбран бэкенд хранения «%1$s», но он недоступен. Используется «%2$s»." + +#: src/Admin/AdminPage.php:1064 +msgid "Check driver settings." +msgstr "Проверьте настройки драйвера." + +#: src/Admin/AdminPage.php:1070 +msgid "Current storage backend:" +msgstr "Текущая система хранения данных:" + +#: src/Admin/AdminPage.php:1074 +msgid "The storage backend only keeps jobs. How they are executed is chosen in System → Status → Queue runner." +msgstr "Бэкенд только хранит задачи. Как они выполняются, выбирается в Система → Состояние → Обработчик очереди." + +#: src/Admin/AdminPage.php:1080 +msgid "Storage backend" +msgstr "бэкэнд хранилища" + +#: src/Admin/AdminPage.php:1082 +msgid "Description" +msgstr "Описание" + +#: src/Admin/AdminPage.php:1101 +msgid "Install: pecl install redis, or the Redis Object Cache plugin (Predis)." +msgstr "Установите: pecl install redis или плагин Redis Object Cache (Predis)." + +#: src/Admin/AdminPage.php:1103 +msgid "Install: pecl install memcached" +msgstr "Установите: pecl install memcached" + +#: src/Admin/AdminPage.php:1113 +msgid "Set in wp-config.php" +msgstr "Задано в wp-config.php" + +#: src/Admin/AdminPage.php:1115 src/Admin/AdminPage.php:1122 +msgid "Make active" +msgstr "Сделать активным" + +#: src/Admin/AdminPage.php:1118 +msgid "Switch the storage backend? Waiting jobs will be moved to it." +msgstr "Переключить бэкенд хранения? Ожидающие задачи будут перенесены." + +#: src/Admin/AdminPage.php:1133 +msgid "How switching works" +msgstr "Как работает переключение" + +#: src/Admin/AdminPage.php:1135 +msgid "Waiting jobs (ready and delayed) are moved to the new backend under the global worker lock, so nothing is lost or run twice." +msgstr "Ожидающие задачи (готовые и отложенные) переносятся в новый бэкенд под глобальной блокировкой воркера: ничего не теряется и не выполняется дважды." + +#: src/Admin/AdminPage.php:1136 +msgid "Switching is refused while a worker is running or jobs are being executed; try again in a minute." +msgstr "Пока работает воркер или выполняются задачи, переключение отклоняется; повторите через минуту." + +#: src/Admin/AdminPage.php:1137 +msgid "Jobs that other requests add to the previous backend during the switch are moved by the worker within a day." +msgstr "Задачи, которые другие запросы добавят в прежний бэкенд во время переключения, воркер перенесёт в течение суток." + +#: src/Admin/AdminPage.php:1138 +msgid "If WP_QUEUE_DRIVER is defined in wp-config.php, it has priority. Inside the \"// BEGIN WP Queue\" block it is edited by the plugin (atomically, with a backup and verification); anywhere else it locks this choice." +msgstr "Если WP_QUEUE_DRIVER задан в wp-config.php, он имеет приоритет. Внутри блока «// BEGIN WP Queue» его правит плагин (атомарно, с бэкапом и проверкой); в любом другом месте он блокирует этот выбор." + +#: src/Admin/AdminPage.php:1140 +msgid "Redis connection" +msgstr "Подключение к Redis" + +#: src/Admin/AdminPage.php:1141 +msgid "Uses the Redis Object Cache constants (WP_REDIS_HOST, WP_REDIS_PORT, WP_REDIS_PASSWORD, WP_REDIS_DATABASE, WP_REDIS_PREFIX). Jobs are claimed with an atomic Lua script, so every job goes to exactly one worker." +msgstr "Используются константы Redis Object Cache (WP_REDIS_HOST, WP_REDIS_PORT, WP_REDIS_PASSWORD, WP_REDIS_DATABASE, WP_REDIS_PREFIX). Задачи захватываются атомарным Lua-скриптом, поэтому каждая достаётся ровно одному воркеру." + +#: src/Admin/AdminPage.php:1150 +msgid "Works everywhere. Atomic claim with a conditional UPDATE." +msgstr "Работает везде. Атомарный захват условным UPDATE." + +#: src/Admin/AdminPage.php:1151 +msgid "Fast, keeps the database small. Needs a Redis server." +msgstr "Быстро, не раздувает базу. Нужен сервер Redis." + +#: src/Admin/AdminPage.php:1152 +msgid "Not recommended: jobs cannot be listed or moved and may be evicted." +msgstr "Не рекомендуется: задачи нельзя перечислить или перенести, они могут быть вытеснены." + +#. translators: %s: constant name +#: src/Admin/AdminPage.php:1165 +#, php-format +msgid "set in wp-config.php (%s)" +msgstr "задано в wp-config.php (%s)" + +#: src/Admin/AdminPage.php:1168 +msgid "set in the WP Queue block of wp-config.php (editable here)" +msgstr "задано в блоке WP Queue в wp-config.php (можно менять здесь)" + +#: src/Admin/AdminPage.php:1169 +msgid "selected in the admin" +msgstr "выбрано в админке" + +#: src/Admin/AdminPage.php:1170 +msgid "default" +msgstr "по умолчанию" + +#: src/Admin/AdminPage.php:1185 +msgid "Ready" +msgstr "Готово" + +#: src/Admin/AdminPage.php:1189 +msgid "No extension" +msgstr "Нет расширения" + +#: src/Admin/AdminPage.php:1193 +msgid "No server" +msgstr "Нет сервера" + +#: src/Admin/AdminPage.php:1197 src/Admin/AdminPage.php:1952 +msgid "Unavailable" +msgstr "Недоступно" + +#: src/Admin/AdminPage.php:1217 +msgid "No activity" +msgstr "Нет активности" + #: src/Admin/AdminPage.php:1385 -msgid "events" -msgstr "события" +msgid "Total Events" +msgstr "Всего событий" -#: src/Admin/AdminPage.php:1375 -msgid "Events by Source" -msgstr "События по источникам" +#: src/Admin/AdminPage.php:1393 src/Admin/AdminPage.php:1488 +#: src/Admin/AdminPage.php:1544 src/Admin/CronMonitor.php:224 +msgid "Overdue" +msgstr "Просрочено" -#. %d: number of minutes -#: src/ScheduledJob.php:45 -msgid "Every %d Minutes" -msgstr "Каждые %d минут" +#: src/Admin/AdminPage.php:1404 +msgid "WP-Cron:" +msgstr "WP-Cron:" -#: src/Admin/AdminPage.php:2218 -msgid "Example Plugin on GitHub" -msgstr "Пример плагина на GitHub" +#: src/Admin/AdminPage.php:1406 src/Admin/AdminPage.php:1748 +#: src/Admin/AdminPage.php:1761 +msgid "Disabled" +msgstr "Отключен" -#: src/Admin/AdminPage.php:750 -msgid "" -"Execution time, status (completed/failed/retrying), job class, queue, error " -"message." -msgstr "" -"Время выполнения, статус (завершено/сбой/повторная попытка), класс задания, " -"очередь, сообщение об ошибке." +#: src/Admin/AdminPage.php:1407 +msgid "Use system cron" +msgstr "Используйте системный cron" + +#: src/Admin/AdminPage.php:1414 +msgid "Events by Source" +msgstr "События по источникам" + +#: src/Admin/AdminPage.php:1424 +msgid "events" +msgstr "события" -#: src/Admin/AdminPage.php:47 src/Admin/AdminPage.php:330 -#: src/Admin/AdminPage.php:359 src/Admin/AdminPage.php:846 -msgid "Failed" -msgstr "Ошибки" +#: src/Admin/AdminPage.php:1435 +msgid "Upcoming Events" +msgstr "Предстоящие события" -#: src/Admin/AdminPage.php:1763 -msgid "Failed Actions" -msgstr "Неудачные действия" +#: src/Admin/AdminPage.php:1439 +msgid "No scheduled events" +msgstr "Мероприятия не запланированы." -#: src/Admin/RestApi.php:523 -msgid "Failed to pause event" -msgstr "Не удалось приостановить событие" +#: src/Admin/AdminPage.php:1444 src/Admin/AdminPage.php:1521 +#: src/Admin/AdminPage.php:1597 src/Admin/AdminPage.php:2344 +msgid "Hook" +msgstr "Хук" -#: src/Admin/RestApi.php:537 -msgid "Failed to resume event" -msgstr "Не удалось возобновить событие" +#: src/Admin/AdminPage.php:1446 src/Admin/AdminPage.php:1524 +msgid "Source" +msgstr "Источник" -#: src/Admin/RestApi.php:554 -msgid "Failed to update event" -msgstr "Не удалось обновить событие" +#: src/Admin/AdminPage.php:1484 +msgid "Total" +msgstr "Всего" -#: src/Admin/AdminPage.php:119 src/Admin/AdminPage.php:135 -msgid "For developers" -msgstr "Для разработчиков" +#: src/Admin/AdminPage.php:1504 src/Admin/AdminPage.php:1897 +msgid "WordPress" +msgstr "WordPress" -#: src/Admin/AdminPage.php:167 -msgid "For more information:" -msgstr "Для получения дополнительной информации:" +#: src/Admin/AdminPage.php:1507 +msgid "WooCommerce" +msgstr "WooCommerce" -#: src/Admin/AdminPage.php:1120 -msgid "" -"For Redis/Memcached to work, you need the PHP extension installed and a " -"server available. If not, the system will automatically use the \"database\" " -"driver." -msgstr "" -"Для работы Redis/Memcached необходимо установить расширение PHP и иметь " -"доступный сервер. В противном случае система автоматически будет " -"использовать драйвер \"database\"." +#: src/Admin/AdminPage.php:1513 +msgid "Plugins" +msgstr "Плагины" -#: src/Admin/AdminPage.php:126 -msgid "For site administrators" -msgstr "Для администраторов сайта" +#: src/Admin/AdminPage.php:1531 +msgid "No cron events found." +msgstr "Событий cron не обнаружено." -#: src/Admin/AdminPage.php:2030 -msgid "Forces processing of all queues" -msgstr "Принудительная обработка всех очередей" +#: src/Admin/AdminPage.php:1549 src/Admin/AdminPage.php:1607 +msgid "Single" +msgstr "Один" -#: src/Admin/AdminPage.php:507 src/Admin/AdminPage.php:618 -msgid "from now" -msgstr "с настоящего момента" +#: src/Admin/AdminPage.php:1567 +msgid "Edit Schedule" +msgstr "Редактировать расписание" -#. %s: URL to GitHub repository -#: src/Admin/AdminPage.php:798 -#, php-format -msgid "Full documentation and code examples are available on GitHub: %s." -msgstr "Полная документация и примеры кода доступны на GitHub: %s." +#: src/Admin/AdminPage.php:1568 +msgid "Edit" +msgstr "Редактировать" -#: src/Admin/AdminPage.php:168 -msgid "GitHub Repository" -msgstr "Репозиторий GitHub" +#: src/Admin/AdminPage.php:1593 +msgid "Paused Events" +msgstr "Приостановленные события" -#: src/Admin/AdminPage.php:1791 -msgid "GMT Offset" -msgstr "GMT Offset" +#: src/Admin/AdminPage.php:1599 +msgid "Paused At" +msgstr "Приостановлено на" -#: src/Admin/AdminPage.php:60 -msgid "Help" -msgstr "Помощь" +#: src/Admin/AdminPage.php:1622 +msgid "Registered Schedules" +msgstr "Зарегистрированные расписания" -#: src/Admin/AdminPage.php:46 -msgid "History" -msgstr "История" +#: src/Admin/AdminPage.php:1626 +msgid "Name" +msgstr "Имя" -#: src/Admin/AdminPage.php:747 -msgid "History of all job executions for diagnostics and debugging." -msgstr "История всех выполненных заданий для диагностики и отладки." +#: src/Admin/AdminPage.php:1627 +msgid "Interval" +msgstr "Интервал" -#: src/Admin/AdminPage.php:1405 src/Admin/AdminPage.php:1482 -#: src/Admin/AdminPage.php:1558 src/Admin/AdminPage.php:2252 -msgid "Hook" -msgstr "Хук" +#: src/Admin/AdminPage.php:1628 +msgid "Display" +msgstr "Показ" -#: src/Admin/AdminPage.php:665 -msgid "How Queues Work" -msgstr "Как работают очереди" +#: src/Admin/AdminPage.php:1645 +msgid "Edit Cron Event" +msgstr "Редактировать событие Cron" -#: src/Admin/AdminPage.php:1102 -msgid "How to change the storage backend?" -msgstr "Как изменить хранилище для данных?" +#: src/Admin/AdminPage.php:1654 +msgid "Single (run once)" +msgstr "Один (запуск один раз)" -#: src/Admin/AdminPage.php:2289 -msgid "How to run WP Queue as a long-running background process." -msgstr "Как запустить WP Queue в виде долгоживущего фонового процесса." +#: src/Admin/AdminPage.php:1664 +msgid "Save Changes" +msgstr "Сохранить изменения" -#. URI of the plugin -msgid "https://github.com/rwsite/wp-queue" -msgstr "https://github.com/rwsite/wp-queue" +#: src/Admin/AdminPage.php:1665 +msgid "Cancel" +msgstr "Отмена" -#. Author URI of the plugin -msgid "https://rwsite.ru" -msgstr "https://rwsite.ru" +#: src/Admin/AdminPage.php:1688 +msgid "Displays environment information (PHP and WordPress versions, memory limits, execution time, timezone), WP-Cron status (disabled, alternative cron, loopback checks). If Action Scheduler is installed - its statistics. Server and WordPress time." +msgstr "Отображает информацию об окружении (версии PHP и WordPress, ограничения памяти, время выполнения, часовой пояс), статус WP-Cron (отключен, альтернативный cron, проверки обратной связи). Если установлен Action Scheduler — его статистика. Время сервера и WordPress." -#: src/Admin/AdminPage.php:479 -msgid "ID" -msgstr "ID" +#: src/Admin/AdminPage.php:1695 +msgid "System Issues Detected:" +msgstr "Обнаружены системные неполадки:" -#: src/Admin/AdminPage.php:325 -msgid "Idle" -msgstr "Idle" +#: src/Admin/AdminPage.php:1704 +msgid "All systems are healthy." +msgstr "Все системы работают исправно." -#: src/Admin/AdminPage.php:785 -msgid "" -"If installed, displays version and statistics (pending/running/failed " -"actions)." -msgstr "" -"Если установлено, отображает версию и статистику " -"(ожидающие/выполняемые/неудачные действия)." +#: src/Admin/AdminPage.php:1712 +msgid "PHP Version" +msgstr "Версия PHP" -#: src/Admin/AdminPage.php:2369 -msgid "" -"If the worker is not running, queues will not be processed in daemon mode. " -"Make sure the process is started and monitored." -msgstr "" -"Если воркер не запущен, очереди в режиме демона обрабатываться не будут. " -"Убедитесь, что процесс запущен и мониторится." +#: src/Admin/AdminPage.php:1716 +msgid "WordPress Version" +msgstr "Версия WordPress" -#: src/Admin/AdminPage.php:2309 -msgid "" -"If WP-CLI is not available, create a PHP script that boots WordPress and " -"runs the worker loop:" -msgstr "" -"Если WP-CLI недоступен, создайте PHP-скрипт, который загружает WordPress и " -"запускает цикл воркера:" +#: src/Admin/AdminPage.php:1720 src/Admin/AdminPage.php:1880 +#: src/Admin/AdminPage.php:2037 +msgid "Memory Limit" +msgstr "Ограничение памяти" -#: src/Admin/AdminPage.php:134 -msgid "" -"If you installed WP Queue because another plugin requires it, you usually do " -"not need to configure anything here. Use these tabs mainly for monitoring " -"and troubleshooting." -msgstr "" -"Если вы установили WP Queue, потому что он требуется другому плагину, обычно " -"здесь ничего настраивать не нужно. Используйте эти вкладки в основном для " -"мониторинга и устранения неполадок." +#: src/Admin/AdminPage.php:1724 +msgid "Current Memory Usage" +msgstr "Текущее использование памяти" -#: src/Admin/AdminPage.php:1119 -msgid "Important:" -msgstr "Важно:" +#: src/Admin/AdminPage.php:1731 src/Admin/AdminPage.php:2045 +msgid "Max Execution Time" +msgstr "Максимальное время выполнения" -#: src/Admin/AdminPage.php:347 -msgid "In Queue" -msgstr "В очереди" +#: src/Admin/AdminPage.php:1735 src/Admin/AdminPage.php:2064 +msgid "Timezone" +msgstr "Часовой пояс" -#: src/Admin/AdminPage.php:2299 -msgid "" -"In this mode WP-Cron scheduling and loopback requests are disabled " -"automatically." -msgstr "" -"В этом режиме планирование WP-Cron и loopback-запросы отключаются " -"автоматически." +#: src/Admin/AdminPage.php:1741 +msgid "WP-Cron Status" +msgstr "Статус WP-Cron" -#: src/Admin/AdminPage.php:116 -msgid "Inspect and manage WP-Cron events for WP Queue and other plugins." -msgstr "" -"Проверяйте и управляйте событиями WP-Cron для WP Queue и других плагинов." +#: src/Admin/AdminPage.php:1745 +msgid "WP-Cron Disabled" +msgstr "WP-Cron отключен" -#: src/Admin/AdminPage.php:1084 -msgid "Install: pecl install memcached" -msgstr "Установите: pecl install memcached" +#: src/Admin/AdminPage.php:1749 +msgid "DISABLE_WP_CRON is set to true. Background tasks will not run automatically." +msgstr "Параметр DISABLE_WP_CRON установлен в значение true. Фоновые задачи не будут выполняться автоматически." -#: src/Admin/AdminPage.php:1082 -msgid "Install: pecl install redis" -msgstr "Установите: pecl install redis" +#: src/Admin/AdminPage.php:1751 src/Admin/AdminPage.php:1759 +msgid "Enabled" +msgstr "Включено" -#: src/Admin/AdminPage.php:1588 -msgid "Interval" -msgstr "Интервал" +#: src/Admin/AdminPage.php:1756 +msgid "Alternate Cron" +msgstr "Альтернативный Cron" -#: src/Admin/AdminPage.php:593 src/Admin/AdminPage.php:877 -#: src/Admin/AdminPage.php:961 src/Admin/AdminPage.php:1165 -msgid "Job" -msgstr "Задача" +#: src/Admin/AdminPage.php:1766 +msgid "Loopback Request" +msgstr "Запрос обратной связи" -#: src/Admin/AdminPage.php:480 -msgid "Job Class" -msgstr "Job Class" +#: src/Admin/AdminPage.php:1772 +msgid "OK" +msgstr "OK" -#: src/Admin/AdminPage.php:734 -msgid "" -"Job class, execution interval (e.g., \"hourly\", \"daily\"), queue " -"assignment, next run time." -msgstr "" -"Класс Job, интервал выполнения (например, \"ежечасно\", \"ежедневно\"), " -"назначение в очередь, время следующего запуска." +#: src/Admin/AdminPage.php:1774 +msgid "Warning" +msgstr "Предупреждение" -#: src/Admin/AdminPage.php:567 -msgid "Job Details" -msgstr "Job Details" +#: src/Admin/AdminPage.php:1776 +msgid "Error" +msgstr "Ошибка" -#: src/Admin/AdminPage.php:734 -msgid "Job information" -msgstr "Job information" +#: src/Admin/AdminPage.php:1794 src/Admin/AdminPage.php:2080 +msgid "Version" +msgstr "Версия" -#: src/Admin/AdminPage.php:733 -msgid "Job list" -msgstr "Список Job" +#: src/Admin/AdminPage.php:1799 +msgid "Pending Actions" +msgstr "Ожидающие действия" -#: src/Admin/AdminPage.php:387 -msgid "jobs" -msgstr "задачи" +#: src/Admin/AdminPage.php:1803 +msgid "Running Actions" +msgstr "Выполнение действий" -#: src/Admin/AdminPage.php:45 -msgid "Jobs in Queue" -msgstr "Задачи в очереди" +#: src/Admin/AdminPage.php:1807 +msgid "Failed Actions" +msgstr "Неудачные действия" -#: src/Admin/AdminPage.php:750 -msgid "Log table" -msgstr "Таблица логов" +#: src/Admin/AdminPage.php:1823 src/Admin/AdminPage.php:1827 +#: src/Admin/AdminPage.php:2056 +msgid "Server Time" +msgstr "Время сервера" -#: src/Admin/AdminPage.php:744 -msgid "Logs" -msgstr "Логи" +#: src/Admin/AdminPage.php:1831 src/Admin/AdminPage.php:2060 +msgid "WordPress Time" +msgstr "Время WordPress" -#: src/Admin/AdminPage.php:130 -msgid "" -"Logs – history of completed and failed jobs that helps to diagnose problems." -msgstr "" -"Логи — история выполненных и неудачных заданий, которая помогает " -"диагностировать проблемы." +#: src/Admin/AdminPage.php:1835 +msgid "GMT Offset" +msgstr "GMT Offset" -#: src/Admin/AdminPage.php:1916 -msgid "Loopback" -msgstr "Обратная связь" +#: src/Admin/AdminPage.php:1876 +msgid "Errors" +msgstr "Ошибки" -#: src/Admin/AdminPage.php:1879 -msgid "" -"Loopback is disabled. Jobs will be processed only by WP-Cron, which can " -"delay execution by up to one minute. Run a daemon worker for instant " -"processing." -msgstr "" -"Loopback отключен. Задачи будут обрабатываться только WP-Cron с задержкой до " -"минуты. Запустите демон-воркер для мгновенной обработки." +#: src/Admin/AdminPage.php:1884 +msgid "Timeout" +msgstr "Тайм-аут" -#: src/Admin/AdminPage.php:1871 -msgid "Loopback is enabled and working. Jobs start immediately after dispatch." -msgstr "Loopback включен и работает. Задачи запускаются сразу после отправки." +#: src/Admin/AdminPage.php:1889 +msgid "Versions" +msgstr "Версии" -#: src/Admin/AdminPage.php:1875 -msgid "" -"Loopback is inactive. Jobs will be processed only by WP-Cron, which can " -"delay execution by up to one minute. Enable loopback or run a daemon worker " -"for instant processing." -msgstr "" -"Loopback неактивен. Задачи будут обрабатываться только WP-Cron с задержкой " -"до минуты. Включите loopback или запустите демон-воркер для мгновенной " -"обработки." +#: src/Admin/AdminPage.php:1901 src/Admin/AdminPage.php:2033 +msgid "PHP" +msgstr "PHP" -#. %s: loopback error message -#: src/Admin/SystemStatus.php:271 -#, php-format -msgid "Loopback issue: %s" -msgstr "Проблема обратной связи: %s" +#: src/Admin/AdminPage.php:1918 +msgid "Component Status" +msgstr "Состояние компонента" -#: src/Admin/AdminPage.php:1722 -msgid "Loopback Request" -msgstr "Запрос обратной связи" +#: src/Admin/AdminPage.php:1923 +msgid "Queue Storage backend" +msgstr "бэкэнд хранилища очередей" -#: src/Admin/SystemStatus.php:148 -msgid "Loopback request successful" -msgstr "Запрос обратной связи выполнен успешно" +#: src/Admin/AdminPage.php:1926 +msgid "Change" +msgstr "Изменить" -#: src/Admin/AdminPage.php:2181 -msgid "Manage queues from command line:" -msgstr "Управление очередями из командной строки:" +#: src/Admin/AdminPage.php:1930 +msgid "Queue runner" +msgstr "Обработчик очереди" -#: src/Admin/AdminPage.php:731 -msgid "Management of scheduled recurring tasks." -msgstr "Управление запланированными повторяющимися задачами." +#: src/Admin/AdminPage.php:1935 +msgid "(auto)" +msgstr "(авто)" -#: src/Admin/AdminPage.php:763 -msgid "" -"Management of WordPress system timers that trigger background processes." -msgstr "" -"Управление системными таймерами WordPress, запускающими фоновые процессы." +#: src/Admin/AdminPage.php:1962 +msgid "Crontab line (as the web server user):" +msgstr "Строка crontab (от пользователя веб-сервера):" -#: src/Admin/AdminPage.php:735 -msgid "Manual run" -msgstr "Ручной запуск" +#: src/Admin/AdminPage.php:1965 +msgid "Last run of the worker (heartbeat):" +msgstr "Последний запуск воркера (heartbeat):" -#: src/Admin/AdminPage.php:1687 src/Admin/AdminPage.php:1953 -msgid "Max Execution Time" -msgstr "Максимальное время выполнения" +#: src/Admin/AdminPage.php:1969 +msgid "never" +msgstr "никогда" -#: src/Admin/AdminPage.php:1676 src/Admin/AdminPage.php:1831 -#: src/Admin/AdminPage.php:1945 -msgid "Memory Limit" -msgstr "Ограничение памяти" +#. translators: 1: time ago, 2: jobs +#: src/Admin/AdminPage.php:1972 +#, php-format +msgid "%1$s ago, jobs: %2$d" +msgstr "%1$s назад, задач: %2$d" -#: src/Admin/SystemStatus.php:275 -msgid "Memory usage is above 80%." -msgstr "Использование памяти выше 80%." +#: src/Admin/AdminPage.php:1975 +msgid "skipped: another runner is selected or a worker was busy" +msgstr "пропущено: выбран другой обработчик или воркер был занят" -#: src/Admin/AdminPage.php:879 -msgid "Message" -msgstr "Сообщение" +#. translators: %s: constant +#: src/Admin/AdminPage.php:1986 +#, php-format +msgid "Set in wp-config.php (%s). Remove the constant to choose here." +msgstr "Задано в wp-config.php (%s). Удалите константу, чтобы выбирать здесь." -#: src/Admin/AdminPage.php:114 -msgid "Monitor which background jobs are queued and running right now." -msgstr "" -"Отслеживайте, какие фоновые задачи находятся в очереди и выполняются в " -"данный момент." +#: src/Admin/AdminPage.php:1992 +msgid "Save runner" +msgstr "Сохранить обработчик" -#: src/Admin/AdminPage.php:793 -msgid "More documentation" -msgstr "Дополнительная документация" +#: src/Admin/AdminPage.php:2003 src/Admin/AdminPage.php:2016 +msgid "Used by the runner" +msgstr "Используется обработчиком" -#: src/Admin/AdminPage.php:1587 -msgid "Name" -msgstr "Имя" +#: src/Admin/AdminPage.php:2003 src/Admin/AdminPage.php:2016 +msgid "Not used by the runner" +msgstr "Не используется обработчиком" -#: src/Admin/AdminPage.php:2118 -msgid "Named Queues" -msgstr "Именованные очереди" +#: src/Admin/AdminPage.php:2007 +msgid "WordPress WP-Cron is disabled (DISABLE_WP_CRON)." +msgstr "WP-Cron WordPress выключен (DISABLE_WP_CRON)." -#: src/Admin/AdminPage.php:596 src/Admin/AdminPage.php:1406 -#: src/Admin/AdminPage.php:1483 -msgid "Next Run" -msgstr "Следующий запуск" +#: src/Admin/AdminPage.php:2008 +msgid "WordPress WP-Cron is enabled." +msgstr "WP-Cron WordPress включён." -#: src/Admin/AdminPage.php:736 -msgid "Next run status" -msgstr "Статус следующего запуска" +#: src/Admin/AdminPage.php:2013 +msgid "Loopback" +msgstr "Обратная связь" + +#: src/Admin/AdminPage.php:2020 +msgid "check OK" +msgstr "проверка пройдена" -#: src/Admin/AdminPage.php:1171 -msgid "No activity" -msgstr "Нет активности" +#: src/Admin/AdminPage.php:2021 +msgid "check: warning" +msgstr "проверка: предупреждение" -#: src/Admin/AdminPage.php:1492 -msgid "No cron events found." -msgstr "Событий cron не обнаружено." +#: src/Admin/AdminPage.php:2022 +msgid "check failed" +msgstr "проверка не пройдена" -#: src/Admin/AdminPage.php:970 -msgid "No errors" -msgstr "Ошибок нет." +#: src/Admin/AdminPage.php:2023 +msgid "not checked" +msgstr "не проверялось" -#: src/Admin/AdminPage.php:1143 -msgid "No extension" -msgstr "Нет расширения" +#: src/Admin/AdminPage.php:2041 +msgid "Used" +msgstr "Использовал" -#: src/Admin/AdminPage.php:885 -msgid "No logs found" -msgstr "Журналы не найдены" +#: src/Admin/AdminPage.php:2115 +msgid "Clear Logs" +msgstr "Очистить журналы" -#: src/Admin/AdminPage.php:2246 -msgid "No paused events" -msgstr "Нет приостановленных событий" +#: src/Admin/AdminPage.php:2116 +msgid "Deletes all job execution logs" +msgstr "Удаляет все журналы выполнения заданий." -#: src/Admin/AdminPage.php:1400 -msgid "No scheduled events" -msgstr "Мероприятия не запланированы." +#: src/Admin/AdminPage.php:2117 +msgid "Clear All Logs" +msgstr "Очистить все журналы" -#: src/Admin/AdminPage.php:603 -msgid "No scheduled jobs found." -msgstr "Запланированных заданий не найдено." +#: src/Admin/AdminPage.php:2121 +msgid "Process Queues" +msgstr "Обработочные очереди" -#: src/Admin/AdminPage.php:1147 -msgid "No server" -msgstr "Нет сервера" +#: src/Admin/AdminPage.php:2122 +msgid "Forces processing of all queues" +msgstr "Принудительная обработка всех очередей" -#: src/Admin/AdminPage.php:782 -msgid "Notifications of critical issues (low memory, disabled WP-Cron)." -msgstr "" -"Уведомления о критических проблемах (недостаток памяти, отключение WP-Cron)." +#: src/Admin/AdminPage.php:2127 +msgid "Clear All Queues" +msgstr "Очистить все очереди" -#: src/Admin/AdminPage.php:509 -msgid "Now" -msgstr "Сейчас" +#: src/Admin/AdminPage.php:2128 +msgid "Deletes all jobs from all queues" +msgstr "Удаляет все задания из всех очередей." -#: src/Admin/AdminPage.php:752 -msgid "Number of entries" -msgstr "Количество записей" +#: src/Admin/AdminPage.php:2129 +msgid "Clear All" +msgstr "Очистить все" -#: src/Admin/AdminPage.php:1728 src/Admin/AdminPage.php:1925 -msgid "OK" -msgstr "OK" +#: src/Admin/AdminPage.php:2159 +msgid "WP Queue — Queue System for WordPress" +msgstr "WP Queue — система очередей для WordPress" -#: src/Admin/AdminPage.php:2262 -msgid "One-time" -msgstr "Один раз" +#: src/Admin/AdminPage.php:2161 +msgid "WP Queue allows executing tasks asynchronously in the background without blocking the main WordPress execution flow." +msgstr "WP Queue позволяет выполнять задачи асинхронно в фоновом режиме, не блокируя основной поток выполнения WordPress." -#: src/Admin/AdminPage.php:2331 -msgid "Option A: systemd service" -msgstr "Вариант A: сервис systemd" +#: src/Admin/AdminPage.php:2171 +msgid "Quick Start" +msgstr "Быстрый старт" -#: src/Admin/AdminPage.php:2348 -msgid "Option B: Supervisor" -msgstr "Вариант B: Supervisor" +#: src/Admin/AdminPage.php:2172 +msgid "Create a job class and dispatch it to the queue:" +msgstr "Создайте класс задания и отправьте его в очередь:" -#: src/Admin/AdminPage.php:2358 -msgid "Option C: Docker Compose" -msgstr "Вариант C: Docker Compose" +#: src/Admin/AdminPage.php:2190 +msgid "Delayed Jobs" +msgstr "Задержка с выполнением заданий" -#: src/Admin/AdminPage.php:2364 -msgid "Option D: plain PHP script" -msgstr "Вариант D: простой PHP-скрипт" +#: src/Admin/AdminPage.php:2191 +msgid "Schedule a job to run after a specific time:" +msgstr "Настройте выполнение задания по истечении определенного времени:" -#: src/Admin/AdminPage.php:1354 src/Admin/AdminPage.php:1449 -#: src/Admin/AdminPage.php:1505 src/Admin/CronMonitor.php:220 -msgid "Overdue" -msgstr "Просрочено" +#: src/Admin/AdminPage.php:2210 +msgid "Named Queues" +msgstr "Именованные очереди" -#: src/Admin/AdminPage.php:44 src/Admin/AdminPage.php:51 -#: src/Admin/AdminPage.php:253 -msgid "Overview" -msgstr "Обзор" +#: src/Admin/AdminPage.php:2211 +msgid "Distribute jobs across different queues:" +msgstr "Распределите задания по разным очередям:" -#: src/Admin/AdminPage.php:445 src/Admin/AdminPage.php:1535 -#: src/Admin/AdminPage.php:1536 -msgid "Pause" -msgstr "Пауза" +#: src/Admin/AdminPage.php:2228 +msgid "Retry Attempts" +msgstr "Повторные попытки" -#: src/Admin/AdminPage.php:200 -msgid "Pause this queue?" -msgstr "Приостановить выполнение этой очереди?" +#: src/Admin/AdminPage.php:2229 +msgid "Configure automatic retries on errors:" +msgstr "Настройте автоматическое повторение попыток при возникновении ошибок:" -#: src/Admin/AdminPage.php:54 src/Admin/AdminPage.php:328 -#: src/Admin/AdminPage.php:427 src/Admin/AdminPage.php:1358 -msgid "Paused" -msgstr "Приостановлено" +#: src/Admin/AdminPage.php:2250 +msgid "Run tasks on schedule:" +msgstr "Выполнить задачи по расписанию:" -#: src/Admin/AdminPage.php:1560 -msgid "Paused At" -msgstr "Приостановлено на" +#: src/Admin/AdminPage.php:2272 +msgid "WP-CLI команды" +msgstr "Команда WP-CLI" -#: src/Admin/AdminPage.php:1554 -msgid "Paused Events" -msgstr "Приостановленные события" +#: src/Admin/AdminPage.php:2273 +msgid "Manage queues from command line:" +msgstr "Управление очередями из командной строки:" -#: src/Admin/AdminPage.php:768 -msgid "Paused events" -msgstr "Приостановленные события" +#: src/Admin/AdminPage.php:2293 +msgid "Useful Links" +msgstr "Полезные ссылки" -#: src/Admin/AdminPage.php:2254 -msgid "Paused Since" -msgstr "Приостановлено с" +#: src/Admin/AdminPage.php:2298 +msgid "Documentation on GitHub" +msgstr "Документация на GitHub" -#: src/Admin/AdminPage.php:326 src/Admin/AdminPage.php:467 -#: src/Admin/AdminPage.php:1993 -msgid "Pending" -msgstr "В ожидании" +#: src/Admin/AdminPage.php:2304 +msgid "Report an Issue" +msgstr "Сообщить о проблеме" -#: src/Admin/AdminPage.php:1755 -msgid "Pending Actions" -msgstr "Ожидающие действия" +#: src/Admin/AdminPage.php:2310 +msgid "Example Plugin on GitHub" +msgstr "Пример плагина на GitHub" -#: src/Admin/AdminPage.php:1852 src/Admin/AdminPage.php:1941 -msgid "PHP" -msgstr "PHP" +#: src/Admin/AdminPage.php:2338 +msgid "No paused events" +msgstr "Нет приостановленных событий" -#: src/Admin/AdminPage.php:783 -msgid "" -"PHP and WordPress versions, memory limits (current usage), maximum execution " -"time, timezone." -msgstr "" -"Версии PHP и WordPress, ограничения памяти (текущее использование), " -"максимальное время выполнения, часовой пояс." +#: src/Admin/AdminPage.php:2346 +msgid "Paused Since" +msgstr "Приостановлено с" -#: src/QueueManager.php:470 -msgid "PHP extension \"memcached\" is not installed" -msgstr "PHP-расширение \"memcached\" не установлено" +#: src/Admin/AdminPage.php:2354 +msgid "One-time" +msgstr "Один раз" -#: src/QueueManager.php:267 -msgid "PHP extension \"redis\" (phpredis) is not installed" -msgstr "PHP-расширение \"redis\" (phpredis) не установлено" +#: src/Admin/AdminPage.php:2381 +msgid "How to run WP Queue as a long-running background process." +msgstr "Как запустить WP Queue в виде долгоживущего фонового процесса." -#: src/Admin/SystemStatus.php:279 -msgid "PHP max_execution_time is less than 30 seconds." -msgstr "PHP max_execution_time меньше 30 секунд." +#: src/Admin/AdminPage.php:2385 +msgid "When to use a daemon" +msgstr "Когда использовать демон" -#: src/Admin/AdminPage.php:1668 -msgid "PHP Version" -msgstr "Версия PHP" +#: src/Admin/AdminPage.php:2386 +msgid "Use a daemon worker on VPS, Docker or dedicated servers where you can keep a process running. It polls the queue continuously and starts jobs immediately. Without a daemon, WP Queue relies on WP-Cron and/or loopback, which can delay jobs by up to a minute." +msgstr "Запускайте демон-воркер на VPS, Docker или выделенном сервере, где можно держать процесс запущенным. Он постоянно опрашивает очередь и сразу запускает задания. Без демона WP Queue полагается на WP-Cron и/или loopback, что может задерживать задания до минуты." -#: src/Admin/AdminPage.php:1474 -msgid "Plugins" -msgstr "Плагины" +#: src/Admin/AdminPage.php:2388 +msgid "1. Select the daemon runner" +msgstr "1. Выберите обработчик «демон»" -#: src/QueueManager.php:416 -msgid "Predis library is not available" -msgstr "Библиотека Predis недоступна" +#: src/Admin/AdminPage.php:2389 +msgid "In System → Status → Queue runner choose \"Daemon / system cron\" (or keep \"Auto\": a running worker is detected by its heartbeat). The same can be forced in wp-config.php:" +msgstr "В Система → Состояние → Обработчик очереди выберите «Демон / системный cron» (или оставьте «Авто»: работающий воркер определяется по heartbeat). То же можно жёстко задать в wp-config.php:" -#: src/Admin/AdminPage.php:670 -msgid "Process" -msgstr "Процесс" +#: src/Admin/AdminPage.php:2391 +msgid "With this runner WP-Cron scheduling and loopback requests are not used." +msgstr "С этим обработчиком планирование WP-Cron и loopback-запросы не используются." -#: src/Admin/AdminPage.php:450 src/Admin/AdminPage.php:2031 -msgid "Process Now" -msgstr "Обработать сейчас" +#: src/Admin/AdminPage.php:2392 +msgid "Simplest option — system cron every minute:" +msgstr "Проще всего — системный cron раз в минуту:" -#: src/Admin/AdminPage.php:2029 -msgid "Process Queues" -msgstr "Обработочные очереди" +#: src/Admin/AdminPage.php:2395 +msgid "2. Run the worker" +msgstr "2. Запустите воркер" -#: src/Admin/AdminPage.php:429 src/Admin/AdminPage.php:471 -msgid "Processing" -msgstr "Обработка" +#: src/Admin/AdminPage.php:2397 +msgid "With WP-CLI" +msgstr "С WP-CLI" -#: src/Admin/AdminPage.php:595 src/Admin/AdminPage.php:878 -#: src/Admin/AdminPage.php:962 -msgid "Queue" -msgstr "Очередь" +#: src/Admin/AdminPage.php:2398 +msgid "Start the worker from the WordPress root:" +msgstr "Запустите воркер из корня WordPress:" -#: src/Admin/AdminPage.php:1895 -msgid "Queue handler" -msgstr "Обработчик очереди" +#: src/Admin/AdminPage.php:2400 +msgid "--memory limits the PHP memory for the worker process. Adjust the value to your needs." +msgstr "--memory ограничивает память PHP для процесса воркера. Подберите значение под свои задачи." -#: src/Admin/AdminPage.php:490 -msgid "Queue is empty" -msgstr "Очередь пуста" +#: src/Admin/AdminPage.php:2402 +msgid "Without WP-CLI" +msgstr "Без WP-CLI" -#: src/Admin/AdminPage.php:718 -msgid "Queue statistics" -msgstr "Статистика очереди" +#: src/Admin/AdminPage.php:2403 +msgid "If WP-CLI is not available, create a PHP script that boots WordPress and runs the worker loop:" +msgstr "Если WP-CLI недоступен, создайте PHP-скрипт, который загружает WordPress и запускает цикл воркера:" -#: src/Admin/AdminPage.php:1889 -msgid "Queue Storage backend" -msgstr "бэкэнд хранилища очередей" +#: src/Admin/AdminPage.php:2418 +msgid "Save the script, make it executable and run it in the background:" +msgstr "Сохраните скрипт, сделайте его исполняемым и запустите в фоне:" -#: src/Admin/AdminPage.php:719 -msgid "Queue table" -msgstr "Таблица очереди" +#: src/Admin/AdminPage.php:2422 +msgid "3. Keep it running" +msgstr "3. Держите процесс запущенным" -#: src/Admin/AdminPage.php:423 -#, php-format -msgid "Queue: %s" -msgstr "Очередь: %s" +#: src/Admin/AdminPage.php:2423 +msgid "The command above must stay alive. In production use one of the options below." +msgstr "Команда выше должна оставаться запущенной. В продакшене используйте один из вариантов ниже." -#: src/Admin/AdminPage.php:37 src/Admin/AdminPage.php:374 -msgid "Queues" -msgstr "Очереди" +#: src/Admin/AdminPage.php:2425 +msgid "Option A: systemd service" +msgstr "Вариант A: сервис systemd" -#: src/Admin/AdminPage.php:2079 -msgid "Quick Start" -msgstr "Быстрый старт" +#: src/Admin/AdminPage.php:2440 +msgid "Save as /etc/systemd/system/wp-queue-worker.service, then run systemctl enable --now wp-queue-worker." +msgstr "Сохраните как /etc/systemd/system/wp-queue-worker.service, затем выполните systemctl enable --now wp-queue-worker." -#: src/Admin/AdminPage.php:115 -msgid "Quickly see if any jobs are failing and view recent log entries." -msgstr "" -"Быстро проверьте, не завершаются ли какие-либо задания с ошибкой, и " -"просмотрите последние записи в журнале." +#: src/Admin/AdminPage.php:2442 +msgid "Option B: Supervisor" +msgstr "Вариант B: Supervisor" -#: src/Admin/AdminPage.php:1139 -msgid "Ready" -msgstr "Готово" +#: src/Admin/AdminPage.php:2452 +msgid "Option C: Docker Compose" +msgstr "Вариант C: Docker Compose" -#: src/Admin/AdminPage.php:398 -msgid "Recent Activity" -msgstr "Последние события" +#: src/Admin/AdminPage.php:2458 +msgid "Option D: plain PHP script" +msgstr "Вариант D: простой PHP-скрипт" -#: src/Admin/AdminPage.php:720 -msgid "Recent activity" -msgstr "Последние события" +#: src/Admin/AdminPage.php:2459 +msgid "Use the script from step 2 (Without WP-CLI) inside screen, tmux or a simple cron-based restart loop. Remember that the script must stay alive to act as a daemon." +msgstr "Используйте скрипт из шага 2 (Без WP-CLI) внутри screen, tmux или простого цикла перезапуска через cron. Помните, что скрипт должен оставаться запущенным, чтобы работать как демон." -#: src/QueueManager.php:358 -msgid "Redis connection failed" -msgstr "Подключение к Redis не удалось." +#: src/Admin/AdminPage.php:2461 +msgid "4. Check status" +msgstr "4. Проверьте статус" -#: src/QueueManager.php:243 -msgid "Redis is disabled via WP_REDIS_DISABLED" -msgstr "Redis отключен с помощью WP_REDIS_DISABLED" +#: src/Admin/AdminPage.php:2463 +msgid "If the worker is not running, queues will not be processed in daemon mode. Make sure the process is started and monitored." +msgstr "Если воркер не запущен, очереди в режиме демона обрабатываться не будут. Убедитесь, что процесс запущен и мониторится." -#: src/Admin/AdminPage.php:699 -msgid "Redis Support" -msgstr "Поддержка Redis" +#: src/Admin/RestApi.php:488 +msgid "Cron event paused" +msgstr "Cron-событие приостановлено" -#: src/Admin/AdminPage.php:1583 -msgid "Registered Schedules" -msgstr "Зарегистрированные расписания" +#: src/Admin/RestApi.php:488 +msgid "Failed to pause event" +msgstr "Не удалось приостановить событие" -#: src/Admin/AdminPage.php:769 -msgid "Registered schedules" -msgstr "Зарегистрированные расписания" +#: src/Admin/RestApi.php:502 +msgid "Cron event resumed" +msgstr "Cron-событие возобновлено" -#: src/Admin/AdminPage.php:2212 -msgid "Report an Issue" -msgstr "Сообщить о проблеме" +#: src/Admin/RestApi.php:502 +msgid "Failed to resume event" +msgstr "Не удалось возобновить событие" -#: src/Admin/AdminPage.php:169 -msgid "Report Issues" -msgstr "Сообщить о проблемах" +#: src/Admin/RestApi.php:519 +msgid "Cron event updated" +msgstr "Cron-событие обновлено" -#: src/Admin/AdminPage.php:440 src/Admin/AdminPage.php:1574 -#: src/Admin/AdminPage.php:2268 -msgid "Resume" -msgstr "Резюме" +#: src/Admin/RestApi.php:519 +msgid "Failed to update event" +msgstr "Не удалось обновить событие" -#: src/Admin/AdminPage.php:2136 -msgid "Retry Attempts" -msgstr "Повторные попытки" +#: src/Admin/SettingsController.php:50 src/Runtime/Runner.php:194 +msgid "Unknown runner." +msgstr "Неизвестный обработчик." -#: src/Admin/AdminPage.php:146 src/Admin/AdminPage.php:1521 -msgid "Run" -msgstr "Запуск" +#: src/Admin/SettingsController.php:70 +msgid "No fresh heartbeat from the daemon / system cron yet: add the crontab line shown below, otherwise jobs will not run." +msgstr "Свежего heartbeat от демона / системного cron пока нет: добавьте строку crontab, показанную ниже, иначе задачи не будут выполняться." -#: src/Admin/AdminPage.php:625 src/Admin/AdminPage.php:1520 -msgid "Run Now" -msgstr "Запустите сейчас" +#: src/Admin/SettingsController.php:159 +msgid "Store in wp-config.php (WP Queue block; edited atomically with a backup and a check)" +msgstr "Хранить в wp-config.php (блок WP Queue; правится атомарно, с бэкапом и проверкой)" -#: src/Admin/AdminPage.php:767 -msgid "" -"Run now, edit schedule, pause, delete. Modal window for changing interval." -msgstr "" -"Запустить сейчас, отредактировать расписание, приостановить, удалить. " -"Модальное окно для изменения интервала." +#: src/Admin/SettingsController.php:167 +msgid "You are not allowed to change WP Queue settings." +msgstr "У вас нет прав менять настройки WP Queue." -#: src/Admin/AdminPage.php:2158 -msgid "Run tasks on schedule:" -msgstr "Выполнить задачи по расписанию:" +#: src/Admin/SystemStatus.php:151 +msgid "admin-ajax.php answered, but not with the WP Queue ping response" +msgstr "admin-ajax.php ответил, но не ответом WP Queue на ping" -#: src/Admin/AdminPage.php:327 src/Admin/AdminPage.php:351 -msgid "Running" -msgstr "Запущено" +#. translators: %d: HTTP response code +#: src/Admin/SystemStatus.php:159 +#, php-format +msgid "Unexpected response code: %d" +msgstr "Неожиданный код ответа: %d" -#: src/Admin/AdminPage.php:1759 -msgid "Running Actions" -msgstr "Выполнение действий" +#: src/Admin/SystemStatus.php:165 +msgid "Loopback request successful" +msgstr "Запрос обратной связи выполнен успешно" -#: src/Admin/AdminPage.php:2346 -msgid "" -"Save as /etc/systemd/system/wp-queue-worker.service, then run systemctl " -"enable --now wp-queue-worker." -msgstr "" -"Сохраните как /etc/systemd/system/wp-queue-worker.service, затем выполните " -"systemctl enable --now wp-queue-worker." +#: src/Admin/SystemStatus.php:282 +msgid "WP-Cron is disabled. Background tasks may not run automatically." +msgstr "WP-Cron отключен. Фоновые задачи могут не выполняться автоматически." -#: src/Admin/AdminPage.php:1625 -msgid "Save Changes" -msgstr "Сохранить изменения" +#. translators: %s: loopback error message +#: src/Admin/SystemStatus.php:288 +#, php-format +msgid "Loopback issue: %s" +msgstr "Проблема обратной связи: %s" -#: src/Admin/AdminPage.php:2324 -msgid "Save the script, make it executable and run it in the background:" -msgstr "Сохраните скрипт, сделайте его исполняемым и запустите в фоне:" +#: src/Admin/SystemStatus.php:292 +msgid "Memory usage is above 80%." +msgstr "Использование памяти выше 80%." -#: src/Admin/AdminPage.php:594 src/Admin/AdminPage.php:1484 -#: src/Admin/AdminPage.php:1559 src/Admin/AdminPage.php:1613 -#: src/Admin/AdminPage.php:2253 -msgid "Schedule" -msgstr "Расписание" +#: src/Admin/SystemStatus.php:296 +msgid "PHP max_execution_time is less than 30 seconds." +msgstr "PHP max_execution_time меньше 30 секунд." -#: src/Admin/AdminPage.php:2099 -msgid "Schedule a job to run after a specific time:" -msgstr "Настройте выполнение задания по истечении определенного времени:" +#. translators: %s: database table name +#: src/QueueManager.php:225 +#, php-format +msgid "Jobs are stored in the %s table" +msgstr "Задачи хранятся в таблице %s" -#: src/Admin/AdminPage.php:53 src/Admin/AdminPage.php:1350 -msgid "Scheduled" -msgstr "Запланировано" +#: src/QueueManager.php:226 +msgid "Synchronous execution (no queue)" +msgstr "Синхронное выполнение (без очереди)" -#: src/Admin/AdminPage.php:728 -msgid "Scheduled Jobs" -msgstr "Запланированные задания" +#: src/QueueManager.php:235 src/QueueManager.php:570 src/QueueManager.php:572 +msgid "Custom driver" +msgstr "Пользовательский драйвер" -#: src/Admin/AdminPage.php:129 -msgid "" -"Scheduled Jobs – list of recurring background jobs added by your theme or " -"plugins." -msgstr "" -"Запланированные задания — список повторяющихся фоновых заданий, добавленных " -"вашей темой или плагинами." +#: src/QueueManager.php:241 +msgid "Unknown driver" +msgstr "Неизвестный драйвер" -#: src/Admin/AdminPage.php:38 src/Admin/AdminPage.php:2157 -msgid "Scheduler" -msgstr "Планировщик" +#: src/QueueManager.php:271 +msgid "Redis is disabled via WP_REDIS_DISABLED" +msgstr "Redis отключен с помощью WP_REDIS_DISABLED" -#: src/Admin/AdminPage.php:1779 src/Admin/AdminPage.php:1783 -#: src/Admin/AdminPage.php:1964 -msgid "Server Time" -msgstr "Время сервера" +#: src/QueueManager.php:295 +msgid "PHP extension \"redis\" (phpredis) is not installed" +msgstr "PHP-расширение \"redis\" (phpredis) не установлено" -#: src/Admin/AdminPage.php:786 -msgid "Server time" -msgstr "Время сервера" +#. translators: 1: Redis host, 2: Redis port. +#: src/QueueManager.php:318 +#, php-format +msgid "Connected to Redis at %1$s:%2$d (phpredis)" +msgstr "Подключено к Redis %1$s:%2$d (phpredis)" -#: src/Admin/AdminPage.php:1510 src/Admin/AdminPage.php:1568 -msgid "Single" -msgstr "Один" +#: src/QueueManager.php:327 src/QueueManager.php:408 src/QueueManager.php:483 +#, php-format +msgid "Cannot connect to Redis at %1$s:%2$d - %3$s" +msgstr "Не удаётся подключиться к Redis %1$s:%2$d — %3$s" -#: src/Admin/AdminPage.php:1615 -msgid "Single (run once)" -msgstr "Один (запуск один раз)" +#. translators: 1: Redis host, 2: Redis port. +#: src/QueueManager.php:380 src/QueueManager.php:399 +#, php-format +msgid "Connected to Redis at %1$s:%2$d (via redis-cache plugin)" +msgstr "Подключено к Redis %1$s:%2$d (через плагин redis-cache)" -#: src/Admin/AdminPage.php:1407 src/Admin/AdminPage.php:1485 -msgid "Source" -msgstr "Источник" +#: src/QueueManager.php:389 +msgid "Redis connection failed" +msgstr "Подключение к Redis не удалось." -#: src/Admin/AdminPage.php:2304 -msgid "Start the worker from the WordPress root:" -msgstr "Запустите воркер из корня WordPress:" +#: src/QueueManager.php:449 +msgid "Predis library is not available" +msgstr "Библиотека Predis недоступна" -#: src/Admin/AdminPage.php:483 src/Admin/AdminPage.php:876 -#: src/Admin/AdminPage.php:1056 src/Admin/AdminPage.php:1164 -msgid "Status" -msgstr "Статус" +#. translators: 1: Redis host, 2: Redis port. +#: src/QueueManager.php:474 +#, php-format +msgid "Connected to Redis at %1$s:%2$d (Predis)" +msgstr "Подключено к Redis %1$s:%2$d (Predis)" -#: src/Admin/AdminPage.php:749 -msgid "Status filters" -msgstr "Фильтры состояния" +#: src/QueueManager.php:505 +msgid "PHP extension \"memcached\" is not installed" +msgstr "PHP-расширение \"memcached\" не установлено" -#: src/Admin/AdminPage.php:668 -msgid "Storage" -msgstr "Хранилище" +#. translators: 1: Memcached host, 2: Memcached port. +#: src/QueueManager.php:525 +#, php-format +msgid "Connected to Memcached at %1$s:%2$d" +msgstr "Подключено к Memcached %1$s:%2$d" -#: src/Admin/AdminPage.php:1055 -msgid "Storage backend" -msgstr "бэкэнд хранилища" +#: src/QueueManager.php:537 +#, php-format +msgid "Cannot connect to Memcached at %1$s:%2$d - %3$s" +msgstr "Не удаётся подключиться к Memcached %1$s:%2$d — %3$s" -#: src/Admin/AdminPage.php:1034 +#. translators: %s: Queue driver name. +#: src/QueueManager.php:717 #, php-format -msgid "" -"Storage backend \"%s\" is configured in wp-config.php, but not available. " -"Falling back to \"%s\"." -msgstr "" -"В файле wp-config.php настроен бэкэнд хранилища \"%s\", но он недоступен. " -"Используется резервный вариант \"%s\"." +msgid "Queue driver \"%s\" is not supported." +msgstr "Драйвер очереди «%s» не поддерживается." -#: src/QueueManager.php:198 -msgid "Synchronous execution (no queue)" -msgstr "Синхронное выполнение (без очереди)" +#: src/Runtime/Runner.php:105 +msgid "Selected manually." +msgstr "Выбран вручную." -#: src/Admin/AdminPage.php:39 src/Admin/AdminPage.php:777 -msgid "System" -msgstr "Система" +#. translators: %s: reason +#: src/Runtime/Runner.php:108 +#, php-format +msgid "Selected manually, but: %s" +msgstr "Выбран вручную, но: %s" -#: src/Admin/AdminPage.php:689 -msgid "System Cron (Recommended)" -msgstr "Системный планировщик задач (рекомендуется)" +#: src/Runtime/Runner.php:132 +msgid "No other runner is available." +msgstr "Другие обработчики недоступны." -#: src/Admin/AdminPage.php:782 -msgid "System health" -msgstr "Здоровье системы" +#. translators: %s: human time diff +#: src/Runtime/Runner.php:150 +#, php-format +msgid "Daemon / system cron is alive: last run %s ago." +msgstr "Демон / системный cron работает: последний запуск %s назад." -#: src/Admin/AdminPage.php:1651 -msgid "System Issues Detected:" -msgstr "Обнаружены системные неполадки:" +#: src/Runtime/Runner.php:158 +msgid "No daemon / system cron heartbeat yet." +msgstr "Heartbeat от демона / системного cron ещё не было." -#: src/Admin/AdminPage.php:57 -msgid "System Status" -msgstr "Состояние системы" +#. translators: %s: human time diff +#: src/Runtime/Runner.php:160 +#, php-format +msgid "Daemon / system cron heartbeat is stale (%s ago)." +msgstr "Heartbeat демона / системного cron устарел (%s назад)." -#: src/Admin/AdminPage.php:132 -msgid "" -"System – checks PHP version, WP-Cron status and other important settings." -msgstr "" -"Система проверяет версию PHP, статус WP-Cron и другие важные настройки." +#: src/Runtime/Runner.php:167 +msgid "Loopback is disabled by WP_QUEUE_LOOPBACK in wp-config.php." +msgstr "Loopback выключен константой WP_QUEUE_LOOPBACK в wp-config.php." -#: src/Admin/AdminPage.php:735 -msgid "" -"The \"Run Now\" button allows you to run any job immediately, without " -"waiting for the schedule." -msgstr "" -"Кнопка «Запустить сейчас» позволяет немедленно запустить любое задание, не " -"дожидаясь расписания." +#. translators: %s: error message +#: src/Runtime/Runner.php:177 +#, php-format +msgid "Loopback request failed: %s" +msgstr "Loopback-запрос не прошёл: %s" -#: src/Admin/AdminPage.php:2329 -msgid "" -"The command above must stay alive. In production use one of the options " -"below." -msgstr "" -"Команда выше должна оставаться запущенной. В продакшене используйте один из " -"вариантов ниже." +#: src/Runtime/Runner.php:181 +msgid "Loopback requests to admin-ajax.php work." +msgstr "Loopback-запросы к admin-ajax.php работают." -#: src/Admin/AdminPage.php:668 -msgid "The job is saved in the database (or Redis) waiting to be picked up." -msgstr "Задание сохраняется в базе данных (или Redis) в ожидании обработки." +#: src/Runtime/Runner.php:185 +msgid "WP-Cron is disabled (DISABLE_WP_CRON); it runs only if a system cron calls wp-cron.php." +msgstr "WP-Cron выключен (DISABLE_WP_CRON); он работает, только если системный cron вызывает wp-cron.php." -#: src/Admin/AdminPage.php:720 -msgid "The last 10 log entries for quick tracking of queue activity." -msgstr "" -"Последние 10 записей в журнале для быстрого отслеживания активности в " -"очереди." +#: src/Runtime/Runner.php:188 +msgid "WP-Cron runs on site visits." +msgstr "WP-Cron запускается при посещениях сайта." -#: src/Admin/AdminPage.php:716 -msgid "The main tab for monitoring queue status in real-time." -msgstr "" -"Главная вкладка для мониторинга состояния очереди в режиме реального времени." +#: src/Runtime/Runner.php:191 +msgid "Jobs run at the end of the request that dispatched them." +msgstr "Задачи выполняются в конце запроса, который их поставил." -#: src/Admin/AdminPage.php:111 -msgid "" -"The plugin itself does not add new features to the frontend. It provides a " -"reliable queue that other plugins or your custom code can use for background " -"work." -msgstr "" -"Сам плагин не добавляет новых функций на фронтенд. Он предоставляет надежную " -"очередь, которую другие плагины или ваш пользовательский код могут " -"использовать для фоновой работы." +#: src/Runtime/Runner.php:242 +msgid "Auto" +msgstr "Авто" -#: src/Admin/AdminPage.php:670 -msgid "" -"The worker picks up the job and executes it. If it succeeds, it is marked as " -"\"Completed\". If it fails, it can be retried." -msgstr "" -"Работник берет задание и выполняет его. Если оно выполняется успешно, оно " -"помечается как «Завершено». Если оно не выполняется, его можно повторить." +#: src/Runtime/Runner.php:243 +msgid "Daemon / system cron" +msgstr "Демон / системный cron" -#: src/Admin/AdminPage.php:317 -msgid "This section is under development." -msgstr "Этот раздел находится в разработке." +#: src/Runtime/Runner.php:244 +msgid "Loopback (admin-ajax)" +msgstr "Loopback (admin-ajax)" -#: src/Admin/AdminPage.php:875 src/Admin/AdminPage.php:960 -#: src/Admin/AdminPage.php:1163 src/Admin/AdminPage.php:1960 -msgid "Time" -msgstr "Время" +#: src/Runtime/Runner.php:246 +msgid "Synchronous (in request)" +msgstr "Синхронно (в запросе)" -#: src/Admin/AdminPage.php:1835 -msgid "Timeout" -msgstr "Тайм-аут" +#: src/Runtime/Runner.php:254 +msgid "Uses the fastest available runner: daemon / system cron if its heartbeat is fresh, then loopback, WP-Cron, synchronous." +msgstr "Использует самый быстрый доступный обработчик: демон / системный cron при свежем heartbeat, затем loopback, WP-Cron, синхронный." -#: src/Admin/AdminPage.php:1691 src/Admin/AdminPage.php:1972 -msgid "Timezone" -msgstr "Часовой пояс" +#: src/Runtime/Runner.php:255 +msgid "Fastest and most reliable. A system cron runs `wp queue work` every minute (or a daemon runs continuously). WP-Cron and loopback are not used." +msgstr "Самый быстрый и надёжный. Системный cron запускает `wp queue work` каждую минуту (или постоянно работает демон). WP-Cron и loopback не используются." -#. %s: URL to GitHub repository -#: src/Admin/AdminPage.php:138 -#, php-format -msgid "" -"To add your own background jobs, use the WP Queue PHP API from your plugin " -"or theme. You can dispatch jobs to different queues, set delays and retries. " -"Full code examples are available in the " -"README on GitHub." -msgstr "" -"Чтобы добавить собственные фоновые задачи, используйте PHP API WP Queue из " -"вашего плагина или темы. Вы можете отправлять задачи в разные очереди, " -"устанавливать задержки и повторные попытки. Полные примеры кода доступны в " -"файле README на GitHub ." +#: src/Runtime/Runner.php:256 +msgid "After a job is dispatched, a non-blocking request to admin-ajax.php starts a worker, like Action Scheduler. Good for shared hosting. Delayed jobs run on the next dispatch." +msgstr "После постановки задачи неблокирующий запрос к admin-ajax.php запускает воркер, как в Action Scheduler. Подходит для виртуального хостинга. Отложенные задачи выполняются при следующей постановке." -#: src/Admin/AdminPage.php:146 -msgid "to get a list of available commands." -msgstr "чтобы получить список доступных команд." +#: src/Runtime/Runner.php:257 +msgid "WP-Cron checks the queue every minute; needs site traffic or a system cron calling wp-cron.php." +msgstr "WP-Cron проверяет очередь каждую минуту; нужен трафик на сайте или системный cron, вызывающий wp-cron.php." -#: src/Admin/AdminPage.php:675 -msgid "" -"To process the queue, WordPress needs a trigger. There are two ways to do " -"this:" -msgstr "" -"Для обработки очереди WordPress необходим триггер. Это можно сделать двумя " -"способами:" +#: src/Runtime/Runner.php:258 +msgid "Jobs run at the end of the request that dispatched them. No background processing; slows that request down." +msgstr "Задачи выполняются в конце запроса, который их поставил. Без фоновой обработки; замедляет этот запрос." -#: src/Admin/AdminPage.php:59 src/Admin/AdminPage.php:2019 -msgid "Tools" -msgstr "Инструменты" +#. translators: %d: seconds +#: src/Runtime/Runner.php:274 +#, php-format +msgid "%d s" +msgstr "%d с" -#: src/Admin/AdminPage.php:1445 -msgid "Total" -msgstr "Всего" +#. translators: %d: minutes +#: src/Runtime/Runner.php:276 +#, php-format +msgid "%d min" +msgstr "%d мин" -#: src/Admin/AdminPage.php:953 -msgid "Total errors" -msgstr "Общее количество ошибок" +#. translators: %d: hours +#: src/Runtime/Runner.php:278 +#, php-format +msgid "%d h" +msgstr "%d ч" -#: src/Admin/AdminPage.php:1346 -msgid "Total Events" -msgstr "Всего событий" +#. translators: %d: number of minutes +#: src/ScheduledJob.php:49 +#, php-format +msgid "Every %d Minutes" +msgstr "Каждые %d минут" -#: src/Admin/AdminPage.php:463 -msgid "Total Jobs" -msgstr "Общее количество рабочих мест" +#: src/Support/ConfigFile.php:211 +msgid "wp-config.php was not found." +msgstr "wp-config.php не найден." -#: src/Admin/AdminPage.php:765 -msgid "" -"Total number of events, overdue, grouped by source (WordPress, WooCommerce, " -"WP Queue, plugins)." -msgstr "" -"Общее количество просроченных событий, сгруппированных по источнику " -"(WordPress, WooCommerce, WP Queue, плагины)." +#: src/Support/ConfigFile.php:217 +msgid "wp-config.php (or its directory) is not writable. Paste this block into wp-config.php manually, above the \"That's all, stop editing!\" line:" +msgstr "wp-config.php (или его каталог) недоступен для записи. Вставьте этот блок в wp-config.php вручную, выше строки «That's all, stop editing!»:" -#: src/Admin/AdminPage.php:1151 -msgid "Unavailable" -msgstr "Недоступно" +#: src/Support/ConfigFile.php:224 +msgid "Could not find where to insert the block in wp-config.php. Add it manually above the \"That's all, stop editing!\" line:" +msgstr "Не удалось найти место для блока в wp-config.php. Добавьте его вручную выше строки «That's all, stop editing!»:" -#. %d: HTTP response code -#: src/Admin/SystemStatus.php:142 -msgid "Unexpected response code: %d" -msgstr "Неожиданный код ответа: %d" +#: src/Support/ConfigFile.php:228 +msgid "wp-config.php is already up to date." +msgstr "wp-config.php уже актуален." -#: src/Admin/AdminPage.php:497 src/Admin/AdminPage.php:1267 -#: src/Admin/AdminPage.php:1928 -msgid "Unknown" -msgstr "Неизвестно" +#: src/Support/ConfigFile.php:232 +msgid "The resulting wp-config.php would not be valid PHP; nothing was changed." +msgstr "Получившийся wp-config.php был бы некорректным PHP; ничего не изменено." -#: src/QueueManager.php:213 -msgid "Unknown driver" -msgstr "Неизвестный драйвер" +#: src/Support/ConfigFile.php:245 +msgid "Could not create a backup of wp-config.php; nothing was changed." +msgstr "Не удалось создать бэкап wp-config.php; ничего не изменено." -#: src/Admin/AdminPage.php:1396 -msgid "Upcoming Events" -msgstr "Предстоящие события" +#: src/Support/ConfigFile.php:254 +msgid "Could not write a temporary file next to wp-config.php; nothing was changed." +msgstr "Не удалось записать временный файл рядом с wp-config.php; ничего не изменено." -#: src/Admin/AdminPage.php:94 -msgid "Usage" -msgstr "Использование" +#: src/Support/ConfigFile.php:273 +msgid "Could not keep the owner/permissions of wp-config.php; nothing was changed. Paste the block manually:" +msgstr "Не удалось сохранить владельца/права wp-config.php; ничего не изменено. Вставьте блок вручную:" -#: src/Admin/AdminPage.php:2294 -msgid "" -"Use a daemon worker on VPS, Docker or dedicated servers where you can keep a " -"process running. It polls the queue continuously and starts jobs immediately." -" Without a daemon, WP Queue relies on WP-Cron and/or loopback, which can " -"delay jobs by up to a minute." -msgstr "" -"Запускайте демон-воркер на VPS, Docker или выделенном сервере, где можно " -"держать процесс запущенным. Он постоянно опрашивает очередь и сразу " -"запускает задания. Без демона WP Queue полагается на WP-Cron и/или loopback, " -"что может задерживать задания до минуты." +#: src/Support/ConfigFile.php:280 +msgid "Could not replace wp-config.php (read-only or bind-mounted file); nothing was changed. Paste the block manually:" +msgstr "Не удалось заменить wp-config.php (файл только для чтения или смонтирован); ничего не изменено. Вставьте блок вручную:" -#: src/Admin/AdminPage.php:1368 -msgid "Use system cron" -msgstr "Используйте системный cron" +#. translators: %s: error +#: src/Support/ConfigFile.php:303 +#, php-format +msgid "WordPress did not load with the new wp-config.php (%s); the previous file was restored." +msgstr "WordPress не загрузился с новым wp-config.php (%s); прежний файл восстановлен." -#: src/Admin/AdminPage.php:2365 -msgid "" -"Use the script from step 2 (Without WP-CLI) inside screen, tmux or a simple " -"cron-based restart loop. Remember that the script must stay alive to act as " -"a daemon." -msgstr "" -"Используйте скрипт из шага 2 (Без WP-CLI) внутри screen, tmux или простого " -"цикла перезапуска через cron. Помните, что скрипт должен оставаться " -"запущенным, чтобы работать как демон." +#: src/Support/ConfigFile.php:310 +msgid "wp-config.php updated and verified." +msgstr "wp-config.php обновлён и проверен." -#: src/Admin/AdminPage.php:722 -msgid "" -"Use this tab for quick checks of queue performance and identifying stuck " -"processes." -msgstr "" -"Используйте эту вкладку для быстрой проверки производительности очереди и " -"выявления зависших процессов." +#. translators: %d: HTTP status +#: src/Support/ConfigFile.php:355 +#, php-format +msgid "HTTP %d" +msgstr "HTTP %d" -#: src/Admin/AdminPage.php:1949 -msgid "Used" -msgstr "Использовал" +#. translators: %s: constant name +#: src/Support/ConfigFile.php:361 +#, php-format +msgid "%s has an unexpected value" +msgstr "%s имеет неожиданное значение" -#: src/Admin/AdminPage.php:738 -msgid "Useful for testing jobs and forcing synchronizations." -msgstr "Полезно для тестирования заданий и принудительной синхронизации." +#: src/Support/DriverSwitcher.php:39 +msgid "Unknown storage driver." +msgstr "Неизвестный драйвер хранения." -#: src/Admin/AdminPage.php:2201 -msgid "Useful Links" -msgstr "Полезные ссылки" +#: src/Support/DriverSwitcher.php:43 +msgid "The storage driver is defined in wp-config.php and cannot be changed here." +msgstr "Драйвер хранения задан в wp-config.php, здесь его изменить нельзя." -#: src/QueueManager.php:197 -msgid "Uses wp_options table" -msgstr "Использует таблицу wp_options" +#: src/Support/DriverSwitcher.php:49 +msgid "This storage driver is already active." +msgstr "Этот драйвер хранения уже активен." -#: src/Admin/AdminPage.php:1750 src/Admin/AdminPage.php:1988 -msgid "Version" -msgstr "Версия" +#. translators: %s: driver status message +#: src/Support/DriverSwitcher.php:57 +#, php-format +msgid "The storage driver is not available: %s" +msgstr "Драйвер хранения недоступен: %s" -#: src/Admin/AdminPage.php:1840 -msgid "Versions" -msgstr "Версии" +#: src/Support/DriverSwitcher.php:65 +msgid "A worker is processing jobs right now. Try again in a minute." +msgstr "Сейчас воркер обрабатывает задачи. Повторите через минуту." -#: src/Admin/AdminPage.php:1730 src/Admin/AdminPage.php:1926 -msgid "Warning" -msgstr "Предупреждение" +#. translators: 1: driver, 2: number of jobs +#: src/Support/DriverSwitcher.php:102 +#, php-format +msgid "Storage driver switched to %1$s. Jobs moved: %2$d." +msgstr "Драйвер хранения переключён на %1$s. Перенесено задач: %2$d." -#: src/Admin/AdminPage.php:112 -msgid "What you can use it for" -msgstr "Для чего его можно использовать" +#. translators: 1: number, 2: queue +#: src/Support/DriverSwitcher.php:154 +#, php-format +msgid "%1$d job(s) in queue \"%2$s\" are being executed. Try again when they finish." +msgstr "В очереди «%2$s» выполняется задач: %1$d. Повторите, когда они завершатся." -#: src/Admin/AdminPage.php:2293 -msgid "When to use a daemon" -msgstr "Когда использовать демон" +#: src/Support/DriverSwitcher.php:166 +msgid "The current storage driver cannot move its jobs. Wait until its queues are empty, then switch." +msgstr "Текущий драйвер хранения не умеет переносить задачи. Дождитесь, пока очереди опустеют, затем переключайте." -#: src/Admin/AdminPage.php:651 -msgid "Why is it needed?" -msgstr "Зачем это нужно?" +#. translators: %s: constant name +#: src/Support/Settings.php:150 +#, php-format +msgid "Defined in wp-config.php (%s). Change it there." +msgstr "Задано в wp-config.php (%s). Меняйте там." -#: src/Admin/AdminPage.php:2303 -msgid "With WP-CLI" -msgstr "С WP-CLI" +#: src/Support/Settings.php:177 +msgid "Saved to wp-config.php (WP Queue block)." +msgstr "Сохранено в wp-config.php (блок WP Queue)." -#: src/Admin/AdminPage.php:2308 -msgid "Without WP-CLI" -msgstr "Без WP-CLI" +#: src/Support/Settings.php:178 +msgid "Saved." +msgstr "Сохранено." -#: src/Admin/AdminPage.php:1468 -msgid "WooCommerce" -msgstr "WooCommerce" +#~ msgid "(configured)" +#~ msgstr "(настроено)" -#: src/Admin/AdminPage.php:1465 src/Admin/AdminPage.php:1848 -msgid "WordPress" -msgstr "WordPress" +#~ msgid "1. Enable daemon runtime mode" +#~ msgstr "1. Включите режим демона" -#: src/Admin/AdminPage.php:683 -msgid "" -"WordPress checks for scheduled tasks on every page load. This works out of " -"the box but has downsides: on low-traffic sites, tasks might not run on time;" -" on high-traffic sites, it can cause performance issues. It is \"fake\" cron." -msgstr "" -"WordPress проверяет наличие запланированных задач при каждой загрузке " -"страницы. Это работает «из коробки», но имеет свои недостатки: на сайтах с " -"низкой посещаемостью задачи могут не выполняться вовремя; на сайтах с " -"высокой посещаемостью это может вызывать проблемы с производительностью. Это " -"«поддельный» cron." +#~ msgid "A daemon worker is expected to process queues. WP-Cron and loopback are disabled." +#~ msgstr "Для обработки очередей ожидается демон-воркер. WP-Cron и loopback отключены." -#: src/Admin/AdminPage.php:1787 src/Admin/AdminPage.php:1968 -msgid "WordPress Time" -msgstr "Время WordPress" +#~ msgid "Add this to wp-config.php:" +#~ msgstr "Добавьте в wp-config.php:" -#: src/Admin/AdminPage.php:1672 -msgid "WordPress Version" -msgstr "Версия WordPress" +#~ msgid "Add to wp-config.php:" +#~ msgstr "Добавьте в файл wp-config.php:" -#: src/Admin/AdminPage.php:669 -msgid "Worker" -msgstr "Воркер" +#, php-format +#~ msgid "Cannot connect to Memcached at %s:%d - %s" +#~ msgstr "Не удалось подключиться к Memcached на %s:%d - %s" -#. Name of the plugin -#: src/Admin/AdminPage.php:68 src/Admin/AdminPage.php:69 -#: src/Admin/AdminPage.php:1471 src/Admin/AdminPage.php:1844 -msgid "WP Queue" -msgstr "WP Queue" +#, php-format +#~ msgid "Cannot connect to Redis at %s:%d - %s" +#~ msgstr "Не удалось подключиться к Redis на %s:%d - %s" -#: src/Admin/AdminPage.php:2069 -msgid "" -"WP Queue allows executing tasks asynchronously in the background without " -"blocking the main WordPress execution flow." -msgstr "" -"WP Queue позволяет выполнять задачи асинхронно в фоновом режиме, не блокируя " -"основной поток выполнения WordPress." +#~ msgid "Configure Memcached" +#~ msgstr "Настройка Memcached" -#: src/Admin/AdminPage.php:110 -msgid "" -"WP Queue helps your site run heavy or regular tasks in the background " -"(emails, synchronizations, cleanups) so that pages load faster for visitors." -msgstr "" -"WP Queue помогает вашему сайту выполнять ресурсоемкие или регулярно " -"выполняемые задачи в фоновом режиме (отправка электронной почты, " -"синхронизация, очистка), благодаря чему страницы загружаются быстрее для " -"посетителей." +#~ msgid "Configure Redis" +#~ msgstr "Настройка Redis" -#: src/Admin/AdminPage.php:643 -msgid "" -"WP Queue is a robust background processing library for WordPress. It allows " -"you to offload time-consuming tasks (like sending emails, syncing data, or " -"generating reports) to be processed asynchronously, ensuring your site " -"remains fast and responsive for visitors." -msgstr "" -"WP Queue — это мощная библиотека для фоновой обработки данных в WordPress. " -"Она позволяет переносить трудоемкие задачи (например, отправку электронных " -"писем, синхронизацию данных или создание отчетов) на асинхронную обработку, " -"обеспечивая быструю и отзывчивую работу вашего сайта для посетителей." +#~ msgid "Configure system cron" +#~ msgstr "Настройте системный cron." -#: src/Admin/AdminPage.php:659 -msgid "" -"WP Queue solves this by pushing these tasks to a \"Queue\" and processing " -"them later in the background. The user gets an instant response, and the " -"heavy work happens behind the scenes." -msgstr "" -"WP Queue решает эту проблему, отправляя эти задачи в \"очередь\" и " -"обрабатывая их позже в фоновом режиме. Пользователь получает мгновенный " -"ответ, а основная работа происходит за кулисами." +#, php-format +#~ msgid "Connected to Memcached at %s:%d" +#~ msgstr "Подключено к Memcached на %s:%d" -#: src/Admin/AdminPage.php:2067 -msgid "WP Queue — Queue System for WordPress" -msgstr "WP Queue — система очередей для WordPress" +#, php-format +#~ msgid "Connected to Redis at %s:%d (phpredis)" +#~ msgstr "Подключено к Redis по адресу %s:%d (phpredis)" -#: src/Admin/AdminPage.php:100 -msgid "WP-CLI" -msgstr "WP-CLI" +#, php-format +#~ msgid "Connected to Redis at %s:%d (Predis)" +#~ msgstr "Подключено к Redis по адресу %s:%d (Predis)" -#: src/Admin/AdminPage.php:145 src/Admin/AdminPage.php:2041 -msgid "WP-CLI Commands" -msgstr "Команды WP-CLI" +#, php-format +#~ msgid "Connected to Redis at %s:%d (via redis-cache plugin)" +#~ msgstr "Подключено к Redis по адресу %s:%d (через плагин redis-cache)" -#: src/Admin/AdminPage.php:2180 -msgid "WP-CLI команды" -msgstr "Команда WP-CLI" +#~ msgid "Daemon process" +#~ msgstr "Демон-процесс" -#: src/Admin/AdminPage.php:760 src/Admin/AdminPage.php:1905 -msgid "WP-Cron" -msgstr "WP-Cron" +#~ msgid "For Redis/Memcached to work, you need the PHP extension installed and a server available. If not, the system will automatically use the \"database\" driver." +#~ msgstr "Для работы Redis/Memcached необходимо установить расширение PHP и иметь доступный сервер. В противном случае система автоматически будет использовать драйвер \"database\"." -#: src/Admin/AdminPage.php:681 -msgid "WP-Cron (Default)" -msgstr "WP-Cron (по умолчанию)" +#~ msgid "How to change the storage backend?" +#~ msgstr "Как изменить хранилище для данных?" -#: src/Admin/AdminPage.php:1869 src/Admin/AdminPage.php:1873 -msgid "WP-Cron + Loopback" -msgstr "WP-Cron + Loopback" +#~ msgid "Important:" +#~ msgstr "Важно:" -#: src/Admin/AdminPage.php:1900 -msgid "WP-Cron checks the queue every minute as a fallback." -msgstr "WP-Cron раз в минуту проверяет очередь как подстраховку." +#~ msgid "In this mode WP-Cron scheduling and loopback requests are disabled automatically." +#~ msgstr "В этом режиме планирование WP-Cron и loopback-запросы отключаются автоматически." -#: src/Admin/AdminPage.php:1701 -msgid "WP-Cron Disabled" -msgstr "WP-Cron отключен" +#~ msgid "Install: pecl install redis" +#~ msgstr "Установите: pecl install redis" -#: src/Admin/SystemStatus.php:265 -msgid "WP-Cron is disabled. Background tasks may not run automatically." -msgstr "WP-Cron отключен. Фоновые задачи могут не выполняться автоматически." +#~ msgid "Loopback is disabled. Jobs will be processed only by WP-Cron, which can delay execution by up to one minute. Run a daemon worker for instant processing." +#~ msgstr "Loopback отключен. Задачи будут обрабатываться только WP-Cron с задержкой до минуты. Запустите демон-воркер для мгновенной обработки." -#: src/Admin/AdminPage.php:1877 -msgid "WP-Cron only" -msgstr "Только WP-Cron" +#~ msgid "Loopback is enabled and working. Jobs start immediately after dispatch." +#~ msgstr "Loopback включен и работает. Задачи запускаются сразу после отправки." -#: src/Admin/AdminPage.php:1697 -msgid "WP-Cron Status" -msgstr "Статус WP-Cron" +#~ msgid "Loopback is inactive. Jobs will be processed only by WP-Cron, which can delay execution by up to one minute. Enable loopback or run a daemon worker for instant processing." +#~ msgstr "Loopback неактивен. Задачи будут обрабатываться только WP-Cron с задержкой до минуты. Включите loopback или запустите демон-воркер для мгновенной обработки." -#: src/Admin/AdminPage.php:784 -msgid "WP-Cron status" -msgstr "статус WP-Cron" +#~ msgid "Queue handler" +#~ msgstr "Обработчик очереди" -#: src/Admin/AdminPage.php:673 -msgid "WP-Cron vs System Cron" -msgstr "WP-Cron против System Cron" +#, php-format +#~ msgid "Storage backend \"%s\" is configured in wp-config.php, but not available. Falling back to \"%s\"." +#~ msgstr "В файле wp-config.php настроен бэкэнд хранилища \"%s\", но он недоступен. Используется резервный вариант \"%s\"." -#: src/Admin/AdminPage.php:131 -msgid "" -"WP-Cron – list of cron events with the ability to run, pause or delete them." -msgstr "" -"WP-Cron – список событий cron с возможностью их запуска, приостановки или " -"удаления." +#~ msgid "Uses wp_options table" +#~ msgstr "Использует таблицу wp_options" -#: src/Admin/AdminPage.php:1365 -msgid "WP-Cron:" -msgstr "WP-Cron:" +#~ msgid "WP-Cron + Loopback" +#~ msgstr "WP-Cron + Loopback" -#: src/Admin/AdminPage.php:1032 -msgid "⚠️ Warning:" -msgstr "⚠️ Предупреждение:" +#~ msgid "WP-Cron checks the queue every minute as a fallback." +#~ msgstr "WP-Cron раз в минуту проверяет очередь как подстраховку." + +#~ msgid "WP-Cron only" +#~ msgstr "Только WP-Cron" diff --git a/languages/wp-queue.pot b/languages/wp-queue.pot index 3f559d0..5a51c0b 100644 --- a/languages/wp-queue.pot +++ b/languages/wp-queue.pot @@ -1,1603 +1,1917 @@ -# Copyright (C) 2024 Aleksei Tikhomirov +# Copyright (C) 2026 Aleksei Tikhomirov # This file is distributed under the GPL-2.0-or-later. -#, fuzzy msgid "" msgstr "" -"Project-Id-Version: WP Queue 1.0.0\n" -"Report-Msgid-Bugs-To: https://github.com/rwsite/wp-queue/issues\n" -"POT-Creation-Date: 2026-07-25 21:09+0000\n" +"Project-Id-Version: Queue Manager 1.4.0\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/app\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2026-11-11T14:53:28+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -"X-Generator: Loco https://localise.biz/" +"X-Generator: WP-CLI 2.12.0\n" +"X-Domain: wp-queue\n" -#: src/Admin/AdminPage.php:913 -msgid "%d entries" +#. Plugin Name of the plugin +#: wp-queue.php +msgid "Queue Manager" msgstr "" -#: src/Admin/AdminPage.php:545 -msgid "%d tasks" +#. Plugin URI of the plugin +#: wp-queue.php +msgid "https://github.com/rwsite/wp-queue" msgstr "" -#: src/Admin/AdminPage.php:1071 -msgid "(configured)" +#. Description of the plugin +#: wp-queue.php +msgid "Background job processing and WP-Cron management for WordPress. Schedule tasks, manage queues, and monitor cron events." msgstr "" -#: src/Admin/AdminPage.php:2306 -msgid "" -"--memory limits the PHP memory for the worker process. Adjust the value to " -"your needs." +#. Author of the plugin +#: wp-queue.php +msgid "Aleksei Tikhomirov" msgstr "" -#: src/Admin/AdminPage.php:2296 -msgid "1. Enable daemon runtime mode" +#. Author URI of the plugin +#: wp-queue.php +msgid "https://rwsite.ru" msgstr "" -#: src/Admin/AdminPage.php:2301 -msgid "2. Run the worker" +#: src/Admin/AdminPage.php:41 +#: src/Admin/AdminPage.php:384 +msgid "Queues" msgstr "" -#: src/Admin/AdminPage.php:2328 -msgid "3. Keep it running" +#: src/Admin/AdminPage.php:42 +#: src/Admin/AdminPage.php:2249 +msgid "Scheduler" msgstr "" -#: src/Admin/AdminPage.php:2367 -msgid "4. Check status" +#: src/Admin/AdminPage.php:43 +#: src/Admin/AdminPage.php:795 +msgid "System" msgstr "" -#: src/Admin/AdminPage.php:669 -msgid "A background process (Worker) constantly checks the queue for new jobs." +#: src/Admin/AdminPage.php:48 +#: src/Admin/AdminPage.php:55 +#: src/Admin/AdminPage.php:257 +msgid "Overview" msgstr "" -#: src/Admin/AdminPage.php:1867 -msgid "" -"A daemon worker is expected to process queues. WP-Cron and loopback are " -"disabled." +#: src/Admin/AdminPage.php:49 +msgid "Jobs in Queue" msgstr "" -#: src/Admin/AdminPage.php:719 -msgid "" -"A list of all active queues with their size, status " -"(idle/pending/running/paused), and control buttons (pause/resume, clear all " -"tasks)." +#: src/Admin/AdminPage.php:50 +msgid "History" msgstr "" -#: src/Admin/AdminPage.php:667 -msgid "A plugin creates a \"Job\" (a task) and pushes it to the queue." +#: src/Admin/AdminPage.php:51 +#: src/Admin/AdminPage.php:334 +#: src/Admin/AdminPage.php:363 +#: src/Admin/AdminPage.php:864 +msgid "Failed" msgstr "" -#: src/Admin/AdminPage.php:691 -msgid "" -"A real cron job configured on your server (Linux) that calls WordPress every " -"minute. This is reliable and precise. Ideally, you should disable default WP-" -"Cron and use System Cron." +#: src/Admin/AdminPage.php:52 +msgid "Drivers" msgstr "" -#: src/Admin/AdminPage.php:768 -msgid "A separate table for events that are temporarily disabled." +#: src/Admin/AdminPage.php:56 +msgid "Cron Events" msgstr "" -#: src/Admin/AdminPage.php:769 -msgid "" -"A table of all available intervals (hourly, daily, etc.) with their duration." +#: src/Admin/AdminPage.php:57 +#: src/Admin/AdminPage.php:1389 +msgid "Scheduled" msgstr "" -#: src/Admin/AdminPage.php:88 src/Admin/AdminPage.php:109 -#: src/Admin/AdminPage.php:641 -msgid "About WP Queue" +#: src/Admin/AdminPage.php:58 +#: src/Admin/AdminPage.php:332 +#: src/Admin/AdminPage.php:441 +#: src/Admin/AdminPage.php:1397 +msgid "Paused" msgstr "" -#: src/Admin/AdminPage.php:201 -msgid "Action completed successfully" +#: src/Admin/AdminPage.php:61 +msgid "System Status" msgstr "" -#: src/Admin/AdminPage.php:785 src/Admin/AdminPage.php:1746 -#: src/Admin/AdminPage.php:1984 -msgid "Action Scheduler" +#: src/Admin/AdminPage.php:62 +#: src/Admin/AdminPage.php:2380 +msgid "Daemon worker" msgstr "" -#: src/Admin/AdminPage.php:484 src/Admin/AdminPage.php:597 -#: src/Admin/AdminPage.php:1486 src/Admin/AdminPage.php:1561 -#: src/Admin/AdminPage.php:2255 -msgid "Actions" +#: src/Admin/AdminPage.php:63 +#: src/Admin/AdminPage.php:2111 +msgid "Tools" msgstr "" -#: src/Admin/AdminPage.php:431 src/Admin/AdminPage.php:1058 -#: src/Admin/AdminPage.php:1370 src/Admin/AdminPage.php:1911 -msgid "Active" +#: src/Admin/AdminPage.php:64 +msgid "Help" msgstr "" -#: src/Admin/AdminPage.php:2297 -msgid "Add this to wp-config.php:" +#: src/Admin/AdminPage.php:72 +#: src/Admin/AdminPage.php:73 +#: src/Admin/AdminPage.php:1510 +#: src/Admin/AdminPage.php:1893 +msgid "WP Queue" msgstr "" -#: src/Admin/AdminPage.php:1103 -msgid "Add to wp-config.php:" +#: src/Admin/AdminPage.php:92 +#: src/Admin/AdminPage.php:113 +#: src/Admin/AdminPage.php:659 +msgid "About WP Queue" msgstr "" -#: src/Admin/AdminPage.php:618 -msgid "ago (overdue)" +#: src/Admin/AdminPage.php:98 +msgid "Usage" msgstr "" -#. Author of the plugin -msgid "Aleksei Tikhomirov" +#: src/Admin/AdminPage.php:104 +msgid "WP-CLI" msgstr "" -#: src/Admin/AdminPage.php:840 src/Admin/AdminPage.php:1462 -msgid "All" +#: src/Admin/AdminPage.php:114 +msgid "WP Queue helps your site run heavy or regular tasks in the background (emails, synchronizations, cleanups) so that pages load faster for visitors." msgstr "" -#: src/Admin/AdminPage.php:851 -msgid "All queues" +#: src/Admin/AdminPage.php:115 +msgid "The plugin itself does not add new features to the frontend. It provides a reliable queue that other plugins or your custom code can use for background work." msgstr "" -#: src/Admin/AdminPage.php:1660 -msgid "All systems are healthy." +#: src/Admin/AdminPage.php:116 +msgid "What you can use it for" msgstr "" -#: src/Admin/AdminPage.php:1712 -msgid "Alternate Cron" +#: src/Admin/AdminPage.php:118 +msgid "Monitor which background jobs are queued and running right now." msgstr "" -#: src/Admin/AdminPage.php:202 -msgid "An error occurred" +#: src/Admin/AdminPage.php:119 +msgid "Quickly see if any jobs are failing and view recent log entries." msgstr "" -#: src/Admin/AdminPage.php:199 -msgid "Are you sure you want to clear this queue?" +#: src/Admin/AdminPage.php:120 +msgid "Inspect and manage WP-Cron events for WP Queue and other plugins." msgstr "" -#: src/Admin/AdminPage.php:481 src/Admin/AdminPage.php:963 -msgid "Attempts" +#: src/Admin/AdminPage.php:121 +msgid "Check basic system requirements that affect queue stability." msgstr "" -#: src/Admin/AdminPage.php:170 -msgid "Author Website" +#: src/Admin/AdminPage.php:123 +#: src/Admin/AdminPage.php:139 +msgid "For developers" msgstr "" -#: src/Admin/AdminPage.php:482 -msgid "Available From" +#: src/Admin/AdminPage.php:124 +msgid "Developers can dispatch their own jobs to the queue, choose drivers (Database, Sync, Redis), configure retries and schedules. See the documentation and examples on GitHub for integration details." msgstr "" -#. Description of the plugin -msgid "" -"Background job processing and WP-Cron management for WordPress. Schedule " -"tasks, manage queues, and monitor cron events." +#: src/Admin/AdminPage.php:129 +msgid "Basic Usage" msgstr "" -#: src/Admin/AdminPage.php:125 -msgid "Basic Usage" +#: src/Admin/AdminPage.php:130 +msgid "For site administrators" msgstr "" -#: src/Admin/AdminPage.php:751 -msgid "Button to delete old log entries to avoid cluttering the database." +#: src/Admin/AdminPage.php:132 +msgid "Dashboard – quick overview of queues, number of jobs and recent activity." msgstr "" -#: src/Admin/AdminPage.php:749 -msgid "Buttons to show all entries, only completed, or only failed jobs." +#: src/Admin/AdminPage.php:133 +msgid "Scheduled Jobs – list of recurring background jobs added by your theme or plugins." msgstr "" -#: src/Admin/AdminPage.php:653 -msgid "" -"By default, WordPress executes all actions during the page load request. If " -"a plugin needs to send 100 emails or sync 500 products with an external API, " -"the user has to wait until it finishes. This leads to slow page loads or " -"timeouts." +#: src/Admin/AdminPage.php:134 +msgid "Logs – history of completed and failed jobs that helps to diagnose problems." msgstr "" -#: src/Admin/AdminPage.php:701 -msgid "" -"By default, WP Queue stores jobs in the WordPress database (wp_options or " -"custom tables). For high-performance sites, you can use Redis. Redis is an " -"in-memory data store that is much faster than a SQL database for queue " -"operations. It reduces load on your database and speeds up job processing." +#: src/Admin/AdminPage.php:135 +msgid "WP-Cron – list of cron events with the ability to run, pause or delete them." msgstr "" -#: src/Admin/AdminPage.php:1626 -msgid "Cancel" +#: src/Admin/AdminPage.php:136 +msgid "System – checks PHP version, WP-Cron status and other important settings." msgstr "" -#: src/QueueManager.php:500 -#, php-format -msgid "Cannot connect to Memcached at %s:%d - %s" +#: src/Admin/AdminPage.php:138 +msgid "If you installed WP Queue because another plugin requires it, you usually do not need to configure anything here. Use these tabs mainly for monitoring and troubleshooting." msgstr "" -#: src/QueueManager.php:297 src/QueueManager.php:375 src/QueueManager.php:448 +#. translators: %s: URL to GitHub repository +#: src/Admin/AdminPage.php:142 #, php-format -msgid "Cannot connect to Redis at %s:%d - %s" +msgid "To add your own background jobs, use the WP Queue PHP API from your plugin or theme. You can dispatch jobs to different queues, set delays and retries. Full code examples are available in the README on GitHub." msgstr "" -#: src/Admin/AdminPage.php:117 -msgid "Check basic system requirements that affect queue stability." +#: src/Admin/AdminPage.php:149 +#: src/Admin/AdminPage.php:2133 +msgid "WP-CLI Commands" msgstr "" -#: src/Admin/AdminPage.php:1040 -msgid "Check driver settings." +#: src/Admin/AdminPage.php:150 +#: src/Admin/AdminPage.php:1560 +msgid "Run" msgstr "" -#: src/Admin/AdminPage.php:754 -msgid "Check logs when encountering errors in background processes." +#: src/Admin/AdminPage.php:150 +msgid "to get a list of available commands." msgstr "" -#: src/Admin/AdminPage.php:788 -msgid "Check this tab when setting up your server or debugging queue issues." +#: src/Admin/AdminPage.php:171 +msgid "For more information:" msgstr "" -#: src/Admin/AdminPage.php:784 -msgid "" -"Checking for disablement (DISABLE_WP_CRON), alternative cron, loopback " -"requests." +#: src/Admin/AdminPage.php:172 +msgid "GitHub Repository" msgstr "" -#: src/Admin/AdminPage.php:780 -msgid "" -"Checking system requirements and environment for stable queue operation." +#: src/Admin/AdminPage.php:173 +msgid "Report Issues" msgstr "" -#: src/Admin/AdminPage.php:454 -msgid "Clear" +#: src/Admin/AdminPage.php:174 +msgid "Author Website" msgstr "" -#: src/Admin/AdminPage.php:2037 -msgid "Clear All" +#: src/Admin/AdminPage.php:203 +msgid "Are you sure you want to clear this queue?" msgstr "" -#: src/Admin/AdminPage.php:2025 -msgid "Clear All Logs" +#: src/Admin/AdminPage.php:204 +msgid "Pause this queue?" msgstr "" -#: src/Admin/AdminPage.php:2035 -msgid "Clear All Queues" +#: src/Admin/AdminPage.php:205 +msgid "Action completed successfully" msgstr "" -#: src/Admin/AdminPage.php:2023 -msgid "Clear Logs" +#: src/Admin/AdminPage.php:206 +msgid "An error occurred" msgstr "" -#: src/Admin/AdminPage.php:751 -msgid "Clear logs" +#: src/Admin/AdminPage.php:321 +msgid "This section is under development." msgstr "" -#: src/Admin/AdminPage.php:863 -msgid "Clear old" +#: src/Admin/AdminPage.php:329 +msgid "Idle" msgstr "" -#: src/Admin/AdminPage.php:570 -msgid "Close" +#: src/Admin/AdminPage.php:330 +#: src/Admin/AdminPage.php:481 +#: src/Admin/AdminPage.php:2085 +msgid "Pending" msgstr "" -#: src/Admin/AdminPage.php:786 -msgid "" -"Comparison of server time, WordPress, and GMT offset for diagnosing " -"scheduling issues." +#: src/Admin/AdminPage.php:331 +#: src/Admin/AdminPage.php:355 +#: src/Admin/AdminPage.php:1950 +msgid "Running" msgstr "" -#: src/Admin/AdminPage.php:329 src/Admin/AdminPage.php:355 -#: src/Admin/AdminPage.php:843 src/Admin/AdminPage.php:1823 +#: src/Admin/AdminPage.php:333 +#: src/Admin/AdminPage.php:359 +#: src/Admin/AdminPage.php:861 +#: src/Admin/AdminPage.php:1872 msgid "Completed" msgstr "" -#: src/Admin/AdminPage.php:1885 -msgid "Component Status" +#: src/Admin/AdminPage.php:351 +msgid "In Queue" msgstr "" -#: src/Admin/AdminPage.php:369 -msgid "Configure" +#: src/Admin/AdminPage.php:370 +msgid "Driver:" msgstr "" -#: src/Admin/AdminPage.php:2137 -msgid "Configure automatic retries on errors:" +#: src/Admin/AdminPage.php:373 +#: src/Admin/AdminPage.php:379 +msgid "Configure" msgstr "" -#: src/Admin/AdminPage.php:1112 -msgid "Configure Memcached" +#: src/Admin/AdminPage.php:376 +msgid "Runner:" msgstr "" -#: src/Admin/AdminPage.php:1106 -msgid "Configure Redis" +#: src/Admin/AdminPage.php:397 +msgid "jobs" msgstr "" -#: src/Admin/AdminPage.php:1909 -msgid "Configure system cron" +#: src/Admin/AdminPage.php:408 +msgid "Recent Activity" msgstr "" -#: src/QueueManager.php:489 +#. translators: %s: Queue name. +#: src/Admin/AdminPage.php:435 #, php-format -msgid "Connected to Memcached at %s:%d" +msgid "Queue: %s" msgstr "" -#: src/QueueManager.php:289 -#, php-format -msgid "Connected to Redis at %s:%d (phpredis)" +#: src/Admin/AdminPage.php:443 +#: src/Admin/AdminPage.php:485 +msgid "Processing" msgstr "" -#: src/QueueManager.php:440 -#, php-format -msgid "Connected to Redis at %s:%d (Predis)" +#: src/Admin/AdminPage.php:445 +#: src/Admin/AdminPage.php:1083 +#: src/Admin/AdminPage.php:1111 +#: src/Admin/AdminPage.php:1409 +msgid "Active" msgstr "" -#: src/QueueManager.php:349 src/QueueManager.php:367 -#, php-format -msgid "Connected to Redis at %s:%d (via redis-cache plugin)" +#: src/Admin/AdminPage.php:454 +#: src/Admin/AdminPage.php:1613 +#: src/Admin/AdminPage.php:2360 +msgid "Resume" msgstr "" -#: src/Admin/AdminPage.php:2080 -msgid "Create a job class and dispatch it to the queue:" +#: src/Admin/AdminPage.php:459 +#: src/Admin/AdminPage.php:1574 +#: src/Admin/AdminPage.php:1575 +msgid "Pause" msgstr "" -#: src/Admin/AdminPage.php:771 -msgid "Critical for understanding why tasks are not running on time." +#: src/Admin/AdminPage.php:464 +#: src/Admin/AdminPage.php:2123 +msgid "Process Now" msgstr "" -#: src/Admin/RestApi.php:523 -msgid "Cron event paused" +#: src/Admin/AdminPage.php:468 +msgid "Clear" msgstr "" -#: src/Admin/RestApi.php:537 -msgid "Cron event resumed" +#: src/Admin/AdminPage.php:477 +msgid "Total Jobs" msgstr "" -#: src/Admin/RestApi.php:554 -msgid "Cron event updated" +#: src/Admin/AdminPage.php:493 +msgid "ID" msgstr "" -#: src/Admin/AdminPage.php:52 -msgid "Cron Events" +#: src/Admin/AdminPage.php:494 +msgid "Job Class" msgstr "" -#: src/Admin/AdminPage.php:1680 -msgid "Current Memory Usage" +#: src/Admin/AdminPage.php:495 +#: src/Admin/AdminPage.php:985 +msgid "Attempts" msgstr "" -#: src/Admin/AdminPage.php:1046 -msgid "Current storage backend:" +#: src/Admin/AdminPage.php:496 +msgid "Available From" msgstr "" -#: src/QueueManager.php:207 src/QueueManager.php:533 src/QueueManager.php:535 -msgid "Custom driver" +#: src/Admin/AdminPage.php:497 +#: src/Admin/AdminPage.php:894 +#: src/Admin/AdminPage.php:1081 +#: src/Admin/AdminPage.php:1210 +msgid "Status" msgstr "" -#: src/Admin/AdminPage.php:1865 -msgid "Daemon process" +#: src/Admin/AdminPage.php:498 +#: src/Admin/AdminPage.php:615 +#: src/Admin/AdminPage.php:1525 +#: src/Admin/AdminPage.php:1600 +#: src/Admin/AdminPage.php:2347 +msgid "Actions" msgstr "" -#: src/Admin/AdminPage.php:58 src/Admin/AdminPage.php:2288 -msgid "Daemon worker" +#: src/Admin/AdminPage.php:504 +msgid "Queue is empty" msgstr "" -#: src/Admin/AdminPage.php:713 -msgid "Dashboard" +#: src/Admin/AdminPage.php:511 +#: src/Admin/AdminPage.php:1306 +msgid "Unknown" msgstr "" -#: src/Admin/AdminPage.php:128 -msgid "" -"Dashboard – quick overview of queues, number of jobs and recent activity." +#: src/Admin/AdminPage.php:521 +#: src/Admin/AdminPage.php:636 +msgid "from now" msgstr "" -#: src/Admin/AdminPage.php:2098 -msgid "Delayed Jobs" +#: src/Admin/AdminPage.php:523 +msgid "Now" +msgstr "" + +#: src/Admin/AdminPage.php:541 +msgid "Details" msgstr "" -#: src/Admin/AdminPage.php:530 src/Admin/AdminPage.php:1542 -#: src/Admin/AdminPage.php:1543 +#: src/Admin/AdminPage.php:544 +#: src/Admin/AdminPage.php:1581 +#: src/Admin/AdminPage.php:1582 msgid "Delete" msgstr "" -#: src/Admin/AdminPage.php:867 -msgid "Delete all" +#. translators: %d: Number of tasks. +#: src/Admin/AdminPage.php:561 +#, php-format +msgid "%d tasks" msgstr "" -#: src/Admin/AdminPage.php:2024 -msgid "Deletes all job execution logs" +#: src/Admin/AdminPage.php:585 +msgid "Job Details" msgstr "" -#: src/Admin/AdminPage.php:2036 -msgid "Deletes all jobs from all queues" +#: src/Admin/AdminPage.php:588 +msgid "Close" msgstr "" -#: src/Admin/AdminPage.php:861 -msgid "Deletes logs older than 7 days" +#: src/Admin/AdminPage.php:603 +msgid "Displays a table of scheduled recurring tasks (PHP classes) registered in WP Queue: job class, execution interval, queue assignment, and next run time. Allows you to run any task manually." msgstr "" -#: src/Admin/AdminPage.php:1057 -msgid "Description" +#: src/Admin/AdminPage.php:611 +#: src/Admin/AdminPage.php:895 +#: src/Admin/AdminPage.php:983 +#: src/Admin/AdminPage.php:1211 +msgid "Job" +msgstr "" + +#: src/Admin/AdminPage.php:612 +#: src/Admin/AdminPage.php:1523 +#: src/Admin/AdminPage.php:1598 +#: src/Admin/AdminPage.php:1652 +#: src/Admin/AdminPage.php:2345 +msgid "Schedule" +msgstr "" + +#: src/Admin/AdminPage.php:613 +#: src/Admin/AdminPage.php:896 +#: src/Admin/AdminPage.php:984 +msgid "Queue" +msgstr "" + +#: src/Admin/AdminPage.php:614 +#: src/Admin/AdminPage.php:1445 +#: src/Admin/AdminPage.php:1522 +msgid "Next Run" +msgstr "" + +#: src/Admin/AdminPage.php:621 +msgid "No scheduled jobs found." +msgstr "" + +#: src/Admin/AdminPage.php:636 +msgid "ago (overdue)" +msgstr "" + +#: src/Admin/AdminPage.php:643 +#: src/Admin/AdminPage.php:1559 +msgid "Run Now" +msgstr "" + +#: src/Admin/AdminPage.php:661 +msgid "WP Queue is a robust background processing library for WordPress. It allows you to offload time-consuming tasks (like sending emails, syncing data, or generating reports) to be processed asynchronously, ensuring your site remains fast and responsive for visitors." +msgstr "" + +#: src/Admin/AdminPage.php:669 +msgid "Why is it needed?" +msgstr "" + +#: src/Admin/AdminPage.php:671 +msgid "By default, WordPress executes all actions during the page load request. If a plugin needs to send 100 emails or sync 500 products with an external API, the user has to wait until it finishes. This leads to slow page loads or timeouts." +msgstr "" + +#: src/Admin/AdminPage.php:677 +msgid "WP Queue solves this by pushing these tasks to a \"Queue\" and processing them later in the background. The user gets an instant response, and the heavy work happens behind the scenes." +msgstr "" + +#: src/Admin/AdminPage.php:683 +msgid "How Queues Work" +msgstr "" + +#: src/Admin/AdminPage.php:685 +msgid "Dispatch" +msgstr "" + +#: src/Admin/AdminPage.php:685 +msgid "A plugin creates a \"Job\" (a task) and pushes it to the queue." +msgstr "" + +#: src/Admin/AdminPage.php:686 +msgid "Storage" +msgstr "" + +#: src/Admin/AdminPage.php:686 +msgid "The job is saved in the database (or Redis) waiting to be picked up." +msgstr "" + +#: src/Admin/AdminPage.php:687 +msgid "Worker" +msgstr "" + +#: src/Admin/AdminPage.php:687 +msgid "A background process (Worker) constantly checks the queue for new jobs." +msgstr "" + +#: src/Admin/AdminPage.php:688 +msgid "Process" +msgstr "" + +#: src/Admin/AdminPage.php:688 +msgid "The worker picks up the job and executes it. If it succeeds, it is marked as \"Completed\". If it fails, it can be retried." +msgstr "" + +#: src/Admin/AdminPage.php:691 +msgid "WP-Cron vs System Cron" +msgstr "" + +#: src/Admin/AdminPage.php:693 +msgid "To process the queue, WordPress needs a trigger. There are two ways to do this:" +msgstr "" + +#: src/Admin/AdminPage.php:699 +msgid "WP-Cron (Default)" +msgstr "" + +#: src/Admin/AdminPage.php:701 +msgid "WordPress checks for scheduled tasks on every page load. This works out of the box but has downsides: on low-traffic sites, tasks might not run on time; on high-traffic sites, it can cause performance issues. It is \"fake\" cron." +msgstr "" + +#: src/Admin/AdminPage.php:707 +msgid "System Cron (Recommended)" msgstr "" #: src/Admin/AdminPage.php:709 +msgid "A real cron job configured on your server (Linux) that calls WordPress every minute. This is reliable and precise. Ideally, you should disable default WP-Cron and use System Cron." +msgstr "" + +#: src/Admin/AdminPage.php:717 +msgid "Redis Support" +msgstr "" + +#: src/Admin/AdminPage.php:719 +msgid "By default, WP Queue stores jobs in the WordPress database (wp_options or custom tables). For high-performance sites, you can use Redis. Redis is an in-memory data store that is much faster than a SQL database for queue operations. It reduces load on your database and speeds up job processing." +msgstr "" + +#: src/Admin/AdminPage.php:727 msgid "Detailed description of the panel tabs" msgstr "" -#: src/Admin/AdminPage.php:527 -msgid "Details" +#: src/Admin/AdminPage.php:731 +msgid "Dashboard" msgstr "" -#: src/Admin/AdminPage.php:120 -msgid "" -"Developers can dispatch their own jobs to the queue, choose drivers " -"(Database, Sync, Redis), configure retries and schedules. See the " -"documentation and examples on GitHub for integration details." +#: src/Admin/AdminPage.php:734 +msgid "The main tab for monitoring queue status in real-time." +msgstr "" + +#: src/Admin/AdminPage.php:736 +msgid "Queue statistics" +msgstr "" + +#: src/Admin/AdminPage.php:736 +msgid "Displays the total number of tasks in different statuses (pending, running, completed, failed)." +msgstr "" + +#: src/Admin/AdminPage.php:737 +msgid "Queue table" +msgstr "" + +#: src/Admin/AdminPage.php:737 +msgid "A list of all active queues with their size, status (idle/pending/running/paused), and control buttons (pause/resume, clear all tasks)." +msgstr "" + +#: src/Admin/AdminPage.php:738 +msgid "Recent activity" +msgstr "" + +#: src/Admin/AdminPage.php:738 +msgid "The last 10 log entries for quick tracking of queue activity." +msgstr "" + +#: src/Admin/AdminPage.php:740 +msgid "Use this tab for quick checks of queue performance and identifying stuck processes." +msgstr "" + +#: src/Admin/AdminPage.php:746 +msgid "Scheduled Jobs" +msgstr "" + +#: src/Admin/AdminPage.php:749 +msgid "Management of scheduled recurring tasks." +msgstr "" + +#: src/Admin/AdminPage.php:751 +msgid "Job list" +msgstr "" + +#: src/Admin/AdminPage.php:751 +msgid "Displays all registered PHP job classes with their configuration." +msgstr "" + +#: src/Admin/AdminPage.php:752 +msgid "Job information" +msgstr "" + +#: src/Admin/AdminPage.php:752 +msgid "Job class, execution interval (e.g., \"hourly\", \"daily\"), queue assignment, next run time." +msgstr "" + +#: src/Admin/AdminPage.php:753 +msgid "Manual run" +msgstr "" + +#: src/Admin/AdminPage.php:753 +msgid "The \"Run Now\" button allows you to run any job immediately, without waiting for the schedule." +msgstr "" + +#: src/Admin/AdminPage.php:754 +msgid "Next run status" +msgstr "" + +#: src/Admin/AdminPage.php:754 +msgid "Displays when the job should run next or marks overdue jobs." +msgstr "" + +#: src/Admin/AdminPage.php:756 +msgid "Useful for testing jobs and forcing synchronizations." +msgstr "" + +#: src/Admin/AdminPage.php:762 +msgid "Logs" +msgstr "" + +#: src/Admin/AdminPage.php:765 +msgid "History of all job executions for diagnostics and debugging." +msgstr "" + +#: src/Admin/AdminPage.php:767 +msgid "Status filters" +msgstr "" + +#: src/Admin/AdminPage.php:767 +msgid "Buttons to show all entries, only completed, or only failed jobs." +msgstr "" + +#: src/Admin/AdminPage.php:768 +msgid "Log table" +msgstr "" + +#: src/Admin/AdminPage.php:768 +msgid "Execution time, status (completed/failed/retrying), job class, queue, error message." +msgstr "" + +#: src/Admin/AdminPage.php:769 +msgid "Clear logs" +msgstr "" + +#: src/Admin/AdminPage.php:769 +msgid "Button to delete old log entries to avoid cluttering the database." +msgstr "" + +#: src/Admin/AdminPage.php:770 +msgid "Number of entries" +msgstr "" + +#: src/Admin/AdminPage.php:770 +msgid "Displays the last 200 entries by default or all completed/failed." +msgstr "" + +#: src/Admin/AdminPage.php:772 +msgid "Check logs when encountering errors in background processes." +msgstr "" + +#: src/Admin/AdminPage.php:778 +#: src/Admin/AdminPage.php:2000 +#: src/Runtime/Runner.php:245 +msgid "WP-Cron" +msgstr "" + +#: src/Admin/AdminPage.php:781 +msgid "Management of WordPress system timers that trigger background processes." +msgstr "" + +#: src/Admin/AdminPage.php:783 +msgid "Event statistics" +msgstr "" + +#: src/Admin/AdminPage.php:783 +msgid "Total number of events, overdue, grouped by source (WordPress, WooCommerce, WP Queue, plugins)." +msgstr "" + +#: src/Admin/AdminPage.php:784 +msgid "Event table" +msgstr "" + +#: src/Admin/AdminPage.php:784 +msgid "Event hook, next run time, schedule (single/hourly/daily), source, arguments." +msgstr "" + +#: src/Admin/AdminPage.php:785 +msgid "Event actions" +msgstr "" + +#: src/Admin/AdminPage.php:785 +msgid "Run now, edit schedule, pause, delete. Modal window for changing interval." +msgstr "" + +#: src/Admin/AdminPage.php:786 +msgid "Paused events" +msgstr "" + +#: src/Admin/AdminPage.php:786 +msgid "A separate table for events that are temporarily disabled." +msgstr "" + +#: src/Admin/AdminPage.php:787 +msgid "Registered schedules" +msgstr "" + +#: src/Admin/AdminPage.php:787 +msgid "A table of all available intervals (hourly, daily, etc.) with their duration." +msgstr "" + +#: src/Admin/AdminPage.php:789 +msgid "Critical for understanding why tasks are not running on time." +msgstr "" + +#: src/Admin/AdminPage.php:798 +msgid "Checking system requirements and environment for stable queue operation." +msgstr "" + +#: src/Admin/AdminPage.php:800 +msgid "System health" +msgstr "" + +#: src/Admin/AdminPage.php:800 +msgid "Notifications of critical issues (low memory, disabled WP-Cron)." +msgstr "" + +#: src/Admin/AdminPage.php:801 +#: src/Admin/AdminPage.php:1708 +msgid "Environment" msgstr "" -#: src/Admin/AdminPage.php:1705 -msgid "" -"DISABLE_WP_CRON is set to true. Background tasks will not run automatically." +#: src/Admin/AdminPage.php:801 +msgid "PHP and WordPress versions, memory limits (current usage), maximum execution time, timezone." msgstr "" -#: src/Admin/AdminPage.php:1367 src/Admin/AdminPage.php:1704 -#: src/Admin/AdminPage.php:1717 src/Admin/AdminPage.php:1908 -msgid "Disabled" +#: src/Admin/AdminPage.php:802 +msgid "WP-Cron status" msgstr "" -#: src/Admin/AdminPage.php:667 -msgid "Dispatch" +#: src/Admin/AdminPage.php:802 +msgid "Checking for disablement (DISABLE_WP_CRON), alternative cron, loopback requests." msgstr "" -#: src/Admin/AdminPage.php:1589 -msgid "Display" +#: src/Admin/AdminPage.php:803 +#: src/Admin/AdminPage.php:1790 +#: src/Admin/AdminPage.php:2076 +msgid "Action Scheduler" msgstr "" -#: src/Admin/AdminPage.php:585 -msgid "" -"Displays a table of scheduled recurring tasks (PHP classes) registered in WP " -"Queue: job class, execution interval, queue assignment, and next run time. " -"Allows you to run any task manually." +#: src/Admin/AdminPage.php:803 +msgid "If installed, displays version and statistics (pending/running/failed actions)." msgstr "" -#: src/Admin/AdminPage.php:733 -msgid "Displays all registered PHP job classes with their configuration." +#: src/Admin/AdminPage.php:804 +msgid "Server time" msgstr "" -#: src/Admin/AdminPage.php:1644 -msgid "" -"Displays environment information (PHP and WordPress versions, memory limits, " -"execution time, timezone), WP-Cron status (disabled, alternative cron, " -"loopback checks). If Action Scheduler is installed - its statistics. Server " -"and WordPress time." +#: src/Admin/AdminPage.php:804 +msgid "Comparison of server time, WordPress, and GMT offset for diagnosing scheduling issues." msgstr "" -#: src/Admin/AdminPage.php:752 -msgid "Displays the last 200 entries by default or all completed/failed." +#: src/Admin/AdminPage.php:806 +msgid "Check this tab when setting up your server or debugging queue issues." msgstr "" -#: src/Admin/AdminPage.php:718 -msgid "" -"Displays the total number of tasks in different statuses (pending, running, " -"completed, failed)." +#: src/Admin/AdminPage.php:811 +msgid "More documentation" msgstr "" -#: src/Admin/AdminPage.php:736 -msgid "Displays when the job should run next or marks overdue jobs." +#. translators: %s: URL to GitHub repository +#: src/Admin/AdminPage.php:816 +#, php-format +msgid "Full documentation and code examples are available on GitHub: %s." msgstr "" -#: src/Admin/AdminPage.php:2119 -msgid "Distribute jobs across different queues:" +#: src/Admin/AdminPage.php:858 +#: src/Admin/AdminPage.php:1501 +msgid "All" msgstr "" -#: src/Admin/AdminPage.php:2206 -msgid "Documentation on GitHub" +#: src/Admin/AdminPage.php:869 +msgid "All queues" msgstr "" -#: src/Admin/AdminPage.php:366 -msgid "Driver:" +#: src/Admin/AdminPage.php:879 +msgid "Deletes logs older than 7 days" msgstr "" -#: src/Admin/AdminPage.php:48 -msgid "Drivers" +#: src/Admin/AdminPage.php:881 +msgid "Clear old" msgstr "" -#: src/Admin/AdminPage.php:1529 -msgid "Edit" +#: src/Admin/AdminPage.php:885 +msgid "Delete all" msgstr "" -#: src/Admin/AdminPage.php:1606 -msgid "Edit Cron Event" +#: src/Admin/AdminPage.php:893 +#: src/Admin/AdminPage.php:982 +#: src/Admin/AdminPage.php:1209 +#: src/Admin/AdminPage.php:2052 +msgid "Time" msgstr "" -#: src/Admin/AdminPage.php:1528 -msgid "Edit Schedule" +#: src/Admin/AdminPage.php:897 +msgid "Message" msgstr "" -#: src/Admin/AdminPage.php:1707 src/Admin/AdminPage.php:1715 -msgid "Enabled" +#: src/Admin/AdminPage.php:903 +msgid "No logs found" msgstr "" -#: src/Admin/AdminPage.php:783 src/Admin/AdminPage.php:1664 -msgid "Environment" +#. translators: %d: Number of log entries. +#: src/Admin/AdminPage.php:933 +#, php-format +msgid "%d entries" msgstr "" -#: src/Admin/AdminPage.php:1732 src/Admin/AdminPage.php:1927 -msgid "Error" +#: src/Admin/AdminPage.php:975 +msgid "Total errors" msgstr "" -#: src/Admin/AdminPage.php:964 +#: src/Admin/AdminPage.php:986 msgid "Error message" msgstr "" -#: src/Admin/AdminPage.php:1827 -msgid "Errors" +#: src/Admin/AdminPage.php:992 +msgid "No errors" msgstr "" -#: src/Admin/AdminPage.php:767 -msgid "Event actions" +#: src/Admin/AdminPage.php:1056 +msgid "⚠️ Warning:" msgstr "" -#: src/Admin/AdminPage.php:766 -msgid "" -"Event hook, next run time, schedule (single/hourly/daily), source, arguments." +#. translators: 1: Configured storage backend, 2: Fallback storage backend. +#: src/Admin/AdminPage.php:1059 +#, php-format +msgid "Storage backend \"%1$s\" is selected, but not available. Falling back to \"%2$s\"." msgstr "" -#: src/Admin/AdminPage.php:765 -msgid "Event statistics" +#: src/Admin/AdminPage.php:1064 +msgid "Check driver settings." msgstr "" -#: src/Admin/AdminPage.php:766 -msgid "Event table" +#: src/Admin/AdminPage.php:1070 +msgid "Current storage backend:" msgstr "" -#: src/Admin/AdminPage.php:1385 -msgid "events" +#: src/Admin/AdminPage.php:1074 +msgid "The storage backend only keeps jobs. How they are executed is chosen in System → Status → Queue runner." msgstr "" -#: src/Admin/AdminPage.php:1375 -msgid "Events by Source" +#: src/Admin/AdminPage.php:1080 +msgid "Storage backend" msgstr "" -#. %d: number of minutes -#: src/ScheduledJob.php:45 -msgid "Every %d Minutes" +#: src/Admin/AdminPage.php:1082 +msgid "Description" msgstr "" -#: src/Admin/AdminPage.php:2218 -msgid "Example Plugin on GitHub" +#: src/Admin/AdminPage.php:1101 +msgid "Install: pecl install redis, or the Redis Object Cache plugin (Predis)." msgstr "" -#: src/Admin/AdminPage.php:750 -msgid "" -"Execution time, status (completed/failed/retrying), job class, queue, error " -"message." +#: src/Admin/AdminPage.php:1103 +msgid "Install: pecl install memcached" msgstr "" -#: src/Admin/AdminPage.php:47 src/Admin/AdminPage.php:330 -#: src/Admin/AdminPage.php:359 src/Admin/AdminPage.php:846 -msgid "Failed" +#: src/Admin/AdminPage.php:1113 +msgid "Set in wp-config.php" msgstr "" -#: src/Admin/AdminPage.php:1763 -msgid "Failed Actions" +#: src/Admin/AdminPage.php:1115 +#: src/Admin/AdminPage.php:1122 +msgid "Make active" msgstr "" -#: src/Admin/RestApi.php:523 -msgid "Failed to pause event" +#: src/Admin/AdminPage.php:1118 +msgid "Switch the storage backend? Waiting jobs will be moved to it." msgstr "" -#: src/Admin/RestApi.php:537 -msgid "Failed to resume event" +#: src/Admin/AdminPage.php:1133 +msgid "How switching works" msgstr "" -#: src/Admin/RestApi.php:554 -msgid "Failed to update event" +#: src/Admin/AdminPage.php:1135 +msgid "Waiting jobs (ready and delayed) are moved to the new backend under the global worker lock, so nothing is lost or run twice." msgstr "" -#: src/Admin/AdminPage.php:119 src/Admin/AdminPage.php:135 -msgid "For developers" +#: src/Admin/AdminPage.php:1136 +msgid "Switching is refused while a worker is running or jobs are being executed; try again in a minute." msgstr "" -#: src/Admin/AdminPage.php:167 -msgid "For more information:" +#: src/Admin/AdminPage.php:1137 +msgid "Jobs that other requests add to the previous backend during the switch are moved by the worker within a day." msgstr "" -#: src/Admin/AdminPage.php:1120 -msgid "" -"For Redis/Memcached to work, you need the PHP extension installed and a " -"server available. If not, the system will automatically use the \"database\" " -"driver." +#: src/Admin/AdminPage.php:1138 +msgid "If WP_QUEUE_DRIVER is defined in wp-config.php, it has priority. Inside the \"// BEGIN WP Queue\" block it is edited by the plugin (atomically, with a backup and verification); anywhere else it locks this choice." msgstr "" -#: src/Admin/AdminPage.php:126 -msgid "For site administrators" +#: src/Admin/AdminPage.php:1140 +msgid "Redis connection" msgstr "" -#: src/Admin/AdminPage.php:2030 -msgid "Forces processing of all queues" +#: src/Admin/AdminPage.php:1141 +msgid "Uses the Redis Object Cache constants (WP_REDIS_HOST, WP_REDIS_PORT, WP_REDIS_PASSWORD, WP_REDIS_DATABASE, WP_REDIS_PREFIX). Jobs are claimed with an atomic Lua script, so every job goes to exactly one worker." msgstr "" -#: src/Admin/AdminPage.php:507 src/Admin/AdminPage.php:618 -msgid "from now" +#: src/Admin/AdminPage.php:1150 +msgid "Works everywhere. Atomic claim with a conditional UPDATE." msgstr "" -#. %s: URL to GitHub repository -#: src/Admin/AdminPage.php:798 -#, php-format -msgid "Full documentation and code examples are available on GitHub: %s." +#: src/Admin/AdminPage.php:1151 +msgid "Fast, keeps the database small. Needs a Redis server." msgstr "" -#: src/Admin/AdminPage.php:168 -msgid "GitHub Repository" +#: src/Admin/AdminPage.php:1152 +msgid "Not recommended: jobs cannot be listed or moved and may be evicted." msgstr "" -#: src/Admin/AdminPage.php:1791 -msgid "GMT Offset" +#. translators: %s: constant name +#: src/Admin/AdminPage.php:1165 +#, php-format +msgid "set in wp-config.php (%s)" msgstr "" -#: src/Admin/AdminPage.php:60 -msgid "Help" +#: src/Admin/AdminPage.php:1168 +msgid "set in the WP Queue block of wp-config.php (editable here)" msgstr "" -#: src/Admin/AdminPage.php:46 -msgid "History" +#: src/Admin/AdminPage.php:1169 +msgid "selected in the admin" msgstr "" -#: src/Admin/AdminPage.php:747 -msgid "History of all job executions for diagnostics and debugging." +#: src/Admin/AdminPage.php:1170 +msgid "default" msgstr "" -#: src/Admin/AdminPage.php:1405 src/Admin/AdminPage.php:1482 -#: src/Admin/AdminPage.php:1558 src/Admin/AdminPage.php:2252 -msgid "Hook" +#: src/Admin/AdminPage.php:1185 +msgid "Ready" msgstr "" -#: src/Admin/AdminPage.php:665 -msgid "How Queues Work" +#: src/Admin/AdminPage.php:1189 +msgid "No extension" msgstr "" -#: src/Admin/AdminPage.php:1102 -msgid "How to change the storage backend?" +#: src/Admin/AdminPage.php:1193 +msgid "No server" msgstr "" -#: src/Admin/AdminPage.php:2289 -msgid "How to run WP Queue as a long-running background process." +#: src/Admin/AdminPage.php:1197 +#: src/Admin/AdminPage.php:1952 +msgid "Unavailable" msgstr "" -#. URI of the plugin -msgid "https://github.com/rwsite/wp-queue" +#: src/Admin/AdminPage.php:1217 +msgid "No activity" msgstr "" -#. Author URI of the plugin -msgid "https://rwsite.ru" +#: src/Admin/AdminPage.php:1385 +msgid "Total Events" msgstr "" -#: src/Admin/AdminPage.php:479 -msgid "ID" +#: src/Admin/AdminPage.php:1393 +#: src/Admin/AdminPage.php:1488 +#: src/Admin/AdminPage.php:1544 +#: src/Admin/CronMonitor.php:224 +msgid "Overdue" msgstr "" -#: src/Admin/AdminPage.php:325 -msgid "Idle" +#: src/Admin/AdminPage.php:1404 +msgid "WP-Cron:" msgstr "" -#: src/Admin/AdminPage.php:785 -msgid "" -"If installed, displays version and statistics (pending/running/failed " -"actions)." +#: src/Admin/AdminPage.php:1406 +#: src/Admin/AdminPage.php:1748 +#: src/Admin/AdminPage.php:1761 +msgid "Disabled" msgstr "" -#: src/Admin/AdminPage.php:2369 -msgid "" -"If the worker is not running, queues will not be processed in daemon mode. " -"Make sure the process is started and monitored." +#: src/Admin/AdminPage.php:1407 +msgid "Use system cron" msgstr "" -#: src/Admin/AdminPage.php:2309 -msgid "" -"If WP-CLI is not available, create a PHP script that boots WordPress and " -"runs the worker loop:" +#: src/Admin/AdminPage.php:1414 +msgid "Events by Source" msgstr "" -#: src/Admin/AdminPage.php:134 -msgid "" -"If you installed WP Queue because another plugin requires it, you usually do " -"not need to configure anything here. Use these tabs mainly for monitoring " -"and troubleshooting." +#: src/Admin/AdminPage.php:1424 +msgid "events" msgstr "" -#: src/Admin/AdminPage.php:1119 -msgid "Important:" +#: src/Admin/AdminPage.php:1435 +msgid "Upcoming Events" msgstr "" -#: src/Admin/AdminPage.php:347 -msgid "In Queue" +#: src/Admin/AdminPage.php:1439 +msgid "No scheduled events" msgstr "" -#: src/Admin/AdminPage.php:2299 -msgid "" -"In this mode WP-Cron scheduling and loopback requests are disabled " -"automatically." +#: src/Admin/AdminPage.php:1444 +#: src/Admin/AdminPage.php:1521 +#: src/Admin/AdminPage.php:1597 +#: src/Admin/AdminPage.php:2344 +msgid "Hook" msgstr "" -#: src/Admin/AdminPage.php:116 -msgid "Inspect and manage WP-Cron events for WP Queue and other plugins." +#: src/Admin/AdminPage.php:1446 +#: src/Admin/AdminPage.php:1524 +msgid "Source" msgstr "" -#: src/Admin/AdminPage.php:1084 -msgid "Install: pecl install memcached" +#: src/Admin/AdminPage.php:1484 +msgid "Total" msgstr "" -#: src/Admin/AdminPage.php:1082 -msgid "Install: pecl install redis" +#: src/Admin/AdminPage.php:1504 +#: src/Admin/AdminPage.php:1897 +msgid "WordPress" msgstr "" -#: src/Admin/AdminPage.php:1588 -msgid "Interval" +#: src/Admin/AdminPage.php:1507 +msgid "WooCommerce" msgstr "" -#: src/Admin/AdminPage.php:593 src/Admin/AdminPage.php:877 -#: src/Admin/AdminPage.php:961 src/Admin/AdminPage.php:1165 -msgid "Job" +#: src/Admin/AdminPage.php:1513 +msgid "Plugins" msgstr "" -#: src/Admin/AdminPage.php:480 -msgid "Job Class" +#: src/Admin/AdminPage.php:1531 +msgid "No cron events found." msgstr "" -#: src/Admin/AdminPage.php:734 -msgid "" -"Job class, execution interval (e.g., \"hourly\", \"daily\"), queue " -"assignment, next run time." +#: src/Admin/AdminPage.php:1549 +#: src/Admin/AdminPage.php:1607 +msgid "Single" msgstr "" -#: src/Admin/AdminPage.php:567 -msgid "Job Details" +#: src/Admin/AdminPage.php:1567 +msgid "Edit Schedule" msgstr "" -#: src/Admin/AdminPage.php:734 -msgid "Job information" +#: src/Admin/AdminPage.php:1568 +msgid "Edit" msgstr "" -#: src/Admin/AdminPage.php:733 -msgid "Job list" +#: src/Admin/AdminPage.php:1593 +msgid "Paused Events" msgstr "" -#: src/Admin/AdminPage.php:387 -msgid "jobs" +#: src/Admin/AdminPage.php:1599 +msgid "Paused At" msgstr "" -#: src/Admin/AdminPage.php:45 -msgid "Jobs in Queue" +#: src/Admin/AdminPage.php:1622 +msgid "Registered Schedules" msgstr "" -#: src/Admin/AdminPage.php:750 -msgid "Log table" +#: src/Admin/AdminPage.php:1626 +msgid "Name" msgstr "" -#: src/Admin/AdminPage.php:744 -msgid "Logs" +#: src/Admin/AdminPage.php:1627 +msgid "Interval" msgstr "" -#: src/Admin/AdminPage.php:130 -msgid "" -"Logs – history of completed and failed jobs that helps to diagnose problems." +#: src/Admin/AdminPage.php:1628 +msgid "Display" msgstr "" -#: src/Admin/AdminPage.php:1916 -msgid "Loopback" +#: src/Admin/AdminPage.php:1645 +msgid "Edit Cron Event" msgstr "" -#: src/Admin/AdminPage.php:1879 -msgid "" -"Loopback is disabled. Jobs will be processed only by WP-Cron, which can " -"delay execution by up to one minute. Run a daemon worker for instant " -"processing." +#: src/Admin/AdminPage.php:1654 +msgid "Single (run once)" msgstr "" -#: src/Admin/AdminPage.php:1871 -msgid "Loopback is enabled and working. Jobs start immediately after dispatch." +#: src/Admin/AdminPage.php:1664 +msgid "Save Changes" msgstr "" -#: src/Admin/AdminPage.php:1875 -msgid "" -"Loopback is inactive. Jobs will be processed only by WP-Cron, which can " -"delay execution by up to one minute. Enable loopback or run a daemon worker " -"for instant processing." +#: src/Admin/AdminPage.php:1665 +msgid "Cancel" msgstr "" -#. %s: loopback error message -#: src/Admin/SystemStatus.php:271 -#, php-format -msgid "Loopback issue: %s" +#: src/Admin/AdminPage.php:1688 +msgid "Displays environment information (PHP and WordPress versions, memory limits, execution time, timezone), WP-Cron status (disabled, alternative cron, loopback checks). If Action Scheduler is installed - its statistics. Server and WordPress time." msgstr "" -#: src/Admin/AdminPage.php:1722 -msgid "Loopback Request" +#: src/Admin/AdminPage.php:1695 +msgid "System Issues Detected:" msgstr "" -#: src/Admin/SystemStatus.php:148 -msgid "Loopback request successful" +#: src/Admin/AdminPage.php:1704 +msgid "All systems are healthy." msgstr "" -#: src/Admin/AdminPage.php:2181 -msgid "Manage queues from command line:" +#: src/Admin/AdminPage.php:1712 +msgid "PHP Version" msgstr "" -#: src/Admin/AdminPage.php:731 -msgid "Management of scheduled recurring tasks." +#: src/Admin/AdminPage.php:1716 +msgid "WordPress Version" msgstr "" -#: src/Admin/AdminPage.php:763 -msgid "" -"Management of WordPress system timers that trigger background processes." +#: src/Admin/AdminPage.php:1720 +#: src/Admin/AdminPage.php:1880 +#: src/Admin/AdminPage.php:2037 +msgid "Memory Limit" msgstr "" -#: src/Admin/AdminPage.php:735 -msgid "Manual run" +#: src/Admin/AdminPage.php:1724 +msgid "Current Memory Usage" msgstr "" -#: src/Admin/AdminPage.php:1687 src/Admin/AdminPage.php:1953 +#: src/Admin/AdminPage.php:1731 +#: src/Admin/AdminPage.php:2045 msgid "Max Execution Time" msgstr "" -#: src/Admin/AdminPage.php:1676 src/Admin/AdminPage.php:1831 -#: src/Admin/AdminPage.php:1945 -msgid "Memory Limit" +#: src/Admin/AdminPage.php:1735 +#: src/Admin/AdminPage.php:2064 +msgid "Timezone" msgstr "" -#: src/Admin/SystemStatus.php:275 -msgid "Memory usage is above 80%." +#: src/Admin/AdminPage.php:1741 +msgid "WP-Cron Status" msgstr "" -#: src/Admin/AdminPage.php:879 -msgid "Message" +#: src/Admin/AdminPage.php:1745 +msgid "WP-Cron Disabled" msgstr "" -#: src/Admin/AdminPage.php:114 -msgid "Monitor which background jobs are queued and running right now." +#: src/Admin/AdminPage.php:1749 +msgid "DISABLE_WP_CRON is set to true. Background tasks will not run automatically." msgstr "" -#: src/Admin/AdminPage.php:793 -msgid "More documentation" +#: src/Admin/AdminPage.php:1751 +#: src/Admin/AdminPage.php:1759 +msgid "Enabled" msgstr "" -#: src/Admin/AdminPage.php:1587 -msgid "Name" +#: src/Admin/AdminPage.php:1756 +msgid "Alternate Cron" msgstr "" -#: src/Admin/AdminPage.php:2118 -msgid "Named Queues" +#: src/Admin/AdminPage.php:1766 +msgid "Loopback Request" msgstr "" -#: src/Admin/AdminPage.php:596 src/Admin/AdminPage.php:1406 -#: src/Admin/AdminPage.php:1483 -msgid "Next Run" +#: src/Admin/AdminPage.php:1772 +msgid "OK" msgstr "" -#: src/Admin/AdminPage.php:736 -msgid "Next run status" +#: src/Admin/AdminPage.php:1774 +msgid "Warning" msgstr "" -#: src/Admin/AdminPage.php:1171 -msgid "No activity" +#: src/Admin/AdminPage.php:1776 +msgid "Error" msgstr "" -#: src/Admin/AdminPage.php:1492 -msgid "No cron events found." +#: src/Admin/AdminPage.php:1794 +#: src/Admin/AdminPage.php:2080 +msgid "Version" msgstr "" -#: src/Admin/AdminPage.php:970 -msgid "No errors" +#: src/Admin/AdminPage.php:1799 +msgid "Pending Actions" msgstr "" -#: src/Admin/AdminPage.php:1143 -msgid "No extension" +#: src/Admin/AdminPage.php:1803 +msgid "Running Actions" msgstr "" -#: src/Admin/AdminPage.php:885 -msgid "No logs found" +#: src/Admin/AdminPage.php:1807 +msgid "Failed Actions" msgstr "" -#: src/Admin/AdminPage.php:2246 -msgid "No paused events" +#: src/Admin/AdminPage.php:1823 +#: src/Admin/AdminPage.php:1827 +#: src/Admin/AdminPage.php:2056 +msgid "Server Time" msgstr "" -#: src/Admin/AdminPage.php:1400 -msgid "No scheduled events" +#: src/Admin/AdminPage.php:1831 +#: src/Admin/AdminPage.php:2060 +msgid "WordPress Time" msgstr "" -#: src/Admin/AdminPage.php:603 -msgid "No scheduled jobs found." +#: src/Admin/AdminPage.php:1835 +msgid "GMT Offset" msgstr "" -#: src/Admin/AdminPage.php:1147 -msgid "No server" +#: src/Admin/AdminPage.php:1876 +msgid "Errors" msgstr "" -#: src/Admin/AdminPage.php:782 -msgid "Notifications of critical issues (low memory, disabled WP-Cron)." +#: src/Admin/AdminPage.php:1884 +msgid "Timeout" msgstr "" -#: src/Admin/AdminPage.php:509 -msgid "Now" +#: src/Admin/AdminPage.php:1889 +msgid "Versions" msgstr "" -#: src/Admin/AdminPage.php:752 -msgid "Number of entries" +#: src/Admin/AdminPage.php:1901 +#: src/Admin/AdminPage.php:2033 +msgid "PHP" msgstr "" -#: src/Admin/AdminPage.php:1728 src/Admin/AdminPage.php:1925 -msgid "OK" +#: src/Admin/AdminPage.php:1918 +msgid "Component Status" msgstr "" -#: src/Admin/AdminPage.php:2262 -msgid "One-time" +#: src/Admin/AdminPage.php:1923 +msgid "Queue Storage backend" msgstr "" -#: src/Admin/AdminPage.php:2331 -msgid "Option A: systemd service" +#: src/Admin/AdminPage.php:1926 +msgid "Change" msgstr "" -#: src/Admin/AdminPage.php:2348 -msgid "Option B: Supervisor" +#: src/Admin/AdminPage.php:1930 +msgid "Queue runner" msgstr "" -#: src/Admin/AdminPage.php:2358 -msgid "Option C: Docker Compose" +#: src/Admin/AdminPage.php:1935 +msgid "(auto)" msgstr "" -#: src/Admin/AdminPage.php:2364 -msgid "Option D: plain PHP script" +#: src/Admin/AdminPage.php:1962 +msgid "Crontab line (as the web server user):" msgstr "" -#: src/Admin/AdminPage.php:1354 src/Admin/AdminPage.php:1449 -#: src/Admin/AdminPage.php:1505 src/Admin/CronMonitor.php:220 -msgid "Overdue" +#: src/Admin/AdminPage.php:1965 +msgid "Last run of the worker (heartbeat):" msgstr "" -#: src/Admin/AdminPage.php:44 src/Admin/AdminPage.php:51 -#: src/Admin/AdminPage.php:253 -msgid "Overview" +#: src/Admin/AdminPage.php:1969 +msgid "never" msgstr "" -#: src/Admin/AdminPage.php:445 src/Admin/AdminPage.php:1535 -#: src/Admin/AdminPage.php:1536 -msgid "Pause" +#. translators: 1: time ago, 2: jobs +#: src/Admin/AdminPage.php:1972 +#, php-format +msgid "%1$s ago, jobs: %2$d" msgstr "" -#: src/Admin/AdminPage.php:200 -msgid "Pause this queue?" +#: src/Admin/AdminPage.php:1975 +msgid "skipped: another runner is selected or a worker was busy" msgstr "" -#: src/Admin/AdminPage.php:54 src/Admin/AdminPage.php:328 -#: src/Admin/AdminPage.php:427 src/Admin/AdminPage.php:1358 -msgid "Paused" +#. translators: %s: constant +#: src/Admin/AdminPage.php:1986 +#, php-format +msgid "Set in wp-config.php (%s). Remove the constant to choose here." msgstr "" -#: src/Admin/AdminPage.php:1560 -msgid "Paused At" +#: src/Admin/AdminPage.php:1992 +msgid "Save runner" msgstr "" -#: src/Admin/AdminPage.php:1554 -msgid "Paused Events" +#: src/Admin/AdminPage.php:2003 +#: src/Admin/AdminPage.php:2016 +msgid "Used by the runner" msgstr "" -#: src/Admin/AdminPage.php:768 -msgid "Paused events" +#: src/Admin/AdminPage.php:2003 +#: src/Admin/AdminPage.php:2016 +msgid "Not used by the runner" +msgstr "" + +#: src/Admin/AdminPage.php:2007 +msgid "WordPress WP-Cron is disabled (DISABLE_WP_CRON)." +msgstr "" + +#: src/Admin/AdminPage.php:2008 +msgid "WordPress WP-Cron is enabled." msgstr "" -#: src/Admin/AdminPage.php:2254 -msgid "Paused Since" +#: src/Admin/AdminPage.php:2013 +msgid "Loopback" msgstr "" -#: src/Admin/AdminPage.php:326 src/Admin/AdminPage.php:467 -#: src/Admin/AdminPage.php:1993 -msgid "Pending" +#: src/Admin/AdminPage.php:2020 +msgid "check OK" msgstr "" -#: src/Admin/AdminPage.php:1755 -msgid "Pending Actions" +#: src/Admin/AdminPage.php:2021 +msgid "check: warning" msgstr "" -#: src/Admin/AdminPage.php:1852 src/Admin/AdminPage.php:1941 -msgid "PHP" +#: src/Admin/AdminPage.php:2022 +msgid "check failed" msgstr "" -#: src/Admin/AdminPage.php:783 -msgid "" -"PHP and WordPress versions, memory limits (current usage), maximum execution " -"time, timezone." +#: src/Admin/AdminPage.php:2023 +msgid "not checked" msgstr "" -#: src/QueueManager.php:470 -msgid "PHP extension \"memcached\" is not installed" +#: src/Admin/AdminPage.php:2041 +msgid "Used" msgstr "" -#: src/QueueManager.php:267 -msgid "PHP extension \"redis\" (phpredis) is not installed" +#: src/Admin/AdminPage.php:2115 +msgid "Clear Logs" msgstr "" -#: src/Admin/SystemStatus.php:279 -msgid "PHP max_execution_time is less than 30 seconds." +#: src/Admin/AdminPage.php:2116 +msgid "Deletes all job execution logs" msgstr "" -#: src/Admin/AdminPage.php:1668 -msgid "PHP Version" +#: src/Admin/AdminPage.php:2117 +msgid "Clear All Logs" msgstr "" -#: src/Admin/AdminPage.php:1474 -msgid "Plugins" +#: src/Admin/AdminPage.php:2121 +msgid "Process Queues" msgstr "" -#: src/QueueManager.php:416 -msgid "Predis library is not available" +#: src/Admin/AdminPage.php:2122 +msgid "Forces processing of all queues" msgstr "" -#: src/Admin/AdminPage.php:670 -msgid "Process" +#: src/Admin/AdminPage.php:2127 +msgid "Clear All Queues" msgstr "" -#: src/Admin/AdminPage.php:450 src/Admin/AdminPage.php:2031 -msgid "Process Now" +#: src/Admin/AdminPage.php:2128 +msgid "Deletes all jobs from all queues" msgstr "" -#: src/Admin/AdminPage.php:2029 -msgid "Process Queues" +#: src/Admin/AdminPage.php:2129 +msgid "Clear All" msgstr "" -#: src/Admin/AdminPage.php:429 src/Admin/AdminPage.php:471 -msgid "Processing" +#: src/Admin/AdminPage.php:2159 +msgid "WP Queue — Queue System for WordPress" msgstr "" -#: src/Admin/AdminPage.php:595 src/Admin/AdminPage.php:878 -#: src/Admin/AdminPage.php:962 -msgid "Queue" +#: src/Admin/AdminPage.php:2161 +msgid "WP Queue allows executing tasks asynchronously in the background without blocking the main WordPress execution flow." msgstr "" -#: src/Admin/AdminPage.php:1895 -msgid "Queue handler" +#: src/Admin/AdminPage.php:2171 +msgid "Quick Start" msgstr "" -#: src/Admin/AdminPage.php:490 -msgid "Queue is empty" +#: src/Admin/AdminPage.php:2172 +msgid "Create a job class and dispatch it to the queue:" msgstr "" -#: src/Admin/AdminPage.php:718 -msgid "Queue statistics" +#: src/Admin/AdminPage.php:2190 +msgid "Delayed Jobs" msgstr "" -#: src/Admin/AdminPage.php:1889 -msgid "Queue Storage backend" +#: src/Admin/AdminPage.php:2191 +msgid "Schedule a job to run after a specific time:" msgstr "" -#: src/Admin/AdminPage.php:719 -msgid "Queue table" +#: src/Admin/AdminPage.php:2210 +msgid "Named Queues" msgstr "" -#: src/Admin/AdminPage.php:423 -#, php-format -msgid "Queue: %s" +#: src/Admin/AdminPage.php:2211 +msgid "Distribute jobs across different queues:" msgstr "" -#: src/Admin/AdminPage.php:37 src/Admin/AdminPage.php:374 -msgid "Queues" +#: src/Admin/AdminPage.php:2228 +msgid "Retry Attempts" msgstr "" -#: src/Admin/AdminPage.php:2079 -msgid "Quick Start" +#: src/Admin/AdminPage.php:2229 +msgid "Configure automatic retries on errors:" msgstr "" -#: src/Admin/AdminPage.php:115 -msgid "Quickly see if any jobs are failing and view recent log entries." +#: src/Admin/AdminPage.php:2250 +msgid "Run tasks on schedule:" msgstr "" -#: src/Admin/AdminPage.php:1139 -msgid "Ready" +#: src/Admin/AdminPage.php:2272 +msgid "WP-CLI команды" msgstr "" -#: src/Admin/AdminPage.php:398 -msgid "Recent Activity" +#: src/Admin/AdminPage.php:2273 +msgid "Manage queues from command line:" msgstr "" -#: src/Admin/AdminPage.php:720 -msgid "Recent activity" +#: src/Admin/AdminPage.php:2293 +msgid "Useful Links" msgstr "" -#: src/QueueManager.php:358 -msgid "Redis connection failed" +#: src/Admin/AdminPage.php:2298 +msgid "Documentation on GitHub" msgstr "" -#: src/QueueManager.php:243 -msgid "Redis is disabled via WP_REDIS_DISABLED" +#: src/Admin/AdminPage.php:2304 +msgid "Report an Issue" msgstr "" -#: src/Admin/AdminPage.php:699 -msgid "Redis Support" +#: src/Admin/AdminPage.php:2310 +msgid "Example Plugin on GitHub" msgstr "" -#: src/Admin/AdminPage.php:1583 -msgid "Registered Schedules" +#: src/Admin/AdminPage.php:2338 +msgid "No paused events" msgstr "" -#: src/Admin/AdminPage.php:769 -msgid "Registered schedules" +#: src/Admin/AdminPage.php:2346 +msgid "Paused Since" msgstr "" -#: src/Admin/AdminPage.php:2212 -msgid "Report an Issue" +#: src/Admin/AdminPage.php:2354 +msgid "One-time" msgstr "" -#: src/Admin/AdminPage.php:169 -msgid "Report Issues" +#: src/Admin/AdminPage.php:2381 +msgid "How to run WP Queue as a long-running background process." msgstr "" -#: src/Admin/AdminPage.php:440 src/Admin/AdminPage.php:1574 -#: src/Admin/AdminPage.php:2268 -msgid "Resume" +#: src/Admin/AdminPage.php:2385 +msgid "When to use a daemon" msgstr "" -#: src/Admin/AdminPage.php:2136 -msgid "Retry Attempts" +#: src/Admin/AdminPage.php:2386 +msgid "Use a daemon worker on VPS, Docker or dedicated servers where you can keep a process running. It polls the queue continuously and starts jobs immediately. Without a daemon, WP Queue relies on WP-Cron and/or loopback, which can delay jobs by up to a minute." msgstr "" -#: src/Admin/AdminPage.php:146 src/Admin/AdminPage.php:1521 -msgid "Run" +#: src/Admin/AdminPage.php:2388 +msgid "1. Select the daemon runner" msgstr "" -#: src/Admin/AdminPage.php:625 src/Admin/AdminPage.php:1520 -msgid "Run Now" +#: src/Admin/AdminPage.php:2389 +msgid "In System → Status → Queue runner choose \"Daemon / system cron\" (or keep \"Auto\": a running worker is detected by its heartbeat). The same can be forced in wp-config.php:" msgstr "" -#: src/Admin/AdminPage.php:767 -msgid "" -"Run now, edit schedule, pause, delete. Modal window for changing interval." +#: src/Admin/AdminPage.php:2391 +msgid "With this runner WP-Cron scheduling and loopback requests are not used." msgstr "" -#: src/Admin/AdminPage.php:2158 -msgid "Run tasks on schedule:" +#: src/Admin/AdminPage.php:2392 +msgid "Simplest option — system cron every minute:" msgstr "" -#: src/Admin/AdminPage.php:327 src/Admin/AdminPage.php:351 -msgid "Running" +#: src/Admin/AdminPage.php:2395 +msgid "2. Run the worker" msgstr "" -#: src/Admin/AdminPage.php:1759 -msgid "Running Actions" +#: src/Admin/AdminPage.php:2397 +msgid "With WP-CLI" msgstr "" -#: src/Admin/AdminPage.php:2346 -msgid "" -"Save as /etc/systemd/system/wp-queue-worker.service, then run systemctl " -"enable --now wp-queue-worker." +#: src/Admin/AdminPage.php:2398 +msgid "Start the worker from the WordPress root:" msgstr "" -#: src/Admin/AdminPage.php:1625 -msgid "Save Changes" +#: src/Admin/AdminPage.php:2400 +msgid "--memory limits the PHP memory for the worker process. Adjust the value to your needs." msgstr "" -#: src/Admin/AdminPage.php:2324 -msgid "Save the script, make it executable and run it in the background:" +#: src/Admin/AdminPage.php:2402 +msgid "Without WP-CLI" msgstr "" -#: src/Admin/AdminPage.php:594 src/Admin/AdminPage.php:1484 -#: src/Admin/AdminPage.php:1559 src/Admin/AdminPage.php:1613 -#: src/Admin/AdminPage.php:2253 -msgid "Schedule" +#: src/Admin/AdminPage.php:2403 +msgid "If WP-CLI is not available, create a PHP script that boots WordPress and runs the worker loop:" msgstr "" -#: src/Admin/AdminPage.php:2099 -msgid "Schedule a job to run after a specific time:" +#: src/Admin/AdminPage.php:2418 +msgid "Save the script, make it executable and run it in the background:" msgstr "" -#: src/Admin/AdminPage.php:53 src/Admin/AdminPage.php:1350 -msgid "Scheduled" +#: src/Admin/AdminPage.php:2422 +msgid "3. Keep it running" msgstr "" -#: src/Admin/AdminPage.php:728 -msgid "Scheduled Jobs" +#: src/Admin/AdminPage.php:2423 +msgid "The command above must stay alive. In production use one of the options below." msgstr "" -#: src/Admin/AdminPage.php:129 -msgid "" -"Scheduled Jobs – list of recurring background jobs added by your theme or " -"plugins." +#: src/Admin/AdminPage.php:2425 +msgid "Option A: systemd service" msgstr "" -#: src/Admin/AdminPage.php:38 src/Admin/AdminPage.php:2157 -msgid "Scheduler" +#: src/Admin/AdminPage.php:2440 +msgid "Save as /etc/systemd/system/wp-queue-worker.service, then run systemctl enable --now wp-queue-worker." msgstr "" -#: src/Admin/AdminPage.php:1779 src/Admin/AdminPage.php:1783 -#: src/Admin/AdminPage.php:1964 -msgid "Server Time" +#: src/Admin/AdminPage.php:2442 +msgid "Option B: Supervisor" msgstr "" -#: src/Admin/AdminPage.php:786 -msgid "Server time" +#: src/Admin/AdminPage.php:2452 +msgid "Option C: Docker Compose" msgstr "" -#: src/Admin/AdminPage.php:1510 src/Admin/AdminPage.php:1568 -msgid "Single" +#: src/Admin/AdminPage.php:2458 +msgid "Option D: plain PHP script" msgstr "" -#: src/Admin/AdminPage.php:1615 -msgid "Single (run once)" +#: src/Admin/AdminPage.php:2459 +msgid "Use the script from step 2 (Without WP-CLI) inside screen, tmux or a simple cron-based restart loop. Remember that the script must stay alive to act as a daemon." msgstr "" -#: src/Admin/AdminPage.php:1407 src/Admin/AdminPage.php:1485 -msgid "Source" +#: src/Admin/AdminPage.php:2461 +msgid "4. Check status" msgstr "" -#: src/Admin/AdminPage.php:2304 -msgid "Start the worker from the WordPress root:" +#: src/Admin/AdminPage.php:2463 +msgid "If the worker is not running, queues will not be processed in daemon mode. Make sure the process is started and monitored." msgstr "" -#: src/Admin/AdminPage.php:483 src/Admin/AdminPage.php:876 -#: src/Admin/AdminPage.php:1056 src/Admin/AdminPage.php:1164 -msgid "Status" +#: src/Admin/RestApi.php:488 +msgid "Cron event paused" msgstr "" -#: src/Admin/AdminPage.php:749 -msgid "Status filters" +#: src/Admin/RestApi.php:488 +msgid "Failed to pause event" msgstr "" -#: src/Admin/AdminPage.php:668 -msgid "Storage" +#: src/Admin/RestApi.php:502 +msgid "Cron event resumed" msgstr "" -#: src/Admin/AdminPage.php:1055 -msgid "Storage backend" +#: src/Admin/RestApi.php:502 +msgid "Failed to resume event" msgstr "" -#: src/Admin/AdminPage.php:1034 -#, php-format -msgid "" -"Storage backend \"%s\" is configured in wp-config.php, but not available. " -"Falling back to \"%s\"." +#: src/Admin/RestApi.php:519 +msgid "Cron event updated" msgstr "" -#: src/QueueManager.php:198 -msgid "Synchronous execution (no queue)" +#: src/Admin/RestApi.php:519 +msgid "Failed to update event" msgstr "" -#: src/Admin/AdminPage.php:39 src/Admin/AdminPage.php:777 -msgid "System" +#: src/Admin/SettingsController.php:50 +#: src/Runtime/Runner.php:194 +msgid "Unknown runner." msgstr "" -#: src/Admin/AdminPage.php:689 -msgid "System Cron (Recommended)" +#: src/Admin/SettingsController.php:70 +msgid "No fresh heartbeat from the daemon / system cron yet: add the crontab line shown below, otherwise jobs will not run." msgstr "" -#: src/Admin/AdminPage.php:782 -msgid "System health" +#: src/Admin/SettingsController.php:159 +msgid "Store in wp-config.php (WP Queue block; edited atomically with a backup and a check)" msgstr "" -#: src/Admin/AdminPage.php:1651 -msgid "System Issues Detected:" +#: src/Admin/SettingsController.php:167 +msgid "You are not allowed to change WP Queue settings." msgstr "" -#: src/Admin/AdminPage.php:57 -msgid "System Status" +#: src/Admin/SystemStatus.php:151 +msgid "admin-ajax.php answered, but not with the WP Queue ping response" msgstr "" -#: src/Admin/AdminPage.php:132 -msgid "" -"System – checks PHP version, WP-Cron status and other important settings." +#. translators: %d: HTTP response code +#: src/Admin/SystemStatus.php:159 +#, php-format +msgid "Unexpected response code: %d" msgstr "" -#: src/Admin/AdminPage.php:735 -msgid "" -"The \"Run Now\" button allows you to run any job immediately, without " -"waiting for the schedule." +#: src/Admin/SystemStatus.php:165 +msgid "Loopback request successful" msgstr "" -#: src/Admin/AdminPage.php:2329 -msgid "" -"The command above must stay alive. In production use one of the options " -"below." +#: src/Admin/SystemStatus.php:282 +msgid "WP-Cron is disabled. Background tasks may not run automatically." msgstr "" -#: src/Admin/AdminPage.php:668 -msgid "The job is saved in the database (or Redis) waiting to be picked up." +#. translators: %s: loopback error message +#: src/Admin/SystemStatus.php:288 +#, php-format +msgid "Loopback issue: %s" msgstr "" -#: src/Admin/AdminPage.php:720 -msgid "The last 10 log entries for quick tracking of queue activity." +#: src/Admin/SystemStatus.php:292 +msgid "Memory usage is above 80%." msgstr "" -#: src/Admin/AdminPage.php:716 -msgid "The main tab for monitoring queue status in real-time." +#: src/Admin/SystemStatus.php:296 +msgid "PHP max_execution_time is less than 30 seconds." msgstr "" -#: src/Admin/AdminPage.php:111 -msgid "" -"The plugin itself does not add new features to the frontend. It provides a " -"reliable queue that other plugins or your custom code can use for background " -"work." +#. translators: %s: database table name +#: src/QueueManager.php:225 +#, php-format +msgid "Jobs are stored in the %s table" msgstr "" -#: src/Admin/AdminPage.php:670 -msgid "" -"The worker picks up the job and executes it. If it succeeds, it is marked as " -"\"Completed\". If it fails, it can be retried." +#: src/QueueManager.php:226 +msgid "Synchronous execution (no queue)" msgstr "" -#: src/Admin/AdminPage.php:317 -msgid "This section is under development." +#: src/QueueManager.php:235 +#: src/QueueManager.php:570 +#: src/QueueManager.php:572 +msgid "Custom driver" msgstr "" -#: src/Admin/AdminPage.php:875 src/Admin/AdminPage.php:960 -#: src/Admin/AdminPage.php:1163 src/Admin/AdminPage.php:1960 -msgid "Time" +#: src/QueueManager.php:241 +msgid "Unknown driver" msgstr "" -#: src/Admin/AdminPage.php:1835 -msgid "Timeout" +#: src/QueueManager.php:271 +msgid "Redis is disabled via WP_REDIS_DISABLED" msgstr "" -#: src/Admin/AdminPage.php:1691 src/Admin/AdminPage.php:1972 -msgid "Timezone" +#: src/QueueManager.php:295 +msgid "PHP extension \"redis\" (phpredis) is not installed" msgstr "" -#. %s: URL to GitHub repository -#: src/Admin/AdminPage.php:138 +#. translators: 1: Redis host, 2: Redis port. +#: src/QueueManager.php:318 #, php-format -msgid "" -"To add your own background jobs, use the WP Queue PHP API from your plugin " -"or theme. You can dispatch jobs to different queues, set delays and retries. " -"Full code examples are available in the " -"README on GitHub." +msgid "Connected to Redis at %1$s:%2$d (phpredis)" msgstr "" -#: src/Admin/AdminPage.php:146 -msgid "to get a list of available commands." +#: src/QueueManager.php:327 +#: src/QueueManager.php:408 +#: src/QueueManager.php:483 +#, php-format +msgid "Cannot connect to Redis at %1$s:%2$d - %3$s" msgstr "" -#: src/Admin/AdminPage.php:675 -msgid "" -"To process the queue, WordPress needs a trigger. There are two ways to do " -"this:" +#. translators: 1: Redis host, 2: Redis port. +#: src/QueueManager.php:380 +#: src/QueueManager.php:399 +#, php-format +msgid "Connected to Redis at %1$s:%2$d (via redis-cache plugin)" msgstr "" -#: src/Admin/AdminPage.php:59 src/Admin/AdminPage.php:2019 -msgid "Tools" +#: src/QueueManager.php:389 +msgid "Redis connection failed" msgstr "" -#: src/Admin/AdminPage.php:1445 -msgid "Total" +#: src/QueueManager.php:449 +msgid "Predis library is not available" msgstr "" -#: src/Admin/AdminPage.php:953 -msgid "Total errors" +#. translators: 1: Redis host, 2: Redis port. +#: src/QueueManager.php:474 +#, php-format +msgid "Connected to Redis at %1$s:%2$d (Predis)" msgstr "" -#: src/Admin/AdminPage.php:1346 -msgid "Total Events" +#: src/QueueManager.php:505 +msgid "PHP extension \"memcached\" is not installed" msgstr "" -#: src/Admin/AdminPage.php:463 -msgid "Total Jobs" +#. translators: 1: Memcached host, 2: Memcached port. +#: src/QueueManager.php:525 +#, php-format +msgid "Connected to Memcached at %1$s:%2$d" msgstr "" -#: src/Admin/AdminPage.php:765 -msgid "" -"Total number of events, overdue, grouped by source (WordPress, WooCommerce, " -"WP Queue, plugins)." +#: src/QueueManager.php:537 +#, php-format +msgid "Cannot connect to Memcached at %1$s:%2$d - %3$s" msgstr "" -#: src/Admin/AdminPage.php:1151 -msgid "Unavailable" +#. translators: %s: Queue driver name. +#: src/QueueManager.php:717 +#, php-format +msgid "Queue driver \"%s\" is not supported." msgstr "" -#. %d: HTTP response code -#: src/Admin/SystemStatus.php:142 -msgid "Unexpected response code: %d" +#: src/Runtime/Runner.php:105 +msgid "Selected manually." msgstr "" -#: src/Admin/AdminPage.php:497 src/Admin/AdminPage.php:1267 -#: src/Admin/AdminPage.php:1928 -msgid "Unknown" +#. translators: %s: reason +#: src/Runtime/Runner.php:108 +#, php-format +msgid "Selected manually, but: %s" msgstr "" -#: src/QueueManager.php:213 -msgid "Unknown driver" +#: src/Runtime/Runner.php:132 +msgid "No other runner is available." msgstr "" -#: src/Admin/AdminPage.php:1396 -msgid "Upcoming Events" +#. translators: %s: human time diff +#: src/Runtime/Runner.php:150 +#, php-format +msgid "Daemon / system cron is alive: last run %s ago." msgstr "" -#: src/Admin/AdminPage.php:94 -msgid "Usage" +#: src/Runtime/Runner.php:158 +msgid "No daemon / system cron heartbeat yet." msgstr "" -#: src/Admin/AdminPage.php:2294 -msgid "" -"Use a daemon worker on VPS, Docker or dedicated servers where you can keep a " -"process running. It polls the queue continuously and starts jobs immediately." -" Without a daemon, WP Queue relies on WP-Cron and/or loopback, which can " -"delay jobs by up to a minute." +#. translators: %s: human time diff +#: src/Runtime/Runner.php:160 +#, php-format +msgid "Daemon / system cron heartbeat is stale (%s ago)." msgstr "" -#: src/Admin/AdminPage.php:1368 -msgid "Use system cron" +#: src/Runtime/Runner.php:167 +msgid "Loopback is disabled by WP_QUEUE_LOOPBACK in wp-config.php." msgstr "" -#: src/Admin/AdminPage.php:2365 -msgid "" -"Use the script from step 2 (Without WP-CLI) inside screen, tmux or a simple " -"cron-based restart loop. Remember that the script must stay alive to act as " -"a daemon." +#. translators: %s: error message +#: src/Runtime/Runner.php:177 +#, php-format +msgid "Loopback request failed: %s" msgstr "" -#: src/Admin/AdminPage.php:722 -msgid "" -"Use this tab for quick checks of queue performance and identifying stuck " -"processes." +#: src/Runtime/Runner.php:181 +msgid "Loopback requests to admin-ajax.php work." msgstr "" -#: src/Admin/AdminPage.php:1949 -msgid "Used" +#: src/Runtime/Runner.php:185 +msgid "WP-Cron is disabled (DISABLE_WP_CRON); it runs only if a system cron calls wp-cron.php." msgstr "" -#: src/Admin/AdminPage.php:738 -msgid "Useful for testing jobs and forcing synchronizations." +#: src/Runtime/Runner.php:188 +msgid "WP-Cron runs on site visits." msgstr "" -#: src/Admin/AdminPage.php:2201 -msgid "Useful Links" +#: src/Runtime/Runner.php:191 +msgid "Jobs run at the end of the request that dispatched them." msgstr "" -#: src/QueueManager.php:197 -msgid "Uses wp_options table" +#: src/Runtime/Runner.php:242 +msgid "Auto" msgstr "" -#: src/Admin/AdminPage.php:1750 src/Admin/AdminPage.php:1988 -msgid "Version" +#: src/Runtime/Runner.php:243 +msgid "Daemon / system cron" msgstr "" -#: src/Admin/AdminPage.php:1840 -msgid "Versions" +#: src/Runtime/Runner.php:244 +msgid "Loopback (admin-ajax)" msgstr "" -#: src/Admin/AdminPage.php:1730 src/Admin/AdminPage.php:1926 -msgid "Warning" +#: src/Runtime/Runner.php:246 +msgid "Synchronous (in request)" msgstr "" -#: src/Admin/AdminPage.php:112 -msgid "What you can use it for" +#: src/Runtime/Runner.php:254 +msgid "Uses the fastest available runner: daemon / system cron if its heartbeat is fresh, then loopback, WP-Cron, synchronous." msgstr "" -#: src/Admin/AdminPage.php:2293 -msgid "When to use a daemon" +#: src/Runtime/Runner.php:255 +msgid "Fastest and most reliable. A system cron runs `wp queue work` every minute (or a daemon runs continuously). WP-Cron and loopback are not used." msgstr "" -#: src/Admin/AdminPage.php:651 -msgid "Why is it needed?" +#: src/Runtime/Runner.php:256 +msgid "After a job is dispatched, a non-blocking request to admin-ajax.php starts a worker, like Action Scheduler. Good for shared hosting. Delayed jobs run on the next dispatch." msgstr "" -#: src/Admin/AdminPage.php:2303 -msgid "With WP-CLI" +#: src/Runtime/Runner.php:257 +msgid "WP-Cron checks the queue every minute; needs site traffic or a system cron calling wp-cron.php." msgstr "" -#: src/Admin/AdminPage.php:2308 -msgid "Without WP-CLI" +#: src/Runtime/Runner.php:258 +msgid "Jobs run at the end of the request that dispatched them. No background processing; slows that request down." msgstr "" -#: src/Admin/AdminPage.php:1468 -msgid "WooCommerce" +#. translators: %d: seconds +#: src/Runtime/Runner.php:274 +#, php-format +msgid "%d s" msgstr "" -#: src/Admin/AdminPage.php:1465 src/Admin/AdminPage.php:1848 -msgid "WordPress" +#. translators: %d: minutes +#: src/Runtime/Runner.php:276 +#, php-format +msgid "%d min" msgstr "" -#: src/Admin/AdminPage.php:683 -msgid "" -"WordPress checks for scheduled tasks on every page load. This works out of " -"the box but has downsides: on low-traffic sites, tasks might not run on time;" -" on high-traffic sites, it can cause performance issues. It is \"fake\" cron." +#. translators: %d: hours +#: src/Runtime/Runner.php:278 +#, php-format +msgid "%d h" msgstr "" -#: src/Admin/AdminPage.php:1787 src/Admin/AdminPage.php:1968 -msgid "WordPress Time" +#. translators: %d: number of minutes +#: src/ScheduledJob.php:49 +#, php-format +msgid "Every %d Minutes" msgstr "" -#: src/Admin/AdminPage.php:1672 -msgid "WordPress Version" +#: src/Support/ConfigFile.php:211 +msgid "wp-config.php was not found." msgstr "" -#: src/Admin/AdminPage.php:669 -msgid "Worker" +#: src/Support/ConfigFile.php:217 +msgid "wp-config.php (or its directory) is not writable. Paste this block into wp-config.php manually, above the \"That's all, stop editing!\" line:" msgstr "" -#. Name of the plugin -#: src/Admin/AdminPage.php:68 src/Admin/AdminPage.php:69 -#: src/Admin/AdminPage.php:1471 src/Admin/AdminPage.php:1844 -msgid "WP Queue" +#: src/Support/ConfigFile.php:224 +msgid "Could not find where to insert the block in wp-config.php. Add it manually above the \"That's all, stop editing!\" line:" msgstr "" -#: src/Admin/AdminPage.php:2069 -msgid "" -"WP Queue allows executing tasks asynchronously in the background without " -"blocking the main WordPress execution flow." +#: src/Support/ConfigFile.php:228 +msgid "wp-config.php is already up to date." msgstr "" -#: src/Admin/AdminPage.php:110 -msgid "" -"WP Queue helps your site run heavy or regular tasks in the background " -"(emails, synchronizations, cleanups) so that pages load faster for visitors." +#: src/Support/ConfigFile.php:232 +msgid "The resulting wp-config.php would not be valid PHP; nothing was changed." msgstr "" -#: src/Admin/AdminPage.php:643 -msgid "" -"WP Queue is a robust background processing library for WordPress. It allows " -"you to offload time-consuming tasks (like sending emails, syncing data, or " -"generating reports) to be processed asynchronously, ensuring your site " -"remains fast and responsive for visitors." +#: src/Support/ConfigFile.php:245 +msgid "Could not create a backup of wp-config.php; nothing was changed." msgstr "" -#: src/Admin/AdminPage.php:659 -msgid "" -"WP Queue solves this by pushing these tasks to a \"Queue\" and processing " -"them later in the background. The user gets an instant response, and the " -"heavy work happens behind the scenes." +#: src/Support/ConfigFile.php:254 +msgid "Could not write a temporary file next to wp-config.php; nothing was changed." msgstr "" -#: src/Admin/AdminPage.php:2067 -msgid "WP Queue — Queue System for WordPress" +#: src/Support/ConfigFile.php:273 +msgid "Could not keep the owner/permissions of wp-config.php; nothing was changed. Paste the block manually:" msgstr "" -#: src/Admin/AdminPage.php:100 -msgid "WP-CLI" +#: src/Support/ConfigFile.php:280 +msgid "Could not replace wp-config.php (read-only or bind-mounted file); nothing was changed. Paste the block manually:" msgstr "" -#: src/Admin/AdminPage.php:145 src/Admin/AdminPage.php:2041 -msgid "WP-CLI Commands" +#. translators: %s: error +#: src/Support/ConfigFile.php:303 +#, php-format +msgid "WordPress did not load with the new wp-config.php (%s); the previous file was restored." msgstr "" -#: src/Admin/AdminPage.php:2180 -msgid "WP-CLI команды" +#: src/Support/ConfigFile.php:310 +msgid "wp-config.php updated and verified." msgstr "" -#: src/Admin/AdminPage.php:760 src/Admin/AdminPage.php:1905 -msgid "WP-Cron" +#. translators: %d: HTTP status +#: src/Support/ConfigFile.php:355 +#, php-format +msgid "HTTP %d" msgstr "" -#: src/Admin/AdminPage.php:681 -msgid "WP-Cron (Default)" +#. translators: %s: constant name +#: src/Support/ConfigFile.php:361 +#, php-format +msgid "%s has an unexpected value" msgstr "" -#: src/Admin/AdminPage.php:1869 src/Admin/AdminPage.php:1873 -msgid "WP-Cron + Loopback" +#: src/Support/DriverSwitcher.php:39 +msgid "Unknown storage driver." msgstr "" -#: src/Admin/AdminPage.php:1900 -msgid "WP-Cron checks the queue every minute as a fallback." +#: src/Support/DriverSwitcher.php:43 +msgid "The storage driver is defined in wp-config.php and cannot be changed here." msgstr "" -#: src/Admin/AdminPage.php:1701 -msgid "WP-Cron Disabled" +#: src/Support/DriverSwitcher.php:49 +msgid "This storage driver is already active." msgstr "" -#: src/Admin/SystemStatus.php:265 -msgid "WP-Cron is disabled. Background tasks may not run automatically." +#. translators: %s: driver status message +#: src/Support/DriverSwitcher.php:57 +#, php-format +msgid "The storage driver is not available: %s" msgstr "" -#: src/Admin/AdminPage.php:1877 -msgid "WP-Cron only" +#: src/Support/DriverSwitcher.php:65 +msgid "A worker is processing jobs right now. Try again in a minute." msgstr "" -#: src/Admin/AdminPage.php:1697 -msgid "WP-Cron Status" +#. translators: 1: driver, 2: number of jobs +#: src/Support/DriverSwitcher.php:102 +#, php-format +msgid "Storage driver switched to %1$s. Jobs moved: %2$d." msgstr "" -#: src/Admin/AdminPage.php:784 -msgid "WP-Cron status" +#. translators: 1: number, 2: queue +#: src/Support/DriverSwitcher.php:154 +#, php-format +msgid "%1$d job(s) in queue \"%2$s\" are being executed. Try again when they finish." msgstr "" -#: src/Admin/AdminPage.php:673 -msgid "WP-Cron vs System Cron" +#: src/Support/DriverSwitcher.php:166 +msgid "The current storage driver cannot move its jobs. Wait until its queues are empty, then switch." msgstr "" -#: src/Admin/AdminPage.php:131 -msgid "" -"WP-Cron – list of cron events with the ability to run, pause or delete them." +#. translators: %s: constant name +#: src/Support/Settings.php:150 +#, php-format +msgid "Defined in wp-config.php (%s). Change it there." msgstr "" -#: src/Admin/AdminPage.php:1365 -msgid "WP-Cron:" +#: src/Support/Settings.php:177 +msgid "Saved to wp-config.php (WP Queue block)." msgstr "" -#: src/Admin/AdminPage.php:1032 -msgid "⚠️ Warning:" +#: src/Support/Settings.php:178 +msgid "Saved." msgstr "" diff --git a/readme.txt b/readme.txt index 2c29833..b65455f 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: queue, cron, background-processing, jobs, scheduler Requires at least: 6.2 Tested up to: 7.0 Requires PHP: 8.3 -Stable tag: 1.3.0 +Stable tag: 1.4.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -89,6 +89,7 @@ wp queue cron resume # Resume a paused event # System commands wp queue system # Show system status +wp queue config # Show/set storage driver and runner ` == Installation == @@ -147,6 +148,18 @@ Yes, WP Queue works with WordPress multisite installations. == Changelog == += 1.4.0 = +* Storage backend (Database / Redis / Memcached) and queue runner are chosen in the admin; `sync` moved from drivers to runners +* Four runners: daemon / system cron, loopback (admin-ajax, like Action Scheduler), WP-Cron, synchronous. Default "Auto" picks the fastest available one and shows why; exactly one runner is active, the others register no hooks and send no requests +* "Make active" button for every ready backend: waiting jobs are moved to the new backend under the worker lock, nothing is lost or run twice +* Settings can live in a `// BEGIN WP Queue` block of wp-config.php, edited atomically by the plugin (backup, syntax check, WordPress load check, automatic rollback; a snippet is shown when the file is read-only). Other `WP_QUEUE_*` constants in wp-config.php lock the setting +* Redis driver rewritten with Lua scripts: atomic claim, delayed and reserved sets, recovery of jobs from crashed workers; works with phpredis and Predis (Redis Object Cache) +* Status page: runner switcher, crontab line and heartbeat for the daemon, WP-Cron / loopback rows show whether the selected runner uses them +* Loopback check uses admin-ajax.php and no longer requests wp-cron.php +* All known queues are listed, including empty ones +* `wp queue config [--driver=] [--runner=] [--store=]` +* New constants: `WP_QUEUE_DRIVER`, `WP_QUEUE_RUNNER` (`WP_QUEUE_RUNTIME_MODE` still works) + = 1.3.0 = * Database driver stores jobs in its own table (`{prefix}queue_jobs`) instead of one wp_options array: a job is claimed with an atomic conditional UPDATE, so parallel workers no longer lose or repeat jobs (also with a persistent object cache such as Redis) * Jobs left in wp_options by 1.2.x are migrated automatically @@ -190,6 +203,9 @@ Yes, WP Queue works with WordPress multisite installations. == Upgrade Notice == += 1.4.0 = +Storage backend and queue runner are now selectable in the admin. Existing WP_QUEUE_RUNTIME_MODE / WP_QUEUE_LOOPBACK constants keep working; remove them from wp-config.php to manage the settings in the admin. + = 1.3.0 = Database driver moves jobs to its own table with atomic claiming (no lost or duplicated jobs under parallel workers). Pending 1.2.x jobs are migrated automatically. diff --git a/src/Admin/AdminPage.php b/src/Admin/AdminPage.php index 3a4d172..bbd1186 100644 --- a/src/Admin/AdminPage.php +++ b/src/Admin/AdminPage.php @@ -4,8 +4,8 @@ namespace WPQueue\Admin; -use WPQueue\Loopback\LoopbackDispatcher; -use WPQueue\Runtime\RuntimeMode; +use WPQueue\Runtime\Runner; +use WPQueue\Support\Settings; use WPQueue\WPQueue; if (! defined('ABSPATH')) { @@ -372,6 +372,12 @@ protected function renderQueuesOverview(): void +  ·  + + + + + @@ -1037,66 +1043,62 @@ protected function renderQueuesDrivers(): void $currentDriver = $manager->getDefaultDriver(); $configuredDriver = $manager->getConfiguredDriver(); $drivers = $manager->getAvailableDrivers(); - - // Check if there's a fallback situation + $setting = Settings::driver(); + $locked = $setting['source'] === Settings::SOURCE_CONSTANT; $hasFallback = $configuredDriver !== $currentDriver; ?>
+ +

-

- -

-
- -
-

- - -

+

+
+

+ + + — sourceLabel($setting)); ?> +

+

+
+ - + $info) { $isActive = ($name === $currentDriver); - $isConfigured = ($name === $configuredDriver); $status = $info['status'] ?? 'unknown'; + $ready = $status === \WPQueue\QueueManager::STATUS_READY; ?> - - + + @@ -1116,32 +1130,47 @@ protected function renderQueuesDrivers(): void
- - -
- -
- renderDriverStatusBadge($status, $info)); ?> - renderDriverStatusBadge($status, $info)); ?> +
driverHint($name)); ?>
- + @@ -1106,8 +1108,20 @@ protected function renderQueuesDrivers(): void
+ + + + + - - +
+ + + + + +
-

-

-
define('WP_QUEUE_DRIVER', 'database'); // or 'redis', 'memcached', 'sync', 'auto'
- -

-
define('WP_REDIS_HOST', '127.0.0.1');
-define('WP_REDIS_PORT', 6379);
-define('WP_REDIS_PASSWORD', ''); // if required
-define('WP_QUEUE_DRIVER', 'redis');
- -

-
define('WP_MEMCACHED_HOST', '127.0.0.1');
-define('WP_MEMCACHED_PORT', 11211);
-define('WP_QUEUE_DRIVER', 'memcached');
- -
-

- - -

-
+

+
    +
  • +
  • +
  • +
  • +
+

+

__('Works everywhere. Atomic claim with a conditional UPDATE.', 'wp-queue'), + 'redis' => __('Fast, keeps the database small. Needs a Redis server.', 'wp-queue'), + 'memcached' => __('Not recommended: jobs cannot be listed or moved and may be evicted.', 'wp-queue'), + default => '', + }; + } + + /** + * @param array{value: string, source: string, constant: string|null} $setting + */ + protected function sourceLabel(array $setting): string + { + return match ($setting['source']) { + Settings::SOURCE_CONSTANT => sprintf( + /* translators: %s: constant name */ + __('set in wp-config.php (%s)', 'wp-queue'), + (string) $setting['constant'], + ), + Settings::SOURCE_MANAGED => __('set in the WP Queue block of wp-config.php (editable here)', 'wp-queue'), + Settings::SOURCE_OPTION => __('selected in the admin', 'wp-queue'), + default => __('default', 'wp-queue'), + }; + } + /** * Render driver status badge with appropriate styling. * @@ -1646,6 +1675,11 @@ protected function renderDiagnosticsEnvironment(): void { $status = new SystemStatus(); $report = $status->getFullReport(); + + if (isset($report['loopback']['status'])) { + set_transient(Runner::LOOPBACK_CHECK_TRANSIENT, $report['loopback'], HOUR_IN_SECONDS); + Runner::reset(); + } $health = $status->getHealthStatus(); ?> @@ -1814,6 +1848,11 @@ protected function renderSystemStatus(): void { $status = new SystemStatus(); $report = $status->getFullReport(); + + if (isset($report['loopback']['status'])) { + set_transient(Runner::LOOPBACK_CHECK_TRANSIENT, $report['loopback'], HOUR_IN_SECONDS); + Runner::reset(); + } $metrics = WPQueue::logs()->metrics(); $driver = WPQueue::manager()->getDefaultDriver(); @@ -1866,82 +1905,125 @@ protected function renderSystemStatus(): void $used ? 'status-completed' : 'status-idle'; ?>

+ - + @@ -2303,10 +2385,12 @@ protected function renderSystemDaemon(): void

-

-

-
define('WP_QUEUE_RUNTIME_MODE', 'daemon');
-

+

+

+
define('WP_QUEUE_RUNNER', 'daemon');
+

+

+

@@ -2319,7 +2403,7 @@ protected function renderSystemDaemon(): void

<?php
 define('WP_QUEUE_DAEMON', true);
-define('WP_QUEUE_RUNTIME_MODE', 'daemon');
+define('WP_QUEUE_RUNNER', 'daemon');
 
 require '/var/www/html/wordpress/wp-load.php';
 
diff --git a/src/Admin/SettingsController.php b/src/Admin/SettingsController.php
new file mode 100644
index 0000000..eb8e17f
--- /dev/null
+++ b/src/Admin/SettingsController.php
@@ -0,0 +1,178 @@
+authorize(self::NONCE_DRIVER);
+
+        $driver = isset($_POST['driver']) ? sanitize_key(wp_unslash($_POST['driver'])) : '';
+        $result = (new DriverSwitcher(WPQueue::manager()))->switchTo($driver, self::toConfig());
+
+        self::flash($result);
+        $this->back('queues', 'drivers');
+    }
+
+    public function setRunner(): void
+    {
+        $this->authorize(self::NONCE_RUNNER);
+
+        $runner = isset($_POST['runner']) ? sanitize_key(wp_unslash($_POST['runner'])) : '';
+
+        if (! in_array($runner, array_merge([Runner::AUTO], Runner::all()), true)) {
+            self::flash(['ok' => false, 'message' => __('Unknown runner.', 'wp-queue')]);
+            $this->back('system', 'status');
+        }
+
+        // Re-check loopback now: it decides availability in "auto" and "loopback".
+        self::refreshLoopbackCheck();
+
+        if ($runner === Runner::LOOPBACK) {
+            $availability = Runner::availability(Runner::LOOPBACK);
+
+            if (! $availability['available']) {
+                self::flash(['ok' => false, 'message' => $availability['reason']]);
+                $this->back('system', 'status');
+            }
+        }
+
+        $result = Settings::persist('runner', $runner, self::toConfig());
+        Runner::reset();
+
+        if ($result['ok'] && $runner === Runner::DAEMON && ! Runner::availability(Runner::DAEMON)['available']) {
+            $result['message'] .= ' '.__('No fresh heartbeat from the daemon / system cron yet: add the crontab line shown below, otherwise jobs will not run.', 'wp-queue');
+            $result['warning'] = true;
+        }
+
+        self::flash($result);
+        $this->back('system', 'status');
+    }
+
+    /**
+     * Run a loopback test and remember the result for runner auto-selection.
+     *
+     * @return array{status: string, message: string}
+     */
+    public static function refreshLoopbackCheck(): array
+    {
+        $check = (new SystemStatus())->checkLoopback();
+        Options::setTransient(Runner::LOOPBACK_CHECK_TRANSIENT, $check, HOUR_IN_SECONDS);
+        Runner::reset();
+
+        return $check;
+    }
+
+    /**
+     * Suggested crontab line for the daemon / system cron runner.
+     */
+    public static function cronCommand(): string
+    {
+        return sprintf(
+            '* * * * * wp --path=%s queue work --all --limit=50 --max-time=50 >/dev/null 2>&1',
+            escapeshellarg(untrailingslashit(ABSPATH)),
+        );
+    }
+
+    /**
+     * @param  array  $result
+     */
+    public static function flash(array $result): void
+    {
+        set_transient('wp_queue_notice_'.get_current_user_id(), $result, 120);
+    }
+
+    public static function renderNotice(): void
+    {
+        $key = 'wp_queue_notice_'.get_current_user_id();
+        $notice = get_transient($key);
+
+        if (! is_array($notice)) {
+            return;
+        }
+
+        delete_transient($key);
+
+        $class = ! empty($notice['ok']) ? (! empty($notice['warning']) ? 'notice-warning' : 'notice-success') : 'notice-error';
+        ?>
+        
+

+ +
+ +
+ + + + 200]); + } + /** * Check if WP-Cron is disabled. */ @@ -92,7 +102,9 @@ public function getPhpVersion(): string */ public function checkLoopback(): array { - $body = ['site-health' => 'loopback-test']; + // A harmless admin-ajax ping. Never request wp-cron.php here: that would + // run every due WP-Cron event, even with DISABLE_WP_CRON. + $body = ['action' => self::PING_ACTION]; $cookies = $_COOKIE ?? []; if (function_exists('wp_unslash')) { @@ -113,13 +125,7 @@ public function checkLoopback(): array $headers['Authorization'] = 'Basic '.base64_encode($user.':'.$pass); } - if (function_exists('site_url')) { - $url = site_url('wp-cron.php'); - } elseif (function_exists('admin_url')) { - $url = admin_url('admin-ajax.php'); - } else { - $url = 'http://127.0.0.1'; - } + $url = function_exists('admin_url') ? admin_url('admin-ajax.php') : 'http://127.0.0.1/wp-admin/admin-ajax.php'; $response = wp_remote_post($url, [ 'body' => $body, @@ -139,6 +145,13 @@ public function checkLoopback(): array $code = wp_remote_retrieve_response_code($response); + if ($code === 200 && trim((string) wp_remote_retrieve_body($response)) !== 'wp-queue-pong') { + return [ + 'status' => 'warning', + 'message' => __('admin-ajax.php answered, but not with the WP Queue ping response', 'wp-queue'), + ]; + } + if ($code !== 200) { return [ 'status' => 'warning', diff --git a/src/CLI/QueueCommand.php b/src/CLI/QueueCommand.php index 98a3f2e..963d09e 100644 --- a/src/CLI/QueueCommand.php +++ b/src/CLI/QueueCommand.php @@ -7,7 +7,10 @@ use WP_CLI; use WP_CLI\Utils; use WPQueue\Admin\SystemStatus; +use WPQueue\Runtime\Runner; +use WPQueue\Support\DriverSwitcher; use WPQueue\Support\Lock; +use WPQueue\Support\Settings; use WPQueue\WPQueue; if (! defined('ABSPATH')) { @@ -112,6 +115,9 @@ public function status(array $args, array $assocArgs): void * default: 0 * --- * + * [--force] + * : Process even if another runner (loopback, WP-Cron, sync) is selected. + * * [--daemon] * : Run as a daemon worker that continuously polls the queue. * In daemon mode loopback requests and WP-Cron scheduling are skipped @@ -132,6 +138,15 @@ public function work(array $args, array $assocArgs): void { $queue = $args[0] ?? 'default'; + // Exactly one runner is active. A system cron line left in place after + // switching to another runner only reports that it is still there. + if (empty($assocArgs['force']) && ! Runner::cliWorkerAllowed()) { + Runner::beat(Runner::DAEMON, 0, true); + WP_CLI::log(sprintf('Active runner is "%s"; skipping (use --force to process anyway).', Runner::active())); + + return; + } + if (! empty($assocArgs['daemon'])) { $this->runDaemon($queue, $assocArgs); @@ -149,6 +164,7 @@ public function work(array $args, array $assocArgs): void $token = Lock::acquire(Lock::WORKER, $lockTtl); if ($token === null) { + Runner::beat(Runner::DAEMON, 0, true); WP_CLI::log('Another worker is processing the queues, skipping.'); return; @@ -163,6 +179,12 @@ public function work(array $args, array $assocArgs): void $worker->setMaxTime($maxTime); $worker->resetJobsProcessed(); + try { + (new DriverSwitcher(WPQueue::manager()))->drainPrevious(); + } catch (\Throwable $e) { + WP_CLI::warning('Moving jobs from the previous driver failed: '.$e->getMessage()); + } + $queues = [$queue]; if (! empty($assocArgs['all'])) { $queues = array_values(array_unique(array_merge($queues, WPQueue::manager()->discoverQueues()))); @@ -174,6 +196,7 @@ public function work(array $args, array $assocArgs): void } } + Runner::beat(Runner::DAEMON, $worker->getJobsProcessed()); WP_CLI::success("Processed {$worker->getJobsProcessed()} jobs from: ".implode(', ', $queues)); } finally { Lock::release(Lock::WORKER, $token); @@ -212,6 +235,12 @@ protected function runDaemon(string $queue, array $assocArgs): void break; } + $lastBeat ??= 0; + if (time() - $lastBeat >= 30) { + Runner::beat(Runner::DAEMON, $worker->getJobsProcessed()); + $lastBeat = time(); + } + if (! $worker->runNextJob($queue)) { sleep(3); } @@ -456,4 +485,79 @@ protected function convertToMB(string $value): int return (int) ($bytes / 1024 / 1024); } + + /** + * Show or change the storage driver and the queue runner. + * + * ## OPTIONS + * + * [--driver=] + * : Storage driver: database, redis, memcached. Waiting jobs are moved. + * + * [--runner=] + * : Queue runner: auto, daemon, loopback, wp_cron, sync. + * + * [--store=] + * : Where to save: option (plugin settings) or wp-config (WP Queue block). + * + * ## EXAMPLES + * + * wp queue config + * wp queue config --driver=redis + * wp queue config --runner=daemon + * + * @when after_wp_load + */ + public function config(array $args, array $assocArgs): void + { + $toConfig = match ($assocArgs['store'] ?? null) { + 'wp-config', 'config' => true, + 'option' => false, + default => null, + }; + + if (isset($assocArgs['driver'])) { + $result = (new DriverSwitcher(WPQueue::manager()))->switchTo((string) $assocArgs['driver'], $toConfig); + $this->reportSettingResult($result); + } + + if (isset($assocArgs['runner'])) { + $runner = Runner::normalize((string) $assocArgs['runner']); + + if ($runner !== (string) $assocArgs['runner']) { + WP_CLI::error('Unknown runner. Use: auto, daemon, loopback, wp_cron, sync.'); + } + + $result = Settings::persist('runner', $runner, $toConfig); + Runner::reset(); + $this->reportSettingResult($result); + } + + $driver = Settings::driver(); + $runner = Settings::runner(); + $resolved = Runner::resolve(); + + WP_CLI::log(sprintf('Driver: %s (active: %s, source: %s)', $driver['value'], WPQueue::manager()->getDefaultDriver(), $driver['source'])); + WP_CLI::log(sprintf('Runner: %s (active: %s, source: %s)', $runner['value'], $resolved['runner'], $runner['source'])); + WP_CLI::log('Reason: '.$resolved['reason']); + + $beat = Runner::heartbeat(Runner::DAEMON); + WP_CLI::log('Daemon heartbeat: '.($beat === null ? 'never' : gmdate('Y-m-d H:i:s', $beat['at']).' UTC'.($beat['skipped'] ? ' (skipped)' : ''))); + } + + /** + * @param array{ok: bool, message: string, snippet?: string} $result + */ + private function reportSettingResult(array $result): void + { + if (! $result['ok']) { + if (! empty($result['snippet'])) { + WP_CLI::log($result['snippet']); + } + + WP_CLI::error($result['message']); + } + + WP_CLI::success($result['message']); + } } diff --git a/src/Contracts/TransferableQueue.php b/src/Contracts/TransferableQueue.php new file mode 100644 index 0000000..bfb87ab --- /dev/null +++ b/src/Contracts/TransferableQueue.php @@ -0,0 +1,35 @@ + + */ + public function queues(): array; + + /** + * Jobs reserved by a worker right now (not stale). + */ + public function reservedCount(string $queue): int; + + /** + * Atomically remove and return waiting jobs (ready or delayed, not reserved). + * + * @return list + */ + public function takePending(string $queue, int $limit = 500): array; +} diff --git a/src/Jobs/PendingDispatch.php b/src/Jobs/PendingDispatch.php index 410b938..81355ad 100644 --- a/src/Jobs/PendingDispatch.php +++ b/src/Jobs/PendingDispatch.php @@ -5,9 +5,8 @@ namespace WPQueue\Jobs; use WPQueue\Contracts\JobInterface; -use WPQueue\Loopback\LoopbackDispatcher; use WPQueue\QueueManager; -use WPQueue\Runtime\RuntimeMode; +use WPQueue\Runtime\Trigger; if (! defined('ABSPATH')) { exit; @@ -17,10 +16,6 @@ class PendingDispatch { protected bool $shouldDispatch = true; - protected static bool $spawnRegistered = false; - - protected static bool $spawnQueued = false; - public function __construct( protected JobInterface $job, protected QueueManager $manager, @@ -78,49 +73,8 @@ protected function send(): void $queue->push($this->job); $queueName = $this->job->getQueue() ?: 'default'; - LoopbackDispatcher::spawn($queueName); - self::scheduleImmediateProcessing($queueName); - } - - protected static function scheduleImmediateProcessing(string $queue): void - { - if (! function_exists('wp_schedule_single_event') || ! function_exists('spawn_cron')) { - return; - } - - // Daemon mode: an external worker polls the queue, WP-Cron is not used. - if (! RuntimeMode::useCron()) { - return; - } - - if (wp_next_scheduled('wp_queue_process', [$queue]) === false) { - wp_schedule_single_event(time(), 'wp_queue_process', [$queue]); - } - - // With DISABLE_WP_CRON the site runs cron from the system scheduler: - // spawning wp-cron.php here would execute every due hook, not only ours. - if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) { - return; - } - - if (! self::$spawnRegistered) { - self::$spawnRegistered = true; - - register_shutdown_function(static function (): void { - if (! self::$spawnQueued) { - return; - } - - self::$spawnQueued = false; - - try { - spawn_cron(); - } catch (\Throwable $e) { - error_log('WP Queue: spawn_cron failed: '.$e->getMessage()); - } - }); - } + $this->manager->rememberQueue($queueName); - self::$spawnQueued = true; + Trigger::afterDispatch($queueName); } } diff --git a/src/Loopback/LoopbackDispatcher.php b/src/Loopback/LoopbackDispatcher.php index 24f4ace..3b2c3de 100644 --- a/src/Loopback/LoopbackDispatcher.php +++ b/src/Loopback/LoopbackDispatcher.php @@ -4,7 +4,7 @@ namespace WPQueue\Loopback; -use WPQueue\Runtime\RuntimeMode; +use WPQueue\Runtime\Runner; use WPQueue\WPQueue; if (! defined('ABSPATH')) { @@ -137,19 +137,19 @@ public static function sanitizeQueue(string $queue): string */ public static function isEnabled(): bool { - if (defined('WP_QUEUE_LOOPBACK')) { - return (bool) WP_QUEUE_LOOPBACK; - } - - if (! RuntimeMode::useLoopback()) { + // Only the active runner may start workers. + if (! Runner::is(Runner::LOOPBACK)) { return false; } - /** - * Filters whether loopback dispatch is enabled. - * - * @param bool $enabled Default true. - */ - return apply_filters('wp_queue_loopback_enabled', true); + return (bool) apply_filters('wp_queue_loopback_enabled', true); + } + + /** + * Allow spawning again in this request (after a worker finished). + */ + public static function forget(string $queue): void + { + unset(self::$spawned[self::sanitizeQueue($queue)]); } } diff --git a/src/Loopback/LoopbackHandler.php b/src/Loopback/LoopbackHandler.php index bbfac64..3b6fb66 100644 --- a/src/Loopback/LoopbackHandler.php +++ b/src/Loopback/LoopbackHandler.php @@ -4,6 +4,7 @@ namespace WPQueue\Loopback; +use WPQueue\Runtime\Runner; use WPQueue\WPQueue; if (! defined('ABSPATH')) { @@ -43,12 +44,36 @@ public function handle(): void wp_die('Already processing', 'Already processing', ['response' => 200]); } - // Trigger the same handler the cron job uses. - do_action('wp_queue_process', $queue); + $processed = WPQueue::processQueues($queue, 50, 50, Runner::LOOPBACK); + + // Jobs may have been dispatched while this worker was finishing: start + // another worker, but only if this one made progress (delayed jobs + // must not cause an endless chain of requests). + if ($processed !== null && $processed > 0 && self::hasPending($queue)) { + LoopbackDispatcher::forget($queue); + LoopbackDispatcher::spawn($queue); + } wp_die('OK', 'OK', ['response' => 200]); } + /** + * The worker serves every queue, so look at all of them. + */ + private static function hasPending(string $queue): bool + { + $queues = WPQueue::manager()->discoverQueues(); + $queues[] = $queue; + + foreach (array_unique($queues) as $name) { + if (WPQueue::queueSize($name) > 0) { + return true; + } + } + + return false; + } + /** * Verify the loopback nonce. */ diff --git a/src/Queue/DatabaseQueue.php b/src/Queue/DatabaseQueue.php index 8619f28..7283f05 100644 --- a/src/Queue/DatabaseQueue.php +++ b/src/Queue/DatabaseQueue.php @@ -7,6 +7,7 @@ use WPQueue\Contracts\InspectableQueue; use WPQueue\Contracts\JobInterface; use WPQueue\Contracts\QueueInterface; +use WPQueue\Contracts\TransferableQueue; use WPQueue\Support\Schema; if (! defined('ABSPATH')) { @@ -20,7 +21,7 @@ * which is atomic in every SQL engine, so concurrent workers can neither take the * same job twice nor lose jobs. The object cache (Redis etc.) is not involved. */ -class DatabaseQueue implements InspectableQueue, QueueInterface +class DatabaseQueue implements InspectableQueue, QueueInterface, TransferableQueue { /** * Seconds after which a reserved job is considered abandoned (worker crashed). @@ -216,6 +217,63 @@ public function jobs(string $queue): array return $jobs; } + public function reservedCount(string $queue): int + { + global $wpdb; + + Schema::ensure(); + + $table = Schema::jobsTable(); + + return (int) $wpdb->get_var($wpdb->prepare( + "SELECT COUNT(*) FROM {$table} WHERE queue = %s AND reserved_at IS NOT NULL AND reserved_at >= %d", + $queue, + time() - self::STALE_THRESHOLD, + )); + } + + public function takePending(string $queue, int $limit = 500): array + { + global $wpdb; + + Schema::ensure(); + + $table = Schema::jobsTable(); + $staleBefore = time() - self::STALE_THRESHOLD; + + $rows = $wpdb->get_results($wpdb->prepare( + "SELECT id, job_id, payload, available_at FROM {$table} WHERE queue = %s AND (reserved_at IS NULL OR reserved_at < %d) ORDER BY available_at ASC, id ASC LIMIT %d", + $queue, + $staleBefore, + $limit, + ), ARRAY_A); + + $taken = []; + + foreach ((array) $rows as $row) { + // Conditional delete: a worker may have claimed the row meanwhile. + $deleted = $wpdb->query($wpdb->prepare( + "DELETE FROM {$table} WHERE id = %d AND (reserved_at IS NULL OR reserved_at < %d)", + (int) $row['id'], + $staleBefore, + )); + + if ((int) $deleted !== 1) { + continue; + } + + $job = $this->decode((string) $row['payload']); + + if ($job instanceof JobInterface) { + $taken[] = ['job' => $job, 'available_at' => (int) $row['available_at']]; + } else { + error_log(sprintf('WP Queue: Dropped unreadable job %s while moving queue %s', $row['job_id'], $queue)); + } + } + + return $taken; + } + /** * Serialized PHP objects contain NUL bytes (private/protected properties), * which PostgreSQL text columns reject, so payloads are stored base64-encoded. diff --git a/src/Queue/Redis/PhpRedisClient.php b/src/Queue/Redis/PhpRedisClient.php index 528b5dd..c9b70e2 100644 --- a/src/Queue/Redis/PhpRedisClient.php +++ b/src/Queue/Redis/PhpRedisClient.php @@ -244,6 +244,35 @@ public function keys(string $pattern): array return $this->redis->keys($pattern) ?: []; } + public function evalScript(string $script, array $keys, array $args = []): mixed + { + $this->ensureConnected(); + + // phpredis applies OPT_PREFIX to the KEYS of EVAL itself. + $result = $this->redis->eval($script, array_merge($keys, array_map('strval', $args)), count($keys)); + + if ($result === false && ($error = $this->redis->getLastError()) !== null) { + $this->redis->clearLastError(); + throw new \RuntimeException('Redis script failed: '.$error); + } + + return $result; + } + + public function sAdd(string $key, string $member): int + { + $this->ensureConnected(); + + return (int) $this->redis->sAdd($key, $member); + } + + public function sMembers(string $key): array + { + $this->ensureConnected(); + + return array_values(array_map('strval', $this->redis->sMembers($key) ?: [])); + } + public function getClientType(): string { return 'phpredis'; diff --git a/src/Queue/Redis/PredisClient.php b/src/Queue/Redis/PredisClient.php index 2eab19a..45f0c2b 100644 --- a/src/Queue/Redis/PredisClient.php +++ b/src/Queue/Redis/PredisClient.php @@ -246,6 +246,29 @@ public function keys(string $pattern): array return array_map(fn ($key) => substr($key, $prefixLen), $keys); } + public function evalScript(string $script, array $keys, array $args = []): mixed + { + $this->ensureConnected(); + + $prefixed = array_map(fn (string $key): string => $this->prefixKey($key), $keys); + + return $this->redis->eval($script, count($prefixed), ...array_merge($prefixed, array_map('strval', $args))); + } + + public function sAdd(string $key, string $member): int + { + $this->ensureConnected(); + + return (int) $this->redis->sadd($this->prefixKey($key), [$member]); + } + + public function sMembers(string $key): array + { + $this->ensureConnected(); + + return array_values(array_map('strval', $this->redis->smembers($this->prefixKey($key)) ?: [])); + } + public function getClientType(): string { return 'predis'; diff --git a/src/Queue/Redis/RedisClientInterface.php b/src/Queue/Redis/RedisClientInterface.php index c26fb2c..0b54d51 100644 --- a/src/Queue/Redis/RedisClientInterface.php +++ b/src/Queue/Redis/RedisClientInterface.php @@ -141,4 +141,19 @@ public function keys(string $pattern): array; * Get client type identifier. */ public function getClientType(): string; + + /** + * Run a Lua script atomically. Keys are prefixed like every other command. + * + * @param list $keys + * @param list $args + */ + public function evalScript(string $script, array $keys, array $args = []): mixed; + + public function sAdd(string $key, string $member): int; + + /** + * @return list + */ + public function sMembers(string $key): array; } diff --git a/src/Queue/RedisQueue.php b/src/Queue/RedisQueue.php index cc2839e..1f752cc 100644 --- a/src/Queue/RedisQueue.php +++ b/src/Queue/RedisQueue.php @@ -4,8 +4,10 @@ namespace WPQueue\Queue; +use WPQueue\Contracts\InspectableQueue; use WPQueue\Contracts\JobInterface; use WPQueue\Contracts\QueueInterface; +use WPQueue\Contracts\TransferableQueue; use WPQueue\Queue\Redis\RedisClientFactory; use WPQueue\Queue\Redis\RedisClientInterface; @@ -30,12 +32,34 @@ * * Supports both phpredis extension and Predis library (via redis-cache plugin). * + * Layout per queue (all changes go through Lua scripts, so they are atomic): + * - q:{queue}:data hash job id => JSON (payload, attempts, available_at) + * - q:{queue}:ready list job ids ready to run + * - q:{queue}:delayed zset job id => available_at + * - q:{queue}:reserved zset job id => reserved_at (claimed by a worker) + * - queues set known queue names + * - index hash job id => queue name + * + * pop() moves due delayed jobs and stale reservations back to the ready list, + * then LPOPs one id and reserves it in the same script, so every job is handed + * to exactly one worker. + * * @see https://github.com/rhubarbgroup/redis-cache */ -class RedisQueue implements QueueInterface +class RedisQueue implements InspectableQueue, QueueInterface, TransferableQueue { protected const PREFIX = 'wp_queue:'; + /** + * Seconds after which a reservation is considered abandoned. + */ + public const STALE_THRESHOLD = 300; + + /** + * @var array Queues whose legacy (<= 1.3.0) keys were imported. + */ + protected array $legacyChecked = []; + protected ?RedisClientInterface $client = null; /** @@ -164,27 +188,16 @@ public function getConnectionInfo(): array public function push(JobInterface $job): string { - $queue = $job->getQueue(); + $queue = $job->getQueue() ?: 'default'; $availableAt = time() + $job->getDelay(); - $data = [ - 'id' => $job->getId(), - 'payload' => serialize($job), - 'available_at' => $availableAt, - 'reserved_at' => null, - 'attempts' => $job->getAttempts(), - 'created_at' => time(), - ]; - - $jsonData = json_encode($data); - - if ($job->getDelay() > 0) { - // Use sorted set for delayed jobs - $this->connection()->zAdd($this->delayedKey($queue), (float) $availableAt, $jsonData); - } else { - // Use list for immediate jobs - $this->connection()->rPush($this->queueKey($queue), $jsonData); - } + $this->connection()->evalScript(self::SCRIPT_PUSH, $this->keys($queue), [ + $job->getId(), + $this->encode($job, $availableAt), + $queue, + $availableAt, + $job->getDelay() > 0 ? 1 : 0, + ]); return $job->getId(); } @@ -198,129 +211,165 @@ public function later(int $delay, JobInterface $job): string public function pop(string $queue = 'default'): ?JobInterface { - // First, migrate delayed jobs that are ready - $this->migrateDelayedJobs($queue); + $this->importLegacy($queue); - // Pop from queue - $data = $this->connection()->lPop($this->queueKey($queue)); + $now = time(); - if ($data === null) { - return null; - } + while (true) { + $result = $this->connection()->evalScript(self::SCRIPT_POP, $this->keys($queue), [ + $now, + $now - self::STALE_THRESHOLD, + ]); - $payload = json_decode($data, true); + if (! is_array($result) || count($result) < 2) { + return null; + } - if (! is_array($payload) || ! isset($payload['payload'])) { - return null; + $job = $this->decode((string) $result[1]); + + if ($job instanceof JobInterface) { + return $job; + } + + error_log(sprintf('WP Queue: Failed to unserialize Redis job %s, removing it', (string) $result[0])); + $this->delete((string) $result[0]); } + } - // Mark as reserved - $payload['reserved_at'] = time(); - $this->connection()->hSet( - $this->reservedKey($queue), - $payload['id'], - json_encode($payload), - ); + public function delete(string $jobId): bool + { + $queue = $this->queueOf($jobId); - $job = unserialize($payload['payload']); + if ($queue === null) { + return false; + } - return $job instanceof JobInterface ? $job : null; + return (int) $this->connection()->evalScript(self::SCRIPT_DELETE, $this->keys($queue), [$jobId]) > 0; } - /** - * Migrate delayed jobs that are ready to be processed. - */ - protected function migrateDelayedJobs(string $queue): void + public function release(JobInterface $job, int $delay = 0): void { - $now = time(); - $delayedKey = $this->delayedKey($queue); - $queueKey = $this->queueKey($queue); + $queue = $job->getQueue() ?: 'default'; + $availableAt = time() + $delay; + + $this->connection()->evalScript(self::SCRIPT_RELEASE, $this->keys($queue), [ + $job->getId(), + $this->encode($job, $availableAt), + $queue, + $availableAt, + $delay > 0 ? 1 : 0, + ]); + } - // Get all delayed jobs that are ready - $jobs = $this->connection()->zRangeByScore($delayedKey, '-inf', (string) $now); + public function size(string $queue = 'default'): int + { + $this->importLegacy($queue); - foreach ($jobs as $job) { - // Remove from delayed set - $this->connection()->zRem($delayedKey, $job); + return (int) $this->connection()->evalScript("return redis.call('HLEN', KEYS[4])", $this->keys($queue)); + } - // Add to main queue - $this->connection()->rPush($queueKey, $job); - } + public function clear(string $queue = 'default'): int + { + return (int) $this->connection()->evalScript(self::SCRIPT_CLEAR, $this->keys($queue)); } - public function delete(string $jobId): bool + public function isEmpty(string $queue = 'default'): bool { - $queues = $this->getAllQueues(); + return $this->size($queue) === 0; + } - foreach ($queues as $queue) { - // Check reserved jobs - if ($this->connection()->hDel($this->reservedKey($queue), $jobId) > 0) { - return true; - } + public function queues(): array + { + return $this->connection()->sMembers('queues'); + } - // Check main queue (slower, but necessary) - $jobs = $this->connection()->lRange($this->queueKey($queue), 0, -1); - foreach ($jobs as $index => $data) { - $payload = json_decode($data, true); - if (isset($payload['id']) && $payload['id'] === $jobId) { - $this->connection()->lRem($this->queueKey($queue), $data, 1); + public function jobs(string $queue): array + { + $raw = $this->connection()->evalScript(self::SCRIPT_JOBS, $this->keys($queue)); + $jobs = []; - return true; - } - } + if (! is_array($raw)) { + return $jobs; + } - // Check delayed jobs - $delayed = $this->connection()->zRange($this->delayedKey($queue), 0, -1); - foreach ($delayed as $data) { - $payload = json_decode($data, true); - if (isset($payload['id']) && $payload['id'] === $jobId) { - $this->connection()->zRem($this->delayedKey($queue), $data); + for ($i = 0; $i + 2 < count($raw); $i += 3) { + $data = json_decode((string) $raw[$i + 1], true); - return true; - } + if (! is_array($data)) { + continue; } - } - - return false; - } - public function release(JobInterface $job, int $delay = 0): void - { - $queue = $job->getQueue(); + $reservedAt = $raw[$i + 2]; + $jobs[(string) $raw[$i]] = [ + 'payload' => (string) base64_decode((string) ($data['payload'] ?? ''), true), + 'available_at' => (int) ($data['available_at'] ?? 0), + 'reserved_at' => ($reservedAt === false || $reservedAt === null || $reservedAt === '') ? null : (int) $reservedAt, + 'attempts' => (int) ($data['attempts'] ?? 0), + ]; + } - // Remove from reserved - $this->connection()->hDel($this->reservedKey($queue), $job->getId()); + uasort($jobs, static fn (array $a, array $b): int => $a['available_at'] <=> $b['available_at']); - // Re-add to queue - $job->delay($delay); - $this->push($job); + return $jobs; } - public function size(string $queue = 'default'): int + public function reservedCount(string $queue): int { - $mainSize = (int) $this->connection()->lLen($this->queueKey($queue)); - $delayedSize = (int) $this->connection()->zCard($this->delayedKey($queue)); - $reservedSize = (int) $this->connection()->hLen($this->reservedKey($queue)); - - return $mainSize + $delayedSize + $reservedSize; + return (int) $this->connection()->evalScript( + "return redis.call('ZCOUNT', KEYS[3], ARGV[1], '+inf')", + $this->keys($queue), + [time() - self::STALE_THRESHOLD], + ); } - public function clear(string $queue = 'default'): int + public function takePending(string $queue, int $limit = 500): array { - $count = $this->size($queue); + $this->importLegacy($queue); - $this->connection()->del([ - $this->queueKey($queue), - $this->delayedKey($queue), - $this->reservedKey($queue), + $raw = $this->connection()->evalScript(self::SCRIPT_TAKE, $this->keys($queue), [ + time() - self::STALE_THRESHOLD, + $limit, ]); - return $count; + $taken = []; + + if (! is_array($raw)) { + return $taken; + } + + for ($i = 0; $i + 1 < count($raw); $i += 2) { + $data = json_decode((string) $raw[$i + 1], true); + $job = is_array($data) ? $this->decode((string) $raw[$i + 1]) : null; + + if ($job instanceof JobInterface) { + $taken[] = ['job' => $job, 'available_at' => (int) ($data['available_at'] ?? time())]; + } else { + error_log(sprintf('WP Queue: Dropped unreadable Redis job %s while moving queue %s', (string) $raw[$i], $queue)); + } + } + + return $taken; } - public function isEmpty(string $queue = 'default'): bool + /** + * Get queue statistics. + * + * @return array{pending: int, delayed: int, reserved: int, total: int} + */ + public function stats(string $queue = 'default'): array { - return $this->size($queue) === 0; + $raw = $this->connection()->evalScript( + "return {redis.call('LLEN', KEYS[1]), redis.call('ZCARD', KEYS[2]), redis.call('ZCARD', KEYS[3]), redis.call('HLEN', KEYS[4])}", + $this->keys($queue), + ); + $raw = is_array($raw) ? array_map('intval', $raw) : [0, 0, 0, 0]; + + return [ + 'pending' => $raw[0] ?? 0, + 'delayed' => $raw[1] ?? 0, + 'reserved' => $raw[2] ?? 0, + 'total' => $raw[3] ?? 0, + ]; } /** @@ -330,49 +379,113 @@ public function isEmpty(string $queue = 'default'): bool */ protected function getAllQueues(): array { - $prefix = $this->config['prefix'].'jobs:'; - $keys = $this->connection()->keys('jobs:*'); - - $queues = []; - foreach ($keys as $key) { - // Remove prefix and suffix - $name = str_replace(['jobs:', ':delayed', ':reserved'], '', $key); - if ($name && ! in_array($name, $queues, true)) { - $queues[] = $name; - } - } + $queues = $this->queues(); return $queues ?: ['default']; } - protected function queueKey(string $queue): string + /** + * Keys of one queue in the order the scripts expect. + * + * @return list + */ + protected function keys(string $queue): array { - return 'jobs:'.$queue; + return [ + 'q:'.$queue.':ready', + 'q:'.$queue.':delayed', + 'q:'.$queue.':reserved', + 'q:'.$queue.':data', + 'queues', + 'index', + ]; } - protected function delayedKey(string $queue): string + protected function queueOf(string $jobId): ?string { - return 'jobs:'.$queue.':delayed'; + $queue = $this->connection()->evalScript("return redis.call('HGET', KEYS[1], ARGV[1])", ['index'], [$jobId]); + + return is_string($queue) && $queue !== '' ? $queue : null; } - protected function reservedKey(string $queue): string + protected function encode(JobInterface $job, int $availableAt): string { - return 'jobs:'.$queue.':reserved'; + return (string) json_encode([ + 'id' => $job->getId(), + // Serialized objects contain NUL bytes and may hold non-UTF-8 data. + 'payload' => base64_encode(serialize($job)), + 'attempts' => $job->getAttempts(), + 'available_at' => $availableAt, + 'created_at' => time(), + ]); + } + + protected function decode(string $json): ?JobInterface + { + $data = json_decode($json, true); + + if (! is_array($data) || ! isset($data['payload'])) { + return null; + } + + $raw = base64_decode((string) $data['payload'], true); + + if ($raw === false) { + return null; + } + + try { + $job = unserialize($raw); + } catch (\Throwable) { + return null; + } + + return $job instanceof JobInterface ? $job : null; } /** - * Get queue statistics. - * - * @return array{pending: int, delayed: int, reserved: int, total: int} + * Move jobs stored by WP Queue <= 1.3.0 (JSON in jobs:{queue} lists) to the + * current layout, once per process and queue. */ - public function stats(string $queue = 'default'): array + protected function importLegacy(string $queue): void { - return [ - 'pending' => (int) $this->connection()->lLen($this->queueKey($queue)), - 'delayed' => (int) $this->connection()->zCard($this->delayedKey($queue)), - 'reserved' => (int) $this->connection()->hLen($this->reservedKey($queue)), - 'total' => $this->size($queue), - ]; + if (isset($this->legacyChecked[$queue])) { + return; + } + + $this->legacyChecked[$queue] = true; + $client = $this->connection(); + + $legacy = []; + + while (($item = $client->lPop('jobs:'.$queue)) !== null) { + $legacy[] = $item; + } + + foreach ($client->zRange('jobs:'.$queue.':delayed', 0, -1) as $item) { + if ($client->zRem('jobs:'.$queue.':delayed', $item) === 1) { + $legacy[] = $item; + } + } + + foreach ($legacy as $item) { + $data = json_decode($item, true); + + if (! is_array($data) || ! isset($data['payload'])) { + continue; + } + + try { + $job = unserialize((string) $data['payload']); + } catch (\Throwable) { + $job = null; + } + + if ($job instanceof JobInterface) { + $job->delay(max(0, (int) ($data['available_at'] ?? 0) - time())); + $this->push($job); + } + } } /** @@ -387,4 +500,115 @@ public function __destruct() { $this->disconnect(); } + + // KEYS: ready, delayed, reserved, data, queues, index + // ARGV: id, json, queue, available_at, delayed(0|1) + protected const SCRIPT_PUSH = <<<'LUA' +redis.call('HSET', KEYS[4], ARGV[1], ARGV[2]) +redis.call('HSET', KEYS[6], ARGV[1], ARGV[3]) +redis.call('SADD', KEYS[5], ARGV[3]) +if ARGV[5] == '1' then + redis.call('ZADD', KEYS[2], ARGV[4], ARGV[1]) +else + redis.call('RPUSH', KEYS[1], ARGV[1]) +end +return 1 +LUA; + + // ARGV: now, stale_before + protected const SCRIPT_POP = <<<'LUA' +local now = tonumber(ARGV[1]) +local due = redis.call('ZRANGEBYSCORE', KEYS[2], '-inf', now, 'LIMIT', 0, 100) +for _, id in ipairs(due) do + redis.call('ZREM', KEYS[2], id) + redis.call('RPUSH', KEYS[1], id) +end +local stale = redis.call('ZRANGEBYSCORE', KEYS[3], '-inf', '(' .. ARGV[2], 'LIMIT', 0, 100) +for _, id in ipairs(stale) do + redis.call('ZREM', KEYS[3], id) + redis.call('RPUSH', KEYS[1], id) +end +while true do + local id = redis.call('LPOP', KEYS[1]) + if not id then + return false + end + local data = redis.call('HGET', KEYS[4], id) + if data then + redis.call('ZADD', KEYS[3], now, id) + return {id, data} + end +end +LUA; + + // ARGV: id + protected const SCRIPT_DELETE = <<<'LUA' +local removed = redis.call('HDEL', KEYS[4], ARGV[1]) +redis.call('ZREM', KEYS[3], ARGV[1]) +redis.call('ZREM', KEYS[2], ARGV[1]) +redis.call('LREM', KEYS[1], 0, ARGV[1]) +redis.call('HDEL', KEYS[6], ARGV[1]) +return removed +LUA; + + // ARGV: id, json, queue, available_at, delayed(0|1) + protected const SCRIPT_RELEASE = <<<'LUA' +redis.call('ZREM', KEYS[3], ARGV[1]) +redis.call('LREM', KEYS[1], 0, ARGV[1]) +redis.call('ZREM', KEYS[2], ARGV[1]) +redis.call('HSET', KEYS[4], ARGV[1], ARGV[2]) +redis.call('HSET', KEYS[6], ARGV[1], ARGV[3]) +redis.call('SADD', KEYS[5], ARGV[3]) +if ARGV[5] == '1' then + redis.call('ZADD', KEYS[2], ARGV[4], ARGV[1]) +else + redis.call('RPUSH', KEYS[1], ARGV[1]) +end +return 1 +LUA; + + protected const SCRIPT_CLEAR = <<<'LUA' +local ids = redis.call('HKEYS', KEYS[4]) +for _, id in ipairs(ids) do + redis.call('HDEL', KEYS[6], id) +end +redis.call('DEL', KEYS[1], KEYS[2], KEYS[3], KEYS[4]) +return #ids +LUA; + + protected const SCRIPT_JOBS = <<<'LUA' +local all = redis.call('HGETALL', KEYS[4]) +local out = {} +for i = 1, #all, 2 do + table.insert(out, all[i]) + table.insert(out, all[i + 1]) + local score = redis.call('ZSCORE', KEYS[3], all[i]) + table.insert(out, score or '') +end +return out +LUA; + + // ARGV: stale_before, limit + protected const SCRIPT_TAKE = <<<'LUA' +local limit = tonumber(ARGV[2]) +local out = {} +local ids = {} +for _, id in ipairs(redis.call('LRANGE', KEYS[1], 0, limit - 1)) do table.insert(ids, id) end +for _, id in ipairs(redis.call('ZRANGE', KEYS[2], 0, limit - 1)) do table.insert(ids, id) end +for _, id in ipairs(redis.call('ZRANGEBYSCORE', KEYS[3], '-inf', '(' .. ARGV[1], 'LIMIT', 0, limit)) do table.insert(ids, id) end +for _, id in ipairs(ids) do + if #out >= limit * 2 then break end + local data = redis.call('HGET', KEYS[4], id) + redis.call('LREM', KEYS[1], 0, id) + redis.call('ZREM', KEYS[2], id) + redis.call('ZREM', KEYS[3], id) + redis.call('HDEL', KEYS[4], id) + redis.call('HDEL', KEYS[6], id) + if data then + table.insert(out, id) + table.insert(out, data) + end +end +return out +LUA; } diff --git a/src/QueueManager.php b/src/QueueManager.php index 94cade4..bd1cecf 100644 --- a/src/QueueManager.php +++ b/src/QueueManager.php @@ -11,6 +11,8 @@ use WPQueue\Queue\MemcachedQueue; use WPQueue\Queue\RedisQueue; use WPQueue\Queue\SyncQueue; +use WPQueue\Support\Options; +use WPQueue\Support\Settings; if (! defined('ABSPATH')) { exit; @@ -20,7 +22,7 @@ * Queue Manager - manages queue connections and drivers. * * Supported drivers: - * - database: Uses wp_options (default) + * - database: {prefix}queue_jobs table (default) * - sync: Synchronous execution (no queue) * - redis: Redis server (requires phpredis extension) * - memcached: Memcached server (requires memcached extension) @@ -82,7 +84,7 @@ public function connection(?string $name = null): QueueInterface * * Priority: * 1. Explicitly set driver via setDefaultDriver() - * 2. WP_QUEUE_DRIVER constant (with availability check) + * 2. WP_QUEUE_DRIVER constant, then the plugin option (admin choice) * 3. 'database' as fallback * * IMPORTANT: If configured driver is not available, falls back to 'database' @@ -90,32 +92,19 @@ public function connection(?string $name = null): QueueInterface */ public function getDefaultDriver(): string { - if ($this->defaultDriver !== null) { - // Even explicitly set driver must be available - if ($this->isDriverReady($this->defaultDriver)) { - return $this->defaultDriver; - } + $driver = $this->defaultDriver ?? Settings::driver()['value']; - return 'database'; + if ($driver === 'auto') { + return $this->detectBestDriver(); } - // Check WP_QUEUE_DRIVER constant - if (defined('WP_QUEUE_DRIVER')) { - $driver = WP_QUEUE_DRIVER; - - if ($driver === 'auto') { - return $this->detectBestDriver(); - } - - // Validate that configured driver is actually ready - if ($this->isDriverReady($driver)) { - return $driver; - } - - return 'database'; + if ($driver === 'database' || $driver === 'sync') { + return $driver; } - return 'database'; + // A configured driver that is not available falls back to the database + // to prevent fatal errors. + return $this->isDriverReady($driver) ? $driver : 'database'; } /** @@ -125,20 +114,63 @@ public function getDefaultDriver(): string */ public function getConfiguredDriver(): string { - if ($this->defaultDriver !== null) { - return $this->defaultDriver; - } + return $this->defaultDriver ?? Settings::driver()['value']; + } - if (defined('WP_QUEUE_DRIVER')) { - return WP_QUEUE_DRIVER; + public function setDefaultDriver(string $driver): void + { + $this->defaultDriver = $driver; + } + + public const KNOWN_QUEUES_OPTION = 'wp_queue_known_queues'; + + /** + * Remember a queue name so it is listed in the admin even when empty. + */ + public function rememberQueue(string $queue): void + { + if ($queue === '') { + return; } - return 'database'; + $known = Options::get(self::KNOWN_QUEUES_OPTION, []); + $known = is_array($known) ? $known : []; + + if (! in_array($queue, $known, true)) { + $known[] = $queue; + Options::set(self::KNOWN_QUEUES_OPTION, array_values($known)); + } } - public function setDefaultDriver(string $driver): void + /** + * Queue names ever used: registry plus queues seen in the job log. + * + * @return list + */ + public function knownQueues(): array { - $this->defaultDriver = $driver; + $known = Options::get(self::KNOWN_QUEUES_OPTION, []); + $known = is_array($known) ? array_map('strval', $known) : []; + + global $wpdb; + + if (isset($wpdb) && method_exists($wpdb, 'get_col')) { + try { + $table = $wpdb->prefix.'queue_logs'; + $suppress = method_exists($wpdb, 'suppress_errors') ? $wpdb->suppress_errors(true) : false; + $logged = (array) $wpdb->get_col("SELECT DISTINCT queue FROM {$table}"); + + if (method_exists($wpdb, 'suppress_errors')) { + $wpdb->suppress_errors($suppress); + } + + $known = array_merge($known, array_map('strval', $logged)); + } catch (\Throwable) { + // No log table yet. + } + } + + return array_values(array_unique(array_filter($known, static fn (string $q): bool => $q !== ''))); } /** @@ -189,7 +221,8 @@ public function getDriverStatus(string $driver): array 'extension' => true, 'server' => true, 'message' => $driver === 'database' - ? __('Uses wp_options table', 'wp-queue') + /* translators: %s: database table name */ + ? sprintf(__('Jobs are stored in the %s table', 'wp-queue'), ($GLOBALS['wpdb']->prefix ?? 'wp_').'queue_jobs') : __('Synchronous execution (no queue)', 'wp-queue'), ], 'redis' => $this->getRedisStatus(), @@ -519,7 +552,7 @@ public function getAvailableDrivers(): array { $drivers = []; - foreach (['database', 'sync', 'redis', 'memcached'] as $driver) { + foreach (Settings::DRIVERS as $driver) { $status = $this->getDriverStatus($driver); $drivers[$driver] = array_merge($status, [ 'available' => $status['status'] === self::STATUS_READY, @@ -591,12 +624,14 @@ public function discoverQueues(): array // Silently ignore discovery errors; default queue will be used. } + $queues = array_merge($queues, $this->knownQueues()); + // Always include default queue if (! in_array('default', $queues, true)) { array_unshift($queues, 'default'); } - return array_unique($queues); + return array_values(array_unique($queues)); } /** diff --git a/src/Runtime/Runner.php b/src/Runtime/Runner.php new file mode 100644 index 0000000..5d7c7fd --- /dev/null +++ b/src/Runtime/Runner.php @@ -0,0 +1,281 @@ + + */ + public static function all(): array + { + return [self::DAEMON, self::LOOPBACK, self::WP_CRON, self::SYNC]; + } + + /** + * Map legacy WP_QUEUE_RUNTIME_MODE values. + */ + public static function normalize(string $value): string + { + return match ($value) { + 'cron_loopback' => self::LOOPBACK, + 'cron', 'wpcron', 'wp-cron' => self::WP_CRON, + 'system_cron', 'cli' => self::DAEMON, + self::DAEMON, self::LOOPBACK, self::WP_CRON, self::SYNC, self::AUTO => $value, + default => self::AUTO, + }; + } + + public static function active(): string + { + return self::resolve()['runner']; + } + + public static function is(string $runner): bool + { + return self::active() === $runner; + } + + /** + * @return array{runner: string, configured: string, auto: bool, reason: string} + */ + public static function resolve(): array + { + if (self::$resolved !== null) { + return self::$resolved; + } + + $configured = Settings::runner()['value']; + + if ($configured !== self::AUTO) { + $availability = self::availability($configured); + + // A runner disabled by configuration cannot run at all: fall back + // to auto so the queue is still processed by exactly one runner. + if ($availability['available'] || ! $availability['hard']) { + return self::$resolved = [ + 'runner' => $configured, + 'configured' => $configured, + 'auto' => false, + 'reason' => $availability['available'] + ? __('Selected manually.', 'wp-queue') + : sprintf( + /* translators: %s: reason */ + __('Selected manually, but: %s', 'wp-queue'), + $availability['reason'], + ), + ]; + } + } + + foreach (self::all() as $runner) { + $availability = self::availability($runner); + + if ($availability['available']) { + return self::$resolved = [ + 'runner' => $runner, + 'configured' => $configured, + 'auto' => true, + 'reason' => $availability['reason'], + ]; + } + } + + return self::$resolved = [ + 'runner' => self::SYNC, + 'configured' => $configured, + 'auto' => true, + 'reason' => __('No other runner is available.', 'wp-queue'), + ]; + } + + /** + * @return array{available: bool, hard: bool, reason: string} + */ + public static function availability(string $runner): array + { + switch ($runner) { + case self::DAEMON: + $beat = self::heartbeat(self::DAEMON); + + if ($beat !== null && $beat['at'] >= time() - self::HEARTBEAT_TTL) { + return [ + 'available' => true, + 'hard' => false, + /* translators: %s: human time diff */ + 'reason' => sprintf(__('Daemon / system cron is alive: last run %s ago.', 'wp-queue'), self::ago($beat['at'])), + ]; + } + + return [ + 'available' => false, + 'hard' => false, + 'reason' => $beat === null + ? __('No daemon / system cron heartbeat yet.', 'wp-queue') + /* translators: %s: human time diff */ + : sprintf(__('Daemon / system cron heartbeat is stale (%s ago).', 'wp-queue'), self::ago($beat['at'])), + ]; + + case self::LOOPBACK: + $constant = Settings::constant('WP_QUEUE_LOOPBACK'); + + if ($constant !== null && ! $constant) { + return ['available' => false, 'hard' => true, 'reason' => __('Loopback is disabled by WP_QUEUE_LOOPBACK in wp-config.php.', 'wp-queue')]; + } + + $check = Options::transient(self::LOOPBACK_CHECK_TRANSIENT); + + if (is_array($check) && ($check['status'] ?? '') === 'error') { + return [ + 'available' => false, + 'hard' => false, + /* translators: %s: error message */ + 'reason' => sprintf(__('Loopback request failed: %s', 'wp-queue'), (string) ($check['message'] ?? '')), + ]; + } + + return ['available' => true, 'hard' => false, 'reason' => __('Loopback requests to admin-ajax.php work.', 'wp-queue')]; + + case self::WP_CRON: + if (Settings::constant('DISABLE_WP_CRON')) { + return ['available' => false, 'hard' => false, 'reason' => __('WP-Cron is disabled (DISABLE_WP_CRON); it runs only if a system cron calls wp-cron.php.', 'wp-queue')]; + } + + return ['available' => true, 'hard' => false, 'reason' => __('WP-Cron runs on site visits.', 'wp-queue')]; + + case self::SYNC: + return ['available' => true, 'hard' => false, 'reason' => __('Jobs run at the end of the request that dispatched them.', 'wp-queue')]; + } + + return ['available' => false, 'hard' => true, 'reason' => __('Unknown runner.', 'wp-queue')]; + } + + /** + * Record that a runner processed the queues (or that the daemon is present). + */ + public static function beat(string $runner, int $processed = 0, bool $skipped = false): void + { + $beats = Options::get(self::HEARTBEAT_OPTION, []); + $beats = is_array($beats) ? $beats : []; + $beats[$runner] = ['at' => time(), 'processed' => $processed, 'skipped' => $skipped]; + + Options::set(self::HEARTBEAT_OPTION, $beats); + } + + /** + * @return array{at: int, processed: int, skipped: bool}|null + */ + public static function heartbeat(string $runner): ?array + { + $beats = Options::get(self::HEARTBEAT_OPTION, []); + $beat = is_array($beats) ? ($beats[$runner] ?? null) : null; + + if (! is_array($beat) || ! isset($beat['at'])) { + return null; + } + + return [ + 'at' => (int) $beat['at'], + 'processed' => (int) ($beat['processed'] ?? 0), + 'skipped' => (bool) ($beat['skipped'] ?? false), + ]; + } + + /** + * Whether `wp queue work` may process jobs: the daemon is the active runner, + * or the runner is "auto" (a running worker makes the daemon available). + */ + public static function cliWorkerAllowed(): bool + { + $configured = Settings::runner()['value']; + + return $configured === self::AUTO || $configured === self::DAEMON || self::active() === self::DAEMON; + } + + public static function label(string $runner): string + { + return match ($runner) { + self::AUTO => __('Auto', 'wp-queue'), + self::DAEMON => __('Daemon / system cron', 'wp-queue'), + self::LOOPBACK => __('Loopback (admin-ajax)', 'wp-queue'), + self::WP_CRON => __('WP-Cron', 'wp-queue'), + self::SYNC => __('Synchronous (in request)', 'wp-queue'), + default => $runner, + }; + } + + public static function hint(string $runner): string + { + return match ($runner) { + self::AUTO => __('Uses the fastest available runner: daemon / system cron if its heartbeat is fresh, then loopback, WP-Cron, synchronous.', 'wp-queue'), + self::DAEMON => __('Fastest and most reliable. A system cron runs `wp queue work` every minute (or a daemon runs continuously). WP-Cron and loopback are not used.', 'wp-queue'), + self::LOOPBACK => __('After a job is dispatched, a non-blocking request to admin-ajax.php starts a worker, like Action Scheduler. Good for shared hosting. Delayed jobs run on the next dispatch.', 'wp-queue'), + self::WP_CRON => __('WP-Cron checks the queue every minute; needs site traffic or a system cron calling wp-cron.php.', 'wp-queue'), + self::SYNC => __('Jobs run at the end of the request that dispatched them. No background processing; slows that request down.', 'wp-queue'), + default => '', + }; + } + + public static function reset(): void + { + self::$resolved = null; + } + + public static function ago(int $timestamp): string + { + $diff = max(0, time() - $timestamp); + + return match (true) { + /* translators: %d: seconds */ + $diff < 120 => sprintf(__('%d s', 'wp-queue'), $diff), + /* translators: %d: minutes */ + $diff < 7200 => sprintf(__('%d min', 'wp-queue'), intdiv($diff, 60)), + /* translators: %d: hours */ + default => sprintf(__('%d h', 'wp-queue'), intdiv($diff, 3600)), + }; + } +} diff --git a/src/Runtime/RuntimeMode.php b/src/Runtime/RuntimeMode.php index dbcd9fb..8940342 100644 --- a/src/Runtime/RuntimeMode.php +++ b/src/Runtime/RuntimeMode.php @@ -8,6 +8,9 @@ exit; } +/** + * Backward-compatible facade over Runner (WP Queue <= 1.3). + */ final class RuntimeMode { public const MODE_CRON_LOOPBACK = 'cron_loopback'; @@ -18,19 +21,15 @@ final class RuntimeMode public static function get(): string { - if (defined('WP_QUEUE_RUNTIME_MODE')) { - $mode = (string) WP_QUEUE_RUNTIME_MODE; - if (self::isValid($mode)) { - return $mode; - } - } - - return apply_filters('wp_queue_runtime_mode', self::MODE_CRON_LOOPBACK); + return match (Runner::active()) { + Runner::DAEMON => self::MODE_DAEMON, + default => self::MODE_CRON_LOOPBACK, + }; } public static function useLoopback(): bool { - return self::resolveMode() === self::MODE_CRON_LOOPBACK; + return Runner::is(Runner::LOOPBACK); } /** @@ -38,21 +37,12 @@ public static function useLoopback(): bool */ public static function useCron(): bool { - return self::resolveMode() !== self::MODE_DAEMON; + return Runner::is(Runner::WP_CRON); } - /** - * Resolve the effective runtime mode. - */ public static function resolveMode(): string { - $mode = self::get(); - - if ($mode === self::MODE_AUTO) { - $mode = self::resolveAuto(); - } - - return $mode; + return self::get(); } public static function isDaemonProcess(): bool @@ -60,16 +50,13 @@ public static function isDaemonProcess(): bool if (defined('WP_QUEUE_DAEMON') && WP_QUEUE_DAEMON) { return true; } - if (getenv('WP_QUEUE_DAEMON') === '1') { - return true; - } - return false; + return getenv('WP_QUEUE_DAEMON') === '1'; } public static function resolveAuto(): string { - return self::isDaemonProcess() ? self::MODE_DAEMON : self::MODE_CRON_LOOPBACK; + return self::get(); } public static function isValid(string $mode): bool diff --git a/src/Runtime/Trigger.php b/src/Runtime/Trigger.php new file mode 100644 index 0000000..a1f37c3 --- /dev/null +++ b/src/Runtime/Trigger.php @@ -0,0 +1,145 @@ + dispatches per queue in this request */ + private static array $loopbackQueues = []; + + public static function afterDispatch(string $queue): void + { + switch (Runner::active()) { + case Runner::LOOPBACK: + self::loopback($queue); + break; + + case Runner::WP_CRON: + self::wpCron($queue); + break; + + case Runner::SYNC: + self::sync($queue); + break; + + default: + // Daemon / system cron polls the queue itself. + break; + } + } + + /** + * Start a worker right away; if more jobs follow in the same request, + * poke it once more at shutdown, after the last push, so a worker that + * started early does not leave the rest waiting for the next dispatch. + */ + private static function loopback(string $queue): void + { + $first = self::$loopbackQueues === []; + self::$loopbackQueues[$queue] = (self::$loopbackQueues[$queue] ?? 0) + 1; + + LoopbackDispatcher::spawn($queue); + + if (! $first) { + return; + } + + register_shutdown_function(static function (): void { + foreach (self::$loopbackQueues as $name => $count) { + if ($count > 1) { + LoopbackDispatcher::forget($name); + LoopbackDispatcher::spawn($name); + } + } + }); + } + + private static function wpCron(string $queue): void + { + if (! function_exists('wp_schedule_single_event') || ! function_exists('wp_next_scheduled')) { + return; + } + + if (wp_next_scheduled('wp_queue_process', [$queue]) === false) { + wp_schedule_single_event(time(), 'wp_queue_process', [$queue]); + } + + // With DISABLE_WP_CRON the site runs cron from the system scheduler: + // spawning wp-cron.php here would execute every due hook, not only ours. + // WordPress never spawns cron from WP-CLI: the non-blocking request may be + // dropped when the process exits and its lock would hold WP-Cron for a minute. + if (Settings::constant('DISABLE_WP_CRON') || Settings::constant('WP_CLI') || ! function_exists('spawn_cron') || self::$cronShutdownRegistered) { + return; + } + + self::$cronShutdownRegistered = true; + + register_shutdown_function(static function (): void { + if (! self::$cronShutdownRegistered) { + return; // cancelled by reset() + } + + try { + spawn_cron(); + } catch (\Throwable $e) { + error_log('WP Queue: spawn_cron failed: '.$e->getMessage()); + } + }); + } + + private static function sync(string $queue): void + { + self::$syncQueue ??= $queue; + + if (self::$syncShutdownRegistered) { + return; + } + + self::$syncShutdownRegistered = true; + + register_shutdown_function(static function (): void { + if (! self::$syncShutdownRegistered) { + return; // cancelled by reset() + } + + WPQueue::processQueues(self::$syncQueue ?? 'default', 50, 25, Runner::SYNC); + }); + } + + /** + * Pending shutdown work registered in this request (for tests/diagnostics). + * + * @return array{spawn_cron: bool, sync: bool} + */ + public static function state(): array + { + return ['spawn_cron' => self::$cronShutdownRegistered, 'sync' => self::$syncShutdownRegistered]; + } + + public static function reset(): void + { + self::$cronShutdownRegistered = false; + self::$syncShutdownRegistered = false; + self::$syncQueue = null; + self::$loopbackQueues = []; + } +} diff --git a/src/Support/ConfigFile.php b/src/Support/ConfigFile.php new file mode 100644 index 0000000..78c44d6 --- /dev/null +++ b/src/Support/ConfigFile.php @@ -0,0 +1,425 @@ +): (true|string))|null + */ + public static $verifier = null; + + /** + * @var array|null + */ + private static ?array $managedCache = null; + + /** + * Block contents as loaded at the start of this request, once the file + * has been rewritten (their runtime constants are stale after that). + * + * @var array|null + */ + private static ?array $loadedManaged = null; + + public static function path(): ?string + { + if (self::$path !== null) { + return self::$path; + } + + if (! defined('ABSPATH')) { + return null; + } + + if (file_exists(ABSPATH.'wp-config.php')) { + return ABSPATH.'wp-config.php'; + } + + $parent = dirname(ABSPATH).'/wp-config.php'; + + if (file_exists($parent) && ! file_exists(dirname(ABSPATH).'/wp-settings.php')) { + return $parent; + } + + return null; + } + + /** + * Constants defined inside the managed block. + * + * @return array + */ + public static function managedValues(): array + { + if (self::$managedCache !== null) { + return self::$managedCache; + } + + $path = self::path(); + $content = $path !== null && is_readable($path) ? (string) file_get_contents($path) : ''; + + return self::$managedCache = self::parse($content); + } + + /** + * @return array + */ + public static function parse(string $content): array + { + $block = self::extractBlock($content); + + if ($block === null) { + return []; + } + + preg_match_all( + "/define\\(\\s*'(WP_QUEUE_[A-Z_]+)'\\s*,\\s*(?:'([^']*)'|(true|false))\\s*\\)\\s*;/i", + $block, + $matches, + PREG_SET_ORDER, + ); + + $values = []; + + foreach ($matches as $match) { + $values[$match[1]] = isset($match[3]) && $match[3] !== '' + ? strtolower($match[3]) === 'true' + : $match[2]; + } + + return $values; + } + + public static function hasBlock(?string $content = null): bool + { + if ($content === null) { + $path = self::path(); + $content = $path !== null && is_readable($path) ? (string) file_get_contents($path) : ''; + } + + return self::extractBlock($content) !== null; + } + + /** + * @param array $defines + */ + public static function block(array $defines): string + { + $lines = [self::BEGIN, '// Managed by WP Queue (Tools > Queues). Edit in the admin or here.']; + + foreach ($defines as $name => $value) { + if (! preg_match('/^WP_QUEUE_[A-Z_]+$/', (string) $name)) { + continue; + } + + $export = is_bool($value) ? ($value ? 'true' : 'false') : "'".str_replace(['\\', "'"], ['\\\\', "\\'"], (string) $value)."'"; + $lines[] = sprintf("define('%s', %s);", $name, $export); + } + + $lines[] = self::END; + + return implode("\n", $lines)."\n"; + } + + /** + * Content with the managed block replaced/inserted (or removed if empty). + * + * @param array $defines + */ + public static function render(string $content, array $defines): ?string + { + $pattern = '/^[ \t]*'.preg_quote(self::BEGIN, '/').'.*?^[ \t]*'.preg_quote(self::END, '/')."[^\n]*\n?(\n)?/ms"; + $block = $defines === [] ? '' : self::block($defines); + + if (preg_match($pattern, $content)) { + // The blank line written after the block goes away with it. + return (string) preg_replace_callback( + $pattern, + static fn (array $m): string => $block === '' ? '' : $block.($m[1] ?? ''), + $content, + 1, + ); + } + + if ($block === '') { + return $content; + } + + // Insert before "That's all, stop editing!" or before wp-settings.php is loaded. + $anchors = [ + "/^.*That's all, stop editing.*$/mi", + "/^.*require(?:_once)?\\s*\\(?\\s*ABSPATH\\s*\\.\\s*['\"]wp-settings\\.php['\"].*$/mi", + ]; + + foreach ($anchors as $anchor) { + if (preg_match($anchor, $content, $match, PREG_OFFSET_CAPTURE)) { + $offset = (int) $match[0][1]; + + return substr($content, 0, $offset).$block."\n".substr($content, $offset); + } + } + + return null; + } + + /** + * @param array $defines + * @return array{ok: bool, message: string, snippet?: string} + */ + public static function write(array $defines): array + { + $before = self::managedValues(); + $snippet = self::block($defines); + $path = self::path(); + + $fail = static fn (string $message): array => ['ok' => false, 'message' => $message, 'snippet' => $snippet]; + + if ($path === null) { + return $fail(__('wp-config.php was not found.', 'wp-queue')); + } + + $dir = dirname($path); + + if (! is_writable($path) || ! is_writable($dir)) { + return $fail(__('wp-config.php (or its directory) is not writable. Paste this block into wp-config.php manually, above the "That\'s all, stop editing!" line:', 'wp-queue')); + } + + $content = (string) file_get_contents($path); + $new = self::render($content, $defines); + + if ($new === null) { + return $fail(__('Could not find where to insert the block in wp-config.php. Add it manually above the "That\'s all, stop editing!" line:', 'wp-queue')); + } + + if ($new === $content) { + return ['ok' => true, 'message' => __('wp-config.php is already up to date.', 'wp-queue')]; + } + + if (! self::syntaxOk($new)) { + return $fail(__('The resulting wp-config.php would not be valid PHP; nothing was changed.', 'wp-queue')); + } + + $perms = fileperms($path) & 0777; + $owner = fileowner($path); + $group = filegroup($path); + $suffix = bin2hex(random_bytes(4)); + // ".php" suffix: if the web server exposes the directory, the file is + // executed rather than served as text, so secrets do not leak. + $backup = $dir.'/.wp-config.wp-queue-backup-'.$suffix.'.php'; + $tmp = $dir.'/.wp-config.wp-queue-tmp-'.$suffix.'.php'; + + if (! @copy($path, $backup)) { + return $fail(__('Could not create a backup of wp-config.php; nothing was changed.', 'wp-queue')); + } + + @chmod($backup, $perms & 0770); + + if (@file_put_contents($tmp, $new, LOCK_EX) !== strlen($new)) { + @unlink($tmp); + @unlink($backup); + + return $fail(__('Could not write a temporary file next to wp-config.php; nothing was changed.', 'wp-queue')); + } + + @chmod($tmp, $perms); + + if (function_exists('posix_geteuid') && fileowner($tmp) !== $owner) { + @chown($tmp, $owner); + } + + if (filegroup($tmp) !== $group) { + @chgrp($tmp, $group); + } + + clearstatcache(true, $tmp); + + if (fileowner($tmp) !== $owner || filegroup($tmp) !== $group || (fileperms($tmp) & 0777) !== $perms) { + @unlink($tmp); + @unlink($backup); + + return $fail(__('Could not keep the owner/permissions of wp-config.php; nothing was changed. Paste the block manually:', 'wp-queue')); + } + + if (! @rename($tmp, $path)) { + @unlink($tmp); + @unlink($backup); + + return $fail(__('Could not replace wp-config.php (read-only or bind-mounted file); nothing was changed. Paste the block manually:', 'wp-queue')); + } + + self::$managedCache = null; + self::$loadedManaged ??= $before; + + if (function_exists('opcache_invalidate')) { + @opcache_invalidate($path, true); + } + + $verified = self::verify($defines); + + if ($verified !== true) { + @rename($backup, $path); + + if (function_exists('opcache_invalidate')) { + @opcache_invalidate($path, true); + } + + self::$managedCache = null; + + return $fail(sprintf( + /* translators: %s: error */ + __('WordPress did not load with the new wp-config.php (%s); the previous file was restored.', 'wp-queue'), + $verified, + )); + } + + @unlink($backup); + + return ['ok' => true, 'message' => __('wp-config.php updated and verified.', 'wp-queue')]; + } + + public static function syntaxOk(string $php): bool + { + try { + token_get_all($php, TOKEN_PARSE); + + return true; + } catch (\ParseError) { + return false; + } + } + + /** + * Ask a fresh WordPress request which managed constants it sees. + * + * @param array $defines + */ + private static function verify(array $defines): true|string + { + if (self::$verifier !== null) { + return (self::$verifier)($defines); + } + + $token = bin2hex(random_bytes(16)); + set_transient(self::PROBE_TRANSIENT, $token, 120); + + $response = wp_remote_post(admin_url('admin-ajax.php'), [ + 'timeout' => 15, + 'sslverify' => apply_filters('https_local_ssl_verify', false), + 'body' => ['action' => self::PROBE_ACTION, 'token' => $token], + ]); + + delete_transient(self::PROBE_TRANSIENT); + + if (is_wp_error($response)) { + return $response->get_error_message(); + } + + $code = (int) wp_remote_retrieve_response_code($response); + $data = json_decode((string) wp_remote_retrieve_body($response), true); + + if ($code !== 200 || ! is_array($data) || ! isset($data['constants'])) { + /* translators: %d: HTTP status */ + return sprintf(__('HTTP %d', 'wp-queue'), $code); + } + + foreach ($defines as $name => $value) { + if (($data['constants'][$name] ?? null) !== $value) { + /* translators: %s: constant name */ + return sprintf(__('%s has an unexpected value', 'wp-queue'), $name); + } + } + + return true; + } + + /** + * admin-ajax handler for the verification request. + */ + public static function handleProbe(): void + { + $token = isset($_POST['token']) ? sanitize_text_field(wp_unslash($_POST['token'])) : ''; + $expected = get_transient(self::PROBE_TRANSIENT); + + if (! is_string($expected) || $token === '' || ! hash_equals($expected, $token)) { + wp_send_json(['error' => 'forbidden'], 403); + } + + $constants = []; + + foreach (array_keys(self::managedValues()) as $name) { + $constants[$name] = defined($name) ? constant($name) : null; + } + + wp_send_json(['constants' => $constants]); + } + + /** + * Whether the block was rewritten during this request. + */ + public static function rewritten(): bool + { + return self::$loadedManaged !== null; + } + + /** + * Names whose runtime constant came from the block and may no longer match the file. + * + * @return list + */ + public static function staleNames(): array + { + return self::$loadedManaged === null ? [] : array_keys(self::$loadedManaged); + } + + public static function resetCache(): void + { + self::$managedCache = null; + self::$loadedManaged = null; + } + + private static function extractBlock(string $content): ?string + { + $begin = strpos($content, self::BEGIN); + + if ($begin === false) { + return null; + } + + $end = strpos($content, self::END, $begin); + + return $end === false ? null : substr($content, $begin, $end - $begin); + } +} diff --git a/src/Support/DriverSwitcher.php b/src/Support/DriverSwitcher.php new file mode 100644 index 0000000..7fe06c2 --- /dev/null +++ b/src/Support/DriverSwitcher.php @@ -0,0 +1,206 @@ + false, 'message' => __('Unknown storage driver.', 'wp-queue')]; + } + + if (Settings::isLocked('driver')) { + return ['ok' => false, 'message' => __('The storage driver is defined in wp-config.php and cannot be changed here.', 'wp-queue')]; + } + + $current = $this->manager->getDefaultDriver(); + + if ($current === $driver && $toConfig === null) { + return ['ok' => true, 'message' => __('This storage driver is already active.', 'wp-queue'), 'moved' => 0]; + } + + $status = $this->manager->getDriverStatus($driver); + + if ($status['status'] !== QueueManager::STATUS_READY) { + return ['ok' => false, 'message' => sprintf( + /* translators: %s: driver status message */ + __('The storage driver is not available: %s', 'wp-queue'), + $status['message'], + )]; + } + + $token = Lock::acquire(Lock::WORKER, 300); + + if ($token === null) { + return ['ok' => false, 'message' => __('A worker is processing jobs right now. Try again in a minute.', 'wp-queue')]; + } + + try { + $from = $this->manager->connection($current); + $to = $this->manager->connection($driver); + + $check = $this->checkSource($from); + + if ($check !== true) { + return ['ok' => false, 'message' => $check]; + } + + $moved = $current !== $driver && $from instanceof TransferableQueue ? self::move($from, $to) : 0; + + $saved = Settings::persist('driver', $driver, $toConfig); + + if (! $saved['ok']) { + // Put the jobs back where the (unchanged) setting expects them. + if ($to instanceof TransferableQueue && $moved > 0 && $current !== $driver) { + self::move($to, $from); + } + + return $saved; + } + + if ($current !== $driver) { + Options::set(self::PREVIOUS_OPTION, ['driver' => $current, 'until' => time() + 86400]); + } + $this->manager->setDefaultDriver($driver); + Runner::reset(); + + return [ + 'ok' => true, + 'moved' => $moved, + 'message' => sprintf( + /* translators: 1: driver, 2: number of jobs */ + __('Storage driver switched to %1$s. Jobs moved: %2$d.', 'wp-queue'), + $driver, + $moved, + ), + ]; + } finally { + Lock::release(Lock::WORKER, $token); + } + } + + /** + * Move leftovers from the previously active driver (called by workers). + */ + public function drainPrevious(): int + { + $previous = Options::get(self::PREVIOUS_OPTION); + + if (! is_array($previous) || empty($previous['driver'])) { + return 0; + } + + if ((int) ($previous['until'] ?? 0) < time()) { + Options::delete(self::PREVIOUS_OPTION); + + return 0; + } + + $old = (string) $previous['driver']; + $current = $this->manager->getDefaultDriver(); + + if ($old === $current || ! $this->manager->isDriverReady($old)) { + return 0; + } + + try { + $from = $this->manager->connection($old); + } catch (\Throwable) { + return 0; + } + + return $from instanceof TransferableQueue ? self::move($from, $this->manager->connection($current)) : 0; + } + + private function checkSource(QueueInterface $from): true|string + { + if ($from instanceof TransferableQueue) { + foreach ($from->queues() as $queue) { + $reserved = $from->reservedCount($queue); + + if ($reserved > 0) { + return sprintf( + /* translators: 1: number, 2: queue */ + __('%1$d job(s) in queue "%2$s" are being executed. Try again when they finish.', 'wp-queue'), + $reserved, + $queue, + ); + } + } + + return true; + } + + foreach ($this->manager->discoverQueues() as $queue) { + if ($from->size($queue) > 0) { + return __('The current storage driver cannot move its jobs. Wait until its queues are empty, then switch.', 'wp-queue'); + } + } + + return true; + } + + /** + * @return int Number of jobs moved. + */ + public static function move(TransferableQueue $from, QueueInterface $to): int + { + $moved = 0; + + foreach ($from->queues() as $queue) { + do { + $batch = $from->takePending($queue, 200); + + foreach ($batch as $index => $item) { + $job = $item['job']; + $job->delay(max(0, $item['available_at'] - time())); + + try { + $to->push($job); + $moved++; + } catch (\Throwable $e) { + // Return this and the remaining jobs to the source. + foreach (array_slice($batch, $index) as $rest) { + $rest['job']->delay(max(0, $rest['available_at'] - time())); + $from instanceof QueueInterface ? $from->push($rest['job']) : null; + } + + throw $e; + } + } + } while (count($batch) === 200); + } + + return $moved; + } +} diff --git a/src/Support/Options.php b/src/Support/Options.php new file mode 100644 index 0000000..6a78b15 --- /dev/null +++ b/src/Support/Options.php @@ -0,0 +1,88 @@ +|null + */ + private static ?array $memory = null; + + public static function useMemory(array $values = []): void + { + self::$memory = $values; + } + + public static function useWordPress(): void + { + self::$memory = null; + } + + public static function get(string $name, mixed $default = false): mixed + { + if (self::$memory !== null) { + return array_key_exists($name, self::$memory) ? self::$memory[$name] : $default; + } + + return function_exists('get_option') ? get_option($name, $default) : $default; + } + + public static function set(string $name, mixed $value, bool $autoload = false): void + { + if (self::$memory !== null) { + self::$memory[$name] = $value; + + return; + } + + if (function_exists('update_option')) { + update_option($name, $value, $autoload); + } + } + + public static function delete(string $name): void + { + if (self::$memory !== null) { + unset(self::$memory[$name]); + + return; + } + + if (function_exists('delete_option')) { + delete_option($name); + } + } + + public static function transient(string $name): mixed + { + if (self::$memory !== null) { + return self::$memory['_transient_'.$name] ?? false; + } + + return function_exists('get_transient') ? get_transient($name) : false; + } + + public static function setTransient(string $name, mixed $value, int $ttl): void + { + if (self::$memory !== null) { + self::$memory['_transient_'.$name] = $value; + + return; + } + + if (function_exists('set_transient')) { + set_transient($name, $value, $ttl); + } + } +} diff --git a/src/Support/Settings.php b/src/Support/Settings.php new file mode 100644 index 0000000..0deb60f --- /dev/null +++ b/src/Support/Settings.php @@ -0,0 +1,199 @@ + plugin option > default. + * A constant written by WP Queue itself (inside the `// BEGIN WP Queue` block of + * wp-config.php) stays editable from the admin; any other constant locks the field. + */ +final class Settings +{ + public const OPTION = 'wp_queue_settings'; + + public const SOURCE_CONSTANT = 'constant'; + + public const SOURCE_MANAGED = 'managed'; + + public const SOURCE_OPTION = 'option'; + + public const SOURCE_DEFAULT = 'default'; + + public const DRIVERS = ['database', 'redis', 'memcached']; + + /** + * Setting => wp-config constants that define it (first defined wins). + */ + public const CONSTANTS = [ + 'driver' => ['WP_QUEUE_DRIVER'], + 'runner' => ['WP_QUEUE_RUNNER', 'WP_QUEUE_RUNTIME_MODE'], + ]; + + /** + * Test seam: replaces defined()/constant(). + * + * @var (callable(string): mixed)|null + */ + public static $constantReader = null; + + /** + * @return array{value: string, source: string, constant: string|null} + */ + public static function driver(): array + { + return self::resolve('driver', 'database'); + } + + /** + * @return array{value: string, source: string, constant: string|null} + */ + public static function runner(): array + { + $resolved = self::resolve('runner', Runner::AUTO); + $resolved['value'] = Runner::normalize($resolved['value']); + + return $resolved; + } + + /** + * @return array{value: string, source: string, constant: string|null} + */ + public static function resolve(string $key, string $default): array + { + foreach (self::CONSTANTS[$key] ?? [] as $name) { + if (ConfigFile::rewritten()) { + // The block was rewritten in this request: the file is the truth. + $managed = ConfigFile::managedValues(); + + if (array_key_exists($name, $managed)) { + return ['value' => (string) $managed[$name], 'source' => self::SOURCE_MANAGED, 'constant' => $name]; + } + + if (in_array($name, ConfigFile::staleNames(), true)) { + continue; + } + } + + $value = self::constant($name); + + if ($value !== null && $value !== '') { + $managed = ConfigFile::managedValues(); + $source = array_key_exists($name, $managed) && (string) $managed[$name] === (string) $value + ? self::SOURCE_MANAGED + : self::SOURCE_CONSTANT; + + return ['value' => (string) $value, 'source' => $source, 'constant' => $name]; + } + } + + $option = self::option(); + + if (isset($option[$key]) && is_string($option[$key]) && $option[$key] !== '') { + return ['value' => $option[$key], 'source' => self::SOURCE_OPTION, 'constant' => null]; + } + + return ['value' => $default, 'source' => self::SOURCE_DEFAULT, 'constant' => null]; + } + + public static function isLocked(string $key): bool + { + $resolved = $key === 'runner' ? self::runner() : self::driver(); + + return $resolved['source'] === self::SOURCE_CONSTANT; + } + + /** + * @return array + */ + public static function option(): array + { + $value = Options::get(self::OPTION, []); + + return is_array($value) ? $value : []; + } + + /** + * @param array $values + */ + public static function updateOption(array $values): void + { + Options::set(self::OPTION, array_merge(self::option(), $values), true); + } + + /** + * Persist a setting. + * + * $toConfig: true — store it in WP Queue's block of wp-config.php, + * false — store it in the plugin option (removing it from the block), + * null — keep it where it is now. + * + * @return array{ok: bool, message: string, snippet?: string} + */ + public static function persist(string $key, string $value, ?bool $toConfig = null): array + { + $resolved = $key === 'runner' ? self::runner() : self::driver(); + + if ($resolved['source'] === self::SOURCE_CONSTANT) { + return [ + 'ok' => false, + /* translators: %s: constant name */ + 'message' => sprintf(__('Defined in wp-config.php (%s). Change it there.', 'wp-queue'), (string) $resolved['constant']), + ]; + } + + $isManaged = $resolved['source'] === self::SOURCE_MANAGED; + $toConfig ??= $isManaged; + $constant = $resolved['constant'] ?? self::CONSTANTS[$key][0]; + + if ($toConfig || $isManaged) { + $managed = ConfigFile::managedValues(); + + if ($toConfig) { + $managed[$constant] = $value; + } else { + unset($managed[$constant]); + } + + $result = ConfigFile::write($managed); + + if (! $result['ok']) { + return $result; + } + } + + self::updateOption([$key => $value]); + + return ['ok' => true, 'message' => $toConfig + ? __('Saved to wp-config.php (WP Queue block).', 'wp-queue') + : __('Saved.', 'wp-queue')]; + } + + /** + * Whether the managed block can be written (for the admin checkbox). + */ + public static function configWritable(): bool + { + $path = ConfigFile::path(); + + return $path !== null && is_writable($path) && is_writable(dirname($path)); + } + + public static function constant(string $name): mixed + { + if (self::$constantReader !== null) { + return (self::$constantReader)($name); + } + + return defined($name) ? constant($name) : null; + } +} diff --git a/src/WPQueue.php b/src/WPQueue.php index df2c67d..aa81f96 100644 --- a/src/WPQueue.php +++ b/src/WPQueue.php @@ -6,11 +6,15 @@ use WPQueue\Admin\AdminPage; use WPQueue\Admin\RestApi; +use WPQueue\Admin\SettingsController; +use WPQueue\Admin\SystemStatus; use WPQueue\Contracts\JobInterface; use WPQueue\Jobs\PendingDispatch; use WPQueue\Loopback\LoopbackHandler; -use WPQueue\Runtime\RuntimeMode; +use WPQueue\Runtime\Runner; use WPQueue\Storage\LogStorage; +use WPQueue\Support\ConfigFile; +use WPQueue\Support\DriverSwitcher; use WPQueue\Support\Lock; use WPQueue\Support\Schema; @@ -77,16 +81,16 @@ public static function boot(): void $instance->scheduler->register(); }); - // Register cron handler for processing queues - add_action('wp_queue_process', static function (string $queue = 'default'): void { - self::processQueues($queue, 50, 50); - }); + // Exactly one runner starts workers. Only the WP-Cron runner hooks into + // WP-Cron; only the loopback runner answers admin-ajax requests. + if (Runner::is(Runner::WP_CRON)) { + add_action('wp_queue_process', static function (string $queue = 'default'): void { + self::processQueues($queue, 50, 50, Runner::WP_CRON); + }); + } - // Schedule queue processing (cron / loopback mode). In daemon mode an - // external worker (`wp queue work`) polls the queue, so stale WP-Cron - // events of the plugin are removed instead. add_action('init', static function (): void { - if (! RuntimeMode::useCron()) { + if (! Runner::is(Runner::WP_CRON)) { self::unscheduleProcessing(); return; @@ -100,13 +104,21 @@ public static function boot(): void // Admin UI if (is_admin()) { new AdminPage(); + new SettingsController(); } - // Loopback async handler (must be outside is_admin()) - if (RuntimeMode::useLoopback()) { + if (Runner::is(Runner::LOOPBACK)) { new LoopbackHandler(); } + // Loopback health check (admin-ajax ping; never wp-cron.php). + add_action('wp_ajax_nopriv_'.SystemStatus::PING_ACTION, [SystemStatus::class, 'handlePing']); + add_action('wp_ajax_'.SystemStatus::PING_ACTION, [SystemStatus::class, 'handlePing']); + + // Verification request after WP Queue edited its wp-config.php block. + add_action('wp_ajax_nopriv_'.ConfigFile::PROBE_ACTION, [ConfigFile::class, 'handleProbe']); + add_action('wp_ajax_'.ConfigFile::PROBE_ACTION, [ConfigFile::class, 'handleProbe']); + // REST API (must be outside is_admin() for REST requests to work) new RestApi(); @@ -144,7 +156,7 @@ public static function deactivate(): void public static function install(): void { // Schedule queue processing - if (RuntimeMode::useCron() && ! wp_next_scheduled('wp_queue_process')) { + if (Runner::is(Runner::WP_CRON) && ! wp_next_scheduled('wp_queue_process')) { wp_schedule_event(time(), 'min', 'wp_queue_process'); } @@ -156,9 +168,7 @@ public static function install(): void public static function uninstall(): void { // Отключаем крон - if (RuntimeMode::useCron()) { - wp_clear_scheduled_hook('wp_queue_process'); - } + wp_clear_scheduled_hook('wp_queue_process'); // Удаляем таблицу логов при деактивации global $wpdb; @@ -323,7 +333,7 @@ public static function isProcessing(string $queue = 'default'): bool * * @return int|null Jobs processed, or null when another worker holds the lock. */ - public static function processQueues(string $queue = 'default', int $maxJobs = 50, int $maxTime = 50): ?int + public static function processQueues(string $queue = 'default', int $maxJobs = 50, int $maxTime = 50, ?string $runner = null): ?int { $token = Lock::acquire(Lock::WORKER, $maxTime + 60); @@ -335,6 +345,14 @@ public static function processQueues(string $queue = 'default', int $maxJobs = 5 try { $instance = self::getInstance(); + + // Jobs pushed with the previous storage driver after a switch. + try { + (new DriverSwitcher($instance->manager))->drainPrevious(); + } catch (\Throwable $e) { + error_log('WP Queue: moving jobs from the previous driver failed: '.$e->getMessage()); + } + $instance->worker->setMaxJobs($maxJobs); $instance->worker->setMaxTime($maxTime); $instance->worker->resetJobsProcessed(); @@ -355,6 +373,10 @@ public static function processQueues(string $queue = 'default', int $maxJobs = 5 $processed = $instance->worker->getJobsProcessed(); + if ($runner !== null) { + Runner::beat($runner, $processed); + } + if ($processed > 0) { error_log('WP Queue: Processing completed. Jobs processed: '.$processed); } diff --git a/tests/Pest.php b/tests/Pest.php index 23a6a13..8ec041c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -22,6 +22,21 @@ ->beforeEach(function (): void { $GLOBALS['wpdb'] = new \WPQueue\Tests\Support\SqliteWpdb(); \WPQueue\Support\Schema::markReady(); + \WPQueue\Support\Options::useMemory(); + \Brain\Monkey\Functions\stubTranslationFunctions(); + \WPQueue\Support\Settings::$constantReader = static fn (string $name): mixed => null; + \WPQueue\Support\ConfigFile::$path = null; + \WPQueue\Support\ConfigFile::$verifier = null; + \WPQueue\Support\ConfigFile::resetCache(); + \WPQueue\Runtime\Runner::reset(); + \WPQueue\Runtime\Trigger::reset(); + }) + ->afterEach(function (): void { + \WPQueue\Support\Options::useWordPress(); + \WPQueue\Support\Settings::$constantReader = null; + \WPQueue\Runtime\Runner::reset(); + \WPQueue\Runtime\Trigger::reset(); + \WPQueue\Support\ConfigFile::resetCache(); }) ->in('Unit'); diff --git a/tests/Support/concurrent-redis-worker.php b/tests/Support/concurrent-redis-worker.php new file mode 100644 index 0000000..81fa0c6 --- /dev/null +++ b/tests/Support/concurrent-redis-worker.php @@ -0,0 +1,29 @@ + + */ +if (PHP_SAPI !== 'cli') { + exit; +} + +define('ABSPATH', sys_get_temp_dir().'/'); + +require dirname(__DIR__, 2).'/vendor/autoload.php'; + +if (($client = getenv('WP_QUEUE_TEST_REDIS_CLIENT')) !== false && $client !== '') { + define('WP_REDIS_CLIENT', $client); +} + +$queue = new WPQueue\Queue\RedisQueue(['host' => $argv[1], 'port' => (int) $argv[2], 'prefix' => $argv[3]]); + +while (($job = $queue->pop('parallel')) !== null) { + $job->handle(); + echo $job->getId(), "\n"; + $queue->delete($job->getId()); +} diff --git a/tests/Unit/ConfigFileTest.php b/tests/Unit/ConfigFileTest.php new file mode 100644 index 0000000..4dc44c2 --- /dev/null +++ b/tests/Unit/ConfigFileTest.php @@ -0,0 +1,136 @@ +dir = sys_get_temp_dir().'/wpq-config-'.bin2hex(random_bytes(4)); + mkdir($this->dir); + $this->file = $this->dir.'/wp-config.php'; + $this->original = "file, $this->original); + chmod($this->file, 0640); + ConfigFile::$path = $this->file; + ConfigFile::resetCache(); +}); + +afterEach(function (): void { + @chmod($this->dir, 0755); + array_map('unlink', glob($this->dir.'/{,.}*.php', GLOB_BRACE) ?: []); + @rmdir($this->dir); +}); + +function wpqLeftovers(string $dir): array +{ + return array_values(array_filter( + glob($dir.'/.*.php') ?: [], + static fn (string $f): bool => str_contains($f, 'wp-queue-'), + )); +} + +describe('ConfigFile', function (): void { + it('inserts the block above "stop editing" and keeps the rest intact', function (): void { + ConfigFile::$verifier = static fn (): bool => true; + + $result = ConfigFile::write(['WP_QUEUE_DRIVER' => 'redis', 'WP_QUEUE_LOOPBACK' => false]); + $content = file_get_contents($this->file); + + expect($result['ok'])->toBeTrue() + ->and($content)->toContain("// BEGIN WP Queue\n") + ->and($content)->toContain("define('WP_QUEUE_DRIVER', 'redis');") + ->and($content)->toContain("define('WP_QUEUE_LOOPBACK', false);") + ->and(strpos($content, '// END WP Queue'))->toBeLessThan(strpos($content, "That's all")) + ->and(str_replace(ConfigFile::block(['WP_QUEUE_DRIVER' => 'redis', 'WP_QUEUE_LOOPBACK' => false])."\n", '', $content))->toBe($this->original) + ->and(fileperms($this->file) & 0777)->toBe(0640) + ->and(wpqLeftovers($this->dir))->toBe([]) + ->and(ConfigFile::managedValues())->toBe(['WP_QUEUE_DRIVER' => 'redis', 'WP_QUEUE_LOOPBACK' => false]); + }); + + it('replaces only its own block and removes it when empty', function (): void { + ConfigFile::$verifier = static fn (): bool => true; + + ConfigFile::write(['WP_QUEUE_DRIVER' => 'redis']); + ConfigFile::write(['WP_QUEUE_DRIVER' => 'database']); + $content = file_get_contents($this->file); + + expect(substr_count($content, '// BEGIN WP Queue'))->toBe(1) + ->and($content)->toContain("define('WP_QUEUE_DRIVER', 'database');") + ->and($content)->not->toContain("'redis'"); + + ConfigFile::write([]); + + expect(file_get_contents($this->file))->toBe($this->original); + }); + + it('restores the previous file when WordPress does not load with the new one', function (): void { + ConfigFile::$verifier = static fn (): string => 'HTTP 500'; + + $result = ConfigFile::write(['WP_QUEUE_DRIVER' => 'redis']); + + expect($result['ok'])->toBeFalse() + ->and($result['message'])->toContain('HTTP 500') + ->and($result['snippet'])->toContain("define('WP_QUEUE_DRIVER', 'redis');") + ->and(file_get_contents($this->file))->toBe($this->original) + ->and(fileperms($this->file) & 0777)->toBe(0640) + ->and(wpqLeftovers($this->dir))->toBe([]); + }); + + it('returns a snippet instead of writing when the directory is read-only', function (): void { + if (function_exists('posix_geteuid') && posix_geteuid() === 0) { + $this->markTestSkipped('root ignores permissions'); + } + + chmod($this->dir, 0555); + + $result = ConfigFile::write(['WP_QUEUE_DRIVER' => 'redis']); + + expect($result['ok'])->toBeFalse() + ->and($result['snippet'])->toStartWith('// BEGIN WP Queue') + ->and(file_get_contents($this->file))->toBe($this->original); + }); + + it('never writes invalid PHP and ignores unknown names', function (): void { + expect(ConfigFile::syntaxOk("toBeTrue() + ->and(ConfigFile::syntaxOk("toBeFalse() + ->and(ConfigFile::block(['DB_PASSWORD' => 'x', "WP_QUEUE_X');evil(" => 'y']))->not->toContain('DB_PASSWORD') + ->and(ConfigFile::block(['WP_QUEUE_DRIVER' => "a'b"]))->toContain("'a\\'b'"); + }); +}); + +describe('Settings storage location', function (): void { + it('moves a setting into the block and back to the option', function (): void { + ConfigFile::$verifier = static fn (): bool => true; + + $toConfig = \WPQueue\Support\Settings::persist('runner', 'wp_cron', true); + + expect($toConfig['ok'])->toBeTrue() + ->and(ConfigFile::managedValues())->toBe(['WP_QUEUE_RUNNER' => 'wp_cron']) + ->and(\WPQueue\Support\Settings::runner())->toMatchArray(['value' => 'wp_cron', 'source' => 'managed']); + + // Simulate the next request: the block constant is now defined at runtime. + ConfigFile::resetCache(); + \WPQueue\Support\Settings::$constantReader = static fn (string $name): mixed => $name === 'WP_QUEUE_RUNNER' ? 'wp_cron' : null; + + $back = \WPQueue\Support\Settings::persist('runner', 'daemon', false); + + expect($back['ok'])->toBeTrue() + ->and(ConfigFile::hasBlock())->toBeFalse() + ->and(file_get_contents($this->file))->toBe($this->original) + // The runtime constant is stale after the rewrite; the option wins. + ->and(\WPQueue\Support\Settings::runner())->toMatchArray(['value' => 'daemon', 'source' => 'option']); + }); + + it('keeps a managed setting in the block when the location is not given', function (): void { + ConfigFile::$verifier = static fn (): bool => true; + ConfigFile::write(['WP_QUEUE_DRIVER' => 'database']); + ConfigFile::resetCache(); + \WPQueue\Support\Settings::$constantReader = static fn (string $name): mixed => $name === 'WP_QUEUE_DRIVER' ? 'database' : null; + + $result = \WPQueue\Support\Settings::persist('driver', 'redis'); + + expect($result['ok'])->toBeTrue() + ->and(ConfigFile::managedValues())->toBe(['WP_QUEUE_DRIVER' => 'redis']) + ->and(\WPQueue\Support\Settings::driver())->toMatchArray(['value' => 'redis', 'source' => 'managed']); + }); +}); diff --git a/tests/Unit/DriverSwitcherTest.php b/tests/Unit/DriverSwitcherTest.php new file mode 100644 index 0000000..18525cd --- /dev/null +++ b/tests/Unit/DriverSwitcherTest.php @@ -0,0 +1,148 @@ + */ + public array $jobs = []; + + public function push(JobInterface $job): string + { + $this->jobs[$job->getId()] = ['job' => $job, 'delay' => $job->getDelay()]; + + return $job->getId(); + } + + public function later(int $delay, JobInterface $job): string + { + return $this->push($job->delay($delay)); + } + + public function pop(string $queue = 'default'): ?JobInterface + { + return null; + } + + public function delete(string $jobId): bool + { + unset($this->jobs[$jobId]); + + return true; + } + + public function release(JobInterface $job, int $delay = 0): void {} + + public function size(string $queue = 'default'): int + { + return count($this->jobs); + } + + public function clear(string $queue = 'default'): int + { + return 0; + } + + public function isEmpty(string $queue = 'default'): bool + { + return $this->jobs === []; + } + }; +} + +describe('DriverSwitcher', function (): void { + it('moves ready and delayed jobs, never jobs being executed', function (): void { + $db = new DatabaseQueue(); + $ready = new ConcurrencyJob(1); + $delayed = (new ConcurrencyJob(2))->delay(300); + $running = new ConcurrencyJob(3); + $db->push($running); + $running = $db->pop('parallel'); // reserved by a worker + $db->push($ready); + $db->push($delayed); + + $target = memoryQueue(); + $moved = DriverSwitcher::move($db, $target); + + expect($moved)->toBe(2) + ->and(array_keys($target->jobs))->toEqualCanonicalizing([$ready->getId(), $delayed->getId()]) + ->and($target->jobs[$delayed->getId()]['delay'])->toBeGreaterThan(290) + ->and($db->size('parallel'))->toBe(1) + ->and($db->reservedCount('parallel'))->toBe(1); + }); + + it('refuses to switch while a worker holds the lock or jobs are running', function (): void { + $manager = new class extends QueueManager + { + public function getDriverStatus(string $driver): array + { + return ['status' => self::STATUS_READY, 'extension' => true, 'server' => true, 'message' => 'ok']; + } + }; + $manager->extend('redis', fn () => memoryQueue()); + + $token = Lock::acquire(Lock::WORKER, 60); + $busy = (new DriverSwitcher($manager))->switchTo('redis'); + Lock::release(Lock::WORKER, $token); + + expect($busy['ok'])->toBeFalse(); + + $db = new DatabaseQueue(); + $db->push(new ConcurrencyJob(4)); + $db->pop('parallel'); + + $running = (new DriverSwitcher($manager))->switchTo('redis'); + + expect($running['ok'])->toBeFalse() + ->and($running['message'])->toContain('parallel') + ->and(Settings::driver()['value'])->toBe('database'); + }); + + it('switches, moves the jobs and remembers the previous driver', function (): void { + $target = memoryQueue(); + $manager = new class extends QueueManager + { + public function getDriverStatus(string $driver): array + { + return ['status' => self::STATUS_READY, 'extension' => true, 'server' => true, 'message' => 'ok']; + } + }; + $manager->extend('redis', fn () => $target); + + $db = new DatabaseQueue(); + $job = new ConcurrencyJob(5); + $db->push($job); + + $result = (new DriverSwitcher($manager))->switchTo('redis'); + + expect($result['ok'])->toBeTrue() + ->and($result['moved'])->toBe(1) + ->and(array_keys($target->jobs))->toBe([$job->getId()]) + ->and($db->size('parallel'))->toBe(0) + ->and(Settings::driver())->toBe(['value' => 'redis', 'source' => Settings::SOURCE_OPTION, 'constant' => null]) + ->and(Options::get(DriverSwitcher::PREVIOUS_OPTION)['driver'])->toBe('database'); + }); + + it('cannot change a driver defined in wp-config.php', function (): void { + Settings::$constantReader = static fn (string $name): mixed => $name === 'WP_QUEUE_DRIVER' ? 'database' : null; + + $result = (new DriverSwitcher(new QueueManager()))->switchTo('redis'); + + expect($result['ok'])->toBeFalse(); + }); +}); diff --git a/tests/Unit/QueueManagerRedisStatusTest.php b/tests/Unit/QueueManagerRedisStatusTest.php index 02858d3..630903a 100644 --- a/tests/Unit/QueueManagerRedisStatusTest.php +++ b/tests/Unit/QueueManagerRedisStatusTest.php @@ -86,7 +86,9 @@ $manager = new QueueManager(); $drivers = $manager->getAvailableDrivers(); - expect($drivers)->toHaveKeys(['database', 'sync', 'redis', 'memcached']); + // Sync is a runner now, not a storage backend. + expect($drivers)->toHaveKeys(['database', 'redis', 'memcached']) + ->and($drivers)->not->toHaveKey('sync'); foreach ($drivers as $name => $info) { expect($info)->toHaveKeys(['status', 'extension', 'server', 'message', 'available']); diff --git a/tests/Unit/RedisQueueTest.php b/tests/Unit/RedisQueueTest.php new file mode 100644 index 0000000..01809e1 --- /dev/null +++ b/tests/Unit/RedisQueueTest.php @@ -0,0 +1,168 @@ + $host, + 'port' => (int) (getenv('WP_QUEUE_TEST_REDIS_PORT') ?: 6379), + 'prefix' => 'wpqtest:'.bin2hex(random_bytes(4)).':', + ]; +} + +function redisTestQueue(array $config): RedisQueue +{ + return new class($config) extends RedisQueue + { + public function wipe(): void + { + foreach (['parallel', 'default'] as $queue) { + $this->clear($queue); + } + + $this->connection()->del(['queues', 'index']); + } + + public function client(): \WPQueue\Queue\Redis\RedisClientInterface + { + return $this->connection(); + } + }; +} + +beforeEach(function (): void { + $this->redisConfig = redisTestConfig(); + + if ($this->redisConfig === null) { + $this->markTestSkipped('Redis server is not configured (WP_QUEUE_TEST_REDIS_HOST).'); + } + + $this->queue = redisTestQueue($this->redisConfig); +}); + +afterEach(function (): void { + if (isset($this->queue)) { + $this->queue->wipe(); + } +}); + +describe('RedisQueue', function (): void { + it('pops each job once and removes it on delete', function (): void { + $job = new ConcurrencyJob(1); + $this->queue->push($job); + + $popped = $this->queue->pop('parallel'); + + expect($popped?->getId())->toBe($job->getId()) + ->and($this->queue->pop('parallel'))->toBeNull() + ->and($this->queue->size('parallel'))->toBe(1) + ->and($this->queue->reservedCount('parallel'))->toBe(1); + + expect($this->queue->delete($job->getId()))->toBeTrue() + ->and($this->queue->size('parallel'))->toBe(0); + }); + + it('keeps delayed jobs until they are due and releases with a delay', function (): void { + $job = (new ConcurrencyJob(2))->delay(60); + $this->queue->push($job); + + expect($this->queue->pop('parallel'))->toBeNull() + ->and($this->queue->size('parallel'))->toBe(1); + + $ready = new ConcurrencyJob(3); + $this->queue->push($ready); + $popped = $this->queue->pop('parallel'); + $this->queue->release($popped, 60); + + expect($this->queue->pop('parallel'))->toBeNull() + ->and($this->queue->stats('parallel')['delayed'])->toBe(2); + }); + + it('re-queues a job abandoned by a crashed worker', function (): void { + $job = new ConcurrencyJob(4); + $this->queue->push($job); + $this->queue->pop('parallel'); + + // Pretend the reservation is older than the stale threshold. + $this->queue->client()->zAdd('q:parallel:reserved', (float) (time() - RedisQueue::STALE_THRESHOLD - 5), $job->getId()); + + expect($this->queue->pop('parallel')?->getId())->toBe($job->getId()); + }); + + it('lists queues and jobs and hands waiting jobs over for a driver switch', function (): void { + $a = new ConcurrencyJob(5); + $b = (new ConcurrencyJob(6))->delay(120); + $c = new ConcurrencyJob(7); + foreach ([$a, $b, $c] as $job) { + $this->queue->push($job); + } + $reserved = $this->queue->pop('parallel'); // $a stays reserved + + expect($this->queue->queues())->toContain('parallel') + ->and(array_keys($this->queue->jobs('parallel')))->toEqualCanonicalizing([$a->getId(), $b->getId(), $c->getId()]); + + $taken = $this->queue->takePending('parallel'); + $ids = array_map(fn (array $item): string => $item['job']->getId(), $taken); + + expect($ids)->toEqualCanonicalizing([$b->getId(), $c->getId()]) + ->and($this->queue->size('parallel'))->toBe(1) + ->and($reserved?->getId())->toBe($a->getId()); + }); + + it('never processes a job twice with parallel worker processes', function (): void { + $ids = []; + for ($i = 0; $i < 120; $i++) { + $job = new ConcurrencyJob($i); + $this->queue->push($job); + $ids[] = $job->getId(); + } + + $script = dirname(__DIR__).'/Support/concurrent-redis-worker.php'; + $processes = []; + $pipes = []; + for ($w = 0; $w < 4; $w++) { + $processes[] = proc_open( + [PHP_BINARY, $script, $this->redisConfig['host'], (string) $this->redisConfig['port'], $this->redisConfig['prefix']], + [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], + $pipes[$w], + ); + } + + $handled = []; + foreach ($processes as $w => $process) { + $out = stream_get_contents($pipes[$w][1]); + $err = stream_get_contents($pipes[$w][2]); + proc_close($process); + expect($err)->toBe(''); + $handled = array_merge($handled, array_filter(explode("\n", $out))); + } + + expect(count($handled))->toBe(120) + ->and(count(array_unique($handled)))->toBe(120) + ->and($handled)->toEqualCanonicalizing($ids) + ->and($this->queue->size('parallel'))->toBe(0); + + expect($this->queue->getConnectionInfo()['client_type'])->toBeIn(['phpredis', 'predis']); + }); +}); diff --git a/tests/Unit/RunnerTest.php b/tests/Unit/RunnerTest.php new file mode 100644 index 0000000..bf22ca7 --- /dev/null +++ b/tests/Unit/RunnerTest.php @@ -0,0 +1,175 @@ + $constants[$name] ?? null; + Runner::reset(); +} + +function selectRunner(string $runner): void +{ + Options::set(Settings::OPTION, ['runner' => $runner]); + Runner::reset(); +} + +describe('Runner auto selection', function (): void { + it('uses the daemon when its heartbeat is fresh', function (): void { + Runner::beat(Runner::DAEMON, 3); + Runner::reset(); + + $resolved = Runner::resolve(); + + expect($resolved['runner'])->toBe(Runner::DAEMON) + ->and($resolved['auto'])->toBeTrue(); + }); + + it('falls back to loopback when the daemon heartbeat is stale', function (): void { + Options::set(Runner::HEARTBEAT_OPTION, [Runner::DAEMON => ['at' => time() - Runner::HEARTBEAT_TTL - 1]]); + Runner::reset(); + + expect(Runner::active())->toBe(Runner::LOOPBACK); + }); + + it('then WP-Cron when loopback fails, then sync when WP-Cron is disabled', function (): void { + Options::setTransient(Runner::LOOPBACK_CHECK_TRANSIENT, ['status' => 'error', 'message' => 'refused'], 60); + Runner::reset(); + expect(Runner::active())->toBe(Runner::WP_CRON); + + withConstants(['DISABLE_WP_CRON' => true]); + expect(Runner::active())->toBe(Runner::SYNC); + }); + + it('treats WP_QUEUE_LOOPBACK=false as loopback unavailable', function (): void { + withConstants(['WP_QUEUE_LOOPBACK' => false]); + + expect(Runner::active())->toBe(Runner::WP_CRON); + }); +}); + +describe('Runner manual selection', function (): void { + it('keeps a manually selected runner even without a heartbeat', function (): void { + selectRunner(Runner::DAEMON); + + $resolved = Runner::resolve(); + + expect($resolved['runner'])->toBe(Runner::DAEMON) + ->and($resolved['auto'])->toBeFalse(); + }); + + it('falls back to auto when the selected runner is disabled in wp-config', function (): void { + Options::set(Settings::OPTION, ['runner' => Runner::LOOPBACK]); + withConstants(['WP_QUEUE_LOOPBACK' => false]); + + expect(Runner::active())->toBe(Runner::WP_CRON); + }); + + it('gives wp-config constants priority and maps legacy values', function (): void { + selectRunner(Runner::SYNC); + withConstants(['WP_QUEUE_RUNTIME_MODE' => 'daemon']); + + expect(Runner::active())->toBe(Runner::DAEMON) + ->and(Settings::runner()['source'])->toBe(Settings::SOURCE_CONSTANT) + ->and(Settings::isLocked('runner'))->toBeTrue() + ->and(Settings::persist('runner', Runner::SYNC)['ok'])->toBeFalse(); + + withConstants(['WP_QUEUE_RUNTIME_MODE' => 'cron_loopback']); + expect(Runner::active())->toBe(Runner::LOOPBACK); + }); + + it('lets the CLI worker run only for daemon or auto', function (): void { + selectRunner(Runner::AUTO); + expect(Runner::cliWorkerAllowed())->toBeTrue(); + + selectRunner(Runner::DAEMON); + expect(Runner::cliWorkerAllowed())->toBeTrue(); + + foreach ([Runner::LOOPBACK, Runner::WP_CRON, Runner::SYNC] as $runner) { + selectRunner($runner); + expect(Runner::cliWorkerAllowed())->toBeFalse(); + } + }); +}); + +describe('Only the selected runner starts workers', function (): void { + beforeEach(function (): void { + $this->calls = ['loopback' => 0, 'schedule' => 0]; + $calls = &$this->calls; + + Functions\when('wp_remote_post')->alias(function () use (&$calls) { + $calls['loopback']++; + + return []; + }); + Functions\when('wp_schedule_single_event')->alias(function () use (&$calls) { + $calls['schedule']++; + + return true; + }); + Functions\when('wp_next_scheduled')->justReturn(false); + Functions\when('spawn_cron')->justReturn(null); + Functions\when('admin_url')->justReturn('https://example.com/wp-admin/admin-ajax.php'); + Functions\when('add_query_arg')->alias(fn (array $args, string $url) => $url.'?'.http_build_query($args)); + Functions\when('wp_create_nonce')->justReturn('nonce'); + Functions\when('esc_url_raw')->returnArg(); + Functions\when('home_url')->justReturn('https://example.com'); + Functions\when('apply_filters')->alias(fn ($hook, $value) => $value); + Functions\when('is_wp_error')->justReturn(false); + }); + + it('starts work only through the active runner', function (string $runner, array $expected): void { + selectRunner($runner); + Trigger::reset(); + + // LoopbackDispatcher remembers spawned queues per request. + LoopbackDispatcher::forget('q-'.$runner); + Trigger::afterDispatch('q-'.$runner); + + expect($this->calls['loopback'])->toBe($expected['loopback']) + ->and($this->calls['schedule'])->toBe($expected['schedule']) + ->and(Trigger::state())->toBe($expected['state']) + ->and(LoopbackDispatcher::isEnabled())->toBe($runner === Runner::LOOPBACK); + })->with([ + 'daemon' => [Runner::DAEMON, ['loopback' => 0, 'schedule' => 0, 'state' => ['spawn_cron' => false, 'sync' => false]]], + 'loopback' => [Runner::LOOPBACK, ['loopback' => 1, 'schedule' => 0, 'state' => ['spawn_cron' => false, 'sync' => false]]], + 'wp_cron' => [Runner::WP_CRON, ['loopback' => 0, 'schedule' => 1, 'state' => ['spawn_cron' => true, 'sync' => false]]], + 'sync' => [Runner::SYNC, ['loopback' => 0, 'schedule' => 0, 'state' => ['spawn_cron' => false, 'sync' => true]]], + ]); + + it('does not spawn wp-cron.php with DISABLE_WP_CRON', function (): void { + selectRunner(Runner::WP_CRON); + withConstants(['DISABLE_WP_CRON' => true]); + Trigger::reset(); + + Trigger::afterDispatch('default'); + + expect($this->calls['schedule'])->toBe(1) + ->and(Trigger::state()['spawn_cron'])->toBeFalse(); + }); +}); + +describe('Settings sources', function (): void { + it('treats a constant inside the WP Queue block as editable', function (): void { + $dir = sys_get_temp_dir().'/wpq-settings-'.bin2hex(random_bytes(3)); + mkdir($dir); + file_put_contents($dir.'/wp-config.php', " 'daemon'])."/* That's all, stop editing! */\n"); + ConfigFile::$path = $dir.'/wp-config.php'; + ConfigFile::resetCache(); + withConstants(['WP_QUEUE_RUNNER' => 'daemon']); + + expect(Settings::runner()['source'])->toBe(Settings::SOURCE_MANAGED) + ->and(Settings::isLocked('runner'))->toBeFalse(); + + array_map('unlink', glob($dir.'/{,.}*.php', GLOB_BRACE) ?: []); + rmdir($dir); + }); +}); diff --git a/tests/Unit/SystemStatusTest.php b/tests/Unit/SystemStatusTest.php index 62c3467..5165f2f 100644 --- a/tests/Unit/SystemStatusTest.php +++ b/tests/Unit/SystemStatusTest.php @@ -12,6 +12,8 @@ 'site_url' => fn () => 'http://example.com/wp-cron.php', 'wp_remote_post' => fn () => ['response' => ['code' => 200]], 'wp_remote_retrieve_response_code' => fn ($response) => $response['response']['code'] ?? 0, + 'wp_remote_retrieve_body' => fn () => 'wp-queue-pong', + 'admin_url' => fn ($path = '') => 'http://example.com/wp-admin/'.$path, 'is_wp_error' => fn ($thing) => false, 'get_option' => fn ($key, $default = false) => $default, 'size_format' => fn ($bytes) => round($bytes / 1024 / 1024, 2).' MB', @@ -86,6 +88,25 @@ expect($loopback['status'])->toBe('ok'); }); + it('never requests wp-cron.php for the loopback check', function (): void { + $requested = null; + + Brain\Monkey\Functions\stubs([ + 'apply_filters' => fn ($filter, $value) => $value, + 'wp_remote_post' => function ($url, $args) use (&$requested) { + $requested = [$url, $args['body']]; + + return ['response' => ['code' => 200]]; + }, + ]); + + (new SystemStatus())->checkLoopback(); + + expect($requested[0])->toContain('admin-ajax.php') + ->and($requested[0])->not->toContain('wp-cron.php') + ->and($requested[1])->toBe(['action' => SystemStatus::PING_ACTION]); + }); + it('detects unexpected response code as warning', function (): void { Brain\Monkey\Functions\stubs([ 'apply_filters' => fn ($filter, $value) => $value, diff --git a/wp-queue.php b/wp-queue.php index 0c46811..76bfc22 100644 --- a/wp-queue.php +++ b/wp-queue.php @@ -6,7 +6,7 @@ * Plugin Name: Queue Manager * Plugin URI: https://github.com/rwsite/wp-queue * Description: Background job processing and WP-Cron management for WordPress. Schedule tasks, manage queues, and monitor cron events. - * Version: 1.3.0 + * Version: 1.4.0 * Author: Aleksei Tikhomirov * Author URI: https://rwsite.ru * License: GPL-2.0-or-later @@ -26,7 +26,7 @@ return; } -define('WP_QUEUE_VERSION', '1.3.0'); +define('WP_QUEUE_VERSION', '1.4.0'); define('WP_QUEUE_FILE', __FILE__); define('WP_QUEUE_PATH', plugin_dir_path(__FILE__)); define('WP_QUEUE_URL', plugin_dir_url(__FILE__));
+
- - - - - +

+ + + + + +

+
+ + +
> + + + +
+ +
+ + + + + + +
+ + +
+ +

+ + +

+ + sourceLabel($runnerSetting)); ?> +

+ +
- - - - - - + + + + + +
+ + + 'status-completed', - 'warning' => 'status-pending', - default => 'status-failed', + $lbStatusLabel = match ($loopbackStatus) { + 'ok' => __('check OK', 'wp-queue'), + 'warning' => __('check: warning', 'wp-queue'), + 'error' => __('check failed', 'wp-queue'), + default => __('not checked', 'wp-queue'), }; - $lbStatusLabel = match ($loopbackStatus) { - 'ok' => __('OK', 'wp-queue'), - 'warning' => __('Warning', 'wp-queue'), - 'error' => __('Error', 'wp-queue'), - default => __('Unknown', 'wp-queue'), - }; ?> - - - - +