0

I am on a mission to find out which plugins are used on a large wordpress installation. Furthermore i need to find out which parts of which plugin is used exactly.

So i decided to record some code coverage data using the php-xdebug plugin.

<?php
xdebug_start_code_coverage();
/**
...
*/
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
file_put_contents("coverage_report/coverage_".time().".json",json_encode(xdebug_get_code_coverage()));
xdebug_stop_code_coverage();

So that gives me a lot of information already and it basically works. But i noticed, that some parts of plugins that i definetly know are being used are not reported here. Especially those parts that are registered in the "init" hook in wordpress seem to not show up in the coverage report. I have plugins that send a redirect in those init hook functions.

My question is: is the index.php the right place to put those calls ? Or is the another place where i can catch EVERY request made to the wordpress system ?

0

This is not how coverage should be tested, or probably not even what it means. coverage "testing" is part of having a testing plan and the coverage information lets you know how good your testing plan is (for some definition of good, as rarely a 100% coverage is worth achieving in a complex code).

What you are doing is more of a profiling, which is a worthy information by itself, but it is not actually related to coverage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.