1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
| PROCEDURE maj_auto_proc()
Fichier_a_telecharger est une chaîne
name_light_or_full est une chaîne
//Ping
ping_ouverte est un entier
ping_texte est une chaîne
ping_fichier est une chaîne
ping_fichier ="/diagbox/web/tmp/ping.txt"
SI fFichierExiste(ping_fichier) =Vrai ALORS
fSupprime(ping_fichier)
FIN
PHPExécute(scripts_ping)
Multitâche(10)
SI fFichierExiste(ping_fichier) =Faux ALORS
error_logs_proc("Pas de fichier ping txt apres lancement script ping.sh","ouverture page maj","")
RENVOYER "2"
FIN
ping_ouverte =fOuvre(ping_fichier,foLectureEcriture)
SI ping_ouverte =-1 ALORS
fSupprime(ping_fichier)
error_logs_proc("Echec ouverture fichier ping.txt","ouverture page maj","")
RENVOYER "2"
FIN
ping_texte =fLitLigne(ping_ouverte)
SI ping_texte ="ok" ALORS
fFerme(ping_ouverte)
fSupprime(ping_fichier)
SINON
fFerme(ping_ouverte)
fSupprime(ping_fichier)
error_logs_proc("retour ko du script ping.sh","ouverture page maj","")
RENVOYER "3"
FIN
//Connexion bdd
SI maj_connexion_bdd() <>1 ALORS
RENVOYER "4"
FIN
SI HLitDernier(MISE_A_JOUR,incr) =Vrai ALORS
name_light_or_full ="diagboxx.update"
uuuuuu est une chaîne
uuuuuu =MISE_A_JOUR.incr
HExécuteRequête(requ_maj_full_or_light,hRequêteSansCorrection,uuuuuu,"full")
SI HLitPremier(requ_maj_full_or_light) ALORS
SI HTrouve(requ_maj_full_or_light) =Vrai ALORS
Fichier_a_telecharger =requ_maj_full_or_light.nom_fichier
SINON
HFermeConnexion(bdd_distante_cnx)
HFermeConnexion(bdd_distante_secours_cnx)
error_logs_proc("Aucune reponse trouvée dans la bdd","","")
RENVOYER "4"
FIN
SINON
HFermeConnexion(bdd_distante_cnx)
HFermeConnexion(bdd_distante_secours_cnx)
error_logs_proc("Aucune reponse trouvée dans la bdd","","")
RENVOYER "4"
FIN
HFermeConnexion(bdd_distante_cnx)
HFermeConnexion(bdd_distante_secours_cnx)
SINON
HFermeConnexion(bdd_distante_cnx)
HFermeConnexion(bdd_distante_secours_cnx)
error_logs_proc("Aucune reponse trouvée dans la bdd","","")
RENVOYER "4"
FIN
SELON maj_connexion_ftp()
CAS 1
//check si le dossier result est present
FTPDéconnecte(connexion_ftp_loadchoice)
result_final_fichier est une chaîne
result_final_fichier ="/diagbox/web/tmp/maj_resultat"
SI fFichierExiste(result_final_fichier) =Vrai ALORS
fSupprime(result_final_fichier)
FIN
//Création du php tempo
tempo_php est une chaîne
tempo_php =doss_tmp+"telecharger_maj.php"
SI fFichierExiste(tempo_php) =Vrai ALORS
fSupprime(tempo_php)
FIN
tempo_creation est un entier
tempo_ouvre est un entier
tempo_ecrit est un entier
tempo_texte est une chaîne
tempo_creation =fCrée(tempo_php)
SI tempo_creation =-1 ALORS
error_logs_proc("Echec creation php tempo","ouverture page maj","")
fSupprime(tempo_php)
RENVOYER "5"
FIN
tempo_ouvre =fOuvre(tempo_php,foLectureEcriture)
SI tempo_ouvre =-1 ALORS
error_logs_proc("Echec ouverture php tempo","ouverture page maj","")
fSupprime(tempo_php)
RENVOYER "5"
FIN
tempo_texte ="<?php"+RC+"exec(""/diagbox/web/scripts/update/telecharger_maj.sh"+" "+...
maj_ftp_id+" "+maj_ftp_mdp+" "+maj_ftp_ip+" "+maj_ftp_port+" "+Fichier_a_telecharger+" "+name_light_or_full+""""+");"+RC+"?>"
tempo_ecrit =fEcrit(tempo_ouvre,tempo_texte)
SI tempo_ecrit =-1 ALORS
error_logs_proc("Echec ecriture php tempo","ouverture page maj","")
fSupprime(tempo_php)
RENVOYER "5"
FIN
fFerme(tempo_ouvre)
tempo_version_scripts est une chaîne
tempo_version_scripts ="/tmp/maj_php_tempo_chmod.php"
PHPExécute(tempo_version_scripts)
Multitâche(10)
SI fFichierExiste(result_final_fichier) =Vrai ALORS
error_logs_proc("Echec chmod 777 php tempo","ouverture page maj","")
fSupprime(tempo_php)
RENVOYER "5"
FIN
fSupprime(dosss+tempo_version_scripts)
tempooo est une chaîne
tempooo ="/tmp/telecharger_maj.php"
PHPExécute(tempooo)
Multitâche(10)
SI fFichierExiste(result_final_fichier) =Faux ALORS
FTPDéconnecte(connexion_ftp_loadchoice)
error_logs_proc("Echec lancement script sh maj telechargement","ouverture page maj","")
fSupprime(tempo_php)
RENVOYER "5"
FIN
final_ouvre est un entier
final_lit est une chaîne
final_ouvre =fOuvre(result_final_fichier)
SI final_ouvre =-1 ALORS
error_logs_proc("Echec ouverture fichier result final","ouverture page maj","")
fSupprime(tempo_php)
RENVOYER "5"
FIN
final_lit =fLitLigne(final_ouvre)
SI final_lit ="ok" ALORS
fSupprime(result_final_fichier)
FTPDéconnecte(connexion_ftp_loadchoice)
fSupprime(tempo_php)
RENVOYER "1"
SINON
//fSupprime(result_final_fichier)
FTPDéconnecte(connexion_ftp_loadchoice)
error_logs_proc("Echec telechargement maj","ouverture page maj","")
fSupprime(tempo_php)
RENVOYER "5"
FIN
AUTRE CAS
FTPDéconnecte(connexion_ftp_loadchoice)
error_logs_proc("Echec connexion serveur(s) ftp","ouverture page maj","")
RENVOYER "5"
FIN |