示例#1
0
 function cleanSynchroRdfStore()
 {
     global $msg, $dbh, $charset, $PMBusername;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $result .= "<h3>" . htmlentities($msg["nettoyage_synchrordfstore_reindexation"], ENT_QUOTES, $charset) . "</h3>";
         $synchro_rdf = new synchro_rdf();
         //remise a zero des tables de synchro rdf
         $synchro_rdf->truncateStore();
         //reindex
         $query = mysql_query("select notice_id from notices order by notice_id");
         if (mysql_num_rows($query)) {
             while ($mesNotices = mysql_fetch_assoc($query)) {
                 $synchro_rdf->addRdf($mesNotices['notice_id'], 0);
                 $notice = new notice($mesNotices['notice_id']);
                 $niveauB = strtolower($notice->biblio_level);
                 //Si c'est un article, il faut réindexer son bulletin
                 if ($niveauB == 'a') {
                     $bulletin = analysis::getBulletinIdFromAnalysisId($mesNotices['notice_id']);
                     $synchro_rdf->addRdf(0, $bulletin);
                 }
             }
             mysql_free_result($query);
         }
         $compte = 0;
         $q = "SELECT *\n\t\t\tWHERE {\n\t\t\t   FILTER (!regex(?p, rdf:type,'i')) .\n\t\t\t   ?s ?p ?o\n\t\t\t}";
         $r = $synchro_rdf->store->query($q);
         if (is_array($r['result']['rows'])) {
             $compte = count($r['result']['rows']);
         }
         $result .= $compte . " " . htmlentities($msg["nettoyage_synchrordfstore_reindex_total"], ENT_QUOTES, $charset);
     } else {
         $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername);
     }
     return $result;
 }
}
require_once $class_path . '/synchro_rdf.class.php';
require_once $class_path . '/notice.class.php';
require_once $class_path . '/serials.class.php';
// la taille d'un paquet de notices
$lot = REINDEX_PAQUET_SIZE;
// defini dans ./params.inc.php
// taille de la jauge pour affichage
$jauge_size = GAUGE_SIZE;
$jauge_size .= "px";
$synchro_rdf = new synchro_rdf();
// initialisation de la borne de départ
if (!isset($start)) {
    $start = 0;
    //remise a zero des tables de synchro rdf
    $synchro_rdf->truncateStore();
}
$v_state = urldecode($v_state);
if (!$count) {
    $notices = pmb_mysql_query("SELECT count(1) FROM notices", $dbh);
    $count = pmb_mysql_result($notices, 0, 0);
}
print "<br /><br /><h2 align='center'>" . htmlentities($msg["nettoyage_synchrordfstore_reindexation"], ENT_QUOTES, $charset) . "</h2>";
$NoIndex = 1;
$query = pmb_mysql_query("select notice_id from notices order by notice_id LIMIT {$start}, {$lot}");
if (pmb_mysql_num_rows($query)) {
    // définition de l'état de la jauge
    $state = floor($start / ($count / $jauge_size));
    $state .= "px";
    // mise à jour de l'affichage de la jauge
    print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge' width='100%'>";