| Server IP : 5.129.245.98 / Your IP : 216.73.216.246 Web Server : Apache/2.4.66 (Debian) System : Linux 1b8c17c336b9 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/cyr2lat/src/php/BackgroundProcesses/ |
Upload File : |
<?php
/**
* Background old slugs converting process
*
* @package cyr-to-lat
*/
namespace CyrToLat\BackgroundProcesses;
use CyrToLat\Main;
use CyrToLat\WP_Background_Processing\WP_Background_Process;
/**
* Class ConversionProcess
*/
class ConversionProcess extends WP_Background_Process {
/**
* Prefix
*
* @var string
*/
protected $prefix;
/**
* Plugin main class
*
* @var Main
*/
protected Main $main;
/**
* ConversionProcess constructor
*
* @param Main $main Plugin main class.
*/
public function __construct( Main $main ) {
$this->main = $main;
$this->prefix = constant( 'CYR_TO_LAT_PREFIX' );
parent::__construct();
}
/**
* Task. Updates single post or term.
*
* @param mixed $item Queue item to iterate over.
*
* @return boolean
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
protected function task( $item ) {
return false;
}
/**
* Complete
*
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
protected function complete() {
parent::complete();
set_site_transient( $this->identifier . '_process_completed', microtime() );
}
/**
* Check if the process is completed.
* Delete relevant transient.
*/
public function is_process_completed(): bool {
if ( get_site_transient( $this->identifier . '_process_completed' ) ) {
// Process is marked as completed.
// Delete relevant site transient.
delete_site_transient( $this->identifier . '_process_completed' );
return true;
}
return false;
}
/**
* Write log
*
* @param string $message Message to log.
*
* @noinspection ForgottenDebugOutputInspection
*/
protected function log( string $message ): void {
if ( defined( 'WP_DEBUG_LOG' ) && constant( 'WP_DEBUG_LOG' ) ) {
// @phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
error_log( 'Cyr To Lat: ' . $message );
}
}
}