3 define( 'YOURLS_NO_UPGRADE_CHECK', true ); // Bypass version checking to prevent loop
\r
4 require_once( dirname(dirname(__FILE__)).'/includes/load-yourls.php' );
\r
5 require_once( dirname(dirname(__FILE__)).'/includes/functions-upgrade.php' );
\r
6 require_once( dirname(dirname(__FILE__)).'/includes/functions-install.php' );
\r
7 yourls_maybe_require_auth();
\r
9 yourls_html_head( 'tools' );
\r
12 <a href="<?php echo YOURLS_SITE; ?>/admin/index.php" title="YOURLS"><span>YOURLS</span>: <span>Y</span>our <span>O</span>wn <span>URL</span> <span>S</span>hortener<br/>
\r
13 <img src="<?php echo YOURLS_SITE; ?>/images/yourls-logo.png" alt="YOURLS" title="YOURLS" style="border: 0px;" /></a>
\r
15 <?php if ( yourls_is_private() ) { ?>
\r
16 <p>Your are logged in as: <strong><?php echo YOURLS_USER; ?></strong>. <a href="?mode=logout" title="Logout">Logout</a></p>
\r
19 <h2>Upgrade YOURLS</h2>
\r
23 // Check if upgrade is needed
\r
24 if ( !yourls_upgrade_is_needed() ) {
\r
25 echo '<p>Upgrade not required. Go <a href="'.YOURLS_SITE.'/admin/index.php">back to play</a>!</p>';
\r
30 step 1: create new tables and populate them, update old tables structure,
\r
31 step 2: convert each row of outdated tables if needed
\r
32 step 3: - if applicable finish updating outdated tables (indexes etc)
\r
33 - update version & db_version in options, this is all done!
\r
36 // From what are we upgrading?
\r
37 if ( isset( $_GET['oldver'] ) && isset( $_GET['oldsql'] ) ) {
\r
38 $oldver = intval( $_GET['oldver'] );
\r
39 $oldsql = intval( $_GET['oldsql'] );
\r
41 list( $oldver, $oldsql ) = yourls_get_current_version_from_sql();
\r
44 // To what are we upgrading ?
\r
45 $newver = YOURLS_VERSION;
\r
46 $newsql = YOURLS_DB_VERSION;
\r
48 // Verbose & ugly details
\r
49 $ydb->show_errors = true;
\r
52 $step = ( isset( $_GET['step'] ) ? intval( $_GET['step'] ) : 0 );
\r
58 <p>Your current installation needs to be upgraded.</p>
\r
59 <p>Please, pretty please, it is recommended that
\r
60 you <strong>backup</strong> your database<br/>(you should do this regularly anyway)</p>
\r
61 <p>Nothing awful <em>should</em> happen, but this doesn't mean it <em>won't</em> happen, right? ;)</p>
\r
62 <p>On every step, if <span class='error'>something goes wrong</span>, you'll see a message and hopefully a way to fix</p>
\r
63 <p>If everything goes too fast and you cannot read, <span class='success'>good for you</span>, let it go :)</p>
\r
64 <p>Once you are ready, press Upgrade!</p>
\r
65 <form action='upgrade.php?' method='get'>
\r
66 <input type='hidden' name='step' value='1' />
\r
67 <input type='hidden' name='oldver' value='$oldver' />
\r
68 <input type='hidden' name='newver' value='$newver' />
\r
69 <input type='hidden' name='oldsql' value='$oldsql' />
\r
70 <input type='hidden' name='newsql' value='$newsql' />
\r
71 <input type='submit' class='primary' value='Upgrade' />
\r
78 $upgrade = yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql );
\r
82 $upgrade = yourls_upgrade( 3, $oldver, $newver, $oldsql, $newsql );
\r
83 $admin = YOURLS_SITE.'/admin/index.php';
\r
85 <p>Your installation is now up to date !</p>
\r
86 <p>Go back to <a href='$admin'>the admin interface</a></p>
\r
95 <?php yourls_html_footer(); ?>
\r