
<!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: revisions-migrator.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php

namespace Yoast\WP\Duplicate_Post;

/**
 * Duplicate Post class to migrate revisions from the Rewrite &amp; Republish copy to the original post.
 *
 * @since 4.0
 */
class Revisions_Migrator {

	/**
	 * Adds hooks to integrate with the Post Republisher class.
	 *
	 * @return void
	 */
	public function register_hooks() {
		\add_action( &#039;duplicate_post_after_rewriting&#039;, [ $this, &#039;migrate_revisions&#039; ], 10, 2 );
	}

	/**
	 * Updates the revisions of the Rewrite &amp; Republish copy to make them revisions of the original.
	 *
	 * It mimics the behaviour of wp_save_post_revision() in wp-includes/revision.php
	 * by deleting the revisions (except autosaves) exceeding the maximum allowed number.
	 *
	 * @param int $copy_id     The copy&#039;s ID.
	 * @param int $original_id The post&#039;s ID.
	 *
	 * @return void
	 */
	public function migrate_revisions( $copy_id, $original_id ) {
		$copy          = \get_post( $copy_id );
		$original_post = \get_post( $original_id );

		if ( \is_null( $copy ) || \is_null( $original_post ) || ! \wp_revisions_enabled( $original_post ) ) {
			return;
		}

		$copy_revisions = \wp_get_post_revisions( $copy );
		foreach ( $copy_revisions as $revision ) {
			$revision-&gt;post_parent = $original_post-&gt;ID;
			$revision-&gt;post_name   = &quot;$original_post-&gt;ID-revision-v1&quot;;
			\wp_update_post( $revision );
		}

		$revisions_to_keep = \wp_revisions_to_keep( $original_post );
		if ( $revisions_to_keep &lt; 0 ) {
			return;
		}

		$revisions = \wp_get_post_revisions( $original_post, [ &#039;order&#039; =&gt; &#039;ASC&#039; ] );
		$delete    = ( \count( $revisions ) - $revisions_to_keep );
		if ( $delete &lt; 1 ) {
			return;
		}

		$revisions = \array_slice( $revisions, 0, $delete );

		for ( $i = 0; isset( $revisions[ $i ] ); $i++ ) {
			if ( \strpos( $revisions[ $i ]-&gt;post_name, &#039;autosave&#039; ) !== false ) {
				continue;
			}
			\wp_delete_post_revision( $revisions[ $i ]-&gt;ID );
		}
	}
}
</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>
