You are here

class PathRedirectImport in Path redirect import 8

A Drush commandfile.

In addition to this file, you need a drush.services.yml in root of your module, and a composer.json file that provides the name of the services file to use.

Hierarchy

  • class \Drupal\path_redirect_import\Commands\PathRedirectImport extends \Drush\Commands\DrushCommands

Expanded class hierarchy of PathRedirectImport

1 string reference to 'PathRedirectImport'
drush.services.yml in ./drush.services.yml
drush.services.yml
1 service uses PathRedirectImport
path_redirect_import.commands in ./drush.services.yml
\Drupal\path_redirect_import\Commands\PathRedirectImport

File

src/Commands/PathRedirectImport.php, line 15

Namespace

Drupal\path_redirect_import\Commands
View source
class PathRedirectImport extends DrushCommands {

  /**
   * Import redirects.
   *
   * @command path-redirect-import
   * @option $no_headers
   * @option $override
   * @option $status_code
   * @option $delimiter
   * @option $language
   * @option $allow_nonexistent
   * @aliases primport
   */
  public function pathRedirectImportCsv($file, $options = [
    'no_headers' => FALSE,
    'override' => FALSE,
    'status_code' => 301,
    'delimiter' => ',',
    'language' => '',
    'allow_nonexistent' => FALSE,
  ]) {
    if (!file_exists($file)) {
      $this
        ->logger()
        ->error("File {$file} doesn't exist \n");
      exit;
    }
    ImporterService::import($file, $options);
  }

}

Members