|
@@ -5,8 +5,8 @@ namespace Opentalent\OtAdmin\Controller;
|
|
|
use http\Exception\RuntimeException;
|
|
use http\Exception\RuntimeException;
|
|
|
use Opentalent\OtAdmin\Domain\Entity\SiteInfos;
|
|
use Opentalent\OtAdmin\Domain\Entity\SiteInfos;
|
|
|
use Opentalent\OtAdmin\Domain\Entity\SiteStatus;
|
|
use Opentalent\OtAdmin\Domain\Entity\SiteStatus;
|
|
|
-use Opentalent\OtAdmin\Exception\NoSuchRecordException;
|
|
|
|
|
-use Opentalent\OtAdmin\Exception\NoSuchWebsiteException;
|
|
|
|
|
|
|
+use Opentalent\OtCore\Exception\NoSuchRecordException;
|
|
|
|
|
+use Opentalent\OtCore\Exception\NoSuchWebsiteException;
|
|
|
use Opentalent\OtCore\Cache\OtCacheManager;
|
|
use Opentalent\OtCore\Cache\OtCacheManager;
|
|
|
use Opentalent\OtCore\Controller\ActionController;
|
|
use Opentalent\OtCore\Controller\ActionController;
|
|
|
use Opentalent\OtCore\Domain\Model\Organization;
|
|
use Opentalent\OtCore\Domain\Model\Organization;
|
|
@@ -525,8 +525,6 @@ class SiteController extends ActionController
|
|
|
if (file_exists($uploadDir)) {
|
|
if (file_exists($uploadDir)) {
|
|
|
throw new \RuntimeException("A directory or file " . $uploadDir . " already exists. Abort.");
|
|
throw new \RuntimeException("A directory or file " . $uploadDir . " already exists. Abort.");
|
|
|
}
|
|
}
|
|
|
- $defaultUploadRelPath = $uploadRelPath . '/images';
|
|
|
|
|
- $defaultUploadDir = $uploadDir . '/images';
|
|
|
|
|
|
|
|
|
|
$formsRelPath = '/form_definitions/' . $organizationId;
|
|
$formsRelPath = '/form_definitions/' . $organizationId;
|
|
|
$formsDir = $fileadminDir . $formsRelPath;
|
|
$formsDir = $fileadminDir . $formsRelPath;
|
|
@@ -535,7 +533,6 @@ class SiteController extends ActionController
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->mkDir($uploadDir);
|
|
$this->mkDir($uploadDir);
|
|
|
- $this->mkDir($defaultUploadDir);
|
|
|
|
|
$this->mkDir($formsDir);
|
|
$this->mkDir($formsDir);
|
|
|
|
|
|
|
|
// Insert the filemounts points (sys_filemounts)
|
|
// Insert the filemounts points (sys_filemounts)
|
|
@@ -543,7 +540,7 @@ class SiteController extends ActionController
|
|
|
$queryBuilder->insert('sys_filemounts')
|
|
$queryBuilder->insert('sys_filemounts')
|
|
|
->values([
|
|
->values([
|
|
|
'title' => 'Documents',
|
|
'title' => 'Documents',
|
|
|
- 'path' => rtrim($defaultUploadRelPath, '/') . '/',
|
|
|
|
|
|
|
+ 'path' => rtrim($uploadRelPath, '/') . '/',
|
|
|
'base' => 1
|
|
'base' => 1
|
|
|
])
|
|
])
|
|
|
->execute();
|
|
->execute();
|
|
@@ -576,7 +573,7 @@ class SiteController extends ActionController
|
|
|
|
|
|
|
|
// Update the user TsConfig
|
|
// Update the user TsConfig
|
|
|
$tsconfig = "options.uploadFieldsInTopOfEB = 1\n" .
|
|
$tsconfig = "options.uploadFieldsInTopOfEB = 1\n" .
|
|
|
- "options.defaultUploadFolder=1:" . $defaultUploadDir . "\n";
|
|
|
|
|
|
|
+ "options.defaultUploadFolder=1:" . rtrim($uploadRelPath, '/') . "/\n";
|
|
|
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('be_users');
|
|
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('be_users');
|
|
|
$queryBuilder
|
|
$queryBuilder
|
|
|
->update('be_users')
|
|
->update('be_users')
|
|
@@ -590,7 +587,7 @@ class SiteController extends ActionController
|
|
|
// 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) {
|
|
|
- throw new \RuntimeException('Something went wrong while commiting the result');
|
|
|
|
|
|
|
+ throw new \RuntimeException('Something went wrong while committing the result');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch(\Throwable $e) {
|
|
} catch(\Throwable $e) {
|
|
@@ -832,9 +829,6 @@ class SiteController extends ActionController
|
|
|
if (is_dir(dirname($configYamlFile))) {
|
|
if (is_dir(dirname($configYamlFile))) {
|
|
|
FileUtility::rmdir(dirname($configYamlFile), $force);
|
|
FileUtility::rmdir(dirname($configYamlFile), $force);
|
|
|
}
|
|
}
|
|
|
- if (is_dir($uploadDir . 'images')) {
|
|
|
|
|
- FileUtility::rmdir($uploadDir . 'images', $force);
|
|
|
|
|
- }
|
|
|
|
|
if (is_dir($uploadDir)) {
|
|
if (is_dir($uploadDir)) {
|
|
|
FileUtility::rmdir($uploadDir, $force);
|
|
FileUtility::rmdir($uploadDir, $force);
|
|
|
}
|
|
}
|
|
@@ -965,13 +959,7 @@ class SiteController extends ActionController
|
|
|
$queryBuilder
|
|
$queryBuilder
|
|
|
->update('sys_filemounts')
|
|
->update('sys_filemounts')
|
|
|
->set('deleted', 0)
|
|
->set('deleted', 0)
|
|
|
- ->where($queryBuilder->expr()->eq('path', "'/user_upload/" . $organizationId . "/images'"))
|
|
|
|
|
- ->execute();
|
|
|
|
|
-
|
|
|
|
|
- $queryBuilder
|
|
|
|
|
- ->update('sys_filemounts')
|
|
|
|
|
- ->set('deleted', 0)
|
|
|
|
|
- ->where($queryBuilder->expr()->eq('path', "'/user_upload/" . $organizationId . "/Forms'"))
|
|
|
|
|
|
|
+ ->where($queryBuilder->expr()->eq('path', "'/user_upload/" . $organizationId . "/'"))
|
|
|
->execute();
|
|
->execute();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2224,7 +2212,7 @@ class SiteController extends ActionController
|
|
|
$queryBuilder
|
|
$queryBuilder
|
|
|
->select('uid')
|
|
->select('uid')
|
|
|
->from('sys_filemounts')
|
|
->from('sys_filemounts')
|
|
|
- ->where("path LIKE '%user_upload/" . $organizationId . "/%'")
|
|
|
|
|
|
|
+ ->where("path LIKE '%user_upload/" . $organizationId . "/'")
|
|
|
->orWhere("path LIKE '%form_definitions/" . $organizationId . "/'");
|
|
->orWhere("path LIKE '%form_definitions/" . $organizationId . "/'");
|
|
|
$statement = $queryBuilder->execute();
|
|
$statement = $queryBuilder->execute();
|
|
|
$rows = $statement->fetchAll(3) ?: [];
|
|
$rows = $statement->fetchAll(3) ?: [];
|