Whats is alternative of sugar_rename in Sugar on Demand ?

Hello,
We are using sugar_rename function in sugar crm package to make a copy of custom file via pre_execute. But in sugar cloud this function is restricted. We need an alternative of sugar_rename for sugar cloud. We know about duplicate_file. duplicate_file is for uploaded file. But we need to make copy of custom file in our package. Please give us any solution.
Thanks!

Parents
  • Can you elaborate on what it is you are attempting to accomplish with the package you are using and the customization it is intended to install?

    I am not clear on what type of customization would require you to programmatically make copies of a given file. 

  • We have created one installable zip package for sugarcrm. In pre_execute function we have below code.

    if(file_exists('custom/modules/EmailTemplates/DetailView.php')) {
    $new_file = 'custom/modules/EmailTemplates/DetailView'.$now.'.php';
    sugar_rename('custom/modules/EmailTemplates/DetailView.php',$new_file);
    }

    This will take backup of existing file(custom/modules/EmailTemplates/DetailView.php). But on cloud platform, sugar_rename did not work. So we need any alternative for sugar_rename function for sugar cloud.

  • Why would you want to make a backup? The instance is already being backed up? 

  • This is customized file. That might be already present in particular path. So we are taking backup of that file. And taking backup was the suggestion from SugarCRM team.

  • It should not be necessary to do this. 

    Upon a Module Loader Package being installed and if Sugar finds that the package is replacing an already existing file, the install process will automatically create a backup of said file for you for "restore" purposes. That allows you to revert to the previous state if you uninstall the package.

    As such, there is no need to be creating copies of files programmatically. 

    It is possible that the backup comment that was shared with you was in reference to making sure you have a backup of your instance in general, as it is certainly possible that you install a package that breaks your entire instance, but for reasons completely unrelated to the fact that you replaced an existing file.

Reply
  • It should not be necessary to do this. 

    Upon a Module Loader Package being installed and if Sugar finds that the package is replacing an already existing file, the install process will automatically create a backup of said file for you for "restore" purposes. That allows you to revert to the previous state if you uninstall the package.

    As such, there is no need to be creating copies of files programmatically. 

    It is possible that the backup comment that was shared with you was in reference to making sure you have a backup of your instance in general, as it is certainly possible that you install a package that breaks your entire instance, but for reasons completely unrelated to the fact that you replaced an existing file.

Children