| Server IP : 82.208.35.60 / Your IP : 216.73.216.236 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/k633_cz/www/wp-content/plugins/backup-backup/includes/progress/ |
Upload File : |
<?php
// Namespace
namespace BMI\Plugin\Progress;
// Use
use BMI\Plugin\BMI_Logger AS Logger;
// Exit on direct access
if (!defined('ABSPATH')) exit;
/**
* Main File Restoration/Migration Logs
*/
class BMI_MigrationProgress {
public $latest;
public $progress;
public $file;
public $muted = false;
public function __construct($continue = false) {
if (!file_exists(BMI_BACKUPS)) mkdir(BMI_BACKUPS, 0755, true);
$this->latest = BMI_BACKUPS . '/latest_migration.log';
$this->progress = BMI_BACKUPS . '/latest_migration_progress.log';
if (file_exists($this->latest) && $continue === false) {
unlink($this->latest);
}
}
public function start($muted = false) {
$this->muted = $muted;
}
public function mute() {
$this->muted = true;
}
public function unmute() {
$this->muted = false;
}
public function progress($progress = '0') {
file_put_contents($this->progress, $progress);
}
public function log($log = '', $level = 'INFO') {
$this->file = fopen($this->latest, 'a');
if (!$this->muted) {
if (defined('BMI_USING_CLI_FUNCTIONALITY') && BMI_USING_CLI_FUNCTIONALITY === true) {
$log_string = '[' . strtoupper($level) . '] [' . date('Y-m-d H:i:s') . '] [CLI] ' . $log . "\n";
} else {
$log_string = '[' . strtoupper($level) . '] [' . date('Y-m-d H:i:s') . '] ' . $log . "\n";
}
fwrite($this->file, $log_string);
if (defined('BMI_USING_CLI_FUNCTIONALITY') && BMI_USING_CLI_FUNCTIONALITY === true) {
echo $log_string;
}
}
fclose($this->file);
}
public function end() {
return true;
}
}