public function createCommand($name)
    {
        $startTimestamp = time();

        #######################
        #     Build Paths     #
        #######################

        $basePath = $this->getStashEntryPath($name);

        $databaseDestination = $basePath . '/database.sql';
        $persistentDestination = $basePath . '/persistent/';

        FileUtils::createDirectoryRecursively($basePath);

        #######################
        # Check Configuration #
        #######################

        $this->checkConfiguration();

        ##################
        # Define Secrets #
        ##################

        $this->addSecret($this->databaseConfiguration['user']);
        $this->addSecret($this->databaseConfiguration['password']);

        ######################
        #  Write Manifest    #
        ######################
        $this->renderHeadLine('Write Manifest');
        $presetName = $this->configurationService->getCurrentPreset();
        $presetConfiguration = $this->configurationService->getCurrentConfiguration();
        $cloneTimestamp = $this->configurationService->getMostRecentCloneTimeStamp();
        $stashTimestamp = time();

        $this->writeStashEntryManifest($name, [
            'preset' => [
                'name' => $presetName,
                'configuration' => $presetConfiguration
            ],
            'cloned_at' => $cloneTimestamp,
            'stashed_at' => $stashTimestamp
        ]);

        ######################
        #  Backup Database   #
        ######################

        $this->renderHeadLine('Backup Database');
        $this->executeLocalShellCommand(
            'mysqldump --single-transaction --add-drop-table --host="%s" --user="%s" --password="%s" %s > %s',
            [
                $this->databaseConfiguration['host'],
                $this->databaseConfiguration['user'],
                $this->databaseConfiguration['password'],
                $this->databaseConfiguration['dbname'],
                $databaseDestination
            ]
        );

        ###############################
        # Backup Persistent Resources #
        ###############################

        $this->renderHeadLine('Backup Persistent Resources');
        $this->executeLocalShellCommand(
            'cp -al %s %s',
            [
                FLOW_PATH_ROOT . 'Data/Persistent',
                $persistentDestination
            ]
        );

        #################
        # Final Message #
        #################

        $endTimestamp = time();
        $duration = $endTimestamp - $startTimestamp;

        $this->renderHeadLine('Done');
        $this->renderLine('Successfuly stashed %s in %s seconds', [$name, $duration]);
    }
public function createCommand($name)
    {
        $startTimestamp = time();

        #######################
        #     Build Paths     #
        #######################

        $basePath = $this->getStashEntryPath($name);

        $databaseDestination = $basePath . '/database.sql';
        $persistentDestination = $basePath . '/persistent/';

        FileUtils::createDirectoryRecursively($basePath);

        #######################
        # Check Configuration #
        #######################

        $this->checkConfiguration();

        ##################
        # Define Secrets #
        ##################

        $this->addSecret($this->databaseConfiguration['user']);
        $this->addSecret($this->databaseConfiguration['password']);

        ######################
        #  Write Manifest    #
        ######################
        $this->renderHeadLine('Write Manifest');
        $presetName = $this->configurationService->getCurrentPreset();
        $presetConfiguration = $this->configurationService->getCurrentConfiguration();
        $cloneTimestamp = $this->configurationService->getMostRecentCloneTimeStamp();
        $stashTimestamp = time();

        $this->writeStashEntryManifest($name, [
            'preset' => [
                'name' => $presetName,
                'configuration' => $presetConfiguration
            ],
            'cloned_at' => $cloneTimestamp,
            'stashed_at' => $stashTimestamp
        ]);

        ######################
        #  Backup Database   #
        ######################

        $this->renderHeadLine('Backup Database');
        $this->executeLocalShellCommand(
            'mysqldump --single-transaction --add-drop-table --host="%s" --user="%s" --password="%s" %s > %s',
            [
                $this->databaseConfiguration['host'],
                $this->databaseConfiguration['user'],
                $this->databaseConfiguration['password'],
                $this->databaseConfiguration['dbname'],
                $databaseDestination
            ]
        );

        ###############################
        # Backup Persistent Resources #
        ###############################

        $this->renderHeadLine('Backup Persistent Resources');
        $this->executeLocalShellCommand(
            'cp -al %s %s',
            [
                FLOW_PATH_ROOT . 'Data/Persistent',
                $persistentDestination
            ]
        );

        #################
        # Final Message #
        #################

        $endTimestamp = time();
        $duration = $endTimestamp - $startTimestamp;

        $this->renderHeadLine('Done');
        $this->renderLine('Successfuly stashed %s in %s seconds', [$name, $duration]);
    }
public function createCommand ( $ name ) { $ startTimestamp = time ( ) ; ####################### #     Build Paths     # ####################### $ basePath = $ this -> getStashEntryPath ( $ name ) ; $ databaseDestination = $ basePath . '/database.sql' ; $ persistentDestination = $ basePath . '/persistent/' ; FileUtils :: createDirectoryRecursively ( $ basePath ) ; ####################### # Check Configuration # ####################### $ this -> checkConfiguration ( ) ; ################## # Define Secrets # ################## $ this -> addSecret ( $ this -> databaseConfiguration [ 'user' ] ) ; $ this -> addSecret ( $ this -> databaseConfiguration [ 'password' ] ) ; ###################### #  Write Manifest    # ###################### $ this -> renderHeadLine ( 'Write Manifest' ) ; $ presetName = $ this -> configurationService -> getCurrentPreset ( ) ; $ presetConfiguration = $ this -> configurationService -> getCurrentConfiguration ( ) ; $ cloneTimestamp = $ this -> configurationService -> getMostRecentCloneTimeStamp ( ) ; $ stashTimestamp = time ( ) ; $ this -> writeStashEntryManifest ( $ name , [ 'preset' => [ 'name' => $ presetName , 'configuration' => $ presetConfiguration ] , 'cloned_at' => $ cloneTimestamp , 'stashed_at' => $ stashTimestamp ] ) ; ###################### #  Backup Database   # ###################### $ this -> renderHeadLine ( 'Backup Database' ) ; $ this -> executeLocalShellCommand ( 'mysqldump --single-transaction --add-drop-table --host="%s" --user="%s" --password="%s" %s > %s' , [ $ this -> databaseConfiguration [ 'host' ] , $ this -> databaseConfiguration [ 'user' ] , $ this -> databaseConfiguration [ 'password' ] , $ this -> databaseConfiguration [ 'dbname' ] , $ databaseDestination ] ) ; ############################### # Backup Persistent Resources # ############################### $ this -> renderHeadLine ( 'Backup Persistent Resources' ) ; $ this -> executeLocalShellCommand ( 'cp -al %s %s' , [ FLOW_PATH_ROOT . 'Data/Persistent' , $ persistentDestination ] ) ; ################# # Final Message # ################# $ endTimestamp = time ( ) ; $ duration = $ endTimestamp - $ startTimestamp ; $ this -> renderHeadLine ( 'Done' ) ; $ this -> renderLine ( 'Successfuly stashed %s in %s seconds' , [ $ name , $ duration ] ) ; }
Creates a new stash entry with the given name.

@param string $name The name for the new stash entry
@return void
Creates a new stash entry with the given name .