Changeset 12802


Ignore:
Timestamp:
Dec 29, 2011, 6:48:16 AM (12 years ago)
Author:
rvelices
Message:

fetaure 2542 replace $conflocal_data_dir with $confdata_location and move combined files and image derivatives from local to _data

Location:
trunk
Files:
1 added
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/updates.class.php

    r12261 r12802  
    317317    include(PHPWG_ROOT_PATH.'admin/include/mysqldump.php');
    318318
    319     $path = $conf['local_data_dir'].'/update';
     319    $path = PHPWG_ROOT_PATH.$conf['data_location'].'update';
    320320
    321321    if (@mkgetdir($path)
     
    351351
    352352      @readfile($backupFile);
    353       self::deltree($conf['local_data_dir'].'/update');
     353      self::deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
    354354      exit();
    355355    }
     
    387387    if (empty($page['errors']))
    388388    {
    389       $path = $conf['local_data_dir'].'/update';
     389      $path = PHPWG_ROOT_PATH.$conf['data_location'].'update';
    390390      $filename = $path.'/'.$code.'.zip';
    391391      @mkgetdir($path);
     
    450450          {
    451451            self::process_obsolete_list($obsolete_list);
    452             self::deltree($conf['local_data_dir'].'/update');
     452            self::deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
    453453            invalidate_user_cache(true);
    454454            $template->delete_compiled_templates();
     
    466466          else
    467467          {
    468             file_put_contents($conf['local_data_dir'].'/update/log_error.txt', $error);
    469             $relative_path = trim(str_replace(dirname(dirname(dirname(dirname(__FILE__)))), '', $conf['local_data_dir']), '/\\');
     468            file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'update/log_error.txt', $error);
    470469            array_push(
    471470              $page['errors'],
    472471              sprintf(
    473472                l10n('An error has occured during extract. Please check files permissions of your piwigo installation.<br><a href="%s">Click here to show log error</a>.'),
    474                 PHPWG_ROOT_PATH.$relative_path.'/update/log_error.txt'
     473                get_root_url().$conf['data_location'].'update/log_error.txt'
    475474              )
    476475            );
     
    479478        else
    480479        {
    481           self::deltree($conf['local_data_dir'].'/update');
     480          self::deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
    482481          array_push($page['errors'], l10n('An error has occured during upgrade.'));
    483482        }
  • trunk/feed.php

    r8728 r12802  
    194194}
    195195
    196 $fileName= $conf['local_data_dir'].'/tmp';
     196$fileName= PHPWG_ROOT_PATH.$conf['data_location'].'tmp';
    197197mkgetdir($fileName); // just in case
    198198$fileName.='/feed.xml';
  • trunk/i.php

    r12798 r12802  
    2727
    2828defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/');
    29 defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', PWG_LOCAL_DIR.'i/');
     29defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', $conf['data_location'].'i/');
    3030
    3131function trigger_action() {}
  • trunk/include/common.inc.php

    r12796 r12802  
    8989include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
    9090@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
     91if (!isset($conf['local_data_dir'])) $conf['local_data_dir'] = realpath(PHPWG_ROOT_PATH.$conf['data_location']); // temp 2.4 for backward compatibility
     92
    9193defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/');
    9294
  • trunk/include/config_default.inc.php

    r12796 r12802  
    720720$conf['light_slideshow'] = true;
    721721
    722 // the local data directory is used to store data such as compiled templates
    723 // or other plugin variables etc
    724 $conf['local_data_dir'] = dirname(dirname(__FILE__)).'/_data';
     722// the local data directory is used to store data such as compiled templates,
     723// plugin variables, combined css/javascript or resized images. Beware of
     724// mandatory trailing slash.
     725$conf['data_location'] = '_data/';
    725726
    726727// where should the API/UploadForm add photos? This path must be relative to
     
    757758$conf['derivative_url_style']=0;
    758759
    759 $conf['chmod_value']=0777;
    760 
     760$conf['chmod_value']= substr_compare(PHP_SAPI, 'apa', 0, 3)==0 ? 0777 : 0755;
    761761?>
  • trunk/include/constants.php

    r12796 r12802  
    2828
    2929define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/');
    30 defined('PWG_COMBINED_DIR') or define('PWG_COMBINED_DIR', PWG_LOCAL_DIR.'combined/');
    31 defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', PWG_LOCAL_DIR.'i/');
     30defined('PWG_COMBINED_DIR') or define('PWG_COMBINED_DIR', $conf['data_location'].'combined/');
     31defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', $conf['data_location'].'i/');
    3232
    3333// Required versions
  • trunk/include/dblayer/functions_pdo-sqlite.inc.php

    r11991 r12802  
    3838  global $conf;
    3939
    40   $db_file = sprintf('sqlite:%s/%s.db', $conf['local_data_dir'], $database);
     40  $db_file = sprintf('sqlite:%s/%s.db', PHPWG_ROOT_PATH.$conf['data_location'], $database);
    4141
    4242  $link = new PDO($db_file);
  • trunk/include/dblayer/functions_sqlite.inc.php

    r11991 r12802  
    3838  global $conf;
    3939
    40   $db_file = sprintf('%s/%s.db', $conf['local_data_dir'], $database);
     40  $db_file = sprintf('%s/%s.db', PHPWG_ROOT_PATH.$conf['data_location'], $database);
    4141
    4242  if (script_basename()=='install')
  • trunk/include/functions_mail.inc.php

    r9360 r12802  
    792792{
    793793    global $conf, $user, $lang_info;
    794     $dir = $conf['local_data_dir'].'/tmp';
     794    $dir = PHPWG_ROOT_PATH.$conf['data_location'].'tmp';
    795795    if ( mkgetdir( $dir,  MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) )
    796796    {
  • trunk/include/template.class.php

    r12656 r12802  
    6060    $this->smarty->force_compile = $conf['template_force_compile'];
    6161
    62     if (!isset($conf['local_data_dir_checked']))
    63     {
    64       mkgetdir($conf['local_data_dir'], MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
    65       if (!is_writable($conf['local_data_dir']))
     62    if (!isset($conf['data_dir_checked']))
     63    {
     64      $dir = PHPWG_ROOT_PATH.$conf['data_location'];
     65      mkgetdir($dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
     66      if (!is_writable($dir))
    6667      {
    6768        load_language('admin.lang');
     
    6970          sprintf(
    7071            l10n('Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'),
    71             basename($conf['local_data_dir'])
     72            $conf['data_location']
    7273            ),
    7374          l10n('an error happened'),
     
    7677      }
    7778      if (function_exists('pwg_query')) {
    78         conf_update_param('local_data_dir_checked', 'true');
     79        conf_update_param('data_dir_checked', 1);
    7980      }
    8081    }
     
    8283    if (!isset($conf['combined_dir_checked']))
    8384    {
    84       mkgetdir(PWG_COMBINED_DIR, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
    85       if (!is_writable(PWG_COMBINED_DIR))
     85      $dir = PHPWG_ROOT_PATH.PWG_COMBINED_DIR;
     86      mkgetdir($dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
     87      if (!is_writable($dir))
    8688      {
    8789        load_language('admin.lang');
     
    9698      }
    9799      if (function_exists('pwg_query')) {
    98         conf_update_param('combined_dir_checked', 'true');
    99       }
    100     }
    101 
    102 
    103     $compile_dir = $conf['local_data_dir'].'/templates_c';
     100        conf_update_param('combined_dir_checked', 1);
     101      }
     102    }
     103
     104
     105    $compile_dir = PHPWG_ROOT_PATH.$conf['data_location'].'templates_c';
    104106    mkgetdir( $compile_dir );
    105107
     
    11821184final class FileCombiner
    11831185{
    1184   const OUT_SUB_DIR = PWG_COMBINED_DIR;
    11851186  private $type; // js or css
    11861187  private $files = array();
     
    11941195  static function clear_combined_files()
    11951196  {
    1196     $dir = opendir(PHPWG_ROOT_PATH.self::OUT_SUB_DIR);
     1197    $dir = opendir(PHPWG_ROOT_PATH.PWG_COMBINED_DIR);
    11971198    while ($file = readdir($dir))
    11981199    {
    11991200      if ( get_extension($file)=='js' || get_extension($file)=='css')
    1200         unlink(PHPWG_ROOT_PATH.self::OUT_SUB_DIR.$file);
     1201        unlink(PHPWG_ROOT_PATH.PWG_COMBINED_DIR.$file);
    12011202    }
    12021203    closedir($dir);
     
    12431244
    12441245    $file = base_convert(crc32($key),10,36);
    1245     $file = self::OUT_SUB_DIR . $file . '.' . $this->type;
     1246    $file = PWG_COMBINED_DIR . $file . '.' . $this->type;
    12461247
    12471248    $exists = file_exists( PHPWG_ROOT_PATH . $file );
  • trunk/install.php

    r12769 r12802  
    111111
    112112// download database config file if exists
    113 if (!empty($_GET['dl']) && file_exists($conf['local_data_dir'].'/pwg_'.$_GET['dl']))
    114 {
    115   $filename = $conf['local_data_dir'].'/pwg_'.$_GET['dl'];
     113if (!empty($_GET['dl']) && file_exists(PHPWG_ROOT_PATH.$conf['data_location'].'pwg_'.$_GET['dl']))
     114{
     115  $filename = PHPWG_ROOT_PATH.$conf['data_location'].'pwg_'.$_GET['dl'];
    116116  header('Cache-Control: no-cache, must-revalidate');
    117117  header('Pragma: no-cache');
     
    282282    {
    283283      $tmp_filename = md5(uniqid(time()));
    284       $fh = @fopen( $conf['local_data_dir'] . '/pwg_' . $tmp_filename, 'w' );
     284      $fh = @fopen( PHPWG_ROOT_PATH.$conf['data_location'] . 'pwg_' . $tmp_filename, 'w' );
    285285      @fputs($fh, $file_content, strlen($file_content));
    286286      @fclose($fh);
  • trunk/install/db/94-database.php

    r11509 r12802  
    6161
    6262// save configuration for a future use by the Community plugin
    63 $backup_filepath = $conf['local_data_dir'].'/plugins/core_user_upload_to_community.php';
     63$backup_filepath = PHPWG_ROOT_PATH.$conf['data_location'].'plugins/core_user_upload_to_community.php';
    6464$save_conf = true;
    6565if (is_dir(dirname($backup_filepath)))
     
    7070  }
    7171}
    72 elseif (!is_writable($conf['local_data_dir']))
     72elseif (!is_writable( PHPWG_ROOT_PATH.$conf['data_location'] ))
    7373{
    7474  $save_conf = false;
Note: See TracChangeset for help on using the changeset viewer.