enwikipedia-acc /
waca
| 1 | <?php |
||
| 2 | /****************************************************************************** |
||
| 3 | * Wikipedia Account Creation Assistance tool * |
||
| 4 | * * |
||
| 5 | * All code in this file is released into the public domain by the ACC * |
||
| 6 | * Development Team. Please see team.json for a list of contributors. * |
||
| 7 | ******************************************************************************/ |
||
| 8 | |||
| 9 | namespace Waca; |
||
| 10 | |||
| 11 | use Smarty; |
||
| 12 | use SmartyException; |
||
|
0 ignored issues
–
show
|
|||
| 13 | use Waca\DataObjects\User; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Handles the tool offline messages |
||
| 17 | */ |
||
| 18 | class Offline |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * Determines if the tool is offline |
||
| 22 | * @return bool |
||
| 23 | */ |
||
| 24 | public static function isOffline(SiteConfiguration $configuration): bool |
||
| 25 | { |
||
| 26 | return (bool)$configuration->getOffline()['offline']; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Gets the offline message |
||
| 31 | * |
||
| 32 | * @throws SmartyException |
||
| 33 | */ |
||
| 34 | public static function getOfflineMessage(bool $external, SiteConfiguration $configuration, ?string $message = null): string |
||
| 35 | { |
||
| 36 | $baseurl = $configuration->getBaseUrl(); |
||
| 37 | $culprit = $configuration->getOffline()['culprit']; |
||
| 38 | $reason = $configuration->getOffline()['reason']; |
||
| 39 | |||
| 40 | $smarty = new Smarty(); |
||
| 41 | $smarty->assign("baseurl", $baseurl); |
||
| 42 | $smarty->assign("resourceCacheEpoch", 0); |
||
| 43 | $smarty->assign("alerts", []); |
||
| 44 | $smarty->assign("toolversion", Environment::getToolVersion()); |
||
| 45 | |||
| 46 | if (!headers_sent()) { |
||
| 47 | header("HTTP/1.1 503 Service Unavailable"); |
||
| 48 | } |
||
| 49 | |||
| 50 | if ($external) { |
||
| 51 | return $smarty->fetch("offline/external.tpl"); |
||
| 52 | } |
||
| 53 | else { |
||
| 54 | $hideCulprit = true; |
||
| 55 | |||
| 56 | // Use the provided message if possible |
||
| 57 | if ($message === null) { |
||
| 58 | $hideCulprit = false; |
||
| 59 | $message = $reason; |
||
| 60 | } |
||
| 61 | |||
| 62 | $smarty->assign("hideCulprit", $hideCulprit); |
||
| 63 | $smarty->assign("dontUseDbCulprit", $culprit); |
||
| 64 | $smarty->assign("dontUseDbReason", $message); |
||
| 65 | $smarty->assign("alerts", []); |
||
| 66 | $smarty->assign('currentUser', User::getCommunity()); |
||
| 67 | $smarty->assign('skin', 'main'); |
||
| 68 | $smarty->assign('currentDomain', null); |
||
| 69 | |||
| 70 | return $smarty->fetch("offline/internal.tpl"); |
||
| 71 | } |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
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