|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package midcom |
|
4
|
|
|
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
5
|
|
|
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
6
|
|
|
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
use Symfony\Component\HttpFoundation\RedirectResponse; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Wrapper for HTTP relocate responses |
|
13
|
|
|
* |
|
14
|
|
|
* @package midcom |
|
15
|
|
|
*/ |
|
16
|
|
|
class midcom_response_relocate extends RedirectResponse |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* The helper actually can distinguish between site-local, absolute redirects and external |
|
20
|
|
|
* redirects. If the url does not start with http[s] or /, it is taken as a URL relative to |
|
21
|
|
|
* the current anchor prefix, which gets prepended automatically (no other characters |
|
22
|
|
|
* as the anchor prefix get inserted). |
|
23
|
|
|
* |
|
24
|
|
|
* Fully qualified urls are used as-is. |
|
25
|
|
|
* |
|
26
|
|
|
* {@inheritDoc} |
|
27
|
|
|
*/ |
|
28
|
59 |
|
public function setTargetUrl(string $url) : static |
|
29
|
|
|
{ |
|
30
|
59 |
|
if ( !str_starts_with($url, "/") |
|
31
|
59 |
|
&& !preg_match('|^https?://|', $url)) { |
|
32
|
23 |
|
$prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) ?: '/'; |
|
33
|
23 |
|
$url = $prefix . $url; |
|
34
|
23 |
|
debug_add("This is a relative URL from the local site, prepending anchor prefix: {$url}"); |
|
35
|
|
|
} |
|
36
|
59 |
|
return parent::setTargetUrl($url); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function send(bool $flush = true): static |
|
40
|
|
|
{ |
|
41
|
|
|
if (defined('OPENPSA2_UNITTEST_RUN')) { |
|
42
|
|
|
throw new openpsa_test_relocate($this->targetUrl, $this->getStatusCode()); |
|
|
|
|
|
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
midcom::get()->cache->content->no_cache(); |
|
46
|
|
|
debug_add("Relocating to {$this->targetUrl}"); |
|
47
|
|
|
return parent::send($flush); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths