Fix persistent errors in plugins #12
base: master
Are you sure you want to change the base?
Conversation
The new version of VVV will be running PHP 7. The Log Deprecated Notices plugin doesn't really have an alternative, but is not actively maintained nor has it got a GH shadow with more up to date code. This plugin has a PHP7 compatibility issue which this adjustment fixes. The WordPress Importer is needed to import the theme test data, but also has PHP7 compatibility issues. HumanMade is working on a refactor, but replacing the current plugin with the refactored one broke the importing of the unit test data, so for now, fixing the PHP 7 issue in the WordPress Importer plugin seemed the simpler solution. Ref: https://github.com/humanmade/WordPress-Importer The fixes are made by editing the actual plugin files. This is done right after install, but also at the end of the script so as to fix already installed versions of the plugins. This gets rids of the following errors which will show in the VVV provision logs and/or PHP error logs: ``` # Log Deprecated Notices Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Deprecated_Log has a deprecated constructor in /srv/www/wordpress-themereview-vvv/htdocs/wp-content/plugins/log-deprecated-notices/log-deprecated-notices.php on line 25 # WordPress Importer Notice: Array to string conversion in /srv/www/wordpress-themereview-vvv/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php on line 884 Notice: Undefined variable: _menu_item_type in /srv/www/wordpress-themereview-vvv/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php on line 886 Notice: Undefined variable: _menu_item_type in /srv/www/wordpress-themereview-vvv/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php on line 888 Notice: Undefined variable: _menu_item_type in /srv/www/wordpress-themereview-vvv/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php on line 890 ```
I left some comments, but I'm not sure I like the idea of modifying files directly. Maybe you could write a |
The problem is that with the new version of VVV the import of the theme data will partially fail because of these errors, making the themereview auto-site a lot less useful. |
P.S.: where did you leave the comments ? I can't seem to find them. |
I left them in the diff's, and thanks for helping out! But, I just think this is a wordpress-importer problem and we should wait for them to fix it there? |
It's weird, I cannot see your comments in the diff. Regarding WP Importer, it's an Automattic plugin which is barely maintained anymore. There have only been three very minimal patch releases in the last five years. |
Oh ... you may need to click "Finish review" for your comments to become visible. Could that be it ? |
@@ -51,7 +51,13 @@ PHP | |||
# ** | |||
|
|||
printf 'Installing plugins...\n' | |||
wp plugin install wordpress-importer --activate --allow-root | |||
wp plugin install wordpress-importer --allow-root |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the reason we're not activating this is because it will throw an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait I see it below being activated, so this actually modifies the code, not sure I'm good with that happening on init.
# Fix PHP4 constructor in the Log Deprecated Notices plugin. | ||
echo "Removing errors from the Log Deprecated Notices plugin." | ||
if [[ -f /srv/www/wordpress-themereview-vvv/htdocs/wp-content/plugins/log-deprecated-notices/log-deprecated-notices.php ]]; then | ||
sed -i -e 's/function Deprecated_Log() {/function __construct() {/g' "/srv/www/wordpress-themereview-vvv/htdocs/wp-content/plugins/log-deprecated-notices/log-deprecated-notices.php" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, again not sure about modifying actual code; I think the developer would do this manually. Maybe we can do a separate .sh file to do this? Maybe?
The new version of VVV will be running PHP 7.
The Log Deprecated Notices plugin doesn't really have an alternative, but is not actively maintained nor has it got a GH shadow with more up to date code.
This plugin has a PHP7 compatibility issue which this adjustment fixes.
The WordPress Importer is needed to import the theme test data, but also has PHP7 compatibility issues. HumanMade is working on a refactor, but replacing the current plugin with the refactored one broke the importing of the unit test data, so for now, fixing the PHP 7 issue in the WordPress Importer plugin seemed the simpler solution.
Ref: https://github.com/humanmade/WordPress-Importer
The fixes are made by editing the actual plugin files. This is done right after install, but also at the end of the script so as to fix already installed versions of the plugins.
This gets rid of the following errors which will show in the VVV provision logs and/or PHP error logs: