| Server IP : 31.214.179.11 / Your IP : 216.73.216.233 Web Server : Apache System : Linux hostingsrv122.dondominio.com 6.12.116+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.116-1 (2026-11-07) x86_64 User : ( 831668) PHP Version : 8.5.12 Disable Function : system,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,exec,ini_alter,show_source,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,mail,eval MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /hosting/www/mammaluisa.es/public/wp-content/plugins/duplicator/classes/utilities/ |
Upload File : |
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
/**
* Class used to apply various patches to installer file
*
* Standard: PSR-2
*
* @link http://www.php-fig.org/psr/psr-2
*
* @package Duplicator
* @subpackage classes
* @copyright (c) 2022, Snapcreek LLC
*/
class DUP_Patch
{
/**
* The current backup directory path for Duplicator Lite
* Possible options are 'wp-snapshots' and 'backups-dup-lite'
*/
public $DupLiteBackupDir;
/**
* Class construct for init
*/
public function __construct()
{
$this->DupLiteBackupDir = DUP_Settings::getSsdirPath();
}
/**
* Apply patch code to all installer files
*/
public function ApplyInstallerPatch_0001()
{
$backupDir = $this->DupLiteBackupDir;
foreach (glob("{$backupDir}/*_installer.php") as $file) {
if (strstr($file, '_installer.php')) {
$content = "<?php \n";
$content .= " /** PATCH_MARKER_START:V.0001 **/ \n";
$content .= " //TODO ADD PHP CODE HERE";
$content .= " /** PATCH_MARKER_END **/ \n";
$content .= "?>\n";
$this->fwritePrepend($file, $content);
}
}
}
/**
* Prepends data to an existing file
*
* @param string $file The full file path to the file
* @param string $content The content to prepend to the file
*
* @return TRUE on success or if file does not exist. FALSE on failure
*/
private function fwritePrepend($file, $prepend)
{
if (!file_exists($file) || !is_writable($file)) {
return false;
}
$handle = fopen($file, "r+");
$len = strlen($prepend);
$final_len = filesize($file) + $len;
$cache_old = fread($handle, $len);
rewind($handle);
$i = 1;
while (ftell($handle) < $final_len) {
fwrite($handle, $prepend);
$prepend = $cache_old;
$cache_old = fread($handle, $len);
fseek($handle, $i * $len);
$i++;
}
}
}