mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
fix #387 check on servername value not empty, valid & https
This commit is contained in:
@@ -104,9 +104,9 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
$previous->getMessage() : 'Unknown.'
|
$previous->getMessage() : 'Unknown.'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$output->writeln(sprintf("\nCheck test suite can not continue please correct FATAL error and relaunch.\n"));
|
$output->writeln(sprintf("\nCheck test suite can not continue please correct FATAL error and relaunch.\n"));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,10 +134,10 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$nbErrors)
|
if (!$nbErrors)
|
||||||
{
|
{
|
||||||
$output->writeln("<info>Your production settings are setted correctly !</info>");
|
$output->writeln("<info>Your production settings are setted correctly !</info>");
|
||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) ($nbErrors > 0);
|
return (int) ($nbErrors > 0);
|
||||||
@@ -223,6 +223,24 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
|
|
||||||
$url = $phraseanet->get("servername");
|
$url = $phraseanet->get("servername");
|
||||||
|
|
||||||
|
if(empty($url))
|
||||||
|
{
|
||||||
|
throw new \Exception("phraseanet:servername connot be empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!filter_var($url, FILTER_VALIDATE_URL))
|
||||||
|
{
|
||||||
|
throw new \Exception(sprintf("%s url is not valid", $url));
|
||||||
|
}
|
||||||
|
|
||||||
|
$parseUrl = parse_url($url);
|
||||||
|
|
||||||
|
if($parseUrl["scheme"] !== "https")
|
||||||
|
{
|
||||||
|
$output->writeln(sprintf("<comment> /!\ %s url scheme should be https</comment>", $url));
|
||||||
|
$output->writeln("");
|
||||||
|
}
|
||||||
|
|
||||||
if ($phraseanet->get("debug") !== false)
|
if ($phraseanet->get("debug") !== false)
|
||||||
{
|
{
|
||||||
throw new \Exception("phraseanet:debug must be initialized to false");
|
throw new \Exception("phraseanet:debug must be initialized to false");
|
||||||
|
Reference in New Issue
Block a user