1
0
forked from ScoDoc/ScoDoc

removed up_to_date checking

This commit is contained in:
Emmanuel Viennet 2021-09-09 07:59:28 +02:00
parent 829d5d8b2e
commit c6f6f45e0d
2 changed files with 5 additions and 90 deletions

View File

@ -28,104 +28,19 @@
""" Verification version logiciel vs version "stable" sur serveur """ Verification version logiciel vs version "stable" sur serveur
N'effectue pas la mise à jour automatiquement, mais permet un affichage d'avertissement. N'effectue pas la mise à jour automatiquement, mais permet un affichage d'avertissement.
Désactivé temporairement pour ScoDoc 9.
""" """
import datetime
import app.scodoc.sco_utils as scu from flask import current_app
from app import log
# Appel renvoyant la subversion "stable"
# La notion de "stable" est juste là pour éviter d'afficher trop frequemment
# des avertissements de mise à jour: on veut pouvoir inciter à mettre à jour lors de
# correctifs majeurs.
GET_VER_URL = "http://scodoc.iutv.univ-paris13.fr/scodoc-installmgr/last_stable_version"
def get_last_stable_version():
"""request last stable version number from server
(returns string as given by server, empty if failure)
(do not wait server answer more than 3 seconds)
"""
global _LAST_UP_TO_DATE_REQUEST
ans = scu.query_portal(
GET_VER_URL, msg="ScoDoc version server", timeout=3
) # sco_utils
if ans:
ans = ans.strip()
_LAST_UP_TO_DATE_REQUEST = datetime.datetime.now()
log(
'get_last_stable_version: updated at %s, answer="%s"'
% (_LAST_UP_TO_DATE_REQUEST, ans)
)
return ans
_LAST_UP_TO_DATE_REQUEST = None # datetime of last request to server
_UP_TO_DATE = True # cached result (limit requests to 1 per day)
_UP_TO_DATE_MSG = ""
def is_up_to_date(): def is_up_to_date():
"""True if up_to_date """True if up_to_date
Returns status, message Returns status, message
""" """
log("Warning: is_up_to_date not implemented for ScoDoc8") current_app.logger.debug("Warning: is_up_to_date not implemented for ScoDoc9")
return True, "unimplemented" return True, "unimplemented"
# global _LAST_UP_TO_DATE_REQUEST, _UP_TO_DATE, _UP_TO_DATE_MSG
# if _LAST_UP_TO_DATE_REQUEST and (
# datetime.datetime.now() - _LAST_UP_TO_DATE_REQUEST
# ) < datetime.timedelta(1):
# # requete deja effectuee aujourd'hui:
# return _UP_TO_DATE, _UP_TO_DATE_MSG
# last_stable_ver = get_last_stable_version()
# cur_ver = scu.get_svn_version(scu.SCO_SRC_DIR) # in sco_utils
# cur_ver2 = cur_ver
# cur_ver_num = -1
# # Convert versions to integers:
# try:
# # cur_ver can be "1234" or "1234M' or '1234:1245M'...
# fs = cur_ver.split(":", 1)
# if len(fs) > 1:
# cur_ver2 = fs[-1]
# m = re.match(r"([0-9]*)", cur_ver2)
# if not m:
# raise ValueError(
# "invalid svn version"
# ) # should never occur, regexp always (maybe empty) match
# cur_ver_num = int(m.group(1))
# except:
# log('Warning: no numeric subversion ! (cur_ver="%s")' % cur_ver)
# return _UP_TO_DATE, _UP_TO_DATE_MSG # silently ignore misconfiguration ?
# try:
# last_stable_ver_num = int(last_stable_ver)
# except:
# log("Warning: last_stable_version returned by server is invalid !")
# return (
# _UP_TO_DATE,
# _UP_TO_DATE_MSG,
# ) # should ignore this error (maybe server is unreachable)
# #
# if cur_ver_num < last_stable_ver_num:
# _UP_TO_DATE = False
# _UP_TO_DATE_MSG = "Version %s disponible (version %s installée)" % (
# last_stable_ver,
# cur_ver_num,
# )
# log(
# "Warning: ScoDoc installation is not up-to-date, should upgrade\n%s"
# % _UP_TO_DATE_MSG
# )
# else:
# _UP_TO_DATE = True
# _UP_TO_DATE_MSG = ""
# log(
# "ScoDoc is up-to-date (cur_ver: %s, using %s=%s)"
# % (cur_ver, cur_ver2, cur_ver_num)
# )
# return _UP_TO_DATE, _UP_TO_DATE_MSG
def html_up_to_date_box(): def html_up_to_date_box():

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.0.10" SCOVERSION = "9.0.11"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"