Changeset 64882 in spip-zone for _plugins_/facd
- Timestamp:
- Aug 16, 2012, 9:38:55 AM (9 years ago)
- Location:
- _plugins_/facd
- Files:
-
- 5 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/facd/action/facd_ajouter_conversion.php
r63537 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 3 * Action d'ajout de document dans la file d'attente 5 4 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 … … 18 16 /** 19 17 * Fonction d'ajout dans la file d'attente 18 * 19 * @return array 20 * Un tableau contenant l'identifiant dans la liste d'attente 20 21 */ 21 22 function action_facd_ajouter_conversion_dist(){ -
_plugins_/facd/action/facd_relancer_conversion.php
r63076 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 5 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 3 * Action de relance d'une conversion en erreur 4 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 … … 16 14 17 15 /** 18 * Relancer un encodageen erreur16 * Relancer une conversion en erreur 19 17 */ 20 18 function action_facd_relancer_conversion_dist(){ -
_plugins_/facd/action/facd_traiter_conversion.php
r63076 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 3 * Action qui lance une conversion 5 4 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 … … 25 23 */ 26 24 function action_facd_traiter_conversion_dist(){ 27 spip_log("Appel de la fonction de conversion","facd");28 25 $nb_conversions = sql_countsel('spip_facd_conversions', "statut='non'"); 29 spip_log(" Il y a $nb_conversions document(s) à convertir","facd");26 spip_log("Appel de la fonction de conversion : il y a $nb_conversions document(s) à convertir","facd"); 30 27 $en_cours = sql_fetsel('id_facd_conversion,maj','spip_facd_conversions',"statut='en_cours'"); 31 28 … … 33 30 * On essaie de voir s'il y a d'autres conversions en cours 34 31 */ 35 if(($nb_conversions >0) && !intval($en_cours['id_facd_conversion'])){32 if(($nb_conversions > 0) && !intval($en_cours['id_facd_conversion'])){ 36 33 $doc_attente = sql_fetsel("*","spip_facd_conversions","statut='non'","","id_facd_conversion ASC","1"); 37 $id_document = $doc_attente['id_document'];38 $id_facd = $doc_attente['id_facd_conversion'];39 $format = $doc_attente['extension'];40 34 /** 41 35 * Vérification de l'exisence du document 42 36 */ 43 $id_document = sql_getfetsel('id_document','spip_documents','id_document='.intval($ id_document));37 $id_document = sql_getfetsel('id_document','spip_documents','id_document='.intval($doc_attente['id_document'])); 44 38 if($id_document > 0){ 45 39 spip_log("on convertit le doc $id_document","facd"); 46 40 $convertir = charger_fonction('facd_convertir','inc'); 47 $retour = $convertir($id_document,$ id_facd,$format);41 $retour = $convertir($id_document,$doc_attente['id_facd_conversion'],$doc_attente['extension']); 48 42 }else{ 49 sql_delete('spip_facd_conversions','id_document='.sql_quote($ id_document));43 sql_delete('spip_facd_conversions','id_document='.sql_quote($doc_attente['id_document'])); 50 44 } 51 45 }else if(intval($en_cours['id_facd_conversion']) && ($en_cours['maj'] < date('Y-m-d H:i:s',mktime(date('H')-5)))){ 52 spip_log("L'id". $en_cours['id_facd_conversion']." de la file d'attente est en cours de conversion depuis plus de 5 h (".$en_cours['maj']."), on doit le réinitialiser","facd");46 spip_log("L'id". $en_cours['id_facd_conversion']." de la file d'attente est en cours de conversion depuis plus de 5 h (".$en_cours['maj']."), on le réinitialise, cela doit être une erreur","facd"); 53 47 sql_updateq('spip_facd_conversions',array('statut' => 'non'),'id_facd_conversion ='.intval($en_cours['id_facd_conversion'])); 54 48 }else if(intval($en_cours['id_facd_conversion'])){ -
_plugins_/facd/base/facd.php
r63076 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 3 * Fichier des pipelines de déclaration de tables 5 4 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 13 11 if (!defined('_ECRIRE_INC_VERSION')) return; 14 12 13 /** 14 * Déclarer la table spip_facd_conversions dans la liste des tables pour pouvoir : 15 * - la créer 16 * - la mettre à jour 17 * 18 * @param array $tables_principales 19 * Un tableau de description des tables 20 * @param array $tables_principales 21 * Le tableau complété 22 */ 15 23 function facd_declarer_tables_principales($tables_principales){ 16 24 /** … … 49 57 } 50 58 51 // Declarer dans la table des tables pour sauvegarde 59 /** 60 * Déclaration dans la table des tables pour sauvegarde 61 * 62 * @param array $interface 63 * Un tableau de description des tables 64 * @return array $interface 65 * Le table de description des tables complété 66 */ 52 67 function facd_declarer_tables_interfaces($interfaces){ 53 68 $interfaces['table_des_tables']['facd_conversions'] = 'facd_conversions'; -
_plugins_/facd/facd_administrations.php
r63076 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 3 * Fichier d'installation du plugin 5 4 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 13 11 if (!defined('_ECRIRE_INC_VERSION')) return; 14 12 13 /** 14 * Installation et mises à jour du plugin 15 * 16 * Crée la table SQL du plugin (spip_facd_conversions) 17 * 18 * @param string $nom_meta_base_version 19 * Nom de la meta informant de la version du schéma de données du plugin installé dans SPIP 20 * @param string $version_cible 21 * Version du schéma de données dans ce plugin (déclaré dans paquet.xml) 22 * @return void 23 */ 15 24 function facd_upgrade($nom_meta_base_version,$version_cible){ 16 25 $maj = array(); … … 24 33 } 25 34 35 /** 36 * Fonction de désinstallation du plugin 37 * 38 * Supprime la table SQL du plugin (spip_facd_conversions) 39 * 40 * @param string $nom_meta_base_version 41 * Nom de la meta informant de la version du schéma de données du plugin installé dans SPIP 42 * @return void 43 */ 26 44 function facd_vider_tables($nom_meta_base_version) { 27 45 include_spip('base/abstract_sql'); -
_plugins_/facd/facd_autoriser.php
r63076 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 3 * Fichier des autorisations spécifique au plugin 5 4 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 -
_plugins_/facd/facd_options.php
r63076 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 5 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 3 * Fichier d'options du plugin 4 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 13 11 if (!defined('_ECRIRE_INC_VERSION')) return; 14 12 15 if(!defined('_DIR_LIB_FLOT')) {13 if(!defined('_DIR_LIB_FLOT')) 16 14 define('_DIR_LIB_FLOT',_DIR_RACINE.'lib/flot'); 17 }18 15 19 16 ?> -
_plugins_/facd/facd_pipelines.php
r63188 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 5 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 3 * Fichier de déclaration des pipelines du plugin 4 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 -
_plugins_/facd/genie/facd_conversion.php
r63076 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 5 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 3 * Fichier des fonctions utilisées en CRON 4 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 13 11 /** 14 12 * Fonction appelée par le génie de SPIP à intervalle régulier 13 * On lance une conversion 15 14 * 16 * @return17 15 * @param object $time 16 * @return int 18 17 */ 19 18 function genie_facd_conversion($time) { -
_plugins_/facd/inc/facd_convertir.php
r63187 r64882 1 1 <?php 2 2 /** 3 * FACD 4 * File d'Attente de Conversion de Documents 3 * Fonction de conversion de document 5 4 * 6 * Auteurs : 7 * b_b 8 * kent1 (http://www.kent1.info - kent1@arscenic.info) 9 * 2010-2012 - Distribué sous licence GNU/GPL 10 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 11 9 */ 12 10 13 11 if (!defined('_ECRIRE_INC_VERSION')) return; 14 12 13 /** 14 * Fonction qui lance la conversion d'un document 15 * 16 * @param int $id_document 17 * Identifiant numérique du document à convertir 18 * @param int $id_facd 19 * Identifiant numérique dans la liste d'attente 20 * @param string/false $format 21 * Le format attendu 22 * @return bool $reussite 23 * True si la conversion a réussi, false dans le cas contraire 24 */ 15 25 function inc_facd_convertir_dist($id_document,$id_facd,$format=false){ 16 26 /** … … 55 65 } 56 66 if($res['success']){ 57 // modification de la file d'attente, on marque le document comme correctement converti 67 /** 68 * Modification de la file d'attente : 69 * on marque le document comme correctement converti 70 */ 58 71 sql_updateq("spip_facd_conversions",array('statut'=>'oui','infos'=>serialize($infos)),"id_facd_conversion=".intval($id_facd)); 59 72 $reussite = true; 60 73 }else if(isset($res['erreur'])){ 74 /** 75 * Modification de la file d'attente : 76 * on marque le document comme étant en erreur 77 */ 61 78 $info['erreur'] = $res['erreur']; 62 79 sql_updateq("spip_facd_conversions",array('statut'=>'erreur','infos'=>serialize($infos)),"id_facd_conversion=".intval($id_facd)); … … 80 97 suivre_invalideur("0",true); 81 98 99 /** 100 * On lance un encodage direct pour éviter d'attendre le prochain cron 101 */ 82 102 $conversion_directe = charger_fonction('facd_convertir_direct','inc'); 83 103 $conversion_directe(); -
_plugins_/facd/inc/facd_convertir_direct.php
r63076 r64882 1 1 <?php 2 2 /** 3 * SPIPmotion 4 * Gestion de l'encodage et des métadonnées de vidéos directement dans spip 5 * 6 * Auteurs : 7 * kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * 2008-2012 - Distribué sous licence GNU/GPL 9 * 3 * Fonction de conversion directe de document 4 * 5 * @plugin FACD pour SPIP 6 * @author b_b 7 * @author kent1 (http://www.kent1.info - kent1@arscenic.info) 8 * @license GPL 10 9 */ 11 10 12 11 if (!defined("_ECRIRE_INC_VERSION")) return; 13 12 13 /** 14 * Fonction d'encodage direct 15 * 16 * Si on a fsockopen 17 * On essaie de relancer un encodage directement si aucun encodage en cours 18 * On force l'execution comme étant publique 19 * 20 * @return void 21 */ 14 22 function inc_facd_convertir_direct_dist(){ 15 /**16 * Si on a fsockopen17 * On essaie de relancer un encodage directement18 * On force l'execution comme étant publique19 */20 23 if(function_exists('fsockopen')){ 21 24 spip_log('Appel de facd_convertir en fsokopen ','facd'); 22 $url = generer_url_action('facd_traiter_conversion','','',true); 23 $parts=parse_url($url); 24 $fp = fsockopen($parts['host'], 25 isset($parts['port'])?$parts['port']:80, 26 $errno, $errstr, 30); 27 if ($fp) { 28 $out = "GET ".$parts['path']."?".$parts['query']." HTTP/1.1\r\n"; 29 $out.= "Host: ".$parts['host']."\r\n"; 30 $out.= "Connection: Close\r\n\r\n"; 31 fwrite($fp, $out); 32 fclose($fp); 25 $nb_conversions = sql_countsel('spip_facd_conversions', "statut='en_cours'"); 26 if($nb_conversions == 0){ 27 $url = generer_url_action('facd_traiter_conversion','','',true); 28 $parts=parse_url($url); 29 $fp = fsockopen($parts['host'], 30 isset($parts['port'])?$parts['port']:80, 31 $errno, $errstr, 30); 32 if ($fp) { 33 $out = "GET ".$parts['path']."?".$parts['query']." HTTP/1.1\r\n"; 34 $out.= "Host: ".$parts['host']."\r\n"; 35 $out.= "Connection: Close\r\n\r\n"; 36 fwrite($fp, $out); 37 fclose($fp); 38 }else{ 39 spip_log('fsockopen ne semble pas fonctionner','facd'); 40 } 33 41 }else{ 34 spip_log(' fsockopen ne semble pas fonctionner','facd');42 spip_log('Une conversion est déjà en cours','facd'); 35 43 } 36 44 }else{ -
_plugins_/facd/paquet.xml
r63091 r64882 2 2 prefix="facd" 3 3 categorie="outil" 4 version="0.1. 0"4 version="0.1.2" 5 5 etat="dev" 6 6 compatibilite="[3.0.0;3.0.99]" 7 7 schema="0.0.1" 8 logo="prive/themes/spip/images/facd-32.png" 8 9 > 9 10 … … 21 22 <pipeline nom="autoriser" inclure="facd_autoriser.php" /> 22 23 23 <menu nom="facd" titre="facd:titre_page_file_menu" parent="menu_administration" />24 <menu nom="facd" titre="facd:titre_page_file_menu" parent="menu_administration" icone="images/facd-16.png" /> 24 25 25 26 <lib nom="flot" lien="http://flot.googlecode.com/files/flot-0.7.zip" />
Note: See TracChangeset
for help on using the changeset viewer.