Topic: unintentionally creating folders for every user
We have a problem where image manager is creating hundreds of thousands of unnecessary folders on our servers because every user who loads tinymce is getting their own folder, regardless of if they use imagemanager.
In this file:
/tiny_mce/plugins/imagemanager/config.php
I have this at the top of that file:
// Include your custom classes here
require('prepend.inc.php');
$objAuthUser = UserSecurity::GetUser();
if(!file_exists(WEB_WRITEABLE . '/images_users/tiny_mce/' . $objAuthUser->Username)) {
mkdir(WEB_WRITEABLE . '/images_users/tiny_mce/' . $objAuthUser->Username, 0777, true);
}
require_once(MCMANAGER_ABSPATH . "ImageManager/ImageManagerPlugin.php");
The reason we do this, the motivation behind it, is so that each authenticated user on our website has their own images directory. So in that same config file I have these lines:
$mcImageManagerConfig['preview.wwwroot'] = WEB_WRITEABLE; // absolute or relative from this script path, try to leave blank system figures it out.
$mcImageManagerConfig['preview.urlprefix'] = FILES_URL . "/"; // domain name
$mcImageManagerConfig['filesystem.rootpath'] = WEB_WRITEABLE . '/images_users/tiny_mce/' . $objAuthUser->Username; // absolute or relative from this script path, required.
That way this ensures that if the user ever goes to upload an image, that folder exists. I"m not sure how I can change this code to be conditional only when the user actually goes to upload an image.
Any ideas?
Last edited by chessdev (2010-05-27 17:20:59)