mirror of
https://github.com/flarum/core.git
synced 2025-07-30 21:20:24 +02:00
Implement proper update process
If the version in the settings table mismatches the code version, then we return a 503 error for all requests coming through index.php and api.php, while admin.php serves up a form prompting for the database password which will run outstanding migrations.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Install Flarum</title>
|
||||
<title><?php echo $title; ?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
|
||||
|
||||
<style>
|
||||
|
@@ -83,7 +83,7 @@ $(function() {
|
||||
window.location.reload();
|
||||
})
|
||||
.fail(function(data) {
|
||||
$('#error').show().text('Something went wrong:\n\n' + data.responseJSON.error);
|
||||
$('#error').show().text('Something went wrong:\n\n' + data.responseText);
|
||||
|
||||
$button.prop('disabled', false).text('Install Flarum');
|
||||
});
|
||||
|
45
framework/core/views/install/update.php
Normal file
45
framework/core/views/install/update.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<h2>Update Flarum</h2>
|
||||
|
||||
<p>Enter your database password to update Flarum. Before you proceed, you should <strong>back up your database</strong>. If you have any trouble, get help on the <a href="http://flarum.org/docs/updating" target="_blank">Flarum website</a>.</p>
|
||||
|
||||
<form method="post">
|
||||
<div id="error" style="display:none"></div>
|
||||
|
||||
<div class="FormGroup">
|
||||
<div class="FormField">
|
||||
<label>Database Password</label>
|
||||
<input type="password" name="databasePassword">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="FormButtons">
|
||||
<button type="submit">Update Flarum</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$('form :input:first').select();
|
||||
|
||||
$('form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $button = $(this).find('button')
|
||||
.text('Please Wait...')
|
||||
.prop('disabled', true);
|
||||
|
||||
$.post('', $(this).serialize())
|
||||
.done(function() {
|
||||
window.location.reload();
|
||||
})
|
||||
.fail(function(data) {
|
||||
$('#error').show().text('Something went wrong:\n\n' + data.responseText);
|
||||
|
||||
$button.prop('disabled', false).text('Update Flarum');
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user