| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/././mahyarcake/././www/wp-content/plugins/duplicator-pro/src/Models/ |
Upload File : |
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
namespace Duplicator\Models;
use Duplicator\Core\Models\AbstractEntitySingleton;
use Duplicator\Models\RecommendedFix;
use VendorDuplicator\Amk\JsonSerialize\JsonSerialize;
/**
* System global entity
* DUP_PRO_System_Global_Entity
*/
class SystemGlobalEntity extends AbstractEntitySingleton
{
/** @var RecommendedFix[] */
public $recommended_fixes = [];
/** @var bool */
public $schedule_failed = false;
/** @var int */
public $package_check_ts = 0;
/**
* Class constructor
*/
protected function __construct()
{
}
/**
* Will be called, automatically, when Serialize
*
* @return array<string,mixed>
*/
public function __serialize() // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__serializeFound
{
$data = JsonSerialize::serializeToData($this, JsonSerialize::JSON_SKIP_MAGIC_METHODS | JsonSerialize::JSON_SKIP_CLASS_NAME);
return $data;
}
/**
* Called after json decode
*
* @return void
*/
public function __wakeup()
{
foreach ($this->recommended_fixes as $index => $data) {
$this->recommended_fixes[$index] = RecommendedFix::objectFromData($data); // @phpstan-ignore-line
}
}
/**
* Return entity type identifier
*
* @return string
*/
public static function getType()
{
return 'DUP_PRO_System_Global_Entity';
}
/**
* Add recommended quick fix
*
* @param string $error_text error text
* @param string $fix_text text to add
* @param mixed[] $javascript_callback javascript callback
*
* @return bool True on success, or false on error.
*/
public function addQuickFix($error_text, $fix_text, $javascript_callback)
{
if ($this->fixExists($fix_text) === false) {
$id = str_shuffle(substr(uniqid('', true), 0, 14) . mt_rand(0, 1000000));
$fix = new RecommendedFix();
$fix->recommended_fix_type = RecommendedFix::TYPE_FIX;
$fix->error_text = $error_text;
$fix->parameter1 = $fix_text;
$fix->parameter2 = $javascript_callback;
$fix->id = $id;
array_push($this->recommended_fixes, $fix);
return $this->save();
}
return true;
}
/**
* Add recommended text
*
* @param string $error_text error text
* @param string $fix_text text to add
*
* @return bool True on success, or false on error.
*/
public function addTextFix($error_text, $fix_text)
{
if ($this->fixExists($fix_text) === false) {
$fix = new RecommendedFix();
$fix->recommended_fix_type = RecommendedFix::TYPE_TEXT;
$fix->error_text = $error_text;
$fix->parameter1 = $fix_text;
array_push($this->recommended_fixes, $fix);
return $this->save();
}
return true;
}
/**
* Remove quick fix by id
*
* @param string $id fix id
*
* @return bool true on success, false on failure
*/
public function removeFixById($id)
{
foreach ($this->recommended_fixes as $key => $fix) {
if ($fix->id === $id) {
unset($this->recommended_fixes[$key]);
$this->recommended_fixes = array_values($this->recommended_fixes);
return $this->save();
}
}
return true;
}
/**
* Search recommended fix by content
*
* @param string $search search string
*
* @return bool true found, false not found
*/
private function fixExists($search)
{
foreach ($this->recommended_fixes as $fix) {
if (strcmp($fix->parameter1, $search) == 0) {
return true;
}
}
return false;
}
/**
* Clear recommended fixes
*
* @return bool true on success, false on failure
*/
public function clearFixes()
{
$this->recommended_fixes = [];
return $this->save();
}
}