upgrade_database() static public method

* FeedWordPress::needs_upgrade ()
static public upgrade_database ( $from = NULL )
Esempio n. 1
0
function fwp_upgrade_page()
{
    if (MyPHP::post('action') == 'Upgrade') {
        $ver = get_option('feedwordpress_version');
        if (get_option('feedwordpress_version') != FEEDWORDPRESS_VERSION) {
            echo "<div class=\"wrap\">\n";
            echo "<h2>Upgrading FeedWordPress...</h2>";
            $feedwordpress = new FeedWordPress();
            $feedwordpress->upgrade_database($ver);
            echo "<p><strong>Done!</strong> Upgraded database to version " . FEEDWORDPRESS_VERSION . ".</p>\n";
            echo "<form action=\"\" method=\"get\">\n";
            echo "<div class=\"submit\"><input type=\"hidden\" name=\"page\" value=\"syndication.php\" />";
            echo "<input type=\"submit\" value=\"Continue &raquo;\" /></form></div>\n";
            echo "</div>\n";
            return;
        } else {
            echo "<div class=\"updated\"><p>Already at version " . FEEDWORDPRESS_VERSION . "!</p></div>";
        }
    }
    ?>
<div class="wrap">
<h2>Upgrade FeedWordPress</h2>

<p>It appears that you have installed FeedWordPress
<?php 
    echo FEEDWORDPRESS_VERSION;
    ?>
 as an upgrade to an existing installation of
FeedWordPress. That's no problem, but you will need to take a minute out first
to upgrade your database: some necessary changes in how the software keeps
track of posts and feeds will cause problems such as duplicate posts and broken
templates if we were to continue without the upgrade.</p>

<p>Note that most of FeedWordPress's functionality is temporarily disabled
until we have successfully completed the upgrade. Everything should begin
working as normal again once the upgrade is complete. There's extraordinarily
little chance of any damage as the result of the upgrade, but if you're paranoid
like me you may want to back up your database before you proceed.</p>

<p>This may take several minutes for a large installation.</p>

<form action="" method="post">
<?php 
    FeedWordPressCompatibility::stamp_nonce('feedwordpress_upgrade');
    ?>
<div class="submit"><input type="submit" name="action" value="Upgrade" /></div>
</form>
</div>
<?php 
}