Skip to content

Instantly share code, notes, and snippets.

Enrico Simonetti esimonetti

Block or report user

Report or block esimonetti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@esimonetti
esimonetti / with_acl_team_set_id.php
Last active Oct 10, 2019
Find records across all tables with acl_team_set_id not null, and their teams
View with_acl_team_set_id.php
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2019-09-02 on Sugar 8.0.0
//
// CLI script to find records with acl_team_set_id
function usage($error = '') {
@esimonetti
esimonetti / commentlog.php
Created Dec 28, 2018
Show last 10 commentlog entries on Cases, with the newest one at the top
View commentlog.php
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2018-12-28 Sugar 8.3.0
// Show last 10 commentlog entries on Cases, with the newest one at the top
//
// file: custom/Extension/modules/Cases/Ext/Vardefs/commentlog.php
//
@esimonetti
esimonetti / .htaccess
Last active Aug 27, 2019
Change sugar upload dir to another disk/mount
View .htaccess
...
...
# file path will depend on the installation path or where the file should be
# if this needs to be executed everywhere (even from cron), consider setting it on php.ini instead of the .htaccess
php_value auto_prepend_file /var/www/html/sugar/prepend.php
@esimonetti
esimonetti / secretHandling.php
Last active May 13, 2019
Sample of programmatic AES256GCM and blowfish encryption and decryption of secret value in Sugar
View secretHandling.php
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2019-05-13
// Sample of programmatic AES256GCM and blowfish encryption and decryption of secret value in Sugar
// secret value to encrypt for storage purposes, and to decrypt real-time
@esimonetti
esimonetti / SugarACLLock.php
Last active Apr 22, 2019
SugarCRM v7 - Conditional record locking through ACL's customisation
View SugarACLLock.php
<?php
//
// Enrico Simonetti
// enricosimonetti.com
//
// 2016-05-08 on Sugar 7.7.0.0
// file: custom/data/acl/SugarACLLock.php
//
// ACL to lock record in certain conditions. Always allow admin users and specific user ids
@esimonetti
esimonetti / TidewaysProf.php
Last active Feb 20, 2019
POC of Tideways profiling extension for Sugar 7.9.1.0 on PHP 7.1
View TidewaysProf.php
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// Original work: https://gist.github.com/lblockken/78a59273f2460b36eb127a7c2ee510a1
//
// 2017-07-31 on Sugar 7.9.1.0 with PHP 7.1
// filename: custom/include/SugarXHprof/TidewaysProf.php
@esimonetti
esimonetti / ProcessQueueCommand.php
Last active Jan 21, 2019
Sugar CLI command to run index processing without waiting for the scheduler - SUPERSEDED, LOOK INTO ./bin/sugarcrm search:silent_reindex and ./bin/sugarcrm search:silent_reindex_mp
View ProcessQueueCommand.php
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2017-12-15 on Sugar 7.9.2.0
// Sugar CLI command to run index processing without waiting for the scheduler
//
// Trigger reindex with: ./bin/sugarcrm search:reindex
// Process records by running either as a background process or with a cron: ./bin/sugarcrm elastic:process_records
@esimonetti
esimonetti / list.php
Created Jan 9, 2019
Add tags to reports on listviews
View list.php
<?php
//
// Enrico Simonetti
// 2019-01-10
//
// file: custom/Extension/modules/Reports/Ext/clients/base/views/list/list.php
//
// Add tags to reports on listviews
//
@esimonetti
esimonetti / CustomSugarCacheRedis.php
Last active Dec 13, 2018
Custom implementation of Sugar redis cache, using authentication and persistent connection
View CustomSugarCacheRedis.php
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2017-11-23 tested on Sugar 7.9.2.0 on PHP 7.1 with the addition of: https://gist.github.com/esimonetti/a99ea05b68cd2586949944c1b24b2921
// Custom implementation of Sugar redis cache, using authentication if configured and using persistent connections if configured
//
// file: custom/include/SugarCache/CustomSugarCacheRedis.php
@esimonetti
esimonetti / purge_activities_stream.php
Last active Nov 1, 2018
The latests up to date project is located here: https://github.com/esimonetti/SugarActivityStreamPurger. CLI script to hard delete activity streams. It will keep: comments, activities with comments, user posts, link and unlink activities and all activities created within the last N months
View purge_activities_stream.php
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2018-09-19 on Sugar 8.0.0
//
// CLI script to hard delete activity streams. It will keep: comments, activities with comments, user posts, and all activities created within the last N months
//
// TEST, TEST, TEST AND USE AT YOUR OWN RISK!
You can’t perform that action at this time.