Sugarcrm支持产品指南糖版本10.010.0企业糖企业10.0行政指南高级配置选项

高级配置选项

概述

Sugar具有许多不同的方法来配置您的系统,以最佳满足您的需求。在整个应用程序中提供了许多配置选项;虽然,界面不可提供一些高级选项,但仍然可以配置。

In the root directory of Sugar, there are two configuration files: config.php and config_override.php. These files hold many configuration options within your instance of Sugar. The config_override.php file is available for you to modify Sugar's configuration. For more information on which options are available to change, please refer to the 开发人员指南.

笔记: Instances running on Sugar's cloud service do not have access to modify the config_override.php file.

维护模式

在极少数情况下,您可能需要将用户限制登录糖。在升级糖或对应用程序进行重大更改时特别有用(例如,更改配置值, 制作代码级更改, 或通过工作室部署更改, Module Builder, 或模块加载器)。对于这些情况,我们建议启用维护模式,默认情况下被禁用。通过启用维护模式,只有管理员才能登录,常规用户将在登录屏幕上收到警报,让他们知道系统暂时不可用。在禁用维护模式之前,所有传入的API调用也将遇到错误消息。当可能时,最好在维护期间通知受影响的用户。

To enable maintenance mode for your instance, add the following line to the config_override.php file:

$sugar_config['maintenanceMode'] = true;

系统配置

Changing values in the config files can change functionality and behaviors in Sugar. We always recommend testing your changes on a development or test system before changing values in a production system. After changing the config_override.php file, you should perform a Quick Repair and Rebuild from the Admin >修复菜单。有关更多信息,请参阅 修理 documentation.

配置文件权限

Sugar中的许多功能要求Web服务器具有正确的文件权限设置,以便能够读取和写入文件。至少,以下文件和目录需要从Web服务器可写:

  • ./config.php
  • ./config_override.php
  • ./sugarcrm.log
  • ./cache/ 和所有子目录和文件
  • ./custom/ 和所有子目录和文件
  • ./data/ 和所有子目录和文件
  • ./modules/ 和所有子目录和文件

使用IIS的Windows上运行的Sugar将需要IIS用户(IUSR_ [ComputerName])来访问这些文件。

在Linux上运行的Sugar期望列出的文件和目录由运行Web服务器的同一用户拥有,也可以在同一组中。然后,糖将需要以下权限:

  • 2770如上所述的目录
  • 660 for the config.php file and all files in the directories listed above
  • 770 for. bin/sugarcrm

When running on Linux, the config.php file in your Sugar instance's root directory contains a setting called default_permissions. This setting controls the ownership and accessibility to all files and folders created by Sugar. The following is an example of setting Read, Write, and Execute permissions for the Apache user and the Apache group on CentOS operating system:

 default_permissions' => array(
   'dir_mode' => 1528,
   'file_mode' => 432,
   'user' => 'apache',
   'group' => 'apache',
),

The values for dir_mode and file_mode are decimal equivalent values for the standard octal values entered for permissions. The value 1528 is the decimal equivalent of the octal value 02770 and a value of 432 which is the decimal equivalent of octal value 0660. These are the recommended directory and file permissions for Linux systems.

笔记:如果输入了八进制值,它们将被解释为十进制,并且不会提供预期的文件权限设置。

The 'user' and 'group' values determine the ownership of the files created. When empty, your Apache settings will take precedence to determine file and directory ownership. These values should be set explicitly to the Apache user and group on your server and these values will vary depending on the Apache setup and/or Linux OS you are running. To update these values, please edit the config_override.php file in the root directory of your installation and add the following lines:

$sugar_config['default_permissions']['user'] = '<your Apache user>';
$sugar_config['default_permissions']['group'] = '<your Apache group>';   

笔记:这些值将仅对新创建的文件生效,而不是现有文件生效。如果需要更改现有文件的文件权限或所有权,则必须通过文件系统执行更改。

允许弹出电子邮件帐户

Inbound email accounts are set up to work with IMAP protocols by default. If your email provider required POP3 access instead of IMAP, you can add the following line to the config_override.php file:

$sugar_config['allow_pop_inbound'] = true;

这将允许使用POP3或IMAP配置新的入站电子邮件帐户。

笔记:不支持POP3访问,可能导致意外后果。 IMAP是用于入站电子邮件帐户的推荐协议。

安全选项

默认情况下,所有管理员都可以访问Sugar的管理工具,如升级向导,模块构建器和模块加载器。以下部分将显示几种不同的方法来禁用这些选项。

锁定管理控制

If you are managing multiple instances of the Sugar application, you can maintain complete control over the Sugar instances by preventing users with administrative privileges from making any changes. To do this, you can lock down the Upgrade Wizard and Module Builder with a single command in the config_override.php file:

$sugar_config['admin_access_control'] = true;

锁定模块装载机

To ensure that users with administrative privileges do not load sub-standard modules into Sugar, you can restrict the Module Loader to a specific directory on the web server that you control. This allows you to check modules before they are loaded into Sugar. To restrict the module loader, simply add the following lines to the config_override.php file:

$sugar_config['use_common_ml_dir'] = true;
$sugar_config['common_ml_dir'] = '/Applications/MAMP/htdocs/sugarcrm/screenedModules';

这将阻止任何管理员用户从指定目录以外的任何目录加载模块。一旦通过必要的通道批准了模块,可以将模块放在必要时安装任何管理员的指定目录中。
restricted_module_loader.

Another method for locking down the module loader is to enable the package scanner. The package scanner is enabled by default for instances hosted on SugarCloud. If you are running Sugar on-site, you can enable the package scanner by adding the following command in the config_override.php file:

$sugar_config['moduleInstaller']['packageScan'] = true;

启用包扫描仪时,模块加载程序将检查正在加载的文件,以损坏服务器或糖的实例。有关哪些函数被列入黑名单的更多信息以及如何配置包扫描仪,请参阅 开发人员指南.

使网站成为推荐

To prevent Cross-Site Request Forgery (XSRF) attacks, Sugar has a list of acceptable sites that are allowed as a referer to Sugar. If you receive a "Possible Cross Site Request Forgery (XSRF) Attack Detected" message from an approved site trying to access Sugar, you can add that approved site's URL to the list of valid referers by adding the following line to the config_override.php file:

$sugar_config['http_referer']['list'][] = 'my.site.com';

此行将将指定的站点添加到批准站点列表中。如果您有多个站点添加,请为所需的每个站点重复此行。

表现

如果您的Sugar实例的性能开始降级,则可以启用某些配置选项来淡化系统上的负载。以下选项可能会导致糖的性能增加,但有些性能收益将丧失功能损失。

Sugar建议使用至少512MB的PHP内存限制。根据用户如何利用糖,可能需要增加该值。例如,根据实例大小和配置,诸如质量更新和导入之类的操作可能需要额外的内存。要更改此限制,请在php.ini中编辑设置:

memory_limit = 512M

此外,display_errors应始终设置为“关闭”。启用此选项可能会导致用户的不利行为。要关闭此设置,请在PHP.ini中编辑选项:

display_errors = off

在对这些设置中的任何一个或php.ini中的任何其他设置进行更改时,必须在设置生效之前重新启动Web服务器。 

限制系统资源

Sugar allows non-admin users to be restricted to how many queries they can run per action. By default, the limit for all modules is set to 1000 queries. This prevents user-initiated processes from taking up too many system resources. If an operation is performed by a user that attempts too many queries they will see a message returned saying: "Error: Query limit of 1000 reached for Leads module." To change this limit for all modules, add the following line to the config_override.php file:

$sugar_config['resource_management']['default_limit'] = 5000; // default is 1000

笔记: Setting the default_limit value to 0 will remove the query limit altogether for all modules.

In addition to setting the default for all modules, you can specify certain modules to have a different value. To remove the limit for specific modules only you need to specify the modules and the limit for those modules by adding the following lines to the config_override.php file:

$sugar_config['resource_management']['special_query_modules'][] = 'Accounts';
$sugar_config['resource_management']['special_query_modules'][] = 'Contacts';
$sugar_config['resource_management']['special_query_limit'] = 0; // default is 50000

In this example, the Accounts module, Contacts module, and any other module in the special_query_modules array will no longer be limited. All other modules will adhere to the default limit.

笔记:将此限制设置得太低可以严重限制用户执行基本操作。或者,可以让用户无意中执行显着影响整体性能的操作,从而删除限制。

配置从站数据库

Sugar允许您配置实例以从从站数据库而不是实时数据库提取报告或列表视图数据。报告和列表视图可以在数据库上创建一个沉重的负载,因此在不同的数据库或服务器上分离报告或列表视图数据可以帮助缓解一些性能问题。

To configure a slave database, set the appropriate array in the config_override.php file:

  • 举报 : $sugar_config['db']['reports']
  • dashlets,subpanel和列表视图 : $sugar_config['db']['listviews']

在数组中设置以下值以配置Sugar以使用从设备数据库:

钥匙 价值
db_host_name. 运行从站数据库的服务器的主机名
db_user_name. 要连接到从站数据库的用户名
db_password. 连接到从属数据库的密码
db_name. 从属数据库的名称
db_type. 运行从站的数据库类型(DB2,MySQL,MSSQL,Oracle)

例如:

$sugar_config['db']['reports'] =
   array(
      'db_host_name' => 'sugar_slave',
      'db_user_name' => 'ro_user',
      'db_password' => 'ro_user_password',
      'db_name' => 'sugarcrm_reports',
      'db_type' => 'mysql',
   );

笔记:您必须创建从站数据库和同步机制,以使从站与Live Database保持最新状态。 Sugar应用程序不会将数据与Live Database的数据同步到从站。

更改上传目录

Sugar stores content, such as images, documents, and installable modules, uploaded by users in the upload directory. Some of these documents may be large in size and can cause performance issues. Administrators can move the upload directory to a different location to ensure that enough space is available for uploads without affecting the system. You can change the location of the uploads to a different folder within the sugar directory or use an absolute path to place the folder anywhere in the file system. You can change this location by adding the following line to the config_override.php file:

$sugar_config['upload_dir'] = 'd:\upload\';

笔记:请记住将文件从旧的上传目录复制到新的上载目录中以获取可访问性。上载目录应由运行Web服务器的用户可写。

更改缓存目录

Sugar uses a cache directory to store files (such as compiled templates, aggregated variable definitions, remote mailbox data, various cache files) produced by the system to optimize functionality and enhance system performance. These files can take considerable space, especially in larger systems. You can change the location of the cache to a different folder within the sugar directory or use an absolute path to place the folder anywhere in the file system. You can change this location by adding the following line to the config_override.php file:

$sugar_config['cache_dir'] = 'd:\cache\';

可以通过Direct URL访问一些缓存文件。因此,如果移动缓存目录,还应确保Web服务器上的URL / Cache /(相对于主Sugar站点URL)配置为引用新的缓存位置。有关如何在URL和文件系统目录之间配置映射的详细信息,请参阅Web服务器文档。

笔记:需要首先创建缓存目录,或者您可能会收到内部服务器错误。 Cache目录应由运行Web服务器的用户可写。

配置计数查询

By default, list views and subpanels in Sugar return record counts. This can be convenient to know how many records were found for a specific search, but in order to retrieve the record count; Sugar needs to perform additional queries on the database. When there are large amounts of data, these queries can cause performance issues. You can disable these count queries in Sugar by adding the following line to the config_override.php file:

$sugar_config['disable_count_query'] = true;

您将在其旁边看到当前已知的记录计数,而不是看到当前已知的记录计数。

When a calculated field in Sugar uses the related function in the Sugar Logic, this will cause the calculated field to be executed when the related module is updated. This can cause a cascading effect through the system to update related calculated fields. When this happens you may receive a 502 Gateway Error. You can disable the related calculation field updates by adding the following line to the config_override.php file:

$sugar_config['disable_related_calc_fields'] = true;

笔记:这是一个会影响所有模块的全局设置。如果您在帐户中有一个计算的字段,可以汇总帐户的所有机会,将此值设置为true将不再更新帐户中的机会帐户总和,直到帐户记录本身被修改。但是,如果禁用此设置,则总和会在任何相关机会或帐户被修改时更新。

禁用自动搜索

默认情况下,Sugar中的列表视图记住每个模块中当前用户执行的最后一个搜索。虽然这很方便,但有时是不必要的。如果在模块中执行的最后一次搜索是一个广泛的搜索,则下次用户导航到该模块将无意中再次执行搜索。这可能对糖的性能产生负面影响。

Set one of the following values for $sugar_config['save_query'] in the config_override.php file to configure different options for saving list view queries:

价值 描述
全部 填充最后一个搜索并执行它
笔记:这是糖中的默认行为。
丢弃上一个搜索并执行没有条件的搜索
populate_only 填充最后一个搜索,但不执行它

例如:

$sugar_config['save_query'] = 'populate_only';

笔记: The $sugar_config['save_query'] setting is not supported for Sidecar modules and only applies to Legacy modules. 

使用Campaign跟踪器的自定义页面

通过Sugar发送活动时,跟踪器URL用于映像,链接和广告系列中的退出链接。当广告系列的收件人点击其中一个链接时,默认情况下默认为发送活动的Sugar实例。许多组织可能希望使用自定义页面发送收件人而不是使用Sugar,或者在运行Sugar现场时,它可能在防火墙后面,并且无法访问广告系列的收件人。使用以下步骤创建自定义登录页面以用于跟踪器URL,同时仍然正确地录制糖中的活动。

  • 在向Internet开放的所需Web服务器上创建索引.php页面。
  • 将以下代码添加到自定义索引.PHP页面中,以确保所有广告系列活动都符合糖。
    笔记:替换所有出现的 “http:// sugar_url” 在下面的代码中,使用Sugar实例的实际站点URL。
<?php
  if ($_REQUEST['entryPoint'] == 'removeme' || $_REQUEST['entryPoint'] == 'campaign_trackerv2' || $_REQUEST['entryPoint'] == 'image') {
    if (strlen($_REQUEST['identifier']) == 36) {
      $ch = curl_init();
      if (strlen($_REQUEST['track']) > 0) {
        curl_setopt($ch, CURLOPT_URL, \"http://sugar_url/index.php?entryPoint=\" . $_REQUEST['entryPoint'] . \"&identifier=\" . $_REQUEST['identifier'] . \"&track=\" . $_REQUEST['track']);
                curl_setopt($ch, CURLOPT_HEADER, 1);
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
                $headers = curl_exec($ch);
                $headerArray = explode(\"\n\",$headers);
                foreach ($headerArray as $value) {
                    if (substr(strtolower($value),0,8) == \"location\") {
                        header($value);
                    }
                }
            } else {
                curl_setopt($ch, CURLOPT_URL, \"http://sugar_url/index.php?entryPoint=\" . $_REQUEST['entryPoint'] . \"&identifier=\" . $_REQUEST['identifier']);
                curl_setopt($ch, CURLOPT_HEADER, 0);
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
                curl_exec($ch);
            }
            curl_close($ch);
            unset($ch);
        }
    }
?>
  • 最后,在admin中指定外部服务器URL>广告系列电子邮件设置>广告系列跟踪文件选项的位置,以便在广告系列电子邮件中正确生成的跟踪链接。有关设置此值的详细信息,请参阅 电子邮件 documentation.

配置Cron for Schedulers

Sugar的调度程序作业由Cron实用程序执行,该实用程序在您的服务器上运行。有几种配置选项可用于确保长时间运行或失败的调度程序作业不妨碍您及时运行的其他计划程序作业。

First, max_cron_runtime determines how long a single job should be allowed to run. If a single job exceeds this limit, cron.php is aborted with the long-running job marked as in progress in the job queue. The next time cron runs, it will skip the job that overran the limit and start on the next job in the queue. Additionally, if the total running time of a single cron run across all current jobs exceeds max_cron_runtime, then cron will complete whatever job it is currently executing, then stop. The next time cron runs, it will pick up with the next queued job. The max_cron_runtime uses seconds as its units and defaults to 1800 (30 minutes). You may wish to adjust this number based on the typical time requirements of scheduler jobs in your instance.

By default, max_cron_runtime is not enforced on your instance. In order to enforce this limit, set enforce_runtime to true.

$sugar_config['cron']['enforce_runtime'] = true; // default is false
$sugar_config['cron']['max_cron_runtime'] = 1800; // seconds, default is 1800

超时配置控制在重新启动之前未完成的作业之前,Cron将等待的时间。一旦作业被标记为时间超过超时设置,下一个Cron运行将标记为失败的作业,使其符合以下Cron运行的队列中的队列。超时使用秒作为其单位,默认为3600(1小时)。您可能希望根据您希望更快或长期运行的作业重新扣除的快速调整此号码。请注意,应将Enforce_Runtime设置为False,或者您的MAX_CRON_RUNTIME长于超时,在达到此超时限制时,通常可以将运行的作业设置为“失败”。

$sugar_config['jobs']['timeout'] = 3600; // seconds, default is 3600

最后修改:2020-02-04 00:12:57