Git Product home page Git Product logo

wp-repo-analysis-tools's Introduction

WP Repo Analysis tools for TGM Plugin Activation

Description

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.

Requirements

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.

Usage instructions.

Before you start:

You only need to do these steps the first time you want to run the scripts.

  1. 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.

  2. Edit both the .bat files in the 2-search-the-repos folder and adjust the first two lines based on your local setup.

  3. Edit both the .php files in the 3-analyse-the-results folder and adjust the paths in the $file_patterns and $dirs properties based on your local setup.

Running the scripts:

  1. 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.
  2. Once both batch files have finished running, open your browser and open the .php files found in 3-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.

Understanding the results.

Logfiles generated by the batch scripts:

... TGMPA search COMBINED.log

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.

... TGMPA search partial file name.log

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.

... child-themes.log

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.

... plugins with Depends header.log

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.

FAQ

I'm on Windows and the slurpers only work on Unix/Linux/Mac systems!

For the plugin repo slurper, there are two forks available which will work on Windows:

For the theme repo slurper, the following fork will work on Windows:

The timestamp looks weird...

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

This can be done in a much smarter way!

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.

wp-repo-analysis-tools's People

Contributors

garyjones avatar jrfnl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.