mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Restart server, run collectstatic at init.
Fix tintin++ default. Resolves #1593.
This commit is contained in:
parent
1aaee33138
commit
2a6e914161
5 changed files with 23 additions and 12 deletions
|
|
@ -51,7 +51,7 @@ class AMPClientFactory(protocol.ReconnectingClientFactory):
|
|||
|
||||
def buildProtocol(self, addr):
|
||||
"""
|
||||
Creates an AMPProtocol instance when connecting to the server.
|
||||
Creates an AMPProtocol instance when connecting to the AMP server.
|
||||
|
||||
Args:
|
||||
addr (str): Connection address. Not used.
|
||||
|
|
@ -108,6 +108,8 @@ class AMPServerClientProtocol(amp.AMPMultiConnectionProtocol):
|
|||
# back with the Server side. We also need the startup mode (reload, reset, shutdown)
|
||||
self.send_AdminServer2Portal(
|
||||
amp.DUMMYSESSION, operation=amp.PSYNC, spid=os.getpid(), info_dict=info_dict)
|
||||
# run the intial setup if needed
|
||||
self.factory.server.run_initial_setup()
|
||||
|
||||
def data_to_portal(self, command, sessid, **kwargs):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ def create_objects():
|
|||
|
||||
"""
|
||||
|
||||
logger.log_info("Creating objects (Account #1 and Limbo room) ...")
|
||||
logger.log_info("Initial setup: Creating objects (Account #1 and Limbo room) ...")
|
||||
|
||||
# Set the initial User's account object's username on the #1 object.
|
||||
# This object is pure django and only holds name, email and password.
|
||||
|
|
@ -121,7 +121,7 @@ def create_channels():
|
|||
Creates some sensible default channels.
|
||||
|
||||
"""
|
||||
logger.log_info("Creating default channels ...")
|
||||
logger.log_info("Initial setup: Creating default channels ...")
|
||||
|
||||
goduser = get_god_account()
|
||||
for channeldict in settings.DEFAULT_CHANNELS:
|
||||
|
|
@ -144,11 +144,21 @@ def at_initial_setup():
|
|||
mod = __import__(modname, fromlist=[None])
|
||||
except (ImportError, ValueError):
|
||||
return
|
||||
logger.log_info(" Running at_initial_setup() hook.")
|
||||
logger.log_info("Initial setup: Running at_initial_setup() hook.")
|
||||
if mod.__dict__.get("at_initial_setup", None):
|
||||
mod.at_initial_setup()
|
||||
|
||||
|
||||
def collectstatic():
|
||||
"""
|
||||
Run collectstatic to make sure all web assets are loaded.
|
||||
|
||||
"""
|
||||
from django.core.management import call_command
|
||||
logger.log_info("Initial setup: Gathering static resources using 'collectstatic'")
|
||||
call_command('collectstatic', '--noinput')
|
||||
|
||||
|
||||
def reset_server():
|
||||
"""
|
||||
We end the initialization by resetting the server. This makes sure
|
||||
|
|
@ -159,8 +169,8 @@ def reset_server():
|
|||
"""
|
||||
ServerConfig.objects.conf("server_epoch", time.time())
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
logger.log_info(" Initial setup complete. Restarting Server once.")
|
||||
SESSIONS.server.shutdown(mode='reset')
|
||||
logger.log_info("Initial setup complete. Restarting Server once.")
|
||||
SESSIONS.portal_reset_server()
|
||||
|
||||
|
||||
def handle_setup(last_step):
|
||||
|
|
@ -186,6 +196,7 @@ def handle_setup(last_step):
|
|||
setup_queue = [create_objects,
|
||||
create_channels,
|
||||
at_initial_setup,
|
||||
collectstatic,
|
||||
reset_server]
|
||||
|
||||
# step through queue, from last completed function
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class Ttype(object):
|
|||
self.protocol.protocol_flags["FORCEDENDLINE"] = False
|
||||
|
||||
if cupper.startswith("TINTIN++"):
|
||||
self.protocol.protocol_flags["FORCEDENDLINE"] = False
|
||||
self.protocol.protocol_flags["FORCEDENDLINE"] = True
|
||||
|
||||
if (cupper.startswith("XTERM") or
|
||||
cupper.endswith("-256COLOR") or
|
||||
|
|
|
|||
|
|
@ -181,9 +181,6 @@ class Evennia(object):
|
|||
|
||||
self.start_time = time.time()
|
||||
|
||||
# Run the initial setup if needed
|
||||
self.run_initial_setup()
|
||||
|
||||
# initialize channelhandler
|
||||
channelhandler.CHANNELHANDLER.update()
|
||||
|
||||
|
|
@ -274,6 +271,8 @@ class Evennia(object):
|
|||
|
||||
def run_initial_setup(self):
|
||||
"""
|
||||
This is triggered by the amp protocol when the connection
|
||||
to the portal has been established.
|
||||
This attempts to run the initial_setup script of the server.
|
||||
It returns if this is not the first time the server starts.
|
||||
Once finished the last_initial_setup_step is set to -1.
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ class ServerSessionHandler(SessionHandler):
|
|||
|
||||
"""
|
||||
super(ServerSessionHandler, self).__init__(*args, **kwargs)
|
||||
self.server = None
|
||||
self.server = None # set at server initialization
|
||||
self.server_data = {"servername": _SERVERNAME}
|
||||
|
||||
def _run_cmd_login(self, session):
|
||||
|
|
@ -290,7 +290,6 @@ class ServerSessionHandler(SessionHandler):
|
|||
if not session.logged_in:
|
||||
self.data_in(session, text=[[CMD_LOGINSTART], {}])
|
||||
|
||||
|
||||
def portal_connect(self, portalsessiondata):
|
||||
"""
|
||||
Called by Portal when a new session has connected.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue