PHP, SugarCRM, Javascript, Cool Web Apps Developer

Blog

Repair Rebuild through Code

Posted by swapnil shinde on January 31, 2012 at 2:40 PM

PHP Code:

require_once("include/entrypoint.php");

require_once("modules/Administration/QuickRepairAndRebuild.php");

$rac = new RepairAndClear();

$rac->repairAndClearAll(array('clearAll'),array(translate('LBL_ALL_MODULES')), false,true);

Categories: Jan2012-SugarCRM Help

Post a Comment

Oops!

Oops, you forgot something.

Oops!

The words you entered did not match the given text. Please try again.

You must be a member to comment on this page. Sign In or Register

10 Comments

Reply Ben
12:56 PM on April 24, 2012 
Hi,

I tried your code, but had many issues.
First, I found that the function translate needs:
require_once("include/utils.php");

Next, even when including utils.php, it doesn't work. I have the following error :

Warning: current() [function.current]: Passed variable is not an array or object in /opt/lampp/htdocs/sugarexed/modules/Administration/QuickRepairAnd
Rebuild.php on line 412

Warning: current() [function.current]: Passed variable is not an array or object in /opt/lampp/htdocs/sugarexed/modules/Administration/QuickRepairAnd
Rebuild.php on line 412

Warning: current() [function.current]: Passed variable is not an array or object in /opt/lampp/htdocs/sugarexed/modules/Administration/QuickRepairAnd
Rebuild.php on line 412

Warning: current() [function.current]: Passed variable is not an array or object in /opt/lampp/htdocs/sugarexed/modules/Administration/QuickRepairAnd
Rebuild.php on line 412

Warning: current() [function.current]: Passed variable is not an array or object in /opt/lampp/htdocs/sugarexed/modules/Administration/QuickRepairAnd
Rebuild.php on line 412

Fatal error: Class 'Basic' not found in /opt/lampp/htdocs/sugarexed/modules/SugarFeed/SugarFeed.php on line 30

Do you know how to solve it ?

Thanks.
Reply swapnil shinde
12:46 AM on April 25, 2012 
Hi Ben,

You need to include "require_once("include/entrypoint.php");" in your code.

You can put whole code like
_______________________________________________________________
if(!defined('sugarEntry')) define('sugarEntry',true);
require_once("include/entrypoint.php");
require_once("modules/Administration/QuickRepairAndRebuild.php");

$rac = new RepairAndClear();
$rac-repairAndClearAll(array('clearAll'),array(translate('LBL_ALL
_MODULES')), false,false);
_______________________________________________________________
in one file and run it manually, though it gives message that "Unauthorized access to administration.", it does trick ;).

Now if you want to merge code in logic hook or in any code in SugarCRM, then just remove "if(!defined('sugarEntry')) define('sugarEntry',true);" from above code, your issue will get resolved.

If still above code doesn't work for you let me know, will give u one more solution.
Reply Ben
4:44 AM on April 30, 2012 
Hi,

I don't know if it works, because whatever I put into translate (like translate('blahblah') ) I have no error message, nor any kind of answer (and I don't have the "Unauthorized access to administration." error neither). So maybe it works, maybe not.
Reply swapnil shinde
5:30 AM on April 30, 2012 
Hi Ben,
You can use
$cleartpl_obj= new RepairAndClear();
$cleartpl_obj-module_list=array('All Modules');
$cleartpl_obj-clearVardefs();
$cleartpl_obj-clearSmarty();
$cleartpl_obj-clearTpls();
Reply Ben
9:09 AM on April 30, 2012 
Thanks for your help.

As you must have read on the SugarCRM forum, my goal is to modify some dropdowns by editing en_us.lang.php, then repairing. Which rebuild operation is needed ? Is clearVardefs enough ?
Reply Ben
6:19 AM on May 10, 2012 
Do you know the answer ?
Reply swapnil shinde
7:30 AM on May 10, 2012 
Ben says...
Do you know the answer ?


Hey Ben,
Wasn't online for a while, so couldn't reply.
Its not necessary to run repair rebuild every time if you change anything into language file. It depends on which language file you are changing.
If you are changing drop down values then it is not necessary to hit repair and rebuild, because it gets called every time you go to edit view.
Reply Ben
9:20 AM on May 10, 2012 
Thanks. I only change values in drop downs. Right now I only change them into custom/include/language/en_us.lang.php, but I'm planning on installing language packs, so I guess I will have to change the corresponding file as well.

swapnil shinde says...
Hey Ben,
Wasn't online for a while, so couldn't reply.
Its not necessary to run repair rebuild every time if you change anything into language file. It depends on which language file you are changing.
If you are changing drop down values then it is not necessary to hit repair and rebuild, because it gets called every time you go to edit view.
Reply Vijay Kanugonda
1:16 AM on December 28, 2013 
Swapnil

How to run repair and rebuild through js file?
Sugar CRM 7.1.x version everything have to write in js only :(
Reply Michaelquavy
7:40 AM on October 17, 2017 
http://verynicelevitratab.net - phd essay writer site online,order personal essay ghostwriter service online,order women and gender studies bibliography