Generate the sql for doing/undoing the deployment and write it to a file

@param  string $file
@param  bool $undo
@return void
433730
protected function createOutputFile($file, $undo = false)
    {
        $fileHandle = fopen($file, "w+");
        $sql = $this->generateSql($undo);
        fwrite($fileHandle, $sql);
    }
754852
public function write($file = "")
    {
        $iniString = $this->generateIniString($this->config);
        file_put_contents($file ? $file : $this->filePath, $iniString);
    }
296915
public function makeEditFileCommand($file, $line, $suite_id)
    {
        $suite = $this->findSuiteById($suite_id);

        $file = $this->addProjectRootPath(
            base64_decode($file),
            $suite
        );

        $command = trim(str_replace(
            ['{file}', '{line}'],
            [$file, $line],
            $this->getEditorBinary($suite)
        ));

        return ends_with($command, ':')
            ? substr($command, 0, -1)
            : $command;
    }
63153
public static function addGeneratingFile( $file )
    {
        if ( !( $file instanceof eZDFSFileHandler ) )
            return false; // @todo Exception

        self::$generatingFiles[$file->filePath] = $file;
    }
715608
public function appendToFile($file, $content)
    {
        if (! file_exists($file)) {
            throw new \Exception('File is missing');
        }
        file_put_contents($file, $content, FILE_APPEND);
    }
480481
public function loadDatabase(string $file): void
	{
		$this->connection->transactional(function (Connection $db) use ($file) {
			$db->query('SET foreign_key_checks = 0');
			FileImporter::executeFile($db, $file);
			$db->query('SET foreign_key_checks = 1');
		});
	}
1210829
public function writeToFile( $format, $file )
    {
        $className = ezcDbSchemaHandlerManager::getDiffWriterByFormat( $format );
        $reader = new $className();
        self::checkSchemaDiffWriter( $reader, ezcDbSchema::FILE );
        $reader->saveDiffToFile( $file, $this );
    }
636487
public function rollback(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        $releasePath = $deployment->getApplicationReleasePath($application);
        $this->shell->execute('rm -Rf ' . $releasePath, $node, $deployment, true);
    }
987077
protected function runDeploy($file)
    {
        $deploy = $this->resolve($name = $this->getDeployName($file));

        $this->note("<comment>Deploying:</comment> {$name}");

        // Run deploy
        $deploy->run();

        $this->note("<info>Deployed:</info>  {$name}");
    }
1070928
public function createDb(array $aOptions = array())
    {
        /**
         * option -a [indicated the sql json file]
         */

        if (isset($aOptions['a'])) { $sSqlJsonFile = $aOptions['a']; }
        else { $sSqlJsonFile = false; }

        /**
         * option -b [indicated the sql json]
         */

        if (isset($aOptions['b'])) { $sSqlJson = $aOptions['b']; }
        else { $sSqlJson = false; $sSqlJsonFile = str_replace('Batch', '', __DIR__).'Db.conf'; }

        /**
         * option -i [indicated the const json file to manage annotation in files]
         */

        if (isset($aOptions['i'])) { $oConstJson = json_decode(file_get_contents($aOptions['i']));}
        else { $oConstJson = '../Const.conf'; }

        if (is_object($oConstJson)) {

            foreach ($oConstJson as $sKey => $mValue) {

                if (is_string($mValue) || is_int($mValue) || is_float($mValue)) {

                    if (!defined(strtoupper($sKey))) { define(strtoupper($sKey), $mValue); }
                }
            }
        }

        if ($sSqlJsonFile !== false) { $oJson = json_decode(file_get_contents($sSqlJsonFile)); }
        else { $oJson = json_decode($sSqlJson); }

        $oConnection = $oJson->configuration;

        $oContainer = new DbContainer;

        $oContainer->setHost($oConnection->host)
            ->setName($oConnection->db)
            ->setPassword($oConnection->password)
            ->setType($oConnection->type)
            ->setUser($oConnection->user);

        $oPdo = Db::connect($oContainer);

        $oPdo->query("CREATE DATABASE ".$oConnection->db);

        echo "\n\n";
        echo Bash::setBackground("                                                                            ", 'green');
        echo Bash::setBackground("          [OK] Success                                                      ", 'green');
        echo Bash::setBackground("                                                                            ", 'green');
        echo "\n\n";
    }
35309
public function log($file, $extension = null)
    {
        $record = ['migration' => $file, 'extension' => $extension];

        $this->table()->insert($record);
    }
1109769
def revert_file(self, file=None):
        

        editor = file and self.get_editor(file) or self.get_current_editor()
        if not editor:
            return False

        file = editor.file
        LOGGER.info("{0} | Reverting '{1}' file!".format(self.__class__.__name__, file))
        if self.reload_file(file, is_modified=False):
            return True
754384
public function write($file = "")
    {
        $envString = $this->generateEnvString($this->lines);
        file_put_contents($file ? $file : $this->filePath, $envString);
    }
738069
@Override
  public boolean undo() {
    if (destTopologyFile != null) {
      LOG.info("Clean uploaded jar");
      File file = new File(destTopologyFile);
      return file.delete();
    }
    return true;
  }
144755
public function save($file)
	{
		$handle = strcasecmp(substr($file, -3), '.gz') ? fopen($file, 'wb') : gzopen($file, 'wb');
		if (!$handle) {
			throw new Exception("ERROR: Cannot write file '$file'.");
		}
		$this->write($handle);
	}
1174239
public static function merge($file)
    {
        if (file_exists($file)) {
            $config = c::get('boomcms', []);
            c::set('boomcms', array_merge_recursive(include $file, $config));
        }
    }
34472
public function saveDiffToFile( $file, ezcDbSchemaDiff $dbSchema )
    {
        $this->writer = new XMLWriter();
        if ( ! @$this->writer->openUri( $file ) )
        {
            throw new ezcBaseFilePermissionException( $file, ezcBaseFileException::WRITE );
        }
        $this->writer->startDocument( '1.0', 'utf-8' );
        $this->writer->setIndent( true );

        $this->writer->startElement( 'database' );
        $this->writer->flush();

        // New tables
        $this->writer->startElement( 'new-tables' );
        $this->writer->flush();
        foreach ( $dbSchema->newTables as $tableName => $table )
        {
            $this->writeTable( $tableName, $table );
            $this->writer->flush();
        }
        $this->writer->endElement();
        $this->writer->flush();

        // Removed tables
        $this->writer->startElement( 'removed-tables' );
        $this->writer->flush();
        foreach ( $dbSchema->removedTables as $tableName => $tableStatus )
        {
            $this->writer->startElement( 'table' );
            $this->writer->startElement( 'name' );
            $this->writer->text( $tableName );
            $this->writer->endElement();
            $this->writer->startElement( 'removed' );
            $this->writer->text( $tableStatus ? 'true' : 'false' );
            $this->writer->endElement();
            $this->writer->endElement();
            $this->writer->flush();
        }
        $this->writer->endElement();
        $this->writer->flush();

        // Changed tables
        $this->writer->startElement( 'changed-tables' );
        $this->writer->flush();
        foreach ( $dbSchema->changedTables as $tableName => $table )
        {
            $this->writeChangedTable( $tableName, $table );
            $this->writer->flush();
        }
        $this->writer->endElement();
        $this->writer->flush();

        $this->writer->endElement();
        $this->writer->endDocument();
    }