Repair Rebuild using Code

It will be done by simple steps and steps are as below,

Step 1 : First of all create an entryPoint in \custom\include\MVC\Controller\entry_point_registry.php and add below code,

<?php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require SUGAR_PATH . '/include/MVC/Controller/entry_point_registry.php';
$entry_point_registry['<entry_point_name>']=array('file' => 'custom/modules/<desired_module>/<any_name>.php', 'auth' => true);

?>

Step 2 : Create file custom/modules/<desired_module>/<any_name>.php and add below code,

if(!defined('sugarEntry')) define('sugarEntry',true); 
require_once("modules/Administration/QuickRepairAndRebuild.php");

$rac = new RepairAndClear(); 
$rac-repairAndClearAll(array('clearAll'),array(translate('LBL_ALL
_MODULES')), false,false); 

Step 3 : Hit custom entryPoint using URL as below,

<URL>?entryPoint=<entry_point_name>

Note :

Here, <desired_module> means the module name you see in the URL, for example, Contacts, Leads, etc.
Here, <any_name> means the any file name for example, custom_fields, search_fields, etc.
Here, <entry_point_name> means any name as your requirements

Hope you find this blog post helpful.

Feel free to add comments and queries, that helps us to improve the quality of posts.

You can contact us at info@infotechbuddies.com

Thank you.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *