In last week's blog post (How to Add Scheduler Tasks in the Manifest) I emphasized the importance of making things as easy as possible on the user. This means reducing what the user needs to do after an install to only what is absolutely necessary. Each additional step is a potential breaking point. Either the step could be missed or done incorrectly. This causes frustration, disappointment, and sometimes unadulterated rage. That then reflects poorly on the add-on, the developer, as well as SugarCRM itself.
No one wants any of that to happen and it is easy to prevent. One common step many add-ons require is to run a Quick Repair and Rebuild. If the user misses that step things can go awry. Fields are missing, modules can't be found, database errors abound, and so on. It's not the fault of the user either. Most off the time it is not obvious that an additional step is required. It could be hidden in the docs or some other obscure place. Other times the user just expects it to work. Why should they care about the quirks of SugarCRM?
They shouldn't and we can make sure of that by utilizing the post_install.php script. Simply dump this file in the /scripts directory inside the installable zip. The Module Installer will automatically pick it up.
<?php | |
if (! defined('sugarEntry') || ! sugarEntry) die('Not A Valid Entry Point'); | |
// /scripts/post_install.php | |
function post_install() { | |
$autoexecute = false; //execute the SQL | |
$show_output = true; //output to the screen | |
require_once("modules/Administration/QuickRepairAndRebuild.php"); | |
$randc = new RepairAndClear(); | |
$randc->repairAndClearAll(array('clearAll'),array(translate('LBL_ALL_MODULES')), $autoexecute,$show_output); | |
} |
This will not execute any generated SQL. If you are adding fields do so in the manifest in the custom_fields array (see also Creating an Installable Package that Creates New Fields). You can use the Ext framework's vardefs section, but it may not be added to the database automatically upon install. If you really, really need to do it the Ext way just set $autoexecute to true in the script above to automatically execute any generated SQL. It should also be altered to run on only your module(s) that are being installed.
-
Gantt Project
The Gantt Project Module for SugarCRM CE gives project managers the tool that they have been waiting for. Now you can plan, coordinate, and track your project tasks using a familiar Gantt chart. -
Background Updater
Have calculated fields and logic hooks that your business depends on for reporting and business logic. Unfortunately those rules only run when a record is saved. Background Updater runs in the backgro... -
CRM Assistant for Gmail™
FEATUREDBoost sales efficiency with SugarCRM Integration for Gmail. Link emails, and manage data & tasks directly from your inbox. - Show more addons