Пример #1
0
 public function getXML()
 {
     $xml = new DomDocument();
     $xml->encoding = "UTF-8";
     // cr?ation de la racine avec id du tu
     $root = $this->createNoeud($xml, $xml, "tu");
     $root->setAttribute("id", TBIDSITE);
     $root_key = $this->createNoeud($xml, $root, "key");
     $root_key->appendChild($xml->createTextNode(TBKEYSITE));
     // noeud id serveur veille
     $root_veille = $this->createNoeud($xml, $root, "idVeille");
     $root_veille->appendChild($xml->createTextNode($this->encode($a)));
     $root_date = $this->createNoeud($xml, $root, "date");
     $root_date->appendChild($xml->createTextNode(date("c")));
     // noeud version
     $root_version = $this->createNoeud($xml, $root, "version");
     $root_version->appendChild($xml->createTextNode($this->encode($this->getVersion())));
     // noeud nombre de patients
     $root_nb_patients = $this->createNoeud($xml, $root, "nbPatients");
     $root_nb_patients->appendChild($xml->createTextNode($this->encode($this->getNbPatients())));
     // noeud nombre de m?decins pr?sents
     $root_nb_medecins = $this->createNoeud($xml, $root, "nbMedecins");
     $root_nb_medecins->appendChild($xml->createTextNode($this->encode($this->getNbMedecins())));
     // ENQUETES
     $root_enq = $this->createNoeud($xml, $root, "enquetes");
     $tab_enq = $this->getEnquetes();
     foreach ($tab_enq as $enq) {
         $node_enq = $this->createNoeud($xml, $root_enq, "enquete");
         $node_enq->setAttribute("id", $this->encode($enq['id']));
         $enq_name = $this->createNoeud($xml, $node_enq, "name");
         $enq_name->appendChild($xml->createTextNode($this->encode($enq['nom'])));
         $enq_valeur = $this->createNoeud($xml, $node_enq, "value");
         $enq_valeur->appendChild($xml->createTextNode($this->encode($enq['is_active'])));
     }
     // OPTIONS
     $root_option = $this->createNoeud($xml, $root, "options");
     $opt_categs = $this->getOptCateg();
     foreach ($opt_categs as $categ) {
         $node_categ = $this->createNoeud($xml, $root_option, "categ");
         $node_categ->setAttribute("nom", $this->encode($categ['categorie']));
         $opts = $this->getTabOptions($categ['categorie']);
         // noeuds options
         foreach ($opts as $opt) {
             $node_opt = $this->createNoeud($xml, $node_categ, "option");
             $node_opt->setAttribute("id", $this->encode($opt['idoption']));
             $opt_name = $this->createNoeud($xml, $node_opt, "name");
             $opt_name->appendChild($xml->createTextNode($this->encode($opt['libelle'])));
             $opt_valeur = $this->createNoeud($xml, $node_opt, "value");
             $opt_valeur->appendChild($xml->createTextNode($this->encode($opt['valeur'])));
         }
     }
     // ajout des tests du index.test.php
     $root_tests = $xml->createElement("tests");
     $root->appendChild($root_tests);
     $tests_categ1 = $this->createCategTest($xml, $root_tests, "Configuration php basique");
     $this->createNoeudTest($xml, $tests_categ1, "Test version de PHP > 5.1.0", clUpdater::checkPHPVersion('5.1.0'));
     $this->createNoeudTest($xml, $tests_categ1, "Safe mode non activ?", clUpdater::testSafeMode());
     $this->createNoeudTest($xml, $tests_categ1, "Test de la desactivation de la limite temporelle d'execution du script", clUpdater::testLimiteTempo());
     $this->createNoeudTest($xml, $tests_categ1, "Test de l'augmentation de la memoire allouee a 512M", clUpdater::testNoNoNoNoNoNoThereIsNoLimit("512M"));
     $tests_categ2 = $this->createCategTest($xml, $root_tests, "Modules php necessaires");
     $modules = array("soap", "xsl", "xml", "ftp", "mysql", "calendar", "gd", "zlib", "mbstring", "sockets");
     foreach ($modules as $module) {
         $this->createNoeudTest($xml, $tests_categ2, "Test de la presence du module PHP " . $module, clUpdater::testModule($module));
     }
     $tests_categ3 = $this->createCategTest($xml, $root_tests, "Modules php pour fonctionalites etendues");
     $modules = array("curl", "openssl");
     foreach ($modules as $module) {
         $this->createNoeudTest($xml, $tests_categ3, "Test de la presence du module PHP " . $module, clUpdater::testModule($module));
     }
     $tests_categ4 = $this->createCategTest($xml, $root_tests, "Verification des repertoires");
     $dirs = array(URLCACHE, URLDOCS, URLLOCAL . 'hprim/', URLLOCAL . 'hprim/ok/', URLLOCAL . 'hprim/xml/', URLLOCAL . 'rpu/', URLLOCAL . 'rpu/ok/', URLLOCAL . 'rpu/logs/', URLLOCAL . 'var/', URLLOCAL . 'var/maj/', URLLOCAL . 'temp/', URLLOCAL . 'var/dist/');
     foreach ($dirs as $dir) {
         $this->createNoeudTest($xml, $tests_categ4, "Test du droit d'ecriture sur le dossier " . $dir, clUpdater::testEcritureDossier($dir), true);
     }
     $tests_categ5 = $this->createCategTest($xml, $root_tests, "Connexions aux bases");
     $this->createNoeudTest($xml, $tests_categ5, "Connexion au serveur MySQL '" . MYSQL_USER . "@" . MYSQL_HOST . " (using password: "******")'", mysql_pconnect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS));
     $bases = array(BASEXHAM, BDD, CCAM_BDD);
     $bbases = array("xham", "tuv2", "ccam");
     foreach ($bases as $i => $base) {
         $this->createNoeudTest($xml, $tests_categ5, "Connexion ? la base " . $bbases[$i] . " '" . $base . "'", mysql_select_db($base));
         $this->createNoeudTest($xml, $tests_categ5, "Test des privileges " . $bbases[$i] . " : CREATE ALTER DROP base '" . $base . "'", clUpdater::testGrantOnBase(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, $base));
     }
     $tests_categ6 = $this->createCategTest($xml, $root_tests, "Communication");
     ob_flush();
     flush();
     $ftp_server = 'www.veille-arh-paca.com';
     $ftp_user_name = 'importsrv';
     $ftp_user_pass = '******';
     $this->createNoeudTest($xml, $tests_categ6, "Test de connexion FTP vers serveur de veille  (ftp://www.veille-arh-paca.com)", clUpdater::testDepotFTP($ftp_server, $ftp_user_name, $ftp_user_pass), true);
     $this->createNoeudTest($xml, $tests_categ6, "Test de cryptage avec la clef publique ARH", clUpdater::clefARH(), true);
     return $xml;
 }
Пример #2
0
    $erreur = "";
}
affichage("Test du parametre mysql server 'lower_case_table_names = 1'", array($b, $erreur), true);
/*
 * TESTS DE COMMUNICATION VERS L'EXTERIEUR
 */
echo "<br /><hr /><h4>Communication</h4>";
//Test connexion FTP vers serveur de veille
ob_flush();
flush();
$ftp_server = 'www.veille-arh-paca.com';
$ftp_user_name = 'importsrv';
$ftp_user_pass = '******';
affichage("Test de connexion FTP vers serveur de veille  (ftp://www.veille-arh-paca.com)", clUpdater::testDepotFTP($ftp_server, $ftp_user_name, $ftp_user_pass), true);
$isSrvMaj = affichage("Test de connexion au serveur de mises à jour (www.orupaca.fr:80)", false !== strpos(XhamUpdater::getUrlContents('http://www.orupaca.fr/test_tu.html'), 'ok'), false, false, false);
affichage("Test de cryptage avec la clef publique ARH", clUpdater::clefARH(), true);
/*
 * MAJ BASES
 */
echo "<br /><hr /><h4>Mise a jour des bases de données</h4>";
clUpdater::applyPatchs(IDSITE) == 0;
/*
 * MAJ TU
 */
if ($isSrvMaj) {
    //    clUpdater::updateTU(URL_MAJ);
    echo "<br /><hr /><h4>Mise a jour de l'application</h4>";
    $tabMatches = array();
    preg_match('/_maj_(.*)_hash_(.*)_/', XhamUpdater::getUrlContents(URL_MAJ . '/last_version_' . BRANCHE . '.html?nocacheteweak=' . rand(1, 10000)), $tabMatches);
    $lastVersion = $tabMatches[1];
    $currentVersion = str_replace("\n", '', file_get_contents(URLLOCAL . 'version.txt'));