anonymize:
backup:
- backup:dump:all
- backup:dump:database
- backup:dump:files
- backup:restore:all
- backup:restore:database
- backup:restore:files
clean:
code:
database:
extract:
hooks:
install:
inventory:
metadata:
package:
plugins:
rels:
system:
user:
Displays help for a command
Usage: help [--xml] [--format FORMAT] [--raw] [--] [<command_name>]
The help command displays help for a given command:
php bin/sugarcli help list
You can also output the help in other formats by using the --format option:
php bin/sugarcli help --format=xml list
To display the list of available commands, please use the list command.
command_nameThe command name
--xmlTo output help as XML--format=FORMATThe output format (txt, xml, json, or md) [default:txt]--rawTo output raw command help
Lists commands
Usage: list [--xml] [--raw] [--format FORMAT] [--] [<namespace>]
The list command lists all commands:
php bin/sugarcli list
You can also display the commands for a specific namespace:
php bin/sugarcli list test
You can also output the information in other formats by using the --format option:
php bin/sugarcli list --format=xml
It's also possible to get raw list of commands (useful for embedding command runner):
php bin/sugarcli list --raw
namespaceThe namespace name
--xmlTo output list as XML--rawTo output raw command list--format=FORMATThe output format (txt, xml, json, or md) [default:txt]
Update the sugarcli.phar with the latest stable version
Usage: self-update [-r|--rollback]
selfupdate
-r, --rollbackRollback to the previous version ofsugracli.phar
Generate a configuration for the Anonymizer
Usage: anonymize:config [-p|--path PATH] [--user-id USER-ID] [-f|--file FILE] [-T|--ignore-table IGNORE-TABLE] [-F|--ignore-field IGNORE-FIELD]
Generate a full yaml configuration file for all tables found in the SugarCRM instance database. It guesses the transformations to apply based on the SugarCRM metadata.
- Dropdown: Get the list of values from the vardefs
- Known column name: Uses the right generation method (example .*_city = city)
- DB type: Exemple: varchar = sentence
To actually anonymize the data, run the anonymize:run command with the generated configuration file
You can also modify the file for your need before running the command.
Example:
guesser_version: 1.0.0
entities:
accounts:
cols:
name: { method: company }
description: { method: sentence, params: [20] }
facebook: { method: url }
twitter: { method: url }
googleplus: { method: url }
account_type: { method: randomElement, params: [['', Analyst, Competitor, Customer, Integrator]] }
industry: { method: randomElement, params: [['', Apparel, Banking, Biotechnology, Chemicals]] }
annual_revenue: { method: randomNumber, params: [4] }
phone_fax: { method: phoneNumber }
billing_address_street: { method: streetAddress }
billing_address_city: { method: city }
billing_address_state: { method: state }
billing_address_postalcode: { method: postcode }
billing_address_country: { method: country }
rating: { method: sentence, params: [8] }
phone_office: { method: phoneNumber }
phone_alternate: { method: phoneNumber }
website: { method: url }
....
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-f, --file=FILEOutput configuration to this file [default:../db/anonymization.yml]-T, --ignore-table=IGNORE-TABLETable to ignore (multiple values allowed)-F, --ignore-field=IGNORE-FIELDField to ignore (multiple values allowed)
Run the Anonymizer
Usage: anonymize:run [-p|--path PATH] [--user-id USER-ID] [-f|--file FILE] [--force] [--remove-deleted] [--clean-cstm] [--sql] [-t|--table TABLE]
Run the anonymization process base on the configuration file that can be generated
with anonymize:config.
Be careful this command will overwrite the data directly in the database.
This command is useful to anonymize the data before giving the database to a developer or partner because:
- It connects directly to the SugarCRM DB
- It is able to generate a configuration file automatically, without destroying the system tables (config / relationships, etc...)
- It uses Faker to generate a data that looks almost real
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-f, --file=FILEPath to the configuration file [default:../db/anonymization.yml]--forceRun the queries--remove-deletedRemove all records withdeleted = 1, requires--forceto be set--clean-cstmClean all records in _cstm that are not in the main table, requires--forceto be set--sqlDisplay the SQL queries that would be run-t, --table=TABLEAnonymize only that table (multiple values allowed)
Create backups of files and database of SugarCRM
Usage: ``
See help of commands backup:dump:database and backup:dump:files for more information.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-d, --destination-dir=DESTINATION-DIRDestination folder for the achive [default:/home/rfremont/backup]-P, --prefix=PREFIXPrepend to the archive name [config: backup.prefix]-c, --compression=COMPRESSIONSet the compression algorithm. Valid values are (gzip|bzip2). [default:gzip]--dry-runDo not run the command only print the tar command--no-skip-definerDo not remove the DEFINER attribute from sql dump--keep-defaults-fileDo not delete the credantials file after completion-T, --ignore-table=IGNORE-TABLETables to ignore. (multiple values allowed)-D, --ignore-for-devIgnore tables not useful for a dev environement--pure-phpDo not use external commandmysqldumpto dump the database. This is less reliable but allows to dump when the commands are not available like inside a docker container.-U, --ignore-uploadIgnore files in upload/ folder and*-restore-C, --ignore-cacheIgnore cache folder
Create a backup file of SugarCRM database
Usage: backup:dump:database [-p|--path PATH] [-d|--destination-dir DESTINATION-DIR] [-P|--prefix PREFIX] [-c|--compression COMPRESSION] [--dry-run] [--no-skip-definer] [--keep-defaults-file] [-T|--ignore-table IGNORE-TABLE] [-D|--ignore-for-dev] [--pure-php]
Backup the SugarCRM database in to a compressed SQL dump.
The prefix can be set in the configuration file .sugarclirc like this:
backup:
prefix: my_prefix
The tables not dumped with --ignore-for-dev are:
activitiesactivities_usersfts_queueinbound_emailjob_queueoutbound_emailtrackertracker_perftracker_queriestracker_sessionstracker_tracker_queries
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-d, --destination-dir=DESTINATION-DIRDestination folder for the achive [default:/home/rfremont/backup]-P, --prefix=PREFIXPrepend to the archive name [config: backup.prefix]-c, --compression=COMPRESSIONSet the compression algorithm. Valid values are (gzip|bzip2). [default:gzip]--dry-runDo not run the command only print the tar command--no-skip-definerDo not remove the DEFINER attribute from sql dump--keep-defaults-fileDo not delete the credantials file after completion-T, --ignore-table=IGNORE-TABLETables to ignore. (multiple values allowed)-D, --ignore-for-devIgnore tables not useful for a dev environement--pure-phpDo not use external commandmysqldumpto dump the database. This is less reliable but allows to dump when the commands are not available like inside a docker container.
Create a backup archive of SugarCRM files
Usage: backup:dump:files [-p|--path PATH] [-d|--destination-dir DESTINATION-DIR] [-P|--prefix PREFIX] [-c|--compression COMPRESSION] [--dry-run] [-U|--ignore-upload] [-C|--ignore-cache]
Backup the SugarCRM files in to a compressed tar archive.
The prefix can be set in the configuration file .sugarclirc like this:
backup:
prefix: my_prefix
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-d, --destination-dir=DESTINATION-DIRDestination folder for the achive [default:/home/rfremont/backup]-P, --prefix=PREFIXPrepend to the archive name [config: backup.prefix]-c, --compression=COMPRESSIONSet the compression algorithm. Valid values are (gzip|bzip2). [default:gzip]--dry-runDo not run the command only print the tar command-U, --ignore-uploadIgnore files in upload/ folder and*-restore-C, --ignore-cacheIgnore cache folder
Restore both the database and files of a SugarCRM instance
Usage: ``
Restore a complete SugarCRM instance from archive files.
The --archive file must point to the files dump and the database dump must start with the same name.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-c, --compression=COMPRESSIONSet the compression algorithm. By default it is guessed from file extention. Valid values are (gzip|bzip2).--dry-runDo not run the command only print the tar command-a, --archive=ARCHIVEDump file to extract--overwriteOverwrite files in place if it already exists.-f, --forceForce import even errors are encountered--no-skip-definerDo not remove the DEFINER attribute from sql dump
Restore a database from a previous backup
Usage: backup:restore:database [-p|--path PATH] [-c|--compression COMPRESSION] [--dry-run] [-a|--archive ARCHIVE] [-f|--force] [--no-skip-definer]
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-c, --compression=COMPRESSIONSet the compression algorithm. By default it is guessed from file extention. Valid values are (gzip|bzip2).--dry-runDo not run the command only print the tar command-a, --archive=ARCHIVEDump file to extract-f, --forceForce import even errors are encountered--no-skip-definerDo not remove the DEFINER attribute from sql dump
Restore files from a previous backup
Usage: backup:restore:files [-p|--path PATH] [-c|--compression COMPRESSION] [--dry-run] [-a|--archive ARCHIVE] [--overwrite]
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-c, --compression=COMPRESSIONSet the compression algorithm. By default it is guessed from file extention. Valid values are (gzip|bzip2).--dry-runDo not run the command only print the tar command-a, --archive=ARCHIVEDump file to extract--overwriteOverwrite files in place if it already exists.
Sort and clean PHP arrays in language files to make it easier for vcs programs
Usage: clean:langfiles [-p|--path PATH] [--no-sort] [-t|--test]
Sort and clean PHP arrays in language files for dropdown lists. Makes it easier for VCS programs to track real changes and avoid conflicts. It is recommended to have a clean working directory before executing this command.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--no-sortDo not sort the files contents. It will still remove duplicates. Useful for testing-t, --testTry to rewrite the files without modifying the contents, imply--no-sort, useful to make sure the parsing is working correctly
Add or delete a button in a module
Usage: code:button [-p|--path PATH] [--user-id USER-ID] [-m|--module MODULE] [-a|--action ACTION] [-b|--name NAME] [-t|--type TYPE] [-j|--javascript]
Creates a new button in the record view menu for the module. Automatically add buttons, their label and the JS triggered by the button to views, from a name.
The affected files are:
custom/Extension/modules/<module>/Ext/Language/<current_lang>.phpcustom/modules/<module>/clients/base/views/record/record.phpcustom/modules/<module>/clients/base/views/record/record.js
The --javascript is experimental. If you do not already have a record.js file
that should work well, else you have to check the generated file to make sure it didn't break anything.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-m, --module=MODULEModule name-a, --action=ACTIONAction: "add" / "delete" [default:add]-b, --name=NAMEButton Name-t, --type=TYPEFor now only "dropdown" [default:dropdown]-j, --javascript[EXPERIMENTAL] Also create the JS
Execute a php file using a SugarCRM loaded context
Usage: code:execute:file [-p|--path PATH] [--user-id USER-ID] [--] <file>
Execute a PHP file after first loading the sugarcrm environment. The script can directly use the classes
and database from sugar. You can also set the --user-id from the command line to have another user
than the default administrator.
filePHP file to execute
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]
Check that composer is setup to be used with SugarCRM
Usage: code:setupcomposer [-p|--path PATH] [--do] [-r|--reinstall] [--no-quickrepair]
Create a new Util to use composer's autoloader and create a composer.json file that contains, by default, libsugarcrm autoloaded for Unit Tests.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--doCreate the files-r, --reinstallReinstall the files--no-quickrepairDo not launch a Quick Repair
Remove deleted records as well as data in audit and lost records in _cstm tables
Usage: database:clean [-p|--path PATH] [--user-id USER-ID] [--remove-deleted] [--clean-cstm] [--clean-history] [--clean-activities] [--clean-fields] [--table TABLE]
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]--remove-deletedRemove all records with deleted = 1. Won't be launched if --force is not set--clean-cstmClean all records in _cstm that are not in the main table. Won't be launched if --force is not set--clean-historyClean *_audit, job_queue and trackers--clean-activitiesClean activities_* and trackers--clean-fieldsRemove fields from *_cstm table if they are not in fields_meta_data table--table=TABLEClean only that table (repeat for multiple values) (multiple values allowed)
Compare the contents of the fields_meta_data table with *_cstm tables. Show the state of the fields_meta_data table compared to a reference file Use the commands database:clean --custom-fields to update the database.
Usage: database:metadata:status [-p|--path PATH] [--user-id USER-ID] [--force] [--table TABLE]
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]--forceShow status for all the fields--table=TABLEClean only that table (repeat for multiple values) (multiple values allowed)
Export mysql tables as csv files
Usage: database:export:csv [-p|--path PATH] [--no-sugar] [-u|--db-user DB-USER] [-P|--db-password DB-PASSWORD] [-d|--db-dsn DB-DSN] [--db-my-cnf DB-MY-CNF] [-o|--output-dir OUTPUT-DIR] [-f|--force] [-i|--include INCLUDE] [-e|--exclude EXCLUDE] [-I|--input-file INPUT-FILE] [-O|--output-file OUTPUT-FILE] [-c|--csv-option CSV-OPTION] [--] <database>
databaseDatabase to use for the export.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--no-sugarDo not use sugar database credentials-u, --db-user=DB-USERDatabase user name.-P, --db-password=DB-PASSWORDDatabase password.-d, --db-dsn=DB-DSNDSN string for usage by PDO. By default will try to fetch parameters from~/.my.cnf.--db-my-cnf=DB-MY-CNFMySQL configuration file to read for database connexion-o, --output-dir=OUTPUT-DIRCSV files will be exported to this directory as TABLE_NAME.csv. [default:.]-f, --forceOverwrite existing CSV files.-i, --include=INCLUDEExport only the tables matching this pattern. (multiple values allowed)-e, --exclude=EXCLUDEExclude the tables matching this pattern. Overridestableparameter. (multiple values allowed)-I, --input-file=INPUT-FILEExport the query read from this file instead of tables.-O, --output-file=OUTPUT-FILEWhen exporting a query, specify this fully qualified file name.-c, --csv-option=CSV-OPTIONSpecify option for csv export. Ex: -c 'delimiter=,' (multiple values allowed)
Update all records in a module. Optionally set fields (Not implemented yet)
Usage: database:massupdate [-p|--path PATH] [--user-id USER-ID] [-m|--module MODULE] [-u|--update-modified-by]
Note: by default date_modified is not updated but seconds can be reset to 00
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-m, --module=MODULESave records from this module-u, --update-modified-byBy default fieldsmodified_user_idanddate_modifiedare not updated. This option let SugarCRM update those fields
Export fields and relationships definitions to CSV files
Usage: extract:fields [-p|--path PATH] [--user-id USER-ID] [-m|--module MODULE] [--lang LANG]
Extract all fields and relationships defined for a module with their parameters (label, dropdown list, dbType, ...) and write the data to 2 CSV files.
Example:
sugarcli extract:fields --module Accounts
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-m, --module=MODULEModule's name--lang=LANGSugarCRM Language [default:en_us]
List hooks of the SugarCRM instance
Usage: hooks:list [-p|--path PATH] [--user-id USER-ID] [-m|--module MODULE] [-f|--format FORMAT] [-c|--compact] [-C|--csv-option CSV-OPTION]
List the hooks defined for the module. For each hook display the following information:
- Weight Order of execution
- Description Short description
- File File containing the source code for the hook
- Class PHP Class name
- Method Method called when the hook is triggered
- Defined In File where the hook is configured
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-m, --module=MODULEList hooks from this module-f, --format=FORMATSpecify the output format (text|csv) [default:text]-c, --compactActivate compact mode output-C, --csv-option=CSV-OPTIONSpecify option for csv export. Ex: -C 'delimiter=,' (multiple values allowed)
Check if SugarCRM is installed and configured
Usage: install:check [-p|--path PATH]
Check if SugarCRM is installed and configured.
Return code is 11 if Sugar is not extracted.
Return code is 12 if Sugar is not installed.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]
Write a default config_si.php file in the current folder
Usage: install:config:get [-c|--config CONFIG] [-f|--force]
This provides default settings for the installer.
You will need to complete some required parameters like database information, usernames and passwords.
Required fields are in the form <VALUE>.
-c, --config=CONFIGWrite to this file instead of config_si.php. [default:config_si.php]-f, --forceOverwrite existing file
Extract and install SugarCRM
Usage: install:run [-p|--path PATH] [-u|--url URL] [-f|--force] [-s|--source SOURCE] [-c|--config CONFIG]
You need to specify an installation path and the public url for your sugar installation.
The installer will extract a SugarCRM installation package named sugar.zip
or specified with the --source option.
It will use the --config option to use for the installation.
Examples:
sugarcli install:config:get
nano config_si.php
sugarcli install:run -v ~/www/sugar7 http://myserver.example.org/sugar7 --source ~/package/SugarPro-Full-7.2.2.1.zip
Use -v or -vv to make the output more verbose.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-u, --url=URL[DEPRECATED] This option does nothing and is only kept for backward compatibility-f, --forceForce the installer to remove the target directory if present-s, --source=SOURCEPath to SugarCRM installation package [default:sugar.zip]-c, --config=CONFIGPHP file to use as configuration for the installation [default:config_si.php]
Gather facts and sends a report to an Inventory server
Usage: inventory:agent [-F|--custom-fact CUSTOM-FACT] [-p|--path PATH] [-a|--account-name ACCOUNT-NAME] [--] <server> <username> <password>
Sends all facts gathered on the system and the SugarCRM instance to an Inventory server.
serverUrl of the inventory serverusernameUsername for server authenticationpasswordPassword for server authentication
-F, --custom-fact=CUSTOM-FACTAdd or override facts Format: path.to.fact:value (multiple values allowed)-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-a, --account-name=ACCOUNT-NAMEName of the account [config: account.name]
Get facts from the system and a Sugar instance
Usage: inventory:facter [-F|--custom-fact CUSTOM-FACT] [-p|--path PATH] [-f|--format FORMAT] [--] [<source>]...
Output various informations about the system and the sugarcrm instance.
Use the --format option to specify your prefered output format.
sourceSpecify facts source (all|system|sugarcrm)
-F, --custom-fact=CUSTOM-FACTAdd or override facts Format: path.to.fact:value (multiple values allowed)-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-f, --format=FORMATSpecify the output format (json|yml|xml) [default:yml]
Dump the contents of the table fields_meta_data in a reference file to track modifications
Usage: metadata:dumptofile [-p|--path PATH] [-m|--metadata-file METADATA-FILE] [-a|--add] [-d|--del] [-u|--update] [--] [<fields>]...
Update the reference YAML file based on the fields_meta_data. This file should be managed with a VCS.
You can filter which modification you whish to apply with the options --add,--del,--update or by setting
the fields name after the options.
Examples:
Write to the file only new fields present in the database:
sugarcli metadata:dumptofile --add --force
Delete fields in the file which are not present in the database:
sugarcli metadata:dumptofile --del --force
Only apply modifications for the status_c field in the Accounts module:
sugarcli metadata:dumptofile Accounts.status_c
fieldsFilter the command to only apply to this list of fields
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-m, --metadata-file=METADATA-FILEPath to the metadata file [config: metadata.file] [default:<SUGAR_PATH>/../db/fields_meta_data.yaml]-a, --addAdd new fields from the DB to the definition file-d, --delDelete fields not present in the DB from the metadata file-u, --updateUpdate the metadata file for modified fields in the DB
Load into the table fields_meta_data contents from a reference file
Usage: metadata:loadfromfile [-p|--path PATH] [-m|--metadata-file METADATA-FILE] [-s|--sql] [-f|--force] [-a|--add] [-d|--del] [-u|--update] [--] [<fields>]...
Update the fields_meta_data table to reflect the data in the reference YAML file.
Will not do anything by default. Use --force to actually execute sql queries to impact the database.
You can filter which modification you whish to apply with the options --add,--del,--update or by setting
the fields name after the options.
Examples:
Load only new fields:
sugarcli metadata:loadfromfile --add --force
Only delete fields which are not present in the reference file:
sugarcli metadata:loadfromfile --del --force
Only apply modifications for the status_c field in the Accounts module:
sugarcli metadata:loadfromfile Accounts.status_c
fieldsFilter the command to only apply to this list of fields
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-m, --metadata-file=METADATA-FILEPath to the metadata file [config: metadata.file] [default:<SUGAR_PATH>/../db/fields_meta_data.yaml]-s, --sqlPrint the sql queries that would have been executed-f, --forceReally execute the SQL queries to modify the database-a, --addAdd new fields from the file to the DB-d, --delDelete fields not present in the metadata file from the DB-u, --updateUpdate the DB for modified fields in metadata file
Show the state of the fields_meta_data table compared to a reference file
Usage: metadata:status [-p|--path PATH] [-m|--metadata-file METADATA-FILE]
Compare the contents of the fields_meta_data table with a YAML reference file.
This file should be managed with a version control software (VCS) to keep the various versions.
Use the commands metadata:loadfromfile or metadata:dumptofile to update the database
or the reference file.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-m, --metadata-file=METADATA-FILEPath to the metadata file [config: metadata.file] [default:<SUGAR_PATH>/../db/fields_meta_data.yaml]
Build a SugarCRM package from a package project
Usage: package:build [--project-dir PROJECT-DIR] [--force-version FORCE-VERSION] [-d|--target-dir TARGET-DIR]
Build a package using a manifest file
--project-dir=PROJECT-DIRRoot path of the package project. Normaly where the manifest.php is present [config: package.project_path]--force-version=FORCE-VERSIONUse this version instead of the default generated one-d, --target-dir=TARGET-DIRDirectory where the zip file will be built, relative to the project-dir [default:build]
Scan a package for SugarCRM Cloud compatibility
Usage: package:scan [-p|--path PATH] [--user-id USER-ID] [--] <package>
Use the SugarCRM package scanner to find incompatibilities with SugarCRM Cloud hosting.
packagePackage file to scan
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]
Dump the contents of the table upgrade_history in a reference file to track modifications
Usage: plugins:dumptofile [-p|--path PATH] [-m|--plugins-file PLUGINS-FILE] [-a|--add] [-d|--del] [-u|--update] [--] [<plugins>]...
Update the reference YAML file based on the upgrade_history. This file should be managed with a VCS.
You can filter which modification you whish to apply with the options --add,--del,--update or by setting
the plugins name after the options.
Examples:
Write to the file only new plugins present in the database:
sugarcli plugins:dumptofile --add --force
Delete plugins in the file which are not present in the database:
sugarcli plugins:dumptofile --del --force
Only apply modifications for the status_c plugin in the Accounts module:
sugarcli plugins:dumptofile Accounts.status_c
pluginsFilter the command to only apply to this list of plugins
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-m, --plugins-file=PLUGINS-FILEPath to the plugins file [config: plugins.file] [default:<SUGAR_PATH>/../db/plugins.yaml]-a, --addAdd new plugins from the DB to the definition file-d, --delDelete plugins not present in the DB from the plugins file-u, --updateUpdate the plugins file for modified plugins in the DB
Load into the table upgrade_history contents from a reference file
Usage: plugins:loadfromfile [-p|--path PATH] [-m|--plugins-file PLUGINS-FILE] [-s|--sql] [-f|--force] [-a|--add] [-d|--del] [-u|--update] [--] [<plugins>]...
Update the upgrade_history table to reflect the data in the reference YAML file.
Will not do anything by default. Use --force to actually execute sql queries to impact the database.
You can filter which modification you whish to apply with the options --add,--del,--update or by setting
the plugins name after the options.
Examples:
Load only new plugins:
sugarcli plugins:loadfromfile --add --force
Only delete plugins which are not present in the reference file:
sugarcli plugins:loadfromfile --del --force
pluginsFilter the command to only apply to this list of plugins
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-m, --plugins-file=PLUGINS-FILEPath to the plugins file [config: plugins.file] [default:<SUGAR_PATH>/../db/plugins.yaml]-s, --sqlPrint the sql queries that would have been executed-f, --forceReally execute the SQL queries to modify the database-a, --addAdd new plugins from the file to the DB-d, --delDelete plugins not present in the plugins file from the DB-u, --updateUpdate the DB for modified plugins in plugins file
Show the state of the upgrade_history table compared to a reference file
Usage: plugins:status [-p|--path PATH] [-m|--plugins-file PLUGINS-FILE]
Compare the contents of the upgrade_history table with a YAML reference file.
This file should be managed with a version control software (VCS) to keep the various versions.
Use the commands plugins:loadfromfile or plugins:dumptofile to update the database
or the reference file.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-m, --plugins-file=PLUGINS-FILEPath to the plugins file [config: plugins.file] [default:<SUGAR_PATH>/../db/plugins.yaml]
Dump the contents of the table relationships for db migrations
Usage: rels:dumptofile [-p|--path PATH] [--file FILE] [-a|--add] [-d|--del] [-u|--update]
Manage the of the dump file based on the relationships table.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--file=FILEPath to the rels file. [config: rels.file] [default:<SUGAR_PATH>/../db/relationships.yaml]-a, --addAdd new relationships from the DB to the definition file.-d, --delDelete relationships not present in the DB-u, --updateUpdate the relationships in the DB.
Load the contents of the table relationships from a file
Usage: rels:loadfromfile [-p|--path PATH] [--file FILE] [-s|--sql] [-f|--force] [-a|--add] [-d|--del] [-u|--update]
This command modify the database based on a dump file. Will not do anything by default. Use --force to actually execute sql queries to impact the database.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--file=FILEPath to the rels file. [config: rels.file] [default:<SUGAR_PATH>/../db/relationships.yaml]-s, --sqlPrint the sql queries that would have been executed.-f, --forceReally execute the SQL queries to modify the database.-a, --addAdd new fields from the file to the DB.-d, --delDelete fields not present in the relationships file from the DB.-u, --updateUpdate the DB for modified fields in relationships file.
Show the state of the relationships table compared to the dump file
Usage: rels:status [-p|--path PATH] [--file FILE]
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--file=FILEPath to the rels file. [config: rels.file] [default:<SUGAR_PATH>/../db/relationships.yaml]
Disallow access to the CRM and show a maintenance page
Usage: system:maintenance [-p|--path PATH] [-a|--allowed-ip ALLOWED-IP] [-P|--page PAGE] [--] <action>
actionSet the maintenance page on or off (on|off)
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]-a, --allowed-ip=ALLOWED-IPIp allowed to bypass the maintenance page [config: maintenance.allowed_ips] (multiple values allowed)-P, --page=PAGEPage file or content to display for the maintenance [config: maintenance.page] [default:DEFAULT_PAGE]
Do a quick repair and rebuild
Usage: system:quickrepair [-p|--path PATH] [--user-id USER-ID] [--no-database] [-f|--force] [-r|--rm-cache]
Execute a quick repair and rebuild. Use this command to apply modifications done to the source files.
By default it will print the SQL queries SugarCRM has generated to update the database, use --force
to execute thoses queries. You should also use --force after an update to the fields_meta_data
with the metadata:loadfromfile command.
Sometimes after some deep files modifications like VCS branch changes, the cache is obsolete
and you will get an error when you try to repair. In this case use the --rm-cache option to delete
the cache folder and compiled files from the Extension framework, namely custom/application/Ext
and custom/modules/*/Ext.
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]--no-databaseDo not check for database changes-f, --forceReally execute the SQL queries (displayed by using -d)-r, --rm-cacheRemove the cache folder and all it's contents before the repair
Run planned scheduler or a scheduler function or class
Usage: system:scheduler:run [-p|--path PATH] [--user-id USER-ID] [-i|--id ID] [-t|--target TARGET] [-d|--data DATA]
Run planned scheduler or a scheduler function or class.
You must specify a target or scheduler id but not both.
--target format:
* function: function::cleanJobQueue
* class: class::\NameSpace\Scheduler\SchedulerJob
--data format: must be a string value. You can encode data as json if necessary.
* --data '{"key":"value"}'
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-i, --id=IDSugarCRM ID of a scheduler configured in the admin zone-t, --target=TARGETExecute a defined function or class scheduler-d, --data=DATASet custom data to pass to the scheduler
List users in the SugarCRM instance
Usage: user:list [-p|--path PATH] [--user-id USER-ID] [-u|--username USERNAME] [-f|--format FORMAT] [-F|--fields FIELDS] [-l|--lang LANG] [-r|--raw]
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-u, --username=USERNAMEList only this user-f, --format=FORMATOutput format (text|json|yml|xml) [default:text]-F, --fields=FIELDSComma sperated list of fields to display [default:id,user_name,is_admin,status,first_name,last_name]-l, --lang=LANGLanguage used to display [default:en_us]-r, --rawShow raw data, no language conversion is done
Create or update a SugarCRM user
Usage: user:update [-p|--path PATH] [--user-id USER-ID] [-c|--create] [-f|--first-name FIRST-NAME] [-l|--last-name LAST-NAME] [-P|--password PASSWORD] [--ask-password] [-e|--email EMAIL] [-a|--admin ADMIN] [-A|--active ACTIVE] [--] <username>
user:create
Create or update a SugarCRM user.
Option --password should be avoided as the password would be kept in shell history.
Examples:
Create a new admin user:
sugarcli user:create -f John -l Doe --ask-password --admin yes jdoe
Alternative:
sugarcli user:update --create -f John -l Doe --ask-password --admin yes jdoe
Disable a user:
sugarcli user:update --active no jdoe
usernameLogin of the user
-p, --path=PATHPath to SugarCRM installation [config: sugarcrm.path]--user-id=USER-IDSugarCRM user id to impersonate when running the command [config: sugarcrm.user_id] [default:1]-c, --createCreate the user instead of updating it, optional if called withuser:create-f, --first-name=FIRST-NAMESet first name-l, --last-name=LAST-NAMESet last name-P, --password=PASSWORDSet password [UNSAFE use--ask-passwordinstead]--ask-passwordAsk for password on stdin-e, --email=EMAILSet principal email address-a, --admin=ADMINSet as administrator [yes|no]-A, --active=ACTIVESet as active [yes|no]