Where does SugarCRM/SuiteCRM set file permissions?

sugarcrm, suitecrm

Solution

After wrestling with this for many moons, I finally tracked down two additional obscure places SugarCRM/SuiteCRM sets file permissions.

utils.php around line 136:

'default_permissions' => array (
    'dir_mode' => 02770,
    'file_mode' => 0660,
    'chown' => '',
    'chgrp' => '',
),

and the kicker for me, Smarty.class.php around line 504:

/**
 * default file permissions
 *
 * @var integer
 */
var $_file_perms           = 0644;

/**
 * default dir permissions
 *
 * @var integer
 */
var $_dir_perms               = 0771;

Hopefully this helps someone else. I'll wait to accept an answer in case someone has more to add.

Problem

Where does sugarcrm (6.5) and it's fork suitecrm (7.x) set file permissions for files it creates? I have seen config.php with the variable: ``` 'default_permissions' => array ( 'dir_mode' => 1528, 'file_mode' => 436, 'user' => '', 'group' => '', ), ``` but that does not seem to be the same permissions that are assigned to cache files. See files in: ``` cache/smarty/templates_c ``` which have `644` permissions rather than `660`. This means that I have to manual `chmod` the files if I want to edit them. So my question: where are file permissions set in sugarcrm/suitecrm?

Original source