id_tache = $id_tache; } //formulaire spécifique au type de tâche function show_form ($param='') { global $msg, $charset, $acquisition_active, $pmb_indexation_docnum; global $pmb_gestion_financiere, $pmb_gestion_amende; if ($param["clean"]) { foreach ($param["clean"] as $name=>$value) { $$name = $value; } } $form_task .= "
 
 
 
 
 
 
 
 
 
 
"; if ($acquisition_active) { $form_task .= "
 
"; } $form_task .= "
 
 
 
 
 
"; if($pmb_indexation_docnum){ $form_task .= "
 
"; } $form_task .= "
 
"; if($pmb_gestion_financiere && $pmb_gestion_amende){ $form_task .= "
 
"; } $form_task .= "
"; return $form_task; } function task_execution() { global $dbh, $msg, $charset, $PMBusername; global $acquisition_active,$pmb_indexation_docnum; if (SESSrights & ADMINISTRATION_AUTH) { $parameters = $this->unserialize_task_params(); $percent = 0; //progression $p_value = (int) 100/count($parameters["clean"]); $this->report[] = "".$this->msg["planificateur_clean"].""; $result=""; foreach ($parameters["clean"] as $clean) { $this->listen_commande(array(&$this,"traite_commande")); if($this->statut == WAITING) { $this->send_command(RUNNING); } if ($this->statut == RUNNING) { switch ($clean) { case INDEX_GLOBAL: $result .= "".htmlentities($msg["nettoyage_index_global"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_indexGlobal')) { $result .= $this->proxy->pmbesClean_indexGlobal(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"indexGlobal","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case INDEX_NOTICES: $result .= "".htmlentities($msg["nettoyage_index_notices"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_indexNotices')) { $result .= $this->proxy->pmbesClean_indexNotices(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"indexNotices","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_AUTHORS: $result .= "".htmlentities($msg["nettoyage_clean_authors"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanAuthors')) { $result .= $this->proxy->pmbesClean_cleanAuthors(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanAuthors","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_PUBLISHERS: $result .= "".htmlentities($msg["nettoyage_clean_editeurs"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanPublishers')) { $result .= $this->proxy->pmbesClean_cleanPublishers(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanPublishers","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_COLLECTIONS: $result .= "".htmlentities($msg["nettoyage_clean_collections"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanCollections')) { $result .= $this->proxy->pmbesClean_cleanCollections(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanCollections","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_SUBCOLLECTIONS: $result .= "".htmlentities($msg["nettoyage_clean_subcollections"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanSubcollections')) { $result .= $this->proxy->pmbesClean_cleanSubcollections(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanSubcollections","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_CATEGORIES: $result .= "".htmlentities($msg["nettoyage_clean_categories"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanCategories')) { $result .= $this->proxy->pmbesClean_cleanCategories(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanCategories","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_SERIES: $result .= "".htmlentities($msg["nettoyage_clean_series"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanSeries')) { $result .= $this->proxy->pmbesClean_cleanSeries(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanSeries","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_RELATIONS: $result .= "".htmlentities($msg["nettoyage_clean_relations"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanRelations')) { $result .= $this->proxy->pmbesClean_cleanRelations(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanRelations","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_NOTICES: $result .= "".htmlentities($msg["nettoyage_clean_expl"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanNotices')) { $result .= $this->proxy->pmbesClean_cleanNotices(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanNotices","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case INDEX_ACQUISITIONS: $result .= "".htmlentities($msg["nettoyage_reindex_acq"], ENT_QUOTES, $charset).""; $result .= ""; if ($acquisition_active) { if (method_exists($this->proxy, 'pmbesClean_indexAcquisitions')) { $result .= $this->proxy->pmbesClean_indexAcquisitions(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"indexAcquisitions","pmbesClean",$PMBusername)."

"; } } else { $result .= "

".$this->msg["clean_acquisition"]."

"; } $result .= ""; break; case GEN_SIGNATURE_NOTICE: $result .= "".htmlentities($msg["gen_signature_notice"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_genSignatureNotice')) { $result .= $this->proxy->pmbesClean_genSignatureNotice(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"genSignatureNotice","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case NETTOYAGE_CLEAN_TAGS: $result .= "".htmlentities($msg["nettoyage_clean_tags"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_nettoyageCleanTags')) { $result .= $this->proxy->pmbesClean_nettoyageCleanTags(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"nettoyageCleanTags","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case CLEAN_CATEGORIES_PATH: $result .= "".htmlentities($msg["clean_categories_path"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_cleanCategoriesPath')) { $result .= $this->proxy->pmbesClean_cleanCategoriesPath(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"cleanCategoriesPath","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case GEN_DATE_PUBLICATION_ARTICLE: $result .= "".htmlentities($msg["gen_date_publication_article"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_genDatePublicationArticle')) { $result .= $this->proxy->pmbesClean_genDatePublicationArticle(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"genDatePublicationArticle","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case GEN_DATE_TRI: $result .= "".htmlentities($msg["gen_date_tri"], ENT_QUOTES, $charset).""; $result .= ""; if (method_exists($this->proxy, 'pmbesClean_genDateTri')) { $result .= $this->proxy->pmbesClean_genDateTri(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"genDateTri","pmbesClean",$PMBusername)."

"; } $result .= ""; break; case INDEX_DOCNUM: $result .= "".htmlentities($msg["docnum_reindexer"], ENT_QUOTES, $charset).""; $result .= ""; if ($pmb_indexation_docnum) { if (method_exists($this->proxy, 'pmbesClean_indexDocnum')) { $result .= $this->proxy->pmbesClean_indexDocnum(); $percent += $p_value; $this->update_progression($percent); } else { $result .= "

".sprintf($msg["planificateur_function_rights"],"indexDocnum","pmbesClean",$PMBusername)."

"; } } else { $result .= "

".$this->msg["clean_indexation_docnum"]."

"; } $result .= ""; break; case CLEAN_OPAC_SEARCH_CACHE: $result .= "".htmlentities($msg["cleaning_opac_search_cache"], ENT_QUOTES, $charset).""; $result .= ""; $query = "truncate table search_cache"; if(mysql_query($query)){ $query = "optimize table search_cache"; if(mysql_query($query)){ $result.= "OK"; }else{ $result.= "OK"; } $percent += $p_value; $this->update_progression($percent); }else{ $result.= "KO"; } $result .= ""; break; case CLEAN_CACHE_AMENDE: $result .= "".htmlentities($msg["cleaning_cache_amende"], ENT_QUOTES, $charset).""; $result .= ""; $query = "truncate table cache_amendes"; if(mysql_query($query)){ $query = "optimize table cache_amendes"; if(mysql_query($query)){ $result.= "OK"; }else{ $result.= "OK"; } $percent += $p_value; $this->update_progression($percent); }else{ $result.= "KO"; } $result .= ""; break; } } } $this->report[] = $result; } else { $this->report[] = "".sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername).""; } } function traite_commande($cmd,$message) { switch ($cmd) { case RESUME : $this->send_command(WAITING); break; case SUSPEND : $this->suspend_clean(); break; case STOP : $this->finalize(); die(); break; case FAIL : $this->finalize(); die(); break; } } function make_serialized_task_params() { global $index_global, $index_notices, $clean_authors, $clean_editeurs; global $clean_collections, $clean_subcollections, $clean_categories; global $clean_series, $clean_relations, $clean_notices, $index_acquisitions; global $gen_signature_notice, $nettoyage_clean_tags, $clean_categories_path; global $gen_date_publication_article, $gen_date_tri, $reindex_docnum; global $clean_opac_search_cache, $clean_cache_amende; $t = parent::make_serialized_task_params(); $t_clean = array(); if ($index_global) $t_clean["index_global"] = $index_global; if($index_notices) $t_clean["index_notices"] = $index_notices; if($clean_authors) $t_clean["clean_authors"] = $clean_authors; if($clean_editeurs) $t_clean["clean_editeurs"] = $clean_editeurs; if($clean_collections) $t_clean["clean_collections"] = $clean_collections; if($clean_subcollections) $t_clean["clean_subcollections"] = $clean_subcollections; if($clean_categories) $t_clean["clean_categories"] = $clean_categories; if($clean_series) $t_clean["clean_series"] = $clean_series; if($clean_notices) $t_clean["clean_notices"] = $clean_notices; if($index_acquisitions) $t_clean["index_acquisitions"] = $index_acquisitions; if($gen_signature_notice) $t_clean["gen_signature_notice"] = $gen_signature_notice; if($nettoyage_clean_tags) $t_clean["nettoyage_clean_tags"] = $nettoyage_clean_tags; if($clean_categories_path) $t_clean["clean_categories_path"] = $clean_categories_path; if($gen_date_publication_article) $t_clean["gen_date_publication_article"] = $gen_date_publication_article; if($gen_date_tri) $t_clean["gen_date_tri"] = $gen_date_tri; if($reindex_docnum) $t_clean["reindex_docnum"] = $reindex_docnum; if($clean_opac_search_cache) $t_clean["clean_opac_search_cache"] = $clean_opac_search_cache; if($clean_cache_amende) $t_clean["clean_cache_amende"] = $clean_cache_amende; if($clean_relations) $t_clean["clean_relations"] = $clean_relations; $t["clean"] = $t_clean; return serialize($t); } function unserialize_task_params() { $params = $this->get_task_params(); return $params; } function suspend_clean() { while ($this->statut == SUSPENDED) { sleep(20); $this->listen_commande(array(&$this,"traite_commande")); } } }