Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
What would the following result in?
Old 03-29-2009, 12:20 AM What would the following result in?
Webmaster Talker

Posts: 626
Trades: 0
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(
          
=> 
             array (
               
'from' => '<basepath>/custom',
               
'to' => 'custom',
             ),
          
=> 
             array (
               
'from' => '<basepath>/custom2',
               
'to' => 'custom2',
             ),
          
=> 
             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(
          
=> 
             array (
               
'from' => '<basepath>/custom',
               
'to' => 'custom',
             ),
          
=> 
             array (
               
'from' => '<basepath>/custom2',
               
'to' => 'custom2',
             ),
          
=> 
             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?
jim.thornton is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-29-2009, 01:59 AM Re: What would the following result in?
virgil's Avatar
Average Talker

Posts: 29
Name: virgilio quilario jr
Trades: 0
first of all, the array should be in pre_install.php as part of initialization.
in this case, you need to examine the script that created manifest.php and see which variables it uses to generate the array.
that way, you would know exactly where and which to set.
__________________
Your thoughts matter!

Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
virgil is offline
Reply With Quote
View Public Profile Visit virgil's homepage!
 
Old 03-29-2009, 09:11 AM Re: What would the following result in?
Webmaster Talker

Posts: 626
Trades: 0
I know exactly what to set. The 'copy' element needs to get set as I set it, but I'm trying to set it up so that if I put it in the custom/modulebuilder/builds directory that when I package it, I won't have to extract and then edit the manifest.php file. I'd like it to be just packaged so that it will work.

The problem is that the script that generates the package automatically sets the 0 =>, 1=> and so on. So I would assume that if I add one manually at $installdefs['copy'][0] that it will get written over (if I put it in the pre_install.php).
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 03-30-2009, 02:53 AM Re: What would the following result in?
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
When it automatically sets the array values, does it specifically set the keys 0, 1, 2 and so on? Because if it doesn't set any keys, they automatically is set to 0, 1, 2 and so on. So in that case, I guess you could modify the script a little, as in
PHP Code:
$installdef = array (
   
'copy' => array(
      
// Not specifying the keys here
      
array(
         
'from' => '<basepath>/custom',
         
'to' => 'custom'
      
),
      array(
         
'from' => '<basepath>/custom',
         
'to' => 'custom'
      
)
   )
); 
In that case, if you set a value at $installdef['copy'][0], the script will just continue at $installdef['copy'][1].
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 03-30-2009, 09:35 AM Re: What would the following result in?
Webmaster Talker

Posts: 626
Trades: 0
unfortunately, the 0=> is automatically inserted.

I guess the only way is going to be to manually edit the manifest.php file.
jim.thornton is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to What would the following result in?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37669 seconds with 12 queries