public function removeCommand($name, $yes = false)
    {
        $directory = FLOW_PATH_ROOT . 'Data/MagicWandStash/' . $name;

        if (!is_dir($directory)) {
            $this->renderLine('<error>%s does not exist</error>', [$name]);
            $this->quit(1);
        }

        if (!$yes) {
            $this->renderLine("Are you sure you want to do this?  Type 'yes' to continue: ");
            $handle = fopen("php://stdin", "r");
            $line = fgets($handle);

            if (trim($line) != 'yes') {
                $this->renderLine('exit');
                $this->quit(1);
            } else {
                $this->renderLine();
                $this->renderLine();
            }
        }

        ###############
        # Start Timer #
        ###############


        $startTimestamp = time();

        FileUtils::removeDirectoryRecursively($directory);

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

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

        $this->renderHeadLine('Done');
        $this->renderLine('Cleanup removed stash %s in %s seconds', [$name, $duration]);
    }
public function removeCommand($name, $yes = false)
    {
        $directory = FLOW_PATH_ROOT . 'Data/MagicWandStash/' . $name;

        if (!is_dir($directory)) {
            $this->renderLine('<error>%s does not exist</error>', [$name]);
            $this->quit(1);
        }

        if (!$yes) {
            $this->renderLine("Are you sure you want to do this?  Type 'yes' to continue: ");
            $handle = fopen("php://stdin", "r");
            $line = fgets($handle);

            if (trim($line) != 'yes') {
                $this->renderLine('exit');
                $this->quit(1);
            } else {
                $this->renderLine();
                $this->renderLine();
            }
        }

        ###############
        # Start Timer #
        ###############


        $startTimestamp = time();

        FileUtils::removeDirectoryRecursively($directory);

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

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

        $this->renderHeadLine('Done');
        $this->renderLine('Cleanup removed stash %s in %s seconds', [$name, $duration]);
    }
public function removeCommand ( $ name , $ yes = false ) { $ directory = FLOW_PATH_ROOT . 'Data/MagicWandStash/' . $ name ; if ( ! is_dir ( $ directory ) ) { $ this -> renderLine ( '<error>%s does not exist</error>' , [ $ name ] ) ; $ this -> quit ( 1 ) ; } if ( ! $ yes ) { $ this -> renderLine ( "Are you sure you want to do this?  Type 'yes' to continue: " ) ; $ handle = fopen ( "php://stdin" , "r" ) ; $ line = fgets ( $ handle ) ; if ( trim ( $ line ) != 'yes' ) { $ this -> renderLine ( 'exit' ) ; $ this -> quit ( 1 ) ; } else { $ this -> renderLine ( ) ; $ this -> renderLine ( ) ; } } ############### # Start Timer # ############### $ startTimestamp = time ( ) ; FileUtils :: removeDirectoryRecursively ( $ directory ) ; ################# # Final Message # ################# $ endTimestamp = time ( ) ; $ duration = $ endTimestamp - $ startTimestamp ; $ this -> renderHeadLine ( 'Done' ) ; $ this -> renderLine ( 'Cleanup removed stash %s in %s seconds' , [ $ name , $ duration ] ) ; }
Remove a named stash entry

@param string $name The name of the stash entry that will be removed
@param boolean $yes confirm execution without further input
@return void
Remove a named stash entry