xwp / site-performance-tracker

Allows you to detect and track site performance metrics
GNU General Public License v2.0
96 stars 15 forks source link

Resolve plugin activation error in WordPress #15

Closed jcmdln closed 5 years ago

jcmdln commented 5 years ago

Using the latest commit from the master branch, I was unable to activate the plugin and was shown the following error:

Fatal error: Uncaught Error: Class 'Site_Performance_Tracker\Plugin' not found in /home/user/public_html/wp-content/plugins/site-performance-tracker-0.2.0/site-performance-tracker.php:60 Stack trace: #0 /home/user/public_html/wp-admin/includes/plugin.php(2050): include() #1 /home/user/public_html/wp-admin/plugins.php(175): plugin_sandbox_scrape('site-performanc...') #2 {main} thrown in /home/user/public_html/wp-content/plugins/site-performance-tracker-0.2.0/site-performance-tracker.php on line 60

Explicitly importing the Plugin.php file resolved the error. Maybe this import was supposed to be handled implicitly, though let me know if I've misunderstood something. Please and thank you!

Environment Information

Host OS:   CentOS Linux release 7.6.1810 (Core)
Kernel:    Linux 3.10.0-957.5.1.el7.x86_64
PHP:       PHP 7.3.3 (cgi-fcgi) (built: Mar 12 2019 03:50:47)
WordPress: v5.1.1

Edit 1: typo Edit 2: wrap error in code tags so that it doesn't reference open issues

jcmdln commented 5 years ago

oof, the error referenced two other open issues. Sorry for the clutter!

kasparsd commented 5 years ago

@jcmdln Sorry for the confusion around this. The plugin currently needs to be installed through Composer and it requires a PSR-4 autoloader that will resolve the classes according to the rules in composer.json:

https://github.com/xwp/site-performance-tracker/blob/cf83b9dd877111194e0d89ff4e160a2b1e1c2698/composer.json#L49-L53

I've added the installation instructions and requirements in #11.