Repair
Overview
The repair functions in Sugar allow administrators to perform common maintenance routines on their instance of Sugar. The repair menu is available to only administrative users and can be accessed through Admin > Repair. The following sections are available options from the repair menu.
Quick Repair and Rebuild
The quick repair and rebuild is the most commonly used repair option and should be performed after significant changes have been made to your instance of Sugar. If you notice inconsistencies with module layouts or fields as you have customized them via Studio, this option is normally the best first course of action to try and correct the issue. Sugar caches files to help access necessary files quickly. This option clears out many of the cached files in Sugar which allows new versions of the files to be loaded. The quick repair and rebuild option performs the following actions:
- Clear Vardefs From Cache: Deletes any
*vardefs.php
file in the cached modules folder - Clear Language Files From Cache: Deletes any
{Module Name}.lang.php
file in the cached modules folder - Clear Template Files From Cache: Deletes any
*.tpl
files in the cached modules folder - Clear JavaScript Files From Cache: Deletes any
*.js
files in the cached modules folder - Clear JavaScript Language Files From Cache: Deletes any
*.js
files in the cached jsLanguage folder - Clear Dashlet Files From Cache: Deletes any
*.php
files in the cached dashlets folder - Clear Sugar Feed Files From Cache: Deletes the Sugar Feed files in cached modules folder
- Clear Smarty Template Files From Cache: Deletes any
*.tpl.php
files in the cached smarty templates folder - Clear Theme Files From Cache: Deletes theme files in the cached theme folder for all themes in Sugar
- Clear XML Files From Cache: Deletes any
*.xml
files in the cached xml folder - Clear Search Files From Cache: Deletes the
unified_search_modules.php
file in the cached module folder - Clear External API Cache Files: Deletes the external API cache PHP and JavaScript files in the cached include folder
- Clear Additional Cache Files: Loops through the cached API folders and deletes any
*.php
files as well as the cached clients folder - Clear PDF Font Cache Files: Deletes the cached PDF font list file
- Rebuild Extension Files: Rebuilds language files, extensions, dashlet containers, relationships, and the table dictionary; this step also clears any cached files by APC or WinCache, resets the Zend accelerator, clears eAccelerator's cache, and clears XCache cached files
Note: These functions will only run if the associated systems are installed and running. - Rebuild Audit Tables: Creates audit tables for any module that has audit enabled and where the audit table does not already exist; the results for each table are printed on the page
- Repair Database Tables: Checks to make sure the database is in sync with the table dictionary and vardef files; any missing tables, columns, and indexes will be scripted to be recreated as well as any column properties that are incorrectly set in the database. The screen will display any database changes that should be made. Click "Execute" to execute the script to apply the changes to the Sugar database or click "Export" to save the script to a SQL file.
Upgrade Teams
The Upgrade Teams option performs some cleanup regarding team records in Sugar. This can be useful to restore the private teams for all users in the event they become corrupted or are removed for any reason. The upgrade teams option performs the following actions:
- Global Team: Creates or restores the global team if it does not exist or has been deleted. All users are then assigned to the global team if not already.
- Private Teams: Creates a private team for every user in the system that does not already have a private team and assigns the user to their private team.
The results are printed on the screen as to what teams already existed and what teams were created.
Rebuild .htaccess File
Rebuild .htaccess File option creates or updates the .htaccess file in the root of the Sugar directory. The .htaccess file contains specific commands to prevent unauthorized access to certain files and directories on your webserver. File permissions need to be configured correctly in order for Sugar to write to the .htaccess file. If writing to the file fails, the expected contents for the file will be printed on the page.
Note: If you have additional lines to add to the .htaccess file, place them outside of the "# BEGIN SUGARCRM RESTRICTIONS" and "# END SUGARCRM RESTRICTIONS" lines or they will be removed when running this repair function.
Rebuild Config File
The Rebuild Config File option takes the config.php
file in the root directory of Sugar and rebuilds it to have all default values for any options not specified directly. It first runs a check to make sure Sugar can write to the config.php
file and will return to you if it can or not. When ready to rebuild the config file select "Rebuild".
The default values for the config will be merged with any custom values currently set and will be loaded into the config.php
file.
Rebuild Sugar Logic Functions
The Rebuild Sugar Logic Functions rebuilds the cache files for all Sugar logic functions in the system. The Sugar logic functions are primarily used as formulas in field definitions. The results of the repair are shown on the screen.
Rebuild Relationships
Rebuild Relationships clears out the relationship cache and data and rebuilds it from the vardef files. Custom and stock relationships are all rebuilt. This repair option is good to run after an upgrade or when installing or uninstalling custom modules. The results of the repair are shown on the screen.
Rebuild Schedulers
The Rebuild Schedulers option removes all schedulers and recreates scheduled jobs that come with Sugar by default. If you have customized the Active/Inactive flag, the frequency the job runs, or even deleted a job, this repair option will restore all settings back to their original default value and recreate any deleted default schedulers. For more information on schedulers and their default settings, please refer to the Schedulers documentation.
Note: This also deletes any custom schedulers added to Sugar. If you have made changes to the default schedulers or created custom schedulers, please backup the details of each scheduler before running this repair.
Rebuild WorkFlow
Rebuild Workflow deletes files in the custom workflows folder for each module and then rebuilds the files from the workflow data in the database. This repair also verifies the proper logic hooks are in place to properly fire the workflows and rebuilds any plug-ins that are installed.
Rebuild Javascript Languages
The Rebuild Javascript Languages function deletes all files in the cached jsLanguage folder and deletes any {Module Name}.lang.php
file in the cached modules folder. The cached files will be rebuilt when they are needed.
Rebuild JS Grouping Files
Rebuild JS Grouping Files takes the many different JavaScript files that are required with Sugar and concatenates them together into the cache directory.
Note: The process will continue working if you navigate away from this page, but if you wait you will see a notification on the page when it is complete.
Rebuild Sprites
Rebuild Sprites takes images in the following directories:
./include/images
./themes
./custom/themes
Creates the sprites and metadata files in the ./cache/sprites/
folder.
Note: The process will continue working if you navigate away from this page, but if you wait you will see a notification on the page when it is complete.
Repair Non-Lowercase Fields
The Repair Non-Lowercase Fields option takes any custom field defined in Sugar and, if the field contains an upper case letter, it will change the field to be lowercase. The database, vardef files, and views are all searched through and corrected for and uppercase fields. This option also clears any vardef files from the cache when finished.
Repair Teams
The Repair Teams option runs a quick check against the database for every user. It performs the following checks:
- Users not in the global team
- Users who do not have a private team
- Users who are not a member of a team that a user who reports to them is a member of
If any of the checks return true, the page will indicate that records were found and the associated action will be selected by default. Select the options you wish to perform and click "Rebuild".
The selected options will perform the following:
- Rebuild access to global team: Create a global team if one does not exist and loops through every user and adds them to the global team.
- Rebuild access to private team: Loops through every user and creates a private team if one does not exist, and then adds the user to their private team.
- Rebuild team hierarchy: Loops through every user and makes sure every manager is included in their employees' teams. This ensures that if Sally reports to Jim, that Jim can see all of Sally's records.
Note: Sugar prevents a loop from being created via the Reports To field. For more information on setting the Reports To field, please refer to the User Management documentation. - Clean up unused combinations of teams: Searches the database for unused combinations of teams and deletes the records from the database.
The users looped through are displayed on the screen when complete.
Repair Roles
Repair Roles goes through every ACL enabled module and ensures that there are appropriate database records to allow roles to be used on the specified module. This repair is important to run after adding new modules via Module Loader or Module Builder to make sure all of the role options are available for the new module. If there is a module that has ACL enabled for it, but the module does not show in the Roles section, then this repair option will add the module. The results of the modules accessed are printed on the screen.
Repair Inbound Email Accounts
Repair Inbound Email Accounts loops through every active inbound email account in Sugar and verifies the settings configured. Any Inbound email account that fails to successfully repair will be listed on the page and will require someone to manually repair them by reentering a valid user name and password.
Remove XSS
The Remove XSS repair loops through the database and removes any malicious scripts from specified field types. Select a module from the dropdown, or select "All" to run for all modules.
The page will then display the count of records that will be scanned, and repaired if necessary. Click "Execute" to being the repair.
You will see the count of Object(s) Repaired incrementing as it is running. Once the repair is complete you will get a popup message saying "Done." and the count repaired should match the count of objects found.
Repair Activities
Repair Activities takes Call or Meeting records where the status field does not equal "Held" and updates the end date based on the duration of the activity. If the status equals "Held" or the record is marked as deleted, this repair will skip it. The screen will show "Done" when complete.
Enable/Disable Seed Users
The Enable/Disable Seed Users option will either enable or disable the default users that are installed with Sugar when selecting a demo installation. If the first seed user retrieved from the database is set to "Active" then this option will give you the option to "Deactivate" the seed users, otherwise, you have the option to "Activate" the seed users.
This option will set the status based on the option presented for all users that have an id that starts with "seed".
Note: If you did not populate Sugar with demo data when installing, this repair will return "No seed users" and will not do anything.
Clear Additional Cache
The Clear Additional Cache option loops through the cached API folders and deletes any *.php
files as well as the cached clients folder. This option is also performed by the Quick Repair and Rebuild option. The screen will show "Done" when complete.