/** * Shows the update screen * * @param string $method * @param string $action * @return \Illuminate\Support\Facades\View */ public function getUpdate($method = 'web', $action = '') { // Updater stage $stage = Session::has('setup.stage') ? Session::get('setup.stage') : 1; // Output based on request method switch ($method) { case 'web': $data = array('error' => Session::get('messages.error'), 'success' => Session::get('messages.success'), 'version' => Session::get('setup.version'), 'versions' => Setup::updateVersions(), 'messages' => Setup::messages(), 'unstable' => System::updated() > 0); return View::make("setup/update/stage{$stage}", $data); case 'ajax': return Setup::update($action); case 'error': return View::make('setup/error'); default: App::abort(404); // Not found } }
$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. if ($auth_method == 'ldap') { Setup::messages('0.4', Lang::get('setup.ldap_update_warn')); } // Remove the old config file File::delete($configFile); } }), '1.0' => array(), '1.1' => array('closure' => function () { $config = Site::config('general'); // Modify config values if (isset($config->googleApi)) { Site::config('services', array('googleApiKey' => $config->googleApi)); } }), '1.2' => array('newTables' => array('comments' => array((object) array('name' => 'id', 'type' => 'increments'), (object) array('name' => 'paste_id', 'type' => 'integer'), (object) array('name' => 'data', 'type' => 'text'), (object) array('name' => 'author', 'type' => 'string', 'length' => 50, 'nullable' => TRUE, 'default' => NULL), (object) array('name' => 'timestamp', 'type' => 'integer')))), '1.3' => array('newTables' => array('statistics' => array((object) array('name' => 'id', 'type' => 'increments'), (object) array('name' => 'date', 'type' => 'date'), (object) array('name' => 'web', 'type' => 'integer', 'default' => 0), (object) array('name' => 'api', 'type' => 'integer', 'default' => 0)))), '1.4' => array(), '1.5' => array(), '1.6' => array('modifyTables' => array('main' => array((object) array('name' => 'flagged', 'type' => 'boolean', 'default' => 0), (object) array('name' => 'attachment', 'type' => 'boolean', 'default' => 0)), 'users' => array((object) array('name' => 'remember_token', 'type' => 'string', 'length' => 60, 'default' => '')))), '1.7' => array('closure' => function () { $config = Site::config('general'); // Modify config values if (isset($config->privateSite) and $config->privateSite) { Site::config('general', array('pasteVisibility' => 'private'));