Overview

Namespaces

  • GAubry
    • ErrorHandler
    • Helpers
    • Logger
    • Shell
  • Himedia
    • Padocc
      • DB
      • Minifier
      • Numbering
      • Properties
      • Task
        • Base
        • Extended
  • None
  • Psr
    • Log

Classes

  • Backup
  • Call
  • Composer
  • Copy
  • Environment
  • ExternalProperty
  • FillTemplate
  • HTTP
  • Link
  • MkDir
  • Project
  • Property
  • Rename
  • Sync
  • Target
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: namespace Himedia\Padocc\Task\Base;
 4: 
 5: use Himedia\Padocc\AttributeProperties;
 6: use Himedia\Padocc\Task;
 7: 
 8: /**
 9:  * Effectue un appel cURL.
10:  * À inclure dans une tâche env ou target.
11:  * Une telle tâche est automatiquement créée par la tâche b2cswitchsymlink.
12:  *
13:  * Exemple : <http url="http://aai.twenga.com/push.php?server=${WEB_SERVERS}&amp;app=web" />
14:  *
15:  * @author Geoffroy AUBRY <gaubry@hi-media.com>, Tony CARON <tony.caron@twenga.com>
16:  */
17: class HTTP extends Task
18: {
19:     /**
20:      * {@inheritdoc}
21:      */
22:     protected function init()
23:     {
24:         parent::init();
25: 
26:         $this->aAttrProperties = array(
27:             'url' => AttributeProperties::ALLOW_PARAMETER | AttributeProperties::REQUIRED | AttributeProperties::URL,
28:             'dest' => AttributeProperties::ALLOW_PARAMETER | AttributeProperties::FILE
29:         );
30:     }
31: 
32:     /**
33:      * {@inheritdoc}
34:      * @codeCoverageIgnore
35:      */
36:     public static function getTagName ()
37:     {
38:         return 'http';
39:     }
40: 
41:     /**
42:      * Vérifie au moyen de tests basiques que la tâche peut être exécutée.
43:      * Lance une exception si tel n'est pas le cas.
44:      *
45:      * Comme toute les tâches sont vérifiées avant que la première ne soit exécutée,
46:      * doit permettre de remonter au plus tôt tout dysfonctionnement.
47:      * Appelé avant la méthode execute().
48:      *
49:      * @throws \UnexpectedValueException en cas d'attribut ou fichier manquant
50:      * @throws \DomainException en cas de valeur non permise
51:      */
52:     public function check ()
53:     {
54:         parent::check();
55:     }
56: 
57:     /**
58:      * Phase de traitements centraux de l'exécution de la tâche.
59:      * Elle devrait systématiquement commencer par "parent::centralExecute();".
60:      * Appelé par execute().
61:      * @see execute()
62:      */
63:     protected function centralExecute ()
64:     {
65:         parent::centralExecute();
66:         $this->getLogger()->info('+++Call URL: ' . $this->aAttValues['url'] . '+++');
67: 
68:         $aURLs = $this->processPath($this->aAttValues['url']);
69:         foreach ($aURLs as $sURL) {
70:             $sCmd = $this->aConfig['curl_path'] . ' ' . $this->aConfig['curl_options'] . ' "' . $sURL . '"';
71:             $this->oShell->exec($sCmd);
72:         }
73: 
74:         $this->getLogger()->info('------');
75:     }
76: }
77: 
Platform for Automatized Deployments with pOwerful Concise Configuration API documentation generated by ApiGen 2.8.0