|
@@ -640,7 +640,7 @@ class SiteController extends ActionController
|
|
|
* @throws \Doctrine\DBAL\DBALException
|
|
* @throws \Doctrine\DBAL\DBALException
|
|
|
* @throws \Throwable
|
|
* @throws \Throwable
|
|
|
*/
|
|
*/
|
|
|
- public function updateSiteAction(int $organizationId, bool $hard=false): int
|
|
|
|
|
|
|
+ public function updateSiteAction(int $organizationId): int
|
|
|
{
|
|
{
|
|
|
$website = $this->otWebsiteRepository->getWebsiteByOrganizationId($organizationId);
|
|
$website = $this->otWebsiteRepository->getWebsiteByOrganizationId($organizationId);
|
|
|
$rootUid = $this->otWebsiteRepository->getWebsiteRootUid($website['uid']);
|
|
$rootUid = $this->otWebsiteRepository->getWebsiteRootUid($website['uid']);
|
|
@@ -652,9 +652,6 @@ class SiteController extends ActionController
|
|
|
// the prod-back DB directly.
|
|
// the prod-back DB directly.
|
|
|
$organizationExtraData = $this->fetchOrganizationExtraData($organizationId);
|
|
$organizationExtraData = $this->fetchOrganizationExtraData($organizationId);
|
|
|
|
|
|
|
|
- // Get the website config identifier if exists
|
|
|
|
|
- $identifier = $this->otWebsiteRepository->findConfigIdentifierFor($rootUid);
|
|
|
|
|
-
|
|
|
|
|
// start transactions
|
|
// start transactions
|
|
|
$this->connectionPool->getConnectionByName('Default')->beginTransaction();
|
|
$this->connectionPool->getConnectionByName('Default')->beginTransaction();
|
|
|
|
|
|
|
@@ -663,14 +660,11 @@ class SiteController extends ActionController
|
|
|
|
|
|
|
|
// ## Update the ot_website table
|
|
// ## Update the ot_website table
|
|
|
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('ot_websites');
|
|
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('ot_websites');
|
|
|
- $q = $queryBuilder->update('ot_websites')
|
|
|
|
|
|
|
+ $queryBuilder->update('ot_websites')
|
|
|
->set('subdomain', $organization->getSubDomain())
|
|
->set('subdomain', $organization->getSubDomain())
|
|
|
- ->set('organization_name', $organization->getName());
|
|
|
|
|
- if ($identifier) {
|
|
|
|
|
- $q->set('config_identifier', $identifier);
|
|
|
|
|
- }
|
|
|
|
|
- $q->where($queryBuilder->expr()->eq('uid', $website['uid']))
|
|
|
|
|
- ->execute();
|
|
|
|
|
|
|
+ ->set('organization_name', $organization->getName())
|
|
|
|
|
+ ->where($queryBuilder->expr()->eq('uid', $website['uid']))
|
|
|
|
|
+ ->execute();
|
|
|
|
|
|
|
|
// ## Update the subpages of the rootpage
|
|
// ## Update the subpages of the rootpage
|
|
|
$sitePages = $this->otPageRepository->getAllSubpagesForPage($rootUid);
|
|
$sitePages = $this->otPageRepository->getAllSubpagesForPage($rootUid);
|
|
@@ -682,11 +676,9 @@ class SiteController extends ActionController
|
|
|
->execute();
|
|
->execute();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // ## Update the config.yaml file
|
|
|
|
|
- if ($hard) {
|
|
|
|
|
- $organizationDomain = $this->otWebsiteRepository->resolveWebsiteDomain($website);
|
|
|
|
|
- $this->writeConfigFile($organizationId, $rootUid, $organizationDomain, true);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // ## Update the config.yaml file and the ot_websites.config_identifier field
|
|
|
|
|
+ $organizationDomain = $this->otWebsiteRepository->resolveWebsiteDomain($website);
|
|
|
|
|
+ $this->writeConfigFile($organizationId, $rootUid, $organizationDomain, true);
|
|
|
|
|
|
|
|
// ## Update the `sys_template`.`constants` and the `pages`.`TSConfig` fields
|
|
// ## Update the `sys_template`.`constants` and the `pages`.`TSConfig` fields
|
|
|
$constants = $this->getTemplateConstants($organizationId, $organizationExtraData);
|
|
$constants = $this->getTemplateConstants($organizationId, $organizationExtraData);
|
|
@@ -705,11 +697,6 @@ class SiteController extends ActionController
|
|
|
->where($queryBuilder->expr()->eq('uid', $rootUid))
|
|
->where($queryBuilder->expr()->eq('uid', $rootUid))
|
|
|
->execute();
|
|
->execute();
|
|
|
|
|
|
|
|
- // ## Reset the users permissions
|
|
|
|
|
- if ($hard) {
|
|
|
|
|
- $this->resetBeUserPermsAction($organizationId, true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// Try to commit the result
|
|
// Try to commit the result
|
|
|
$commitSuccess = $this->connectionPool->getConnectionByName('Default')->commit();
|
|
$commitSuccess = $this->connectionPool->getConnectionByName('Default')->commit();
|
|
|
if (!$commitSuccess) {
|
|
if (!$commitSuccess) {
|