configure upload dir for tonymce module

This commit is contained in:
Manuel Raynaud
2014-01-14 11:20:12 +01:00
parent d73eaad981
commit 55d0fd2ae2
6 changed files with 18 additions and 9 deletions

1
.gitignore vendored
View File

@@ -19,6 +19,7 @@ local/media/images/*
web/assets/* web/assets/*
web/cache/* web/cache/*
web/tinymce web/tinymce
web/media
phpdoc*.log phpdoc*.log
php-cs php-cs
xhprof/ xhprof/

1
local/modules/Tinymce/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
Resources/*

View File

@@ -41,20 +41,26 @@ class VerifyTinymceListener implements EventSubscriberInterface
public function verifyTinymce(Event $event) public function verifyTinymce(Event $event)
{ {
if(false === file_exists(THELIA_WEB_DIR . '/tinymce')) { $fs = new Filesystem();
$fs = new Filesystem(); if (false === file_exists(THELIA_WEB_DIR . '/tinymce')) {
$fs->mirror(__DIR__ . '/../Resources/js/tinymce', THELIA_WEB_DIR . '/tinymce'); $fs->mirror(__DIR__ . '/../Resources/js/tinymce', THELIA_WEB_DIR . '/tinymce');
} }
if (false === file_exists(THELIA_WEB_DIR . '/media')) {
$fs->symlink(__DIR__ . '/../Resources/media', THELIA_WEB_DIR . '/media');
}
} }
public function clearCache(CacheEvent $event) public function clearCache(CacheEvent $event)
{ {
$fs = new Filesystem(); if (true === file_exists(THELIA_WEB_DIR . '/tinymce')) {
echo "toto";
$fs = new Filesystem();
$directory = new \DirectoryIterator(THELIA_WEB_DIR . '/tinymce'); $directory = new \DirectoryIterator(THELIA_WEB_DIR . '/tinymce');
$fs->remove($directory); $fs->remove($directory);
}
} }
/** /**
@@ -81,7 +87,7 @@ class VerifyTinymceListener implements EventSubscriberInterface
{ {
return array( return array(
TheliaEvents::BOOT => array('verifyTinymce', 128), TheliaEvents::BOOT => array('verifyTinymce', 128),
TheliaEvents::CACHE_CLEAR => array("clearCache", 128) TheliaEvents::CACHE_CLEAR => array("clearCache", 0)
); );
} }
} }

View File

@@ -61,9 +61,9 @@ if (false === $isGranted) {
$base_url=rtrim(\Thelia\Model\ConfigQuery::read('url_site'), '/'); // base url (only domain) of site (without final /). If you prefer relative urls leave empty $base_url=rtrim(\Thelia\Model\ConfigQuery::read('url_site'), '/'); // base url (only domain) of site (without final /). If you prefer relative urls leave empty
$upload_dir = '/media/'; // path from base_url to base of upload folder (with start and final /) $upload_dir = '/media/'; // path from base_url to base of upload folder (with start and final /)
$current_path = '../source/'; // relative path from filemanager folder to upload folder (with final /) $current_path = '../../../media/'; // relative path from filemanager folder to upload folder (with final /)
//thumbs folder can't put inside upload folder //thumbs folder can't put inside upload folder
$thumbs_base_path = '../thumbs/'; // relative path from filemanager folder to thumbs folder (with final /) $thumbs_base_path = '../../../media/'; // relative path from filemanager folder to thumbs folder (with final /)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// YOU CAN COPY AND CHANGE THESE VARIABLES IN FOLDERS config.php FILES // YOU CAN COPY AND CHANGE THESE VARIABLES IN FOLDERS config.php FILES

0
local/modules/Tinymce/Resources/media/.gitkeep Normal file → Executable file
View File

View File

@@ -38,5 +38,6 @@ class Tinymce extends BaseModule
$fs = new Filesystem(); $fs = new Filesystem();
$fs->mirror(__DIR__ . '/Resources/js/tinymce', THELIA_WEB_DIR . '/tinymce'); $fs->mirror(__DIR__ . '/Resources/js/tinymce', THELIA_WEB_DIR . '/tinymce');
$fs->symlink(__DIR__ . 'Resource/media', THELIA_WEB_DIR . '/media');
} }
} }