$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 if (File::exists($configFile)) { include $configFile; // Import site settings Site::config('general', array_map('html_entity_decode', array('title' => $site_name, 'copyright' => $site_copyright, 'googleApi' => $google_api_key))); // Import antispam settings Site::config('antispam', array_map('html_entity_decode', array('services' => $sg_services, 'phpKey' => $sg_php_key, 'phpDays' => $sg_php_days, 'phpScore' => $sg_php_score, 'phpType' => $sg_php_type, 'censor' => $sg_censor))); // Import authentication settings Site::config('auth', array_map('html_entity_decode', array('method' => $auth_method, 'ldapServer' => $ldap_server, 'ldapPort' => $ldap_port, 'ldapBaseDn' => $ldap_base_dn, 'ldapUid' => $ldap_uid, 'ldapFilter' => $ldap_filter, 'ldapUserDn' => $ldap_user_dn, 'ldapPassword' => $ldap_password))); // Import SMTP settings Site::config('mail', array_map('html_entity_decode', array('host' => $smtp_host, 'port' => $smtp_port, 'encryption' => $smtp_crypt, 'username' => $smtp_username, 'password' => $smtp_password, 'address' => $smtp_from))); // If auth method is LDAP, notify the user to set // an admin filter.