mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-10 10:42:59 +02:00
fetaure 2542 replace $conf['local_data_dir'] with $conf['data_location'] and move combined files and image derivatives from local to _data
git-svn-id: http://piwigo.org/svn/trunk@12802 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -88,6 +88,8 @@ foreach( array(
|
||||
|
||||
include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
|
||||
@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
|
||||
if (!isset($conf['local_data_dir'])) $conf['local_data_dir'] = realpath(PHPWG_ROOT_PATH.$conf['data_location']); // temp 2.4 for backward compatibility
|
||||
|
||||
defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/');
|
||||
|
||||
|
||||
|
||||
@@ -719,9 +719,10 @@ $conf['slideshow_repeat'] = true;
|
||||
// Every plugin from 1.7 would be design to manage light_slideshow case.
|
||||
$conf['light_slideshow'] = true;
|
||||
|
||||
// the local data directory is used to store data such as compiled templates
|
||||
// or other plugin variables etc
|
||||
$conf['local_data_dir'] = dirname(dirname(__FILE__)).'/_data';
|
||||
// the local data directory is used to store data such as compiled templates,
|
||||
// plugin variables, combined css/javascript or resized images. Beware of
|
||||
// mandatory trailing slash.
|
||||
$conf['data_location'] = '_data/';
|
||||
|
||||
// where should the API/UploadForm add photos? This path must be relative to
|
||||
// the Piwigo installation directory (but can be outside, as long as it's
|
||||
@@ -756,6 +757,5 @@ $conf['upload_form_automatic_rotation'] = true;
|
||||
// 0-'auto', 1-'derivative' 2-'script'
|
||||
$conf['derivative_url_style']=0;
|
||||
|
||||
$conf['chmod_value']=0777;
|
||||
|
||||
$conf['chmod_value']= substr_compare(PHP_SAPI, 'apa', 0, 3)==0 ? 0777 : 0755;
|
||||
?>
|
||||
@@ -27,8 +27,8 @@ define('PHPWG_DEFAULT_LANGUAGE', 'en_UK');
|
||||
define('PHPWG_DEFAULT_TEMPLATE', 'Sylvia');
|
||||
|
||||
define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/');
|
||||
defined('PWG_COMBINED_DIR') or define('PWG_COMBINED_DIR', PWG_LOCAL_DIR.'combined/');
|
||||
defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', PWG_LOCAL_DIR.'i/');
|
||||
defined('PWG_COMBINED_DIR') or define('PWG_COMBINED_DIR', $conf['data_location'].'combined/');
|
||||
defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', $conf['data_location'].'i/');
|
||||
|
||||
// Required versions
|
||||
define('REQUIRED_PHP_VERSION', '5.0.0');
|
||||
|
||||
@@ -37,7 +37,7 @@ function pwg_db_connect($host, $user, $password, $database)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$db_file = sprintf('sqlite:%s/%s.db', $conf['local_data_dir'], $database);
|
||||
$db_file = sprintf('sqlite:%s/%s.db', PHPWG_ROOT_PATH.$conf['data_location'], $database);
|
||||
|
||||
$link = new PDO($db_file);
|
||||
if (!$link)
|
||||
|
||||
@@ -37,7 +37,7 @@ function pwg_db_connect($host, $user, $password, $database)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$db_file = sprintf('%s/%s.db', $conf['local_data_dir'], $database);
|
||||
$db_file = sprintf('%s/%s.db', PHPWG_ROOT_PATH.$conf['data_location'], $database);
|
||||
|
||||
if (script_basename()=='install')
|
||||
{
|
||||
|
||||
@@ -791,7 +791,7 @@ function move_ccs_rules_to_body($content)
|
||||
function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args)
|
||||
{
|
||||
global $conf, $user, $lang_info;
|
||||
$dir = $conf['local_data_dir'].'/tmp';
|
||||
$dir = PHPWG_ROOT_PATH.$conf['data_location'].'tmp';
|
||||
if ( mkgetdir( $dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) )
|
||||
{
|
||||
$filename = $dir.'/mail.'.stripslashes($user['username']).'.'.$lang_info['code'].'.'.$args['theme'].'-'.date('YmdHis');
|
||||
|
||||
+14
-13
@@ -59,30 +59,32 @@ class Template {
|
||||
$this->smarty->compile_check = $conf['template_compile_check'];
|
||||
$this->smarty->force_compile = $conf['template_force_compile'];
|
||||
|
||||
if (!isset($conf['local_data_dir_checked']))
|
||||
if (!isset($conf['data_dir_checked']))
|
||||
{
|
||||
mkgetdir($conf['local_data_dir'], MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
|
||||
if (!is_writable($conf['local_data_dir']))
|
||||
$dir = PHPWG_ROOT_PATH.$conf['data_location'];
|
||||
mkgetdir($dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
|
||||
if (!is_writable($dir))
|
||||
{
|
||||
load_language('admin.lang');
|
||||
fatal_error(
|
||||
sprintf(
|
||||
l10n('Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'),
|
||||
basename($conf['local_data_dir'])
|
||||
$conf['data_location']
|
||||
),
|
||||
l10n('an error happened'),
|
||||
false // show trace
|
||||
);
|
||||
}
|
||||
if (function_exists('pwg_query')) {
|
||||
conf_update_param('local_data_dir_checked', 'true');
|
||||
conf_update_param('data_dir_checked', 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($conf['combined_dir_checked']))
|
||||
{
|
||||
mkgetdir(PWG_COMBINED_DIR, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
|
||||
if (!is_writable(PWG_COMBINED_DIR))
|
||||
$dir = PHPWG_ROOT_PATH.PWG_COMBINED_DIR;
|
||||
mkgetdir($dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
|
||||
if (!is_writable($dir))
|
||||
{
|
||||
load_language('admin.lang');
|
||||
fatal_error(
|
||||
@@ -95,12 +97,12 @@ class Template {
|
||||
);
|
||||
}
|
||||
if (function_exists('pwg_query')) {
|
||||
conf_update_param('combined_dir_checked', 'true');
|
||||
conf_update_param('combined_dir_checked', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$compile_dir = $conf['local_data_dir'].'/templates_c';
|
||||
$compile_dir = PHPWG_ROOT_PATH.$conf['data_location'].'templates_c';
|
||||
mkgetdir( $compile_dir );
|
||||
|
||||
$this->smarty->compile_dir = $compile_dir;
|
||||
@@ -1181,7 +1183,6 @@ class ScriptLoader
|
||||
/*Allows merging of javascript and css files into a single one.*/
|
||||
final class FileCombiner
|
||||
{
|
||||
const OUT_SUB_DIR = PWG_COMBINED_DIR;
|
||||
private $type; // js or css
|
||||
private $files = array();
|
||||
private $versions = array();
|
||||
@@ -1193,11 +1194,11 @@ final class FileCombiner
|
||||
|
||||
static function clear_combined_files()
|
||||
{
|
||||
$dir = opendir(PHPWG_ROOT_PATH.self::OUT_SUB_DIR);
|
||||
$dir = opendir(PHPWG_ROOT_PATH.PWG_COMBINED_DIR);
|
||||
while ($file = readdir($dir))
|
||||
{
|
||||
if ( get_extension($file)=='js' || get_extension($file)=='css')
|
||||
unlink(PHPWG_ROOT_PATH.self::OUT_SUB_DIR.$file);
|
||||
unlink(PHPWG_ROOT_PATH.PWG_COMBINED_DIR.$file);
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
@@ -1242,7 +1243,7 @@ final class FileCombiner
|
||||
$key = join('>', $key);
|
||||
|
||||
$file = base_convert(crc32($key),10,36);
|
||||
$file = self::OUT_SUB_DIR . $file . '.' . $this->type;
|
||||
$file = PWG_COMBINED_DIR . $file . '.' . $this->type;
|
||||
|
||||
$exists = file_exists( PHPWG_ROOT_PATH . $file );
|
||||
if ($exists)
|
||||
|
||||
Reference in New Issue
Block a user