Overview

Namespaces

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

Classes

  • B2CSwitchSymlink
  • BuildLanguage
  • CVSExport
  • GitExport
  • Minifier
  • SwitchSymlink
  • TwengaServers
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: namespace Himedia\Padocc\Task\Extended;
  4: 
  5: use Himedia\Padocc\Task;
  6: 
  7: /**
  8:  * @author Geoffroy AUBRY <gaubry@hi-media.com>
  9:  * @author Another Author Tony Caron <caron.tony@gmail.com>
 10:  */
 11: class TwengaServers extends Task
 12: {
 13:     /**
 14:      * Tâche d'export Git sous-jacente.
 15:      *
 16:      * @var GitExport
 17:      */
 18:     private $oGitExportTask;
 19: 
 20:     /**
 21:      * Répertoire temporaire où extraire master_synchro.cfg.
 22:      * @var string
 23:      */
 24:     private $sTmpDir;
 25: 
 26:     /**
 27:      * {@inheritdoc}
 28:      */
 29:     protected function init()
 30:     {
 31:         parent::init();
 32: 
 33:         $this->aAttrProperties = array();
 34:         $this->sTmpDir = $this->aConfig['dir']['tmp'] . '/'
 35:             . $this->oProperties->getProperty('execution_id') . '_' . self::getTagName();
 36: 
 37:         // Création de la tâche de synchronisation sous-jacente :
 38:         $this->oNumbering->addCounterDivision();
 39:         $this->oGitExportTask = GitExport::getNewInstance(
 40:             array(
 41:                 'repository' => 'git@git.twenga.com:aa/server_config.git',
 42:                 'ref' => 'master',
 43:                 'destdir' => $this->sTmpDir
 44:             ),
 45:             $this->oProject,
 46:             $this->oDIContainer
 47:         );
 48:         $this->oNumbering->removeCounterDivision();
 49:     }
 50: 
 51:     /**
 52:      * {@inheritdoc}
 53:      * @codeCoverageIgnore
 54:      */
 55:     public static function getTagName ()
 56:     {
 57:         return 'twengaserverexport';
 58:     }
 59: 
 60:     /**
 61:      * Prépare la tâche avant exécution : vérifications basiques, analyse des serveurs concernés...
 62:      */
 63:     public function setUp ()
 64:     {
 65:         parent::setUp();
 66:         $this->getLogger()->info('+++');
 67:         $this->oGitExportTask->setUp();
 68:         $this->getLogger()->info('---');
 69:     }
 70: 
 71:     /**
 72:      * Vérifie au moyen de tests basiques que la tâche peut être exécutée.
 73:      * Lance une exception si tel n'est pas le cas.
 74:      *
 75:      * Comme toute les tâches sont vérifiées avant que la première ne soit exécutée,
 76:      * doit permettre de remonter au plus tôt tout dysfonctionnement.
 77:      * Appelé avant la méthode execute().
 78:      */
 79:     protected function check ()
 80:     {
 81:         parent::centralExecute();
 82:         $this->getLogger()->info('+++');
 83:         $this->oGitExportTask->execute();
 84:         $sPathToLoad = $this->sTmpDir . '/master_synchro.cfg';
 85:         $this->getLogger()->info("Load shell properties: $sPathToLoad+++");
 86:         $this->oProperties->loadConfigShellFile($sPathToLoad);
 87:         $this->oShell->remove($this->sTmpDir);
 88:         $this->getLogger()->info('------');
 89:     }
 90: 
 91:     /**
 92:      * Phase de traitements centraux de l'exécution de la tâche.
 93:      * Elle devrait systématiquement commencer par "parent::centralExecute();".
 94:      * Appelé par execute().
 95:      * @see execute()
 96:      */
 97:     protected function centralExecute ()
 98:     {
 99:         parent::centralExecute();
100:     }
101: }
102: 
Platform for Automatized Deployments with pOwerful Concise Configuration API documentation generated by ApiGen 2.8.0