Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1133 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Problème shell_exec fonctionne pas Graphviz Mediawiki

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Problème shell_exec fonctionne pas Graphviz Mediawiki

n°2240352
mikael923
Posté le 15-10-2014 à 11:40:18  profilanswer
 

Bonjour,
J’essaye d’installer et de faire fonctionner l’Extension :GraphViz sur un mediawiki pour générer des graphes. Puis par la suite installer les extensions xycategoriesBrowser ou FormGraph pour les générer automatiquement.
 
Mediawiki : 1.23.1  PHP : 5.5.11 sur Windows7
Extension :Graphviz  v1.3.1 qui date du 2014-07-10 (très récent) http://www.mediawiki.org/wiki/Extension:GraphViz  
Le programme Graphviz 2.38 installé depuis http://www.graphviz.org/Download..php en .msi
 
 
 Voila mon problème les graphes ne veulent pas se générer avec les balises par exemple :
<graphviz border='frame' format='png' caption='Graph for example no. 1'>
digraph example1 {Hello->World}
</graphviz>
 
Le problème s’emblerait venir de la commande de wfshell_exec :  
 
protected static function executeCommand( $command, &$output ) {
  if ( !wfIsWindows() ) {
// redirect stderr to stdout so that it will be included in outputArray
   $command .= " 2>&1";  
                }
 $output = wfShellExec( $command, $ret );
   if ( $ret != 0 ) {  
return false;  }
  return true;
}
 
La source et le fichier .png sont bien créé quand je met des exit donc la $command est bonne. Le $ret me met toujours un false car égal à 1 et la sortie $output est nulle. Je suppose que c’est la fonction de shell_exec qui bug.
 
Evidement j’ai bien les droits utilisateurs dans les dossiers, la variable d’environnement path modifiée, les chemins dot et exec path, l’Extension ImageMaps qui fonctionne.
 
Cette function executeCommand intervient ici :
 protected static function render( $input, $args, $parser )
 {   ----------sous silence---------------  
  // check if the graph source changed only if:
  // - the wiki text is being saved or
  // - an edit of the wiki text is being previewed or
  // - the graph image or map file does not exist
  $sourceChanged = false;
  if ( $saving || $isPreview || !$imageExists || !$mapExists ) {
   if ( !self::isSourceChanged( $graphParms->getSourcePath( $isPreview ), $input, $sourceChanged, $errorText ) ) {
    return self::errorHTML( $errorText );
   }
  }
  wfDebug( __METHOD__ . ": sourceChanged: $sourceChanged\n" );
 
//var_dump ($graphParms->getImageCommand( $isPreview ));
  echo "AVANT TESTS DES CHANGEMENTS\n";
// generate image and map files only if the graph source changed or the image or map files do not exist
  if ( $sourceChanged || !$imageExists || !$mapExists ) {
  // first, check if the user is allowed to upload the image
   if ( !UploadLocalFile::isUploadAllowedForUser( $user, $errorText ) ) {
    return self::errorHTML( $errorText );
   }
   echo "JE PEUX FAIRE UN UPLOAD\n";
 
   // if the source changed, update it on disk
   if ( $sourceChanged ) {
       echo "LA SOURCE A BIEN CHANGEE\n";
    if ( !self::updateSource( $graphParms->getSourcePath( $isPreview ), $input, $errorText ) ) {
     self::deleteFiles( $graphParms, $isPreview, false );
     return self::errorHTML( $errorText );
    }
   }
   echo "LA SOURCE EST GENEREE\n";
   //var_dump($isPreview);
 
   // execute the image creation command
   if ( !self::executeCommand( $graphParms->getImageCommand( $isPreview ), $errorText ) )
   {
   self::deleteFiles( $graphParms, $isPreview, false );
 
   // remove path info from the errorText
  $errorText = str_replace( $imageDir, "", $errorText );
  $errorText = str_replace( $sourceAndMapDir, "", $errorText );
  return self::multilineErrorHTML( $errorText );
  }
  echo "L IMAGE EST GENEREE\n";  (ne le fait jamais ici)
  exit;
 
// check if the upload is allowed for the intended title (the image file must exist prior to this check)
   if ( !UploadLocalFile::isUploadAllowedForTitle(
    $user,
    $graphParms->getImageFileName( $isPreview ),
    $graphParms->getImagePath( $isPreview ),
    false,
    $parser->getFunctionLang(),
    $errorText ) )
   {
    self::deleteFiles( $graphParms, $isPreview, false );
    return self::errorHTML( $errorText );
   }
 
   // execute the map creation command
   if ( !self::executeCommand( $graphParms->getMapCommand( $isPreview ), $errorText ) )
   {
    self::deleteFiles( $graphParms, $isPreview, false );
 
// remove path info from the errorText (file base names are allowed to pass)
  $errorText = str_replace( $imageDir, "", $errorText );
  $errorText = str_replace( $sourceAndMapDir, "", $errorText );
  return self::multilineErrorHTML( $errorText );
   }
 
 
Donc quelqu'un aurait une idée pour faire fonctionner correctement la fonction de shell_exec ?
Merci beaucoup de votre attention et de l'intérêt que vous pourrez porter à mon problème.
 
Mikael.
 
 
 
J’ai essayé toutes les versions antérieurs sans succès. J’ai cependant trouvé quelques informations (des versions antérieur d’ailleurs) .
 
$cmdline    = wfEscapeShellArg($cmd).' -T '.$outputType.'   -o '.wfEscapeShellArg($imgn).' '.$inputOption.wfEscapeShellArg($src);
  $cmdlinemap = wfEscapeShellArg($cmd).$mapDashTOption.'-o '.wfEscapeShellArg($mapn).' '.$inputOption.wfEscapeShellArg($src);
if ( $isWindows ) {
                 $WshShell = new COM("WScript.Shell" );
                 $ret = $WshShell->Exec($cmdline);
                 $retmap = $WshShell->Exec($cmdlinemap);
             }     else {
                 $ret = shell_exec($cmdline);
                 $retmap = shell_exec($cmdlinemap);
 
Sinon j'ai vu aussi l'anti-aliasing avec ImageMagick où on passe  
dotCommand > OutputPSscript > Passed to Magick > .png mais plus dure à mettre en place.

mood
Publicité
Posté le 15-10-2014 à 11:40:18  profilanswer
 

n°2240399
olivthill
Posté le 15-10-2014 à 18:48:21  profilanswer
 

Dans le titre, vous dites que le coupable est "shell_exec".
Mais le dernier bout de programme montre que "shell_exec" n'est pas utilisé sous Windows (or vous voulez le faire tourner sous Windows si j'ai bien compris).
 
Dans le texte vous dites que ce serait "wfshell_exec".
Mais le code du début montre "wfShellExec".
 
Vous dites que "la $command est bonne".
Mmm'oui ?! Faut voir.
 
Pour plus d'informations sur "WScript.Shell", voir http://msdn.microsoft.com/en-us/li [...] s.84).aspx et  http://msdn.microsoft.com/en-us/li [...] s.84).aspx
A priori, c'est la méthode "exec" qui m'étonne un peu, et peut-être que ça irait mieux avec la méthode "run".


Message édité par olivthill le 15-10-2014 à 18:48:55

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Problème shell_exec fonctionne pas Graphviz Mediawiki

 

Sujets relatifs
probleme de soulignement sur code blocks 13.12dd
Problème de transtypageProblème encodage
Problème à l'installation d'un template Joomlaproblème avec jquery et fonction load()
probleme de lancement du scriptProblème d'interruption externe sur PIC18
Problème pour insérer des données sur MySQL[Shell] Executer des commandes en provenance d'une liste
Plus de sujets relatifs à : Problème shell_exec fonctionne pas Graphviz Mediawiki


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR