TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Redirects\Event;
|
||||
|
||||
use TYPO3\CMS\Redirects\RedirectUpdate\RedirectSourceInterface;
|
||||
use TYPO3\CMS\Redirects\RedirectUpdate\SlugRedirectChangeItem;
|
||||
|
||||
/**
|
||||
* This event is fired in the \TYPO3\CMS\Redirects\Service\SlugService after
|
||||
* a redirect record has been automatically created and persisted after page
|
||||
* slug change. It's mainly a pure notification event.
|
||||
*
|
||||
* It can be used to update redirects external in a load-balancer directly for
|
||||
* example, or doing some kind of synchronization.
|
||||
*/
|
||||
final readonly class AfterAutoCreateRedirectHasBeenPersistedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private SlugRedirectChangeItem $slugRedirectChangeItem,
|
||||
private RedirectSourceInterface $source,
|
||||
private array $redirectRecord,
|
||||
) {}
|
||||
|
||||
public function getSlugRedirectChangeItem(): SlugRedirectChangeItem
|
||||
{
|
||||
return $this->slugRedirectChangeItem;
|
||||
}
|
||||
|
||||
public function getSource(): RedirectSourceInterface
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
public function getRedirectRecord(): array
|
||||
{
|
||||
return $this->redirectRecord;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Redirects\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Site\Entity\Site;
|
||||
|
||||
/**
|
||||
* This event is fired in \TYPO3\CMS\Redirects\Service\IntegrityService->getAllPageUrlsForSite() to
|
||||
* gather URLs of subpages for a given site.
|
||||
*/
|
||||
final class AfterPageUrlsForSiteForRedirectIntegrityHaveBeenCollectedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Site $site,
|
||||
private array $pageUrls = [],
|
||||
) {}
|
||||
|
||||
public function getSite(): Site
|
||||
{
|
||||
return $this->site;
|
||||
}
|
||||
|
||||
public function setPageUrls(array $pageUrls): void
|
||||
{
|
||||
$this->pageUrls = $pageUrls;
|
||||
}
|
||||
|
||||
public function getPageUrls(): array
|
||||
{
|
||||
return $this->pageUrls;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Redirects\Event;
|
||||
|
||||
/**
|
||||
* This event is fired in \TYPO3\CMS\Redirects\Service\RedirectService->matchRedirect() for checked host and
|
||||
* wildcard host "*".
|
||||
*
|
||||
* It can be used to implement a custom match method, returning a matchedRedirect record with eventually enriched
|
||||
* record data.
|
||||
*/
|
||||
final class BeforeRedirectMatchDomainEvent
|
||||
{
|
||||
private ?array $matchedRedirect = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly string $domain,
|
||||
private readonly string $path,
|
||||
private readonly string $query,
|
||||
private readonly string $matchDomainName,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return string Request domain name (host)
|
||||
*/
|
||||
public function getDomain(): string
|
||||
{
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Request path
|
||||
*/
|
||||
public function getPath(): string
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Request query parameters
|
||||
*/
|
||||
public function getQuery(): string
|
||||
{
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Domain name which should be checked, and `getRedirects()` items are provided for
|
||||
*/
|
||||
public function getMatchDomainName(): string
|
||||
{
|
||||
return $this->matchDomainName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null Returns the matched `sys_redirect` record or null
|
||||
*/
|
||||
public function getMatchedRedirect(): ?array
|
||||
{
|
||||
return $this->matchedRedirect;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $matchedRedirect Set matched `sys_redirect` record or null to clear prior set record
|
||||
*/
|
||||
public function setMatchedRedirect(?array $matchedRedirect): void
|
||||
{
|
||||
$this->matchedRedirect = $matchedRedirect;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Redirects\Event;
|
||||
|
||||
use TYPO3\CMS\Redirects\RedirectUpdate\RedirectSourceInterface;
|
||||
use TYPO3\CMS\Redirects\RedirectUpdate\SlugRedirectChangeItem;
|
||||
|
||||
/**
|
||||
* This event is fired in the \TYPO3\CMS\Redirects\Service\SlugService before
|
||||
* a redirect record is persisted for changed page slug.
|
||||
*
|
||||
* It can be used to modify the redirect record before persisting it. This
|
||||
* gives extension developers the ability to apply defaults or add custom
|
||||
* values to the record.
|
||||
*/
|
||||
final class ModifyAutoCreateRedirectRecordBeforePersistingEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly SlugRedirectChangeItem $slugRedirectChangeItem,
|
||||
private readonly RedirectSourceInterface $source,
|
||||
private array $redirectRecord,
|
||||
) {}
|
||||
|
||||
public function getSlugRedirectChangeItem(): SlugRedirectChangeItem
|
||||
{
|
||||
return $this->slugRedirectChangeItem;
|
||||
}
|
||||
|
||||
public function getSource(): RedirectSourceInterface
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
public function getRedirectRecord(): array
|
||||
{
|
||||
return $this->redirectRecord;
|
||||
}
|
||||
|
||||
public function setRedirectRecord(array $redirectRecord): void
|
||||
{
|
||||
$this->redirectRecord = $redirectRecord;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Redirects\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\View\ViewInterface;
|
||||
use TYPO3\CMS\Redirects\Repository\Demand;
|
||||
|
||||
/**
|
||||
* This event is fired in the \TYPO3\CMS\Redirects\Controller\ManagementController
|
||||
* handleRequest() method.
|
||||
*
|
||||
* It can be used to further enrich view data for the management view.
|
||||
*/
|
||||
final class ModifyRedirectManagementControllerViewDataEvent
|
||||
{
|
||||
public function __construct(
|
||||
private Demand $demand,
|
||||
private array $redirects,
|
||||
private array $hosts,
|
||||
private array $statusCodes,
|
||||
private array $creationTypes,
|
||||
private bool $showHitCounter,
|
||||
private ViewInterface $view,
|
||||
private readonly ServerRequestInterface $request,
|
||||
private array $integrityStatusCodes,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Return the demand object used to retrieve the redirects.
|
||||
*/
|
||||
public function getDemand(): Demand
|
||||
{
|
||||
return $this->demand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to set the demand object.
|
||||
*/
|
||||
public function setDemand(Demand $demand): void
|
||||
{
|
||||
$this->demand = $demand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the retrieved redirects.
|
||||
*/
|
||||
public function getRedirects(): array
|
||||
{
|
||||
return $this->redirects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to set the redirects, for example, after enriching redirect fields.
|
||||
*/
|
||||
public function setRedirects(array $redirects): void
|
||||
{
|
||||
$this->redirects = $redirects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current PSR-7 request.
|
||||
*/
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hosts to be used for the host filter select box.
|
||||
*/
|
||||
public function getHosts(): array
|
||||
{
|
||||
return $this->hosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to update which hosts are available in the filter select box.
|
||||
*/
|
||||
public function setHosts(array $hosts): void
|
||||
{
|
||||
$this->hosts = $hosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status codes for the filter select box.
|
||||
*/
|
||||
public function getStatusCodes(): array
|
||||
{
|
||||
return $this->statusCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to update which status codes are available in the filter select box.
|
||||
*/
|
||||
public function setStatusCodes(array $statusCodes): void
|
||||
{
|
||||
$this->statusCodes = $statusCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns creation types for the filter select box.
|
||||
*/
|
||||
public function getCreationTypes(): array
|
||||
{
|
||||
return $this->creationTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to update which creation types are available in the filter select box.
|
||||
*/
|
||||
public function setCreationTypes(array $creationTypes): void
|
||||
{
|
||||
$this->creationTypes = $creationTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns, if hit counter should be displayed.
|
||||
*/
|
||||
public function getShowHitCounter(): bool
|
||||
{
|
||||
return $this->showHitCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to manage, if the hit counter should be displayed.
|
||||
*/
|
||||
public function setShowHitCounter(bool $showHitCounter): void
|
||||
{
|
||||
$this->showHitCounter = $showHitCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current view object, without controller data assigned yet.
|
||||
*/
|
||||
public function getView(): ViewInterface
|
||||
{
|
||||
return $this->view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to assign additional data to the view.
|
||||
*/
|
||||
public function setView(ViewInterface $view): void
|
||||
{
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all integrity status codes.
|
||||
*/
|
||||
public function getIntegrityStatusCodes(): array
|
||||
{
|
||||
return $this->integrityStatusCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to set integrity status codes. It can be used to filter for integrity status codes.
|
||||
*/
|
||||
public function setIntegrityStatusCodes(array $integrityStatusCodes): void
|
||||
{
|
||||
$this->integrityStatusCodes = $integrityStatusCodes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Redirects\Event;
|
||||
|
||||
/**
|
||||
* This event is fired in \TYPO3\CMS\Redirects\Service\IntegrityService->checkRedirectTargetIntegrity()
|
||||
* for each redirect record.
|
||||
*
|
||||
* It can be used to perform custom validation on redirect targets and flag broken or invalid targets.
|
||||
*/
|
||||
final class RedirectIntegrityCheckEvent
|
||||
{
|
||||
private ?string $integrityStatus = null;
|
||||
|
||||
/**
|
||||
* @param array<string, string|int|float|null> $redirect
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly array $redirect,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return array<string, string|int|float|null>
|
||||
*/
|
||||
public function getRedirect(): array
|
||||
{
|
||||
return $this->redirect;
|
||||
}
|
||||
|
||||
public function getUid(): int
|
||||
{
|
||||
return $this->redirect['uid'];
|
||||
}
|
||||
|
||||
public function getPid(): int
|
||||
{
|
||||
return $this->redirect['pid'];
|
||||
}
|
||||
|
||||
public function getDeleted(): bool
|
||||
{
|
||||
return ((int)($this->redirect['deleted'] ?? 0)) === 1;
|
||||
}
|
||||
|
||||
public function getDisabled(): bool
|
||||
{
|
||||
return ((int)($this->redirect['disabled'] ?? 0)) === 1;
|
||||
}
|
||||
|
||||
public function getSourceHost(): string
|
||||
{
|
||||
return $this->redirect['source_host'];
|
||||
}
|
||||
|
||||
public function getSourcePath(): string
|
||||
{
|
||||
return $this->redirect['source_path'];
|
||||
}
|
||||
|
||||
public function getIsRegExp(): bool
|
||||
{
|
||||
return ((int)($this->redirect['is_regexp'] ?? 0)) === 1;
|
||||
}
|
||||
|
||||
public function getProtected(): bool
|
||||
{
|
||||
return ((int)($this->redirect['protected'] ?? 0)) === 1;
|
||||
}
|
||||
|
||||
public function getForceHttps(): bool
|
||||
{
|
||||
return ((int)($this->redirect['force_https'] ?? 0)) === 1;
|
||||
}
|
||||
|
||||
public function getRespectQueryParameters(): bool
|
||||
{
|
||||
return ((int)($this->redirect['respect_query_parameters'] ?? 0)) === 1;
|
||||
}
|
||||
|
||||
public function getKeepQueryParameters(): bool
|
||||
{
|
||||
return ((int)($this->redirect['keep_query_parameters'] ?? 0)) === 1;
|
||||
}
|
||||
|
||||
public function getTarget(): string
|
||||
{
|
||||
return (string)($this->redirect['target'] ?? '');
|
||||
}
|
||||
|
||||
public function getTargetStatusCode(): int
|
||||
{
|
||||
return (int)$this->redirect['target_statuscode'];
|
||||
}
|
||||
|
||||
public function getCreationType(): int
|
||||
{
|
||||
return (int)$this->redirect['creation_type'];
|
||||
}
|
||||
|
||||
public function getOriginalIntegrityStatus(): string
|
||||
{
|
||||
return $this->redirect['integrity_status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Be aware that this has been possible set by another earlier PSR-14 event listener already.
|
||||
* Could be any of the {@see RedirectConflict} constants, a custom value or `NULL`. In case
|
||||
* of `NULL` no further handlinge are processed or regonized as conflict during the integrity
|
||||
* checks.
|
||||
*
|
||||
* This is not initialized with the `sys_redirect.integirty_status` value.
|
||||
*/
|
||||
public function getIntegrityStatus(): ?string
|
||||
{
|
||||
return $this->integrityStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the integrity status, could be one of the {@see RedirectConflict} constants, a custom value or `NULL`.
|
||||
* In case of `NULL` no further handlinge are processed or regonized as conflict during the integrity checks.
|
||||
*/
|
||||
public function setIntegrityStatus(?string $integrityStatus): void
|
||||
{
|
||||
$this->integrityStatus = $integrityStatus;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Redirects\Event;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
|
||||
/**
|
||||
* This event is fired in the \TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler
|
||||
* middleware when a request matches a configured redirect.
|
||||
*
|
||||
* It can be used to further process the matched redirect and
|
||||
* to adjust the PSR-7 Response. It furthermore allows to influence Core
|
||||
* functionality, for example the hit count increment.
|
||||
*/
|
||||
final class RedirectWasHitEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private ResponseInterface $response,
|
||||
private array $matchedRedirect,
|
||||
private readonly UriInterface $targetUrl
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getTargetUrl(): UriInterface
|
||||
{
|
||||
return $this->targetUrl;
|
||||
}
|
||||
|
||||
public function setMatchedRedirect(array $matchedRedirect): void
|
||||
{
|
||||
$this->matchedRedirect = $matchedRedirect;
|
||||
}
|
||||
|
||||
public function getMatchedRedirect(): array
|
||||
{
|
||||
return $this->matchedRedirect;
|
||||
}
|
||||
|
||||
public function setResponse(ResponseInterface $response): void
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function getResponse(): ResponseInterface
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace TYPO3\CMS\Redirects\Event;
|
||||
|
||||
use TYPO3\CMS\Redirects\RedirectUpdate\SlugRedirectChangeItem;
|
||||
|
||||
/**
|
||||
* This event is fired in the \TYPO3\CMS\Redirects\RedirectUpdate\SlugRedirectChangeItemFactory
|
||||
* factory if a new SlugRedirectChangeItem is created.
|
||||
*
|
||||
* It can be used to add additional sources, remove sources or completely remove the change item itself.
|
||||
* A source must implement the RedirectSourceInterface, and for each source a redirect record is created
|
||||
* later in the SlugService. If the SlugRedirectChangeItem is set to null, no further action is executed
|
||||
* for this slug change.
|
||||
*/
|
||||
final class SlugRedirectChangeItemCreatedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private SlugRedirectChangeItem $slugRedirectChangeItem
|
||||
) {}
|
||||
|
||||
public function getSlugRedirectChangeItem(): SlugRedirectChangeItem
|
||||
{
|
||||
return $this->slugRedirectChangeItem;
|
||||
}
|
||||
|
||||
public function setSlugRedirectChangeItem(SlugRedirectChangeItem $slugRedirectChangeItem): void
|
||||
{
|
||||
$this->slugRedirectChangeItem = $slugRedirectChangeItem;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user