: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Smush\Core\Modules\Background;
* TRUE: Don't perform the operation if lock couldn't be acquired
* FALSE: Even if lock is not acquired, still perform the operation
private $break_on_timeout = false;
public function __construct( $key ) {
public function execute( $operation ) {
$acquired = $this->acquire_lock();
if ( $acquired || ! $this->break_on_timeout() ) {
call_user_func( $operation );
private function acquire_lock() {
'SELECT GET_LOCK(%s,%d) as lock_set',
return 1 === intval( $lock->lock_set );
private function release_lock() {
'SELECT RELEASE_LOCK(%s) as lock_released',
array( $this->get_key() )
public function break_on_timeout() {
return $this->break_on_timeout;
* @param bool $break_on_timeout
public function set_break_on_timeout( $break_on_timeout ) {
$this->break_on_timeout = $break_on_timeout;
public function get_timeout() {
public function set_timeout( $timeout ) {
$this->timeout = $timeout;
public function get_key() {
public function set_key( $key ) {