|
|
@@ -13,6 +13,7 @@ use Opentalent\OtCore\Controller\ActionController;
|
|
|
use Opentalent\OtCore\Domain\Model\Organization;
|
|
|
use Opentalent\OtCore\Domain\Repository\OrganizationRepository;
|
|
|
use Opentalent\OtCore\Exception\ApiRequestException;
|
|
|
+use Opentalent\OtCore\Service\OpentalentEnvService;
|
|
|
use Opentalent\OtCore\Website\OtWebsiteRepository;
|
|
|
use Opentalent\OtCore\Utility\FileUtility;
|
|
|
use Opentalent\OtCore\Routing\Indexer;
|
|
|
@@ -154,7 +155,6 @@ class SiteController extends ActionController
|
|
|
|
|
|
public function __construct()
|
|
|
{
|
|
|
- parent::__construct();
|
|
|
$this->createdPagesIndex = [];
|
|
|
$this->createdDirs = [];
|
|
|
$this->createdFiles = [];
|
|
|
@@ -532,9 +532,9 @@ class SiteController extends ActionController
|
|
|
->execute();
|
|
|
|
|
|
// Create the user_upload and form_definitions directories and update the sys_filemounts table
|
|
|
- $uploadRelPath = "/user_upload/" . $organizationId;
|
|
|
+ $uploadRelPath = "user_upload/" . $organizationId;
|
|
|
$fileadminDir = $_ENV['TYPO3_PATH_APP'] . "/public/fileadmin";
|
|
|
- $uploadDir = $fileadminDir . "/" . $uploadRelPath;
|
|
|
+ $uploadDir = rtrim($fileadminDir, '/') . "/" . ltrim($uploadRelPath, '/');
|
|
|
if (file_exists($uploadDir)) {
|
|
|
throw new \RuntimeException("A directory or file " . $uploadDir . " already exists. Abort.");
|
|
|
}
|
|
|
@@ -670,7 +670,7 @@ class SiteController extends ActionController
|
|
|
->set('organization_name', $organization->getName())
|
|
|
->where($queryBuilder->expr()->eq('uid', $website['uid']))
|
|
|
->execute();
|
|
|
-
|
|
|
+
|
|
|
// ## Update the subpages of the rootpage
|
|
|
$sitePages = $this->otPageRepository->getAllSubpagesForPage($rootUid);
|
|
|
foreach ($sitePages as $page) {
|
|
|
@@ -1993,14 +1993,10 @@ class SiteController extends ActionController
|
|
|
}
|
|
|
|
|
|
private function fetchOrganizationExtraData(int $organizationId) {
|
|
|
-
|
|
|
- $db_host = ($_SERVER['HTTP_HOST'] == 'typo3' |
|
|
|
- $_SERVER['HTTP_HOST'] == 'local.sub.opentalent.fr') ? 'db' : 'prod-back';
|
|
|
-
|
|
|
$cnn = new PDO(
|
|
|
- "mysql:host=" . $db_host . ";dbname=opentalent",
|
|
|
- 'dbcloner',
|
|
|
- 'wWZ4hYcrmHLW2mUK',
|
|
|
+ "mysql:host=" . OpentalentEnvService::get('DB_HOST') . ";dbname=opentalent",
|
|
|
+ OpentalentEnvService::get('DB_USER'),
|
|
|
+ OpentalentEnvService::get('DB_PASSWORD'),
|
|
|
array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')
|
|
|
);
|
|
|
$cnn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|