function RsyncValidator::validate

Checks that rsync is available.

Parameters

\Drupal\package_manager\Event\PreOperationStageEvent $event: The event being handled.

File

core/modules/package_manager/src/Validator/RsyncValidator.php, line 40

Class

RsyncValidator
Checks that rsync is available.

Namespace

Drupal\package_manager\Validator

Code

public function validate(PreOperationStageEvent $event) : void {
    try {
        $this->executableFinder
            ->find('rsync');
        $rsync_found = TRUE;
    } catch (LogicException) {
        $rsync_found = FALSE;
    }
    if ($rsync_found === FALSE) {
        $message = $this->t('<code>rsync</code> is not available.');
        if ($this->moduleHandler
            ->moduleExists('help')) {
            $help_url = Url::fromRoute('help.page')->setRouteParameter('name', 'package_manager')
                ->setOption('fragment', 'package-manager-faq-rsync')
                ->toString();
            $message = $this->t('@message See the <a href=":url">Package Manager help</a> for more information on how to resolve this.', [
                '@message' => $message,
                ':url' => $help_url,
            ]);
        }
        $event->addError([
            $message,
        ]);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.