UPGRADE-3.0.md
\AppKernel::MAJOR_VERSION, \AppKernel::MINOR_VERSION, \AppKernel::PATCH_VERSION, and \AppKernel::EXTRA_VERSION are no longer defined. Use \Mautic\CoreBundle\Release\ThisRelease::getMetadata()->getMajorVersion(), etc instead.In Mautic 3, several configuration parameters have changed (app/config/local.php). The upgrade script will update those automatically for you, but here's an overview of parameters that will be updated by the script:
| Key | Old value | New value | Comment |
|---|---|---|---|
| mailer_transport | 'mail' | 'sendmail' | 'mail' option was removed in SwiftMailer 6, other options should keep working as-is |
| system_update_url | 'https://updates.mautic.org/ index.php?option=com_mauticdownload& task=checkUpdates' | 'https://api.github.com/ repos/mautic/mautic/releases' | New update mechanism |
| dev_hosts | null | array() | If this was set to null, it should now be an empty array |
| theme | 'Mauve' | 'blank' | Mauve theme was removed in 3.x (already deprecated for a while) |
| track_by_fingerprint | 0 | N/A | Functionality removed in 3.x |
| webhook_start | '0' | N/A | Removed in 3.x |
| cache_path | 'YOUR_MAUTIC_FOLDER/ app/cache' | 'YOUR_MAUTIC_FOLDER/ app/../var/cache' | We'll only change the default value (new location is var/cache) but leave any custom configs intact |
| log_path | 'YOUR_MAUTIC_FOLDER/ app/logs' | 'YOUR_MAUTIC_FOLDER/ app/../var/logs' | We'll only change the default value (new location is var/logs) but leave any custom configs intact |
| tmp_path | 'YOUR_MAUTIC_FOLDER/ app/cache' | 'YOUR_MAUTIC_FOLDER/ app/../var/tmp' | We'll only change the default value (new location is var/tmp, it has its own dedicated folder now) but leave any custom configs intact |
| mailer_spool_path | '%kernel.root_dir%/spool' | '%kernel.root_dir%/../var/spool' | We'll only change the default value (new location is var/spool) but leave any custom configs intact |
| api_rate_limiter_cache | 'type' => 'file_system' | 'adapter' => 'cache.adapter.filesystem' | See below |
Note on the api_rate_limiter_cache parameter: this is an advanced feature that we only expect a very small subset of users to be using currently.
If you had a custom API rate limiter other than the filesystem (default), you'll need to specify a Symfony cache adapter as of Mautic 3. The upgrade script will change it to 'cache.adapter.filesystem' to prevent issues in the upgrade process, so you should change it yourself post-upgrade. For example, if you had Memcached set up with the following configuration:
'api_rate_limiter_cache' => array(
'memcached' => array(
'servers' => array(
'0' => array(
'host' => 'memcached.local',
'port' => '12345'
)
)
)
),
... it should now be:
'api_rate_limiter_cache' => array(
'adapter' => 'cache.adapter.memcached',
'provider' => 'memcached://memcached.local:12345'
),
In case you've been using $_SERVER['MAUTIC_DEV_HOSTS'] to add more allowed IP addresses for the development enviroment, there had to be 2 changes because it was conflicting with handling configuration with environment variables.
MAUTIC_DEV_HOSTS to MAUTIC_CUSTOM_DEV_HOSTS.Before:
$_SERVER['MAUTIC_DEV_HOSTS'] = '1.2.3.4';
After:
$_SERVER['MAUTIC_CUSTOM_DEV_HOSTS'] = '["1.2.3.4"]';
Mautic's Configuration is no longer dependent on the Symfony container. This means that any parameter that has to be used in a cache compiler pass is no longer compatible with the UI. These "advanced" configuration options have to be manually set in the local.php file then delete Mautic's cache. For example, the QueueBundle must now be manually configured due to its dependency on cache compilers.
The following changes were made to support this:
%mautic.parameters% is no longer available to services. Use the CoreParametersHelper instead.CoreParametersHelper is now limited to just Mautic configuration parameters. It can no longer be used to fetch other Symfony parameters, mautic.paths, mautic.supported_languages, mautic.bundles, or mautic.plugin.bundles. Pass them as needed to the constructor of the service, use the BundleHelper, LanguageHelper, or the PathsHelper instead.PHPUNIT was upgraded to version 7.5.0 which means that the namespaces changed. See https://thephp.cc/news/2017/02/migrating-to-phpunit-6 for more details.
The database fixtures are being installed based on the class name instead of the file path. Example:
Mautic 2 (how it was before):
$this->installDatabaseFixtures([dirname(__DIR__).'/../../../../../app/bundles/LeadBundle/DataFixtures/ORM/LoadLeadData.php']);
Mautic 3 (how it should be now):
$this->installDatabaseFixtures([\Mautic\LeadBundle\DataFixtures\ORM\LeadFieldData::class]);
All fixtures must be defined as services in a bundle's config.php
spacer form type was removed without a replacement (\Mautic\CoreBundle\Form\Type\SpacerType)hidden_entity form type was removed (\Mautic\CoreBundle\Form\Type\HiddenEntityType)mautic:migrations:generate use command doctrine:migrations:generate to generate a migration class.mautic.paths, mautic.supported_languages, mautic.bundles, or mautic.plugin.bundles.
mautic.bundles or mautic.plugin.bundles use \Mautic\CoreBundle\Helper\BundleHelper::getMauticBundles() or getPluginBundles() insteadmautic.supported_languages, use \Mautic\CoreBundle\Helper\LanguageHelper::getSupportedLanguages()mautic.paths, use \Mautic\CoreBundle\Helper\PathsHelper::getSystemPath() instead--negative-only removed for command mautic:campaigns:trigger. Use --inactive-only instead./api/campaigns/{id}/contact/add/{leadId} route removed. Use /api/campaigns/{id}/contact/{leadId}/add instead./api/campaigns/{id}/contact/remove/{leadId} route removed. Use /api/campaigns/{id}/contact/{leadId}/remove instead.Before:
public function onConfigGenerate(ConfigBuilderEvent $event)
{
$event->addForm([
'bundle' => 'EmailBundle',
'formAlias' => 'emailconfig',
'formTheme' => 'MauticEmailBundle:FormTheme\Config',
'parameters' => $event->getParametersFromConfig('MauticEmailBundle'),
]);
}
After:
public function onConfigGenerate(ConfigBuilderEvent $event)
{
$event->addForm([
'bundle' => 'EmailBundle',
'formType' => ConfigType::class,
'formAlias' => 'emailconfig',
'formTheme' => 'MauticEmailBundle:FormTheme\Config',
'parameters' => $event->getParametersFromConfig('MauticEmailBundle'),
]);
}
lead.remove_do_not_contactsetOptional method in form types is deprecated. Please use setDefined method instead.