def lastupdate_cmd(args):
    """
   iptocountry_getlastupdate <var>
   Returns the time of the last IPToCountry database update
   """
    if len(args) == 1:
        es.ServerVar(args[0]).set(iptocountry.get_last_update())

    else:
        es.dbgmsg(0, 'Syntax: iptocountry_getlastupdate <var>')
def lastupdate_cmd(args):
   """
   iptocountry_getlastupdate <var>
   Returns the time of the last IPToCountry database update
   """
   if len(args) == 1:
      es.ServerVar(args[0]).set(iptocountry.get_last_update())

   else:
      es.dbgmsg(0, 'Syntax: iptocountry_getlastupdate <var>')
def load():
    """
   Ensures critical server variables are created by the config
   Updates the database if necessary
   """
    config.execute()

    if cvar_update_load:
        data_update()
    else:
        try_update()

    if not iptocountry.get_last_update():
        es.dbgmsg(0, 'IPToCountry Example: Error, no database loaded!')
def load():
   """
   Ensures critical server variables are created by the config
   Updates the database if necessary
   """
   config.execute()

   if cvar_update_load:
      data_update()
   else:
      try_update()

   if not iptocountry.get_last_update():
      es.dbgmsg(0, 'IPToCountry Example: Error, no database loaded!')
def try_update():
    """ Calls data_update if the data is the requisite age and no humans are connected """
    update_days = float(cvar_update_days)
    if update_days and not playerlib.getPlayerList('#human'):
        if time.time() - iptocountry.get_last_update() > update_days * 86400:
            data_update()
def try_update():
   """ Calls data_update if the data is the requisite age and no humans are connected """
   update_days = float(cvar_update_days)
   if update_days and not playerlib.getPlayerList('#human'):
      if time.time() - iptocountry.get_last_update() > update_days * 86400:
         data_update()