File tree 3 files changed +16
-9
lines changed
3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,16 @@ MaxFileUploads = data.get("MaxFileUploads",'20')
48
48
h2hs = data .get ("http2https" , True )
49
49
le = data .get ("lets_encrypt" , False )
50
50
51
- with open ("databases/NextFpmPort" , "r+" ) as fp :
52
- NextFpmPort = int (fp .read () or "9000" ) + 1
53
- fp .seek (0 )
54
- fp .write (str (NextFpmPort ))
51
+ # read Netxfpmport, the file could be missing so we need to handle the exception
52
+ try :
53
+ with open ("databases/NextFpmPort" , "r+" ) as fp :
54
+ NextFpmPort = int (fp .read () or "9000" ) + 1
55
+ fp .seek (0 )
56
+ fp .write (str (NextFpmPort ))
57
+ except FileNotFoundError :
58
+ NextFpmPort = 9001
59
+ with open ("databases/NextFpmPort" , "w" ) as fp :
60
+ fp .write (str (NextFpmPort ))
55
61
56
62
config ['vhost' ] = {}
57
63
config ['vhost' ]['ServerNames' ] = ',' .join (ServerNames )
Original file line number Diff line number Diff line change @@ -53,10 +53,12 @@ for file in glob.iglob("databases/vhosts/*.ini"):
53
53
vhosts .append (vhost )
54
54
55
55
configuration ['virtualhost' ] = vhosts
56
- # read Netxfpmport
57
- with open ("databases/NextFpmPort" , "r" ) as fp :
58
- NextFpmPort = int (fp .read () or "9000" ) + 1
59
- fp .close ()
56
+ # read Netxfpmport, the file could be missing so we need to handle the exception
57
+ try :
58
+ with open ("databases/NextFpmPort" , "r" ) as fp :
59
+ NextFpmPort = int (fp .read () or "9000" ) + 1
60
+ except FileNotFoundError :
61
+ NextFpmPort = 9001
60
62
61
63
configuration ['NextFpmPort' ] = NextFpmPort
62
64
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments