Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Set Path of content and preview directory if not exist #193

Merged
merged 1 commit into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Classes/Controller/WizardContentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* ************************************************************* */

use TYPO3\CMS\Extbase\Annotation\Inject;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
*
Expand Down Expand Up @@ -206,11 +207,11 @@ public function activateAction($key)
*/
protected function deleteHtml($key)
{
if (file_exists(PATH_site . $this->extSettings["content"] . $key . ".html")) {
unlink(PATH_site . $this->extSettings["content"] . $key . ".html");
if (file_exists(GeneralUtility::getFileAbsFileName($this->extSettings["content"]) . $key . ".html")) {
unlink(GeneralUtility::getFileAbsFileName($this->extSettings["content"]) . $key . ".html");
}
if (file_exists(PATH_site . $this->extSettings["backend"] . $key . ".html")) {
unlink(PATH_site . $this->extSettings["backend"] . $key . ".html");
if (file_exists(GeneralUtility::getFileAbsFileName($this->extSettings["backend"]) . $key . ".html")) {
unlink(GeneralUtility::getFileAbsFileName($this->extSettings["backend"]) . $key . ".html");
}
}

Expand Down
16 changes: 8 additions & 8 deletions Classes/Controller/WizardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ protected function showHtmlAction($key, $table)
*/
protected function saveHtml($key, $html)
{
if (file_exists(PATH_site . $this->extSettings["content"] . ucfirst($key) . ".html")) {
if (file_exists(GeneralUtility::getFileAbsFileName($this->extSettings["content"]) . ucfirst($key) . ".html")) {
return false;
} else {
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_site . $this->extSettings["content"] . ucfirst($key) . ".html",
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(GeneralUtility::getFileAbsFileName($this->extSettings["content"]) . ucfirst($key) . ".html",
$html);
return true;
}
Expand Down Expand Up @@ -262,11 +262,11 @@ protected function checkFolders()

$messages = [];

if (!file_exists(PATH_site . $this->extSettings["content"])) {
if (!file_exists(GeneralUtility::getFileAbsFileName($this->extSettings["content"]))) {
$messages[] = $this->extSettings["content"] . ": " . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.all.error.missingfolder',
'mask');
}
if (!file_exists(PATH_site . $this->extSettings["preview"])) {
if (!file_exists(GeneralUtility::getFileAbsFileName($this->extSettings["preview"]))) {
$messages[] = $this->extSettings["preview"] . ": " . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.all.error.missingfolder',
'mask');
}
Expand All @@ -281,11 +281,11 @@ protected function checkFolders()
protected function createMissingFolders()
{
$success = true;
if (!file_exists(PATH_site . $this->extSettings["content"])) {
$success = $success && mkdir(PATH_site . $this->extSettings["content"], 0755, true);
if (!file_exists(GeneralUtility::getFileAbsFileName($this->extSettings["content"]))) {
$success = $success && mkdir(GeneralUtility::getFileAbsFileName($this->extSettings["content"]), 0755, true);
}
if (!file_exists(PATH_site . $this->extSettings["preview"])) {
$success = $success && mkdir(PATH_site . $this->extSettings["preview"], 0755, true);
if (!file_exists(GeneralUtility::getFileAbsFileName($this->extSettings["preview"]))) {
$success = $success && mkdir(GeneralUtility::getFileAbsFileName($this->extSettings["preview"]), 0755, true);
}
return $success;
}
Expand Down