2 define( 'YOURLS_ADMIN', true );
\r
3 define( 'YOURLS_UPGRADING', true );
\r
4 require_once( dirname( dirname( __FILE__ ) ).'/includes/load-yourls.php' );
\r
5 require_once( YOURLS_INC.'/functions-upgrade.php' );
\r
6 require_once( YOURLS_INC.'/functions-install.php' );
\r
7 yourls_maybe_require_auth();
\r
9 yourls_html_head( 'upgrade', yourls__( 'Upgrade YOURLS' ) );
\r
13 <h2><?php yourls_e( 'Upgrade YOURLS' ); ?></h2>
\r
16 // Check if upgrade is needed
\r
17 if ( !yourls_upgrade_is_needed() ) {
\r
18 echo '<p>' . yourls_s( 'Upgrade not required. Go <a href="%s">back to play</a>!', yourls_admin_url('index.php') ) . '</p>';
\r
23 step 1: create new tables and populate them, update old tables structure,
\r
24 step 2: convert each row of outdated tables if needed
\r
25 step 3: - if applicable finish updating outdated tables (indexes etc)
\r
26 - update version & db_version in options, this is all done!
\r
29 // From what are we upgrading?
\r
30 if ( isset( $_GET['oldver'] ) && isset( $_GET['oldsql'] ) ) {
\r
31 $oldver = yourls_sanitize_version( $_GET['oldver'] );
\r
32 $oldsql = yourls_sanitize_version( $_GET['oldsql'] );
\r
34 list( $oldver, $oldsql ) = yourls_get_current_version_from_sql();
\r
37 // To what are we upgrading ?
\r
38 $newver = YOURLS_VERSION;
\r
39 $newsql = YOURLS_DB_VERSION;
\r
41 // Verbose & ugly details
\r
42 $ydb->show_errors = true;
\r
45 $step = ( isset( $_GET['step'] ) ? intval( $_GET['step'] ) : 0 );
\r
51 <p><?php yourls_e( 'Your current installation needs to be upgraded.' ); ?></p>
\r
52 <p><?php yourls_e( 'Please, pretty please, it is recommended that you <strong>backup</strong> your database<br/>(you should do this regularly anyway)' ); ?></p>
\r
53 <p><?php yourls_e( "Nothing awful <em>should</em> happen, but this doesn't mean it <em>won't</em> happen, right? ;)" ); ?></p>
\r
54 <p><?php yourls_e( "On every step, if <span class='error'>something goes wrong</span>, you'll see a message and hopefully a way to fix." ); ?></p>
\r
55 <p><?php yourls_e( 'If everything goes too fast and you cannot read, <span class="success">good for you</span>, let it go :)' ); ?></p>
\r
56 <p><?php yourls_e( 'Once you are ready, press "Upgrade" !' ); ?></p>
\r
59 <form action='upgrade.php?' method='get'>
\r
60 <input type='hidden' name='step' value='1' />
\r
61 <input type='hidden' name='oldver' value='$oldver' />
\r
62 <input type='hidden' name='newver' value='$newver' />
\r
63 <input type='hidden' name='oldsql' value='$oldsql' />
\r
64 <input type='hidden' name='newsql' value='$newsql' />
\r
65 <input type='submit' class='primary' value='" . yourls_esc_attr__( 'Upgrade' ) . "' />
\r
72 $upgrade = yourls_upgrade( $step, $oldver, $newver, $oldsql, $newsql );
\r
76 $upgrade = yourls_upgrade( 3, $oldver, $newver, $oldsql, $newsql );
\r
77 echo '<p>' . yourls__( 'Your installation is now up to date ! ' ) . '</p>';
\r
78 echo '<p>' . yourls_s( 'Go back to <a href="%s">the admin interface</a>', yourls_admin_url('index.php') ) . '</p>';
\r
86 <?php yourls_html_footer(); ?>
\r