src/Tasks.php
private function getDatabaseOfTruth() {
    $project_properties = $this->getProjectProperties();
    $default_database = $this->databaseSourceOfTruth();

    if (file_exists('vendor/database.sql.gz')) {
      $default_database = 'local';
    }

    $this->say('This command will drop all tables in your local database and re-populate from a backup .sql.gz file.');
    $this->say('If you already have a database backup in your  vendor folder, the "local" option will be available.');
    $this->say('If you want to grab a more recent backup from Pantheon, type in the environment name (i.e. dev, test, live, my-multidev). This will be saved to your vendor folder for future re-installs.');
    $this->say('Backups are generated on Pantheon regularly, but might be old.');
    $this->say('If you need the very latest data from a Pantheon site, go create a new backup using either the Pantheon backend, or Terminus.');

    $which_database = $this->askDefault(
      'Which database backup should we load (i.e. local/dev/live)?', $default_database
    );

    $getDB = TRUE;
    if ($which_database !== 'local') {
      $getDB = $this->downloadPantheonBackup($which_database);
    }

    if ($getDB) {
      $this->say('Emptying existing database.');
      $empty_database = $this->taskExec('drush sql:drop -y')->dir($project_properties['web_root'])->run();
      return $this->importLocal();
    }
    else {
      $this->yell('Failed to download a Pantheon backup. Database was not refreshed.');
      return false;
    }
  }
private function getDatabaseOfTruth() {
    $project_properties = $this->getProjectProperties();
    $default_database = $this->databaseSourceOfTruth();

    if (file_exists('vendor/database.sql.gz')) {
      $default_database = 'local';
    }

    $this->say('This command will drop all tables in your local database and re-populate from a backup .sql.gz file.');
    $this->say('If you already have a database backup in your  vendor folder, the "local" option will be available.');
    $this->say('If you want to grab a more recent backup from Pantheon, type in the environment name (i.e. dev, test, live, my-multidev). This will be saved to your vendor folder for future re-installs.');
    $this->say('Backups are generated on Pantheon regularly, but might be old.');
    $this->say('If you need the very latest data from a Pantheon site, go create a new backup using either the Pantheon backend, or Terminus.');

    $which_database = $this->askDefault(
      'Which database backup should we load (i.e. local/dev/live)?', $default_database
    );

    $getDB = TRUE;
    if ($which_database !== 'local') {
      $getDB = $this->downloadPantheonBackup($which_database);
    }

    if ($getDB) {
      $this->say('Emptying existing database.');
      $empty_database = $this->taskExec('drush sql:drop -y')->dir($project_properties['web_root'])->run();
      return $this->importLocal();
    }
    else {
      $this->yell('Failed to download a Pantheon backup. Database was not refreshed.');
      return false;
    }
  }
private function getDatabaseOfTruth ( ) { $ project_properties = $ this -> getProjectProperties ( ) ; $ default_database = $ this -> databaseSourceOfTruth ( ) ; if ( file_exists ( 'vendor/database.sql.gz' ) ) { $ default_database = 'local' ; } $ this -> say ( 'This command will drop all tables in your local database and re-populate from a backup .sql.gz file.' ) ; $ this -> say ( 'If you already have a database backup in your  vendor folder, the "local" option will be available.' ) ; $ this -> say ( 'If you want to grab a more recent backup from Pantheon, type in the environment name (i.e. dev, test, live, my-multidev). This will be saved to your vendor folder for future re-installs.' ) ; $ this -> say ( 'Backups are generated on Pantheon regularly, but might be old.' ) ; $ this -> say ( 'If you need the very latest data from a Pantheon site, go create a new backup using either the Pantheon backend, or Terminus.' ) ; $ which_database = $ this -> askDefault ( 'Which database backup should we load (i.e. local/dev/live)?' , $ default_database ) ; $ getDB = TRUE ; if ( $ which_database !== 'local' ) { $ getDB = $ this -> downloadPantheonBackup ( $ which_database ) ; } if ( $ getDB ) { $ this -> say ( 'Emptying existing database.' ) ; $ empty_database = $ this -> taskExec ( 'drush sql:drop -y' ) -> dir ( $ project_properties [ 'web_root' ] ) -> run ( ) ; return $ this -> importLocal ( ) ; } else { $ this -> yell ( 'Failed to download a Pantheon backup. Database was not refreshed.' ) ; return false ; } }
Helper function to pull the database of truth to your local machine.

@return bool
If the remote database was reached and downloaded, return TRUE.
Helper function to pull the database of truth to your local machine .