Commit d08926c 1 parent db145b4 commit d08926c Copy full SHA for d08926c
File tree 5 files changed +13
-5
lines changed
5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -324,7 +324,8 @@ errors = {
324
324
function renderErrorInt ( errorView ) {
325
325
var stack = null ;
326
326
327
- if ( statusCode !== 404 && process . env . NODE_ENV !== 'production' && err . stack ) {
327
+ // Not Found and Maintenance Errors don't need a stack trace
328
+ if ( statusCode !== 404 && statusCode !== 503 && process . env . NODE_ENV !== 'production' && err . stack ) {
328
329
stack = parseStack ( err . stack ) ;
329
330
}
330
331
Original file line number Diff line number Diff line change @@ -69,14 +69,15 @@ function init(options) {
69
69
} ) . then ( function ( ) {
70
70
return versioning . getDatabaseVersion ( )
71
71
. then ( function ( currentVersion ) {
72
+ var maintenanceState = config . maintenance . enabled || false ;
72
73
config . maintenance . enabled = true ;
73
74
74
75
migrations . update ( {
75
76
fromVersion : currentVersion ,
76
77
toVersion : versioning . getNewestDatabaseVersion ( ) ,
77
78
forceMigration : process . env . FORCE_MIGRATION
78
79
} ) . then ( function ( ) {
79
- config . maintenance . enabled = false ;
80
+ config . maintenance . enabled = maintenanceState ;
80
81
} ) . catch ( function ( err ) {
81
82
errors . logErrorAndExit ( err , err . context , err . help ) ;
82
83
} ) ;
Original file line number Diff line number Diff line change @@ -197,7 +197,9 @@ setupMiddleware = function setupMiddleware(blogApp) {
197
197
198
198
// Mount admin express app to /ghost and set up routes
199
199
adminApp . use ( redirectToSetup ) ;
200
+ adminApp . use ( maintenance ) ;
200
201
adminApp . use ( routes . admin ( ) ) ;
202
+
201
203
blogApp . use ( '/ghost' , adminApp ) ;
202
204
203
205
// send 503 error page in case of maintenance
Original file line number Diff line number Diff line change 1
- var config = require ( __dirname + '/../config' ) ,
2
- errors = require ( config . paths . corePath + '/server/errors' ) ;
1
+ var config = require ( '../config' ) ,
2
+ i18n = require ( '../i18n' ) ,
3
+ errors = require ( '../errors' ) ;
3
4
4
5
module . exports = function ( req , res , next ) {
5
6
if ( config . maintenance . enabled ) {
6
- return next ( new errors . Maintenance ( ) ) ;
7
+ return next ( new errors . Maintenance (
8
+ i18n . t ( 'errors.general.maintenance' )
9
+ ) ) ;
7
10
}
8
11
9
12
next ( ) ;
Original file line number Diff line number Diff line change 170
170
}
171
171
},
172
172
"general" : {
173
+ "maintenance" : " Ghost is currently undergoing maintenance, please wait a moment then retry." ,
173
174
"moreInfo" : " \n More info: {info}" ,
174
175
"requiredOnFuture" : " This will be required in future. Please see {link}"
175
176
},
You can’t perform that action at this time.
0 commit comments