// for 0.4, only admins could log in DB::update("UPDATE {$dbPrefix}users SET admin = 1"); // Set user type = ldap for users without passwords DB::update("UPDATE {$dbPrefix}users SET type = 'ldap' WHERE password = ''"); // Drop the session table, we no longer need it DB::update("DROP TABLE {$dbPrefix}session"); // Drop the cron table, we use cache to handle that now DB::update("DROP TABLE {$dbPrefix}cron"); // Generate URL keys for pastes that do not have a key. // We process the pastes in batches of 1000 to avoid running // out of memory. while (TRUE) { $pastes = Paste::where('urlkey', '')->take(1000)->get(array('id', 'urlkey')); if ($pastes->count() > 0) { foreach ($pastes as $paste) { $paste->urlkey = Paste::makeUrlKey(); $paste->save(); } } else { break; } } // Get the FQDN for the server $fqdn = getenv('SERVER_NAME'); // Insert fqdn, app version and migration ID to site config // The migration ID is nothing but the max paste ID while updating // This will be used to allow/deny access to old pastes by their IDs Site::config('general', array('fqdn' => $fqdn, 'preMigrate' => Paste::max('id'))); // This is the v0.4 config file $configFile = app_path() . '/config/config.php'; // Now we migrate the old config data