I'm working on creating a custom module for SugarCRM. Their forums are active but they are very inactive with people that actually provide solutions, so I thought I would come here since this question is not specific to Sugar.
Given the following code:
PHP Code:
<?php
$installdefs = array (
'copy' => array(
0 =>
array (
'from' => '<basepath>/custom',
'to' => 'custom',
),
1 =>
array (
'from' => '<basepath>/custom2',
'to' => 'custom2',
),
2 =>
array (
'from' => '<basepath>/custom2',
'to' => 'custom2',
),
),
);
?>
$installdefs['copy'][0]['from'] = "<basepath>/custom";
right??
If so... What would happen if I executed the code as follows:
PHP Code:
<?php
$installdefs['copy'][0]['from'] = "<basepath>/different";
$installdefs = array (
'copy' => array(
0 =>
array (
'from' => '<basepath>/custom',
'to' => 'custom',
),
1 =>
array (
'from' => '<basepath>/custom2',
'to' => 'custom2',
),
2 =>
array (
'from' => '<basepath>/custom2',
'to' => 'custom2',
),
),
);
?>
My assumption is that the initial declaration of the $installdef['copy'][0]['from'] will get totally overwritten. If so... I need to be able to add a value to the $installdefs['copy'][] array. BUT I need to add this PRIOR to the first declaration. How can I accomplish this?
REASON: SugarCRM automatically generates the manifest.php file when you publish the module. BUT, I have custom code that I want inserted into custom directory. The only way to do that (automatically) is to insert values into the above array.
The problem is that the script is executed as followings:
include(pre_install.php)
include(manifest.php)
include(post_install.php)
If I put the declaration in the post_install.php file it is too late. If I put it in the pre_install.php file, I think it will be overwritten when the manifest.php file is included.
Is there a way to do what I want?