This is a limited set of scripts to be used in conjunction with the WordPress-Theme-Directory-Slurper and WordPress-Plugin-Directory-Slurper to analyse usage of the TGMPA library in plugins and themes hosted on wordpress.org.
- A system on which you can run command line PHP and PHP scripts in the browser.
- WordPress-Theme-Directory-Slurper
- WordPress-Plugin-Directory-Slurper
Note: The scripts in 2-search-the-repos
are currently only suitable to be run on Windows. Pull requests with additional versions suitable for other operating systems welcome.
You only need to do these steps the first time you want to run the scripts.
-
Follow the instructions for both the Theme and Plugin slurpers to set up your initial local copy of the repositories.
Note The initial slurping will generally take quite a while, so you might want to let it run overnight.
-
Edit both the
.bat
files in the2-search-the-repos
folder and adjust the first two lines based on your local setup. -
Edit both the
.php
files in the3-analyse-the-results
folder and adjust the paths in the$file_patterns
and$dirs
properties based on your local setup.
-
Run the scripts found in the
2-search-the-repos
folder from the command line:> tgmpa_analyse_themes > tgmpa_analyse_plugins
The batch files will each do three things:
- it will update the local version of the theme/plugin repository by running the slurper script.
- it will run three different searches over all files in either the local plugin or theme repository.
- it will save the results in both timestamped logfiles as well as logfiles with
latest
instead of a timestamp.
-
Once both batch files have finished running, open your browser and open the
.php
files found in3-analyse-the-results
. Make sure they are in a location which can run PHP! (i.e.http://localhost/
or similar)Watch in awe while your screen will fill with statistics on the usage of TGMPA by themes and plugins in the WP repository.
Logfiles generated by the batch scripts:
This file will contain relative paths to files in the theme/plugin repository which contain one or more text strings which are associated and very specific to TGMPA. The likelyhood of these files in actual fact being TGMPA is very high.
This file will contain absolute paths to files which end in plugin-activation.php
. These will sometimes need manual inspection as this list may contain false positives.
The PHP analysis scripts already exclude a number of such false positives from the final analysis based on manual inspection at the time of creation of these scripts.
This file - which is currently not used in the PHP based analysis - contains relative paths for all themes which are child themes and therefore have a dependency on a parent theme.
This file - which is currently not used in the PHP based analysis - contains relative paths for all plugins which have a "Depends:" header as supported by the Plugin Dependencies plugin.
For the plugin repo slurper, there are two forks available which will work on Windows:
- https://github.com/Rarst/WordPress-Plugin-Directory-Slurper
- https://github.com/chriscct7/WordPress-Plugin-Directory-Slurper
For the theme repo slurper, the following fork will work on Windows:
The timestamp is based on a Windows system with European dates. You may want to fiddle with the variables in the below line which is contained in both batch files to make it work with your system date.
set LOGFILE_STAMP=%DATE:~9,4%%DATE:~6,2%%DATE:~3,2%-%TIME:~0,2%.%TIME:~3,2%
You may find this page useful as a reference: http://ss64.com/nt/date.html
Great! If you know of one, please share it with us or even better: send in a pull request with improvements.
I'm by no means a Windows shell wizard, these scripts are just cobbled together with the limited knowledge of shell scripting I have and a lot of Google searches.
This seems highly geared towards TGMPA and the dev machine of one of the developers. Why did you put it online ?
As it took some time to figure out how to gather and analyse this kind of information, I figured it might be useful as an example for other people who want to do analysis on the WP theme and plugin repositories.