3 define( 'YOURLS_NO_VERSION_CHECK', true ); // Bypass version checking to prevent loop
\r
4 require_once( dirname(dirname(__FILE__)).'/includes/config.php' );
\r
5 require_once( dirname(dirname(__FILE__)).'/includes/functions-upgrade.php' );
\r
6 if (defined('YOURLS_PRIVATE') && YOURLS_PRIVATE == true)
\r
7 require_once( dirname(dirname(__FILE__)).'/includes/auth.php' );
\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 ( defined('YOURLS_PRIVATE') && YOURLS_PRIVATE == true ) { ?>
\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 <div id="tools_desc">
\r
21 <h2>Upgrade YOURLS</h2>
\r
25 // Check if upgrade is needed
\r
26 if ( !yourls_upgrade_is_needed() ) {
\r
27 echo '<p>Upgrade not required. Go <a href="'.YOURLS_SITE.'/admin/index.php">back to play</a>!</p>';
\r
32 step 1: create new tables and populate them, update old tables structure,
\r
33 step 2: convert each row of outdated tables if needed
\r
34 step 3: if applicable finish updating outdated tables (indexes etc)
\r
35 step 4: update version & db_version in options, this is all done!
\r
38 // From what are we upgrading?
\r
39 if ( isset( $_GET['oldver'] ) && isset( $_GET['oldsql'] ) ) {
\r
40 $oldver = intval( $_GET['oldver'] );
\r
41 $oldsql = intval( $_GET['oldsql'] );
\r
43 list( $oldver, $oldsql ) = yourls_get_current_version_from_sql();
\r
46 // To what are we upgrading ?
\r
47 $newver = YOURLS_VERSION;
\r
48 $newsql = YOURLS_DB_VERSION;
\r
51 $step = ( isset( $_GET['step'] ) ? intval( $_GET['step'] ) : 0 );
\r
57 <p>Your current installation needs to be upgraded.</p>
\r
58 <p>Please, pretty please, it is recommended that
\r
59 you <strong>backup</strong> your database (you should do this regularly anyway)</p>
\r
60 <p>Nothing awful *should* happen, but this doesn't mean it *won't* happen, right?</p>
\r
61 <p>Once you are ready, press Upgrade!</p>
\r
62 <form action='upgrade.php?' method='get'>
\r
63 <input type='hidden' name='step' value='1' />
\r
64 <input type='hidden' name='oldver' value='$oldver' />
\r
65 <input type='hidden' name='newver' value='$newver' />
\r
66 <input type='hidden' name='oldsql' value='$oldsql' />
\r
67 <input type='hidden' name='newsql' value='$newsql' />
\r
68 <input type='submit' class='primary' value='Upgrade' />
\r
76 yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql );
\r
80 yourls_upgrade( 4, $oldver, $newver, $oldsql, $newsql );
\r
81 $admin = YOURLS_SITE.'/admin/index.php';
\r
83 <p>Your installation is now up to date :)</p>
\r
84 <p>Go back to <a href='$admin'>the admin interface</a></p>
\r
94 <?php yourls_html_footer(); ?>
\r