Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecator Class #2870

Closed
gregorskii opened this issue May 9, 2018 · 5 comments
Closed

Deprecator Class #2870

gregorskii opened this issue May 9, 2018 · 5 comments

Comments

@gregorskii
Copy link

gregorskii commented May 9, 2018

Description

The deprecator service class can flood an instance of Craft 3 with too many open writes, as each deprecation error is written to the database on every request.

Per the file:

https://github.com/craftcms/cms/blob/develop/src/services/Deprecator.php

There is no way to turn off Deprecation writes to the DB, and some of the Deprecation errors I am getting are out of my control.

Temporarily we returned false from the Deprecator.

This feature should be removed on production, or write to a file instead, or be controlled by the user.

Additional info

  • Craft version: Craft Pro 3.0.3.1
  • PHP version: 7.1.15
  • Database driver & version: Aurora MySQL 5.6.10a
  • Plugins & versions: Element API 2.5.2, Migration Manager 3.0.0, Redactor 1.1.0

Looks like some of the deprecations are coming from an outdated version of Migration Manager, I can work on updating that, but nevertheless I humbly suggest these should not be written to the DB on each request... :)

screenshot 2018-05-09 16 25 35

I have fixed the config mismatches in the log here as well.

@brandonkelly
Copy link
Member

The assumption is that you will fix the deprecation errors when you see them. If we removed them from production (or wrote to a file), the logs would likely be missed by most people.

@gregorskii
Copy link
Author

Fair, but leaving then in production on a high traffic site has the potential to take it down.

I would imagine its fair to assume people should fix these issues in staging, or make their own choice to disable them in production.

@brandonkelly
Copy link
Member

brandonkelly commented May 10, 2018

I just added a new $logTarget property to the Deprecator service, which can be changed to 'logs' if you want deprecation errors to be saved to your error logs, or false if you want them to be suppressed entirely.

You can set that property from config/app.php:

return [
    '*' => [
        // keep this array even if it's empty
    ],
    'production' => [
        'components' => [
            'deprecator' => [
                'logTarget' => 'logs',
            ],
        ],
    ],
];

@gregorskii
Copy link
Author

gregorskii commented May 10, 2018

Awesome,

When is this fix available to new composer requires?

Thank you 🙏

---- Update

I see 3.0.7, testing.

@gregorskii
Copy link
Author

Thanks this is deployed to our server. I believe it is working. I am now not getting any deprecation errors in the CMS admin panel.

Looks like this is good.

TY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants