function yourls_upgrade_to_14($step) { switch ($step) { case 1: // create table log & table options // update table url structure // update .htaccess yourls_create_tables_for_14(); // no value returned, assuming it went OK yourls_alter_url_table_to_14(); // no value returned, assuming it went OK $clean = yourls_clean_htaccess_for_14(); // returns bool $create = yourls_create_htaccess(); // returns bool if (!$create) { echo "<p class='warning'>Please create your <tt>.htaccess</tt> file (I could not do it for you). Please refer to <a href='http://yourls.org/htaccess'>http://yourls.org/htaccess</a>."; } yourls_redirect_javascript(yourls_admin_url("upgrade.php?step=2&oldver=1.3&newver=1.4&oldsql=100&newsql=200"), $create); break; case 2: // convert each link in table url yourls_update_table_to_14(); break; case 3: // update table url structure part 2: recreate indexes yourls_alter_url_table_to_14_part_two(); // update version & db_version & next_id in the option table // attempt to drop YOURLS_DB_TABLE_NEXTDEC yourls_update_options_to_14(); // Now upgrade to 1.4.1 yourls_redirect_javascript(yourls_admin_url("upgrade.php?step=1&oldver=1.4&newver=1.4.1&oldsql=200&newsql=210")); break; } }
// Check additional stuff if (!yourls_check_curl()) { $warning[] = 'PHP extension <tt>cURL</tt> is not installed. This server won\'t be able to use the remote API'; } // Is YOURLS already installed ? if (yourls_is_installed()) { $error[] = 'YOURLS already installed.'; // check if .htaccess exists, recreate otherwise. No error checking. if (!file_exists(YOURLS_ABSPATH . '/.htaccess')) { yourls_create_htaccess(); } } // Start install if possible and needed if (isset($_REQUEST['install']) && count($error) == 0) { // Create/update .htaccess file if (yourls_create_htaccess()) { $success[] = 'File <tt>.htaccess</tt> successfully created/updated.'; } else { $warning[] = 'Could not write file <tt>.htaccess</tt> in YOURLS root directory. You will have to do it manually. See <a href="http://yourls.org/htaccess">how</a>.'; } // Create SQL tables $install = yourls_create_sql_tables(); if (isset($install['error'])) { $error = array_merge($error, $install['error']); } if (isset($install['success'])) { $success = array_merge($success, $install['success']); } } // Start output yourls_html_head('install', 'Install YOURLS');