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?
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.
I believe the config.php's
'file_mode' => 436,
should actually be
'file_mode' => 432,
Try changing it and see if the files are now given 660
Hope it helps.
See if /install/installSystemCheck.php is what you are looking for, on my v7.2.1 line 217
Related
I've made an update from TYPO3 CMS 6.2 to TYPO3 CMS 7.6.16. After a few problems with other extensions (tx_newsand third party ext.) and the changes in the TCA. Everything works fine after import live-dump ...
Upgrade wizard / Database compare
Update reference Index
Flush Cache and empty typo3temp
Deactivate and reactivate the Extensions with problems
Everything? Unfortunately, no. The extension doesn't work. I don't written the extension by myself. If I try to add a new data record in backend with this ext., I'll get this error:
An item in field form of table tx_blah_domain_model_job is not an array as expected
But the database comprare is finished. All tables are correct?!
Where's the problem? I know it's hard to analyze this without source code. There's a database field wrong, but why? It's the same database like before?
Where's the fault .. ext_tables.php or still sth. in TCA is wrong? I really need a tip .. its frustrating ..
EDIT: sys_log entry
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1439288036: An item in field form of table tx_blah_domain_model_job is not an array as expected | UnexpectedValueException thrown in file /typo3_src/typo3_src-7.6.16/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php in line 1264.
EDIT 2: I think, there must be sth. in typo3conf/ext/blah/Configuration/TCA/tx_blah_domain_model_job.php
see TCA source code
and that's in line 1264
/**
* Sanitize incoming item array
*
* Used by TcaSelectItems and TcaSelectTreeItems data providers
*
* #param mixed $itemArray
* #param string $tableName
* #param string $fieldName
* #throws \UnexpectedValueException
* #return array
*/
public function sanitizeItemArray($itemArray, $tableName, $fieldName)
{
if (!is_array($itemArray)) {
$itemArray = [];
}
foreach ($itemArray as $item) {
if (!is_array($item)) {
throw new \UnexpectedValueException(
'An item in field ' . $fieldName . ' of table ' . $tableName . ' is not an array as expected',
1439288036
);
}
}
return $itemArray;
}
aTry to use this in the TCA tx_imappointments_domain_model_job.php
'form' => array(
'exclude' => 1,
'label' => 'LLL:EXT:im_appointments/Resources/Private/Language/locallang_db.xlf:tx_imappointments_domain_model_job.form',
'config' => array(
'type' => 'select',
'renderType' => 'selectSingle',
'items' => array(array('', 0)),
'foreign_table' => 'pages',
'foreign_table_where' => ' AND pages.pid = 293',
'minitems' => 0,
'maxitems' => 1,
),
),
'items' in 'form' has to be a array how your error message said:
https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Select.html#items
I am adding a folder module to a Moodle course using the API:
folder_add_instance($data, null);
I am getting the error below when running the script using CMD:
!!! Invalid course module ID !!!
I looked into the folder_add_instance() function in the library, the error is occurring when trying to get the context:
$context = context_module::instance($cmid)//$cmid = 8
i looked into the mdl_context table in Moodle database but couldn't understand the values and their relation to the error i am getting.
Will deleting the mdl_context values from the database will help? or i am missing something here?
Note that the script was working fine, until i deleted all the courses i had on Moodle using the web interface.(i deleted the category containing all the courses).
To programmatically create a module in Moodle you should use function add_moduleinfo().
Look at the example in the folder generator:
https://github.com/moodle/moodle/blob/master/mod/forum/tests/generator/lib.php#L67
Will be something like:
require_once($CFG->dirroot.'/course/modlib.php');
$foldername = 'YOUR NAME HERE';
$courseid = 12345;
$sectionnum = 0;
$course = get_course($courseid);
$moduleid = $DB->get_field('modules', 'id', array('name' => 'folder'));
$data = (object)array(
'name' => $foldername,
'intro' => '',
'display' => FOLDER_DISPLAY_PAGE,
'revision' => 1,
'showexpanded' => 1,
'files' => file_get_unused_draft_itemid(),
'visible' => 1,
'modulename' => 'folder',
'module' => $moduleid,
'section' => $sectionnum,
'introformat' => FORMAT_HTML,
'cmidnumber' => '',
'groupmode' => NOGROUPS,
'groupingid' => 0,
'availability' => null,
'completion' => 0,
'completionview' => 0,
'completionexpected' => 0,
'conditiongradegroup' => array(),
'conditionfieldgroup' => array(),
'conditioncompletiongroup' => array()
);
return add_moduleinfo($data, $course, $mform = null);
Invalid course module ID . That means moodle can find a course module record, but the cm doesn't actually exist in the course object when fetching all the course data.
What you can do to fix it is add the broken module back into a section of this course. It might be in a section that exists, then you also need to add the cmid to the sequence field. (Just add this cmid on the end of the existing sequence).
update mdl_course_modules set section=<existingsection> where id=cmid;
update mdl_course_sections set sequence='XX,YY,ZZ,cmid' where id =<existingsection>;
Then after you purge caches, you should now be able to view the module again, eg. for an assignment:
https://moodle.com/mod/assign/view.php?id=cmid
I have set up an extension with the current extension_builder in TYPO3 6.2.11.
FAL File upload in the backend is not working.
extension_builder says that file upload isn't implemented at all in extbase, but as far as I understood (cf https://github.com/helhum/upload_example), this is regarding FE upload. Correct?
I only need completely regular BE file upload - select via "Create new relation" or "Select & upload files".
The direct upload fails with "Upload failed! A file with "*" extension is expected!" (or whatever extensions I specify in TCA).
The reference creation works, but the reference is lost after saving.
This screenshot shows the two tries before saving.
And after saving, empty again:
How do I make this work? Do I have to add extra code to the repo for saving the relation? Or might there be a basic setting missing?
For tt_content, FAL relations and upload work fine.
And: As a workaround, is it possible to use a regular "Pibase" 'type' => 'group','internal_type' => 'file' field? But how would getters and setters in the model look then? Just like a regular string?
TCA:
'apprenticeship_document' => array(
'exclude' => 1,
'label' => 'LLL:EXT:stellen/Resources/Private/Language/locallang_db.xlf:tx_stellen_domain_model_institution.apprenticeship_document',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'apprenticeshipDocument',
array('maxitems' => 1),
'*'
),
),
Model as created by extension_builder:
/**
* apprenticeshipDocument
*
* #var \TYPO3\CMS\Extbase\Domain\Model\FileReference
*/
protected $apprenticeshipDocument = NULL;
/**
* Returns the apprenticeshipDocument
*
* #return \TYPO3\CMS\Extbase\Domain\Model\FileReference $apprenticeshipDocument
*/
public function getApprenticeshipDocument() {
return $this->apprenticeshipDocument;
}
/**
* Sets the apprenticeshipDocument
*
* #param \TYPO3\CMS\Extbase\Domain\Model\FileReference $apprenticeshipDocument
* #return void
*/
public function setApprenticeshipDocument(\TYPO3\CMS\Extbase\Domain\Model\FileReference $apprenticeshipDocument) {
$this->apprenticeshipDocument = $apprenticeshipDocument;
}
I have also tried to use \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> instead of \TYPO3\CMS\Extbase\Domain\Model\FileReference $apprenticeshipDocument, but that doesn't make a difference either.
Your TCA definition has an error, the first argument of getFileFieldTCAConfig should be with lower underscore, not lowerCamelCase:
'apprenticeship_document' => array(
'exclude' => 1,
'label' => 'LLL:EXT:stellen/Resources/Private/Language/locallang_db.xlf:tx_stellen_domain_model_institution.apprenticeship_document',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'apprenticeship_document',
array('maxitems' => 1),
'pdf,doc,docx'
),
),
Apart from that, "*" is not a valid file extension. You need to define a comma-separated list of file extensions (e.g. 'doc,docx,pdf'). From reading the documentation, there is no wildcard for file extensions.
File upload in FE is not implemented in the Extension Builder, but perfectly possible with the solution provided by Helmut Hummel.
i'm having a little problem with Zend Framework Full Page Cache.
My current Bootstrap configuration looks like this:
$dir = PUBLIC_PATH . "/tmp/";
$frontendOptions = array(
'lifetime' => 6000000000,
'content_type_memorization' => true,
'default_options' => array(
'cache_with_get_variables' => true,
'cache_with_post_variables' => true,
'cache_with_session_variables' => true,
'cache_with_cookie_variables' => true,
),
'regexps' => array(
'^/.*' => array('cache' => true),
)
);
$backendOptions = array(
'cache_dir' => $dir
);
// getting a Zend_Cache_Frontend_Page object
$cache = Zend_Cache::factory('Page',
'File',
$frontendOptions,
$backendOptions);
$cache->start();
which worked perfectly before changing our development system to the live one.
Now if we enable the caching system it creates the correct cached file in the correct path but doens't load it.
So for every request another cache file is created but the old one NEVER gets loaded.
Maybe anyone has had this problems before and can give me a hint?
Thanks in advance!
there might be issue with permission to move from development environment to live.
The tmp directory is writable by myself and other users of the same group and also apparently Zend will access the files as another user. The solution was to chmod 777 on the folder, making it writable.
let me know if i can help you more.
I wrote a backendmodule with extbase in typo3 4.5 and I would like to show different extbase models for different usergroups, but I don't know how. My idea was to register one backendmodul per usergroup, but i think its too laborious. I don't want to check the user group and their rights in my extension. Is there a way to get this?
Example:
models | usergroup: editor could see
specific models | usergroup: specific_editor could see
Please explain the scenario in details. From this i can say this is possible . All you do see to check the user group and according to this you can create a switchable actions in your controller .
What about having a few checkboxes in extension manager - extension configuration tab for selecting the user group and their rights in your extension?
I try to show different extbase-model-entries to different users in my own backend-modul. For example user 'editor' only see 'entry1' and 'special_editor' see 'entry2' and 'entry3'. My idea was to extend the usergroup tca and add a selectfield for my models. My backend-modul will check the current backenduser to get his usergroup and than i want to check the assigned model. It seems to be laborious, but i think its the best and the only way.
I get one solution:
At first i add a field to be_users.
$tempColumns = array(
'model' => array(
'exclude' => 0,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:extensionResources/Private/Language/locallang_db.xml:tx_extension_domain_model_ownmodel',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_extension_domain_model_ownmodel',
'size' => 10,
'width' => 20,
'minitems' => 0,
'maxitems' => 9999,
'allowNonIdValues' => 0,
'eval' => 'required',
),
),
);
t3lib_div::loadTCA('be_users');
t3lib_extMgm::addTCAcolumns('be_users',$tempColumns,1);
t3lib_extMgm::addToAllTCAtypes('be_users','model;;;;1-1-1');
in my backend-modul i check the current backenduser
$GLOBALS['BE_USER']->user['model']
so i get a list of my modelids separated by commas.
thats it.