private function promptLegacyMigrate()
    {
        static $asked = false;
        /** @var \Platformsh\Cli\Local\LocalProject $localProject */
        $localProject = $this->getService('local.project');
        if ($localProject->getLegacyProjectRoot() && $this->getName() !== 'legacy-migrate' && !$asked) {
            $asked = true;

            $projectRoot = $this->getProjectRoot();
            $timestamp = time();
            $promptMigrate = true;
            if ($projectRoot) {
                $projectConfig = $localProject->getProjectConfig($projectRoot);
                if (isset($projectConfig['migrate']['3.x']['last_asked'])
                    && $projectConfig['migrate']['3.x']['last_asked'] > $timestamp - 3600) {
                    $promptMigrate = false;
                }
            }

            $this->stdErr->writeln(sprintf(
                'You are in a project using an old file structure, from previous versions of the %s.',
                $this->config()->get('application.name')
            ));
            if ($this->input->isInteractive() && $promptMigrate) {
                if ($projectRoot && isset($projectConfig)) {
                    $projectConfig['migrate']['3.x']['last_asked'] = $timestamp;
                    $localProject->writeCurrentProjectConfig($projectConfig, $projectRoot);
                }
                /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
                $questionHelper = $this->getService('question_helper');
                if ($questionHelper->confirm('Migrate to the new structure?')) {
                    $code = $this->runOtherCommand('legacy-migrate');
                    exit($code);
                }
            } else {
                $this->stdErr->writeln(sprintf(
                    'Fix this with: <comment>%s legacy-migrate</comment>',
                    $this->config()->get('application.executable')
                ));
            }
            $this->stdErr->writeln('');
        }
    }
private function promptLegacyMigrate()
    {
        static $asked = false;
        /** @var \Platformsh\Cli\Local\LocalProject $localProject */
        $localProject = $this->getService('local.project');
        if ($localProject->getLegacyProjectRoot() && $this->getName() !== 'legacy-migrate' && !$asked) {
            $asked = true;

            $projectRoot = $this->getProjectRoot();
            $timestamp = time();
            $promptMigrate = true;
            if ($projectRoot) {
                $projectConfig = $localProject->getProjectConfig($projectRoot);
                if (isset($projectConfig['migrate']['3.x']['last_asked'])
                    && $projectConfig['migrate']['3.x']['last_asked'] > $timestamp - 3600) {
                    $promptMigrate = false;
                }
            }

            $this->stdErr->writeln(sprintf(
                'You are in a project using an old file structure, from previous versions of the %s.',
                $this->config()->get('application.name')
            ));
            if ($this->input->isInteractive() && $promptMigrate) {
                if ($projectRoot && isset($projectConfig)) {
                    $projectConfig['migrate']['3.x']['last_asked'] = $timestamp;
                    $localProject->writeCurrentProjectConfig($projectConfig, $projectRoot);
                }
                /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
                $questionHelper = $this->getService('question_helper');
                if ($questionHelper->confirm('Migrate to the new structure?')) {
                    $code = $this->runOtherCommand('legacy-migrate');
                    exit($code);
                }
            } else {
                $this->stdErr->writeln(sprintf(
                    'Fix this with: <comment>%s legacy-migrate</comment>',
                    $this->config()->get('application.executable')
                ));
            }
            $this->stdErr->writeln('');
        }
    }
private function promptLegacyMigrate ( ) { static $ asked = false ; /** @var \Platformsh\Cli\Local\LocalProject $localProject */ $ localProject = $ this -> getService ( 'local.project' ) ; if ( $ localProject -> getLegacyProjectRoot ( ) && $ this -> getName ( ) !== 'legacy-migrate' && ! $ asked ) { $ asked = true ; $ projectRoot = $ this -> getProjectRoot ( ) ; $ timestamp = time ( ) ; $ promptMigrate = true ; if ( $ projectRoot ) { $ projectConfig = $ localProject -> getProjectConfig ( $ projectRoot ) ; if ( isset ( $ projectConfig [ 'migrate' ] [ '3.x' ] [ 'last_asked' ] ) && $ projectConfig [ 'migrate' ] [ '3.x' ] [ 'last_asked' ] > $ timestamp - 3600 ) { $ promptMigrate = false ; } } $ this -> stdErr -> writeln ( sprintf ( 'You are in a project using an old file structure, from previous versions of the %s.' , $ this -> config ( ) -> get ( 'application.name' ) ) ) ; if ( $ this -> input -> isInteractive ( ) && $ promptMigrate ) { if ( $ projectRoot && isset ( $ projectConfig ) ) { $ projectConfig [ 'migrate' ] [ '3.x' ] [ 'last_asked' ] = $ timestamp ; $ localProject -> writeCurrentProjectConfig ( $ projectConfig , $ projectRoot ) ; } /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ $ questionHelper = $ this -> getService ( 'question_helper' ) ; if ( $ questionHelper -> confirm ( 'Migrate to the new structure?' ) ) { $ code = $ this -> runOtherCommand ( 'legacy-migrate' ) ; exit ( $ code ) ; } } else { $ this -> stdErr -> writeln ( sprintf ( 'Fix this with: <comment>%s legacy-migrate</comment>' , $ this -> config ( ) -> get ( 'application.executable' ) ) ) ; } $ this -> stdErr -> writeln ( '' ) ; } }
Prompt the user to migrate from the legacy project file structure.

If the input is interactive, the user will be asked to migrate up to once
per hour. The time they were last asked will be stored in the project
configuration. If the input is not interactive, the user will be warned
(on every command run) that they should run the 'legacy-migrate' command.
Prompt the user to migrate from the legacy project file structure .