[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/var/www/se3/majphp/ -> majtest.php (source)

   1  <?php
   2  
   3  
   4     /**
   5     
   6     * Mise a jour de SambaEdu3 
   7     * @Version $Id: majtest.php 8557 2015-03-15 13:02:33Z plouf $ 
   8     
   9    
  10     * @Projet LCS / SambaEdu 
  11     
  12     * @auteurs wawa   olivier.lecluse@crdp.ac-caen.fr
  13     * @auteurs Equipe Tice academie de Caen
  14     
  15     * @Licence Distribue selon les termes de la licence GPL
  16     
  17     * @note 
  18     
  19     */
  20  
  21     /**
  22  
  23     * @Repertoire: majphp 
  24     * file: majtest.php
  25  
  26    */    
  27  
  28  
  29  require("entete.inc.php");
  30  
  31  //aide
  32  $_SESSION["pageaide"]="Prise_en_main#Mettre_.C3.A0_jour_le_serveur";
  33  
  34  if (ldap_get_right("se3_is_admin",$login)!="Y")
  35      die ("<HTML><BODY>".gettext("Vous n'avez pas les droits suffisants pour acc&#233;der &#224; cette fonction")."</BODY></HTML>");
  36  
  37  $action=$_GET['action'];
  38      
  39  if ($action == "majse3") {
  40      $info_1 = gettext("Mise &#224; jour lanc&#233;e, ne fermez pas cette fen&#234;tre avant que le script ne soit termin&#233;. vous recevrez un mail r&#233;capitulatif de tout ce qui sera effectu&#233;...");
  41      echo $info_1;
  42  
  43      system('sleep 1; /usr/bin/sudo /usr/share/se3/scripts/install_se3-module.sh se3 &');
  44  }
  45  else {
  46      echo "<H1>Mise  &#224; jour du serveur Se3</H1>\n";
  47      echo "<br><br>";
  48      echo "<center>";
  49      echo "<TABLE border=\"1\" width=\"80%\">";
  50      // Modules disponibles
  51  //    echo "<TR><TD colspan=\"4\" align=\"center\" class=\"menuheader\" height=\"30\">\n";
  52  //    echo gettext("Etat des paquets");
  53  //    echo "</TD></TR>";
  54      echo "<TR><TD align=\"center\" class=\"menuheader\" height=\"30\">\n";
  55      echo gettext("Nom du paquet &#224; mettre  &#224; jour");
  56      echo "</TD><TD align=\"center\" class=\"menuheader\" height=\"30\">".gettext("Version install&#233;e")."</TD><TD align=\"center\" class=\"menuheader\" height=\"30\">".gettext("Version disponible")."</TD></TR>";
  57  
  58      
  59      // paquet se3Master
  60      // On teste si on a bien la derniere version
  61      $se3_version_install = exec("apt-cache policy se3 | grep \"Install\" | cut -d\":\" -f2");
  62      $se3_version_dispo = exec("apt-cache policy se3 | grep \"Candidat\" | cut -d\":\" -f2");
  63      if ("$se3_version_install" != "$se3_version_dispo") {
  64              echo "<TR><TD>".gettext("Paquet principal Se3")."</TD>";
  65              echo "<TD align=\"center\">$se3_version_install</TD>";
  66              echo "<TD align=\"center\"><b>$se3_version_dispo</b></TD>";
  67              echo "</TR>";
  68      }
  69  
  70  
  71      // Module se3-domain
  72      $domain_actif = exec("dpkg -s se3-domain | grep \"Status: install ok\"> /dev/null && echo 1");
  73      // On teste si on a bien la derniere version
  74      $domain_version_install = exec("apt-cache policy se3-domain | grep \"Install\" | cut -d\":\" -f2");
  75      $domain_version_dispo = exec("apt-cache policy se3-domain | grep \"Candidat\" | cut -d\":\" -f2");
  76      if ("$domain_version_install" != "$domain_version_dispo") {
  77              echo "<TR><TD>".gettext("Scripts de jonction au domaine (se3-domain)")."</TD>";
  78              echo "<TD align=\"center\">$domain_version_install</TD>";
  79              echo "<TD align=\"center\"><b>$domain_version_dispo</b></TD>";
  80              echo "</TR>";
  81      }
  82  
  83      // Module se3-logonpy
  84      $logonpy_actif = exec("dpkg -s se3-logonpy | grep \"Status: install ok\"> /dev/null && echo 1");
  85      // On teste si on a bien la derniere version
  86      $logonpy_version_install = exec("apt-cache policy se3-logonpy | grep \"Install\" | cut -d\":\" -f2");
  87      $logonpy_version_dispo = exec("apt-cache policy se3-logonpy | grep \"Candidat\" | cut -d\":\" -f2");
  88      if ("$logonpy_version_install" != "$logonpy_version_dispo") {
  89          echo "<TR><TD>".gettext("Gestion de l'environnement (se3-logonpy)")."</TD>";
  90          echo "<TD align=\"center\">$logonpy_version_install</TD>";
  91          echo "<TD align=\"center\"><b>$logonpy_version_dispo</b></TD>";
  92          echo "</TR>";
  93      }
  94  
  95      // Module backup
  96      $backup_actif = exec("dpkg -s se3-backup | grep \"Status: install ok\"> /dev/null && echo 1");
  97      if ($backup_actif =="1") {
  98          // On teste si on a bien la derniere version
  99          $backup_version_install = exec("apt-cache policy se3-backup | grep \"Install\" | cut -d\":\" -f2");
 100          $backup_version_dispo = exec("apt-cache policy se3-backup | grep \"Candidat\" | cut -d\":\" -f2");
 101          if ("$backup_version_install" != "$backup_version_dispo") {
 102              echo "<TR><TD>".gettext("Sauvegarde sur disque ou NAS (se3-backup)")."</TD>";
 103              echo "<TD align=\"center\">$backup_version_install</TD>";
 104              echo "<TD align=\"center\"><b>$backup_version_dispo</b></TD>";
 105              echo "</TR>";
 106          }
 107      }
 108      
 109      // Module Inventaire
 110      $ocs_actif = exec("dpkg -s se3-ocs | grep \"Status: install ok\"> /dev/null && echo 1");
 111      if ($ocs_actif =="1") {
 112          $ocs_version_install = exec("apt-cache policy se3-ocs | grep \"Install\" | cut -d\":\" -f2");
 113          $ocs_version_dispo = exec("apt-cache policy se3-ocs | grep \"Candidat\" | cut -d\":\" -f2");
 114          // On teste si on a bien la derniere version
 115          if ("$ocs_version_install" != "$ocs_version_dispo") {
 116              echo "<TR><TD>".gettext("Syst&#232;me d'inventaire (se3-ocs)")."</TD>";
 117              echo "<TD align=\"center\">$ocs_version_install</TD>";
 118              echo "<TD align=\"center\"><b>$ocs_version_dispo</b></TD>";
 119              echo "</TR>";
 120          }
 121      }
 122  
 123      // Module Antivirus
 124      $clam_actif = exec("dpkg -s se3-clamav | grep \"Status: install ok\"> /dev/null && echo 1");
 125      if($clam_actif == "1") {
 126          $clam_version_install = exec("apt-cache policy se3-clamav | grep \"Install\" | cut -d\":\" -f2");
 127          $clam_version_dispo = exec("apt-cache policy se3-clamav | grep \"Candidat\" | cut -d\":\" -f2");
 128          // On teste si on a bien la derniere version
 129          if ("$clam_version_install" != "$clam_version_dispo") {
 130              echo "<TR><TD>".gettext("Syst&#232;me anti-virus (se3-clamav)")."</TD>";
 131              echo "<TD align=\"center\">$clam_version_install</TD>";
 132              echo "<TD align=\"center\"><b>$clam_version_dispo</b></TD>";
 133             echo "</TR>";
 134          }
 135  
 136      }
 137  
 138      // Module DHCP
 139      $dhcp_actif = exec("dpkg -s se3-dhcp | grep \"Status: install ok\" > /dev/null && echo 1");
 140      
 141      if($dhcp_actif == "1") {
 142          $dhcp_version_install = exec("apt-cache policy se3-dhcp | grep \"Install\" | cut -d\":\" -f2");
 143          $dhcp_version_dispo = exec("apt-cache policy se3-dhcp | grep \"Candidat\" | cut -d\":\" -f2");
 144          // On teste si on a bien la derniere version
 145          if ("$dhcp_version_install" != "$dhcp_version_dispo") {
 146              echo "<TR><TD>".gettext("Serveur DHCP (se3-dhcp)")."</TD>";
 147              echo "<TD align=\"center\">$dhcp_version_install</TD>";
 148              echo "<TD align=\"center\"><b>$dhcp_version_dispo</b></TD>";
 149             echo "</TR>";
 150          }
 151          
 152      }
 153      
 154      // Menu support seven
 155      $resultat=mysql_query("SELECT * FROM params WHERE name='support_seven'");
 156      if(mysql_num_rows($resultat)==0){
 157              $support_seven=0;
 158      }
 159      else{
 160              $ligne=mysql_fetch_object($resultat);
 161              if($ligne->value=="1"){
 162                      $support_seven=1;
 163              }
 164              else {
 165                      $support_seven=0;
 166              }
 167      }
 168      if ($support_seven=="1") {
 169          $seven_version_install = exec("apt-cache policy samba | grep \"Install\" | cut -d\" \" -f4");
 170          
 171          $seven_version_dispo = exec("apt-cache policy samba | grep \"Candidat\" | cut -d\" \" -f4");
 172          // On teste si on a bien la derniere version
 173  
 174          if ("$seven_version_install" != "$seven_version_dispo") {
 175              echo "<tr><td>".gettext("Support des clients seven")."</TD>";
 176              echo "<TD align=\"center\">$seven_version_install</TD>";
 177              echo "<TD align=\"center\"><b>$seven_version_dispo</b></TD>";
 178              echo "</tr>\n";
 179          }
 180      }
 181  
 182      // Module clonage
 183      $clonage_actif = exec("dpkg -s se3-clonage | grep \"Status: install ok\" > /dev/null && echo 1");
 184      if($clonage_actif == "1") {
 185          $clonage_version_install = exec("apt-cache policy se3-clonage | grep \"Install\" | cut -d\":\" -f2");
 186          $clonage_version_dispo = exec("apt-cache policy se3-clonage | grep \"Candidat\" | cut -d\":\" -f2");
 187          // On teste si on a bien la derniere version
 188          if ("$clonage_version_install" != "$clonage_version_dispo") {
 189              echo "<TR><TD>".gettext("Clonage / sauvegarde - restauration des stations (se3-clonage)")."</TD>";
 190              echo "<TD align=\"center\">$clonage_version_install</TD>";
 191              echo "<TD align=\"center\"><b>$clonage_version_dispo</b></TD>";
 192             echo "</TR>";
 193          }
 194          
 195      }
 196      // Module unattended
 197      
 198      $unattended_actif = exec("dpkg -s se3-unattended | grep \"Status: install ok\" > /dev/null && echo 1");
 199      
 200      if($unattended_actif == "1") {
 201          $unattended_version_install = exec("apt-cache policy se3-unattended | grep \"Install\" | cut -d\":\" -f2");
 202          $unattended_version_dispo = exec("apt-cache policy se3-unattended | grep \"Candidat\" | cut -d\":\" -f2");
 203          // On teste si on a bien la derniere version
 204          if ("$unattended_version_install" != "$unattended_version_dispo") {
 205              echo "<TR><TD>".gettext("Installation de stations (se3-unattended)")."</TD>";
 206              echo "<TD align=\"center\">$unattended_version_install</TD>";
 207              echo "<TD align=\"center\"><b>$unattended_version_dispo</b></TD>";
 208              echo "</TR>";
 209          }
 210          
 211      }
 212      
 213      
 214  
 215      // Module wpkg
 216      $wpkg_actif = exec("dpkg -s se3-wpkg | grep \"Status: install ok\" > /dev/null && echo 1");
 217      if($wpkg_actif == "1") {
 218          $wpkg_version_install = exec("apt-cache policy se3-wpkg | grep \"Install\" | cut -d\":\" -f2");
 219          $wpkg_version_dispo = exec("apt-cache policy se3-wpkg | grep \"Candidat\" | cut -d\":\" -f2");
 220          // On teste si on a bien la derniere version
 221          if ("$wpkg_version_install" != "$wpkg_version_dispo") {
 222              echo "<TR><TD>".gettext("D&#233;ploiement d'applications sur les clients windows (se3-wpkg)")."</TD>";
 223              echo "<TD align=\"center\">$wpkg_version_install</TD>";
 224              echo "<TD align=\"center\"><b>$wpkg_version_dispo</b></TD>";
 225              echo "</TR>";
 226          }
 227          
 228      }
 229      
 230      
 231  
 232      // Module internet
 233      $internet_actif = exec("dpkg -s se3-internet | grep \"Status: install ok\" > /dev/null && echo 1");
 234      if($internet_actif == "1") {
 235          $internet_version_install = exec("apt-cache policy se3-internet | grep \"Install\" | cut -d\":\" -f2");
 236          $internet_version_dispo = exec("apt-cache policy se3-internet | grep \"Candidat\" | cut -d\":\" -f2");
 237          // On teste si on a bien la derniere version
 238          if ("$internet_version_install" != "$internet_version_dispo") {
 239              echo "<TR><TD>".gettext("contr&#244;le de l'acc&#232;s internet (se3-internet)")."</TD>";
 240              echo "<TD align=\"center\">$internet_version_install</TD>";
 241              echo "<TD align=\"center\"><b>$internet_version_dispo</b></TD>";
 242              echo "</TR>";
 243          }
 244          
 245      }
 246      
 247      // Module synchro
 248      $synchro_actif = exec("dpkg -s se3-synchro | grep \"Status: install ok\" > /dev/null && echo 1");
 249      if($synchro_actif == "1") {
 250          $synchro_version_install = exec("apt-cache policy se3-synchro | grep \"Install\" | cut -d\":\" -f2");
 251          $synchro_version_dispo = exec("apt-cache policy se3-synchro | grep \"Candidat\" | cut -d\":\" -f2");
 252          // On teste si on a bien la derniere version
 253          if ("$synchro_version_install" != "$synchro_version_dispo") {
 254              echo "<TR><TD>".gettext("synchronisation distante de fichiers (se3-synchro)")."</TD>";
 255              echo "<TD align=\"center\">$synchro_version_install</TD>";
 256              echo "<TD align=\"center\"><b>$synchro_version_dispo</b></TD>";
 257              echo "</TR>";
 258          }
 259          
 260      }
 261      
 262      
 263      echo "</table>";
 264      echo "<BR><BR>";
 265          
 266          
 267      echo "Vous pouvez consulter la liste des changements en consultant <a href='http://wwdeb.crdp.ac-caen.fr/mediase3/index.php/Mises_%C3%A0_jour' TARGET='_blank' >cette page</a> \n";
 268      echo "<BR><BR>";
 269          echo "<FORM action=\"majtest.php?action=majse3 \"method=\"post\"><CENTER><INPUT type='submit' VALUE='Lancer la mise &#224; jour'></CENTER></FORM>\n";
 270          
 271  
 272  }
 273  # pied de page
 274  include ("pdp.inc.php");
 275  
 276  ?>


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1