mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-13 22:43:39 +08:00
74fce9640e
Some checks are pending
analyse-php / build (push) Waiting to run
lint-php / build (push) Waiting to run
test-migrations / build (8.1) (push) Waiting to run
test-migrations / build (8.2) (push) Waiting to run
test-migrations / build (8.3) (push) Waiting to run
test-php / build (8.1) (push) Waiting to run
test-php / build (8.2) (push) Waiting to run
test-php / build (8.3) (push) Waiting to run
27 lines
541 B
PHP
27 lines
541 B
PHP
<?php
|
|
|
|
namespace BookStack\Exports\ZipExports;
|
|
|
|
use Closure;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use ZipArchive;
|
|
|
|
class ZipFileReferenceRule implements ValidationRule
|
|
{
|
|
public function __construct(
|
|
protected ZipValidationHelper $context,
|
|
) {
|
|
}
|
|
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
|
{
|
|
if (!$this->context->zipReader->fileExists($value)) {
|
|
$fail('validation.zip_file')->translate();
|
|
}
|
|
}
|
|
}
|