original_string: public function importSde()
      {
  
          $this->line('Importing...');
          $bar = $this->getProgressBar(count($this->json->tables));
  
          foreach ($this->json->tables as $table) {
  
              $archive_path = $this->storage_path . $table . $this->json->format;
              $extracted_path = $this->storage_path . $table . '.sql';
  
              if (! File::exists($archive_path)) {
  
                  $this->warn($archive_path . ' seems to be invalid. Skipping.');
                  continue;
              }
  
              // Get 2 handles ready for both the in and out files
              $input_file = bzopen($archive_path, 'r');
              $output_file = fopen($extracted_path, 'w');
  
              // Write the $output_file in chunks
              while ($chunk = bzread($input_file, 4096))
                  fwrite($output_file, $chunk, 4096);
  
              // Close the files
              bzclose($input_file);
              fclose($output_file);
  
              // With the output file ready, prepare the scary exec() command
              // that should be run. A sample $import_command is:
              // mysql -u root -h 127.0.0.1 seat < /tmp/sample.sql
              $import_command = 'mysql -u ' . config('database.connections.mysql.username') .
                  // Check if the password is longer than 0. If not, don't specify the -p flag
                  (strlen(config('database.connections.mysql.password')) ? ' -p' : '')
                  // Append this regardless. Escape special chars in the password too.
                  . escapeshellcmd(config('database.connections.mysql.password')) .
                  ' -h ' . config('database.connections.mysql.host') .
                  ' -P ' . config('database.connections.mysql.port') .
                  ' ' . config('database.connections.mysql.database') .
                  ' < ' . $extracted_path;
  
              // Run the command... (*scared_face*)
              exec($import_command, $output, $exit_code);
  
              if ($exit_code !== 0)
                  $this->error('Warning: Import failed with exit code ' .
                      $exit_code . ' and command outut: ' . implode('\n', $output));
  
              $bar->advance();
  
          }
  
          $bar->finish();
          $this->line('');
  
      }
code: public function importSde()
      {
  
          $this->line('Importing...');
          $bar = $this->getProgressBar(count($this->json->tables));
  
          foreach ($this->json->tables as $table) {
  
              $archive_path = $this->storage_path . $table . $this->json->format;
              $extracted_path = $this->storage_path . $table . '.sql';
  
              if (! File::exists($archive_path)) {
  
                  $this->warn($archive_path . ' seems to be invalid. Skipping.');
                  continue;
              }
  
              // Get 2 handles ready for both the in and out files
              $input_file = bzopen($archive_path, 'r');
              $output_file = fopen($extracted_path, 'w');
  
              // Write the $output_file in chunks
              while ($chunk = bzread($input_file, 4096))
                  fwrite($output_file, $chunk, 4096);
  
              // Close the files
              bzclose($input_file);
              fclose($output_file);
  
              // With the output file ready, prepare the scary exec() command
              // that should be run. A sample $import_command is:
              // mysql -u root -h 127.0.0.1 seat < /tmp/sample.sql
              $import_command = 'mysql -u ' . config('database.connections.mysql.username') .
                  // Check if the password is longer than 0. If not, don't specify the -p flag
                  (strlen(config('database.connections.mysql.password')) ? ' -p' : '')
                  // Append this regardless. Escape special chars in the password too.
                  . escapeshellcmd(config('database.connections.mysql.password')) .
                  ' -h ' . config('database.connections.mysql.host') .
                  ' -P ' . config('database.connections.mysql.port') .
                  ' ' . config('database.connections.mysql.database') .
                  ' < ' . $extracted_path;
  
              // Run the command... (*scared_face*)
              exec($import_command, $output, $exit_code);
  
              if ($exit_code !== 0)
                  $this->error('Warning: Import failed with exit code ' .
                      $exit_code . ' and command outut: ' . implode('\n', $output));
  
              $bar->advance();
  
          }
  
          $bar->finish();
          $this->line('');
  
      }
code_tokens: public function importSde ( ) { $ this -> line ( 'Importing...' ) ; $ bar = $ this -> getProgressBar ( count ( $ this -> json -> tables ) ) ; foreach ( $ this -> json -> tables as $ table ) { $ archive_path = $ this -> storage_path . $ table . $ this -> json -> format ; $ extracted_path = $ this -> storage_path . $ table . '.sql' ; if ( ! File :: exists ( $ archive_path ) ) { $ this -> warn ( $ archive_path . ' seems to be invalid. Skipping.' ) ; continue ; } // Get 2 handles ready for both the in and out files $ input_file = bzopen ( $ archive_path , 'r' ) ; $ output_file = fopen ( $ extracted_path , 'w' ) ; // Write the $output_file in chunks while ( $ chunk = bzread ( $ input_file , 4096 ) ) fwrite ( $ output_file , $ chunk , 4096 ) ; // Close the files bzclose ( $ input_file ) ; fclose ( $ output_file ) ; // With the output file ready, prepare the scary exec() command // that should be run. A sample $import_command is: // mysql -u root -h 127.0.0.1 seat < /tmp/sample.sql $ import_command = 'mysql -u ' . config ( 'database.connections.mysql.username' ) . // Check if the password is longer than 0. If not, don't specify the -p flag ( strlen ( config ( 'database.connections.mysql.password' ) ) ? ' -p' : '' ) // Append this regardless. Escape special chars in the password too. . escapeshellcmd ( config ( 'database.connections.mysql.password' ) ) . ' -h ' . config ( 'database.connections.mysql.host' ) . ' -P ' . config ( 'database.connections.mysql.port' ) . ' ' . config ( 'database.connections.mysql.database' ) . ' < ' . $ extracted_path ; // Run the command... (*scared_face*) exec ( $ import_command , $ output , $ exit_code ) ; if ( $ exit_code !== 0 ) $ this -> error ( 'Warning: Import failed with exit code ' . $ exit_code . ' and command outut: ' . implode ( '\n' , $ output ) ) ; $ bar -> advance ( ) ; } $ bar -> finish ( ) ; $ this -> line ( '' ) ; }
docstring: Extract the SDE files downloaded and run the MySQL command
  to import them into the database.
docstring_tokens: Extract the SDE files downloaded and run the MySQL command to import them into the database .