l10n_server-2.x-dev/l10n_packager/src/Commands/L10nPackagerCommands.php

l10n_packager/src/Commands/L10nPackagerCommands.php
<?php

declare(strict_types=1);

namespace Drupal\l10n_packager\Commands;

use Drupal\l10n_packager\L10nPackager;
use Drush\Commands\DrushCommands;
use Drush\Drush;

/**
 * A Drush command file.
 *
 * 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.
 *
 * See these files for an example of injecting Drupal services:
 *   - http://cgit.drupalcode.org/devel/tree/src/Commands/DevelCommands.php
 *   - http://cgit.drupalcode.org/devel/tree/drush.services.yml
 */
class L10nPackagerCommands extends DrushCommands {

  /**
   * L10n packager service.
   *
   * @var \Drupal\l10n_packager\L10nPackager
   */
  protected $packager;

  /**
   * Constructor.
   */
  public function __construct(L10nPackager $packager) {
    $this->packager = $packager;
  }

  /**
   * Create a release.
   *
   * @usage l10n_packager-create
   *
   * @command l10n_packager:create
   *
   * @aliases lpc
   */
  public function create(): void {}

  /**
   * Queue releases for packaging.
   *
   * @param array $options
   *   An associative array of options whose values come from cli, aliases,
   *   config, etc.
   *
   * @option force
   *
   * @usage l10n_packager-queue
   *   Queue releases for parsing.
   *
   * @command l10n_packager:queue
   *
   * @aliases lpq
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   * @throws \Drupal\Core\Entity\EntityStorageException
   */
  public function queue(array $options = ['force' => NULL]): void {}

  /**
   * Package releases.
   *
   * @param string $project
   *   The project to scan.
   * @param array $options
   *   An associative array of options whose values come from cli, aliases,
   *   config, etc.
   *
   * @option force
   *   Force update for all packages (not yet implemented).
   * @option all
   *   Update all packages (not yet implemented).
   *
   * @usage l10n_packager-package
   *   Queue releases for packaging.
   *
   * @command l10n_packager:package
   *
   * @aliases lpp
   */
  public function package(string $project = '', array $options = ['force' => NULL]): void {
    [$checked, $updated, $time] = $this->packager->checkUpdates($project);
    Drush::output()->writeln(dt('@ms ms for @checked releases/@updated files.', [
      '@checked' => $checked,
      '@updated' => $updated,
      '@ms' => $time,
    ]));
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc