Пример #1
0
 /**
  * @param array  $data
  * @param string $entityType
  */
 public function storeData($data, $entityType)
 {
     parent::storeData($data, $entityType);
     $fileName = $this->_getEntityFilename($entityType);
     $git = new VersionControl_Git($this->_getStorageDirectory());
     $fileName = substr($fileName, strlen($this->_getStorageDirectory()));
     try {
         $status = $git->getRevListFetcher();
         $status->setSubCommand('status');
         $status->addArgument('--porcelain');
         $status_result = $status->execute();
         foreach (explode("\n", $status_result) as $status_line) {
             $git_status = substr($status_line, 1, 1);
             $git_file = substr($status_line, 3);
             if (in_array($git_status, array('M', 'A'))) {
                 $commit = $git->getCommand('commit');
                 $commit->setOption('message', 'current "' . $entityType . '" content');
                 $commit->addArgument($fileName);
                 $commit->execute();
             }
         }
     } catch (VersionControl_Git_Exception $e) {
         //if ( strpos($e->getMessage(), 'nothing to commit') === false )
         //{
         throw $e;
         //}
     }
 }