wpseek / wpseek-web

This repository is currently only used for issue tracking for wpseek.com
https://wpseek.com/
1 stars 0 forks source link

Plugin Doctor - List Functions by WP Version in Reverse Order #31

Open danieliser opened 8 years ago

danieliser commented 8 years ago

Currently finding the functions that make your plugin require a certain version are hidden and organized by file. In a large plugin that makes it extremely difficult to sort & find what your after.

Can you also add the ability to see by version what / how its used?

IE

4.5.3

4.4.0

In this way a plugin dev can easily go through and find ways to lower the required version much more quickly. Same info just organized a bit differently.

oliverschloebe commented 8 years ago

Hi Daniel, et voilá: https://wpseek.com/pluginfilecheck/

Still putting finishing touches on it, but should be good to go already.

danieliser commented 8 years ago

@AlphawolfWMP - WOW.. Absolutley WOW.

When I suggested this I expected a few weeks / months before it would come about (knew you guys rocked and would do it) but never so soon.

Looks perfect, though I would add one request: Make it switchable or show both lists.

IE the original by file list was useful in its own ways, and this new organization makes it easier to reduce required version in mass quickly.

Not a requirement at all, as this new method is 2x as useful I think, but the other does have merit still

danieliser commented 8 years ago

@AlphawolfWMP Question, and I will start another issue if you think its doable. Could PHP version compatibility be factored in? IE checking for PHP 5.2/5.3/5.4/5.5/7 compatibility

oliverschloebe commented 8 years ago

@danieliser I've been thinking about making the lists switchable but came to the conclusion that I wouldn't want to clutter the UI. TBH the UI would be needing an update since it's quite old anyways, and I'm probably bringing the old list (as an alternative) back after redesigning the whole thing some day. As for now, I think your idea works way better and is more useful for devs that the tool is made for. If I'm getting feedback that users are missing the old list, I might overthink my decision. :smiley:

Regarding PHP compatibility checking... technically it'd be possible, but while I would be able to curate a list of PHP function names (used as source data), what's missing is a source giving me info on when PHP functions were introduced. If you have a source or idea, I'm open for anything.

danieliser commented 8 years ago

@AlphawolfWMP Can you link me the source of your WP functions similar to what you want for PHP? If I know what you need exactly or what your using now for WP I may be able to track it down for you. I think this would be a crucial addition to this tool as those are the two primary version dependencies any theme or plugin needs to know.

oliverschloebe commented 8 years ago

@danieliser Well, basically all I need is an array/CSV/JSON object of PHP functions with @since info for each PHP function like

$funcs = array( 'strtolower' => '4.0.0' );

which holds the functions and the required PHP version it's been introduced.

danieliser commented 8 years ago

@AlphawolfWMP Took a lot of digging, and not sure how much work to convert it to what you need, but seems PHP docs are way behind current technologies ;)

Here are the resources I found that may lead the way:

Another possible option would be to use http://php.net/manual/en/function.get-defined-functions.php or similar to build a list of all php functions, then scrape the needed php info.

If you decide to try scraping I would suggest doing it from the downloadable versions here: http://php.net/download-docs.php. Namely the single html file or multi html file versions. Be sure to check out the *nix versions of the docs available too on the right sidebar of the download-docs.php page.

All of that said, I did not try to get the phd setup working to see how the xml & json exports look. But I would be happy to help build a reference set like this.

If we have to scrape it not a problem using the downloadable versions, you can scan for each function using classes pretty easy. IE

As I said no solid immediately ready solution, but I think between the downloadable version & the PHB svn custom format output options we can find a solid solution.

Heck I think this would be a valuable tool in general since nobody has done it & made it publicly available yet.

danieliser commented 8 years ago

Oh and there is also the svn where the actual docs are kept, but Its so messy I can't imagine scraping it: http://svn.php.net/viewvc/phpdoc/en/trunk/reference/array/functions/ for instance has all the array based functions. Way simpler to scrape the html itself if thats the way to go.

oliverschloebe commented 8 years ago

Thanks a lot, Daniel! I'm sure I can get something to work from your info. :smiley:

danieliser commented 8 years ago

@AlphawolfWMP Awesome, a little more digging showed that most IDEs use the PHD custom exports for their auto complete, so that is likely your best bet at a clean source with minimal hassle.

danieliser commented 8 years ago

On that note, would you want to team up on an official WP plugin-check toolset? Would like to automate some of the plugin review teams efforts using a simple plugin and more advanced build tools.

oliverschloebe commented 8 years ago

@danieliser There already seem to be some kind of "plugin check" plugin https://wordpress.org/plugins/plugincheck/ but feel free to kickstart a WP plugin-check toolset. I'm happy to help whereever I can but I'm pretty much involved in other projects this year so I probably wouldn't be a reliable contributor. Sorry.

danieliser commented 8 years ago

@AlphawolfWMP - Yea the plugin review team said it doesn't cover 5% of whats actually needed.

Also the Theme Review Team pointed me to their current workings on automation here: https://github.com/WPTRT/WordPress-Coding-Standards

I plan on forking it and starting a rebuild based on plugins as that one is very theme centric.

There used to be a plugin-check plugin available but it also wasn't nearly capable enough.

https://plugins.svn.wordpress.org/plugin-check/trunk/

I think if you ever get this tool & the php tool packaged into a build tool, I would love to include it in my build routines as I am sure others would.

JDGrimes commented 8 years ago

@danieliser — You might want to have a look at the WordPress Coding Standards ruleset for PHPCS. There is an open ticket to add checks for deprecated functions, including links to some related tools.

oliverschloebe commented 8 years ago

Okay, so far I managed to compile an array of PHP functions and their version string from the PhD package: https://wpseek.com/test.php

Next up: Parsing the version strings.

danieliser commented 8 years ago

@AlphawolfWMP You are awesome. And insanely fast. Or at least have way more time to commit to projects than I do. Though I just made changes to my business that will give me 10x more time to create awesome stuff.

Parsing the version strings should be pretty simple for you I'm sure :100:

danieliser commented 8 years ago

Sorry wrong button.

danieliser commented 8 years ago

Mind telling me / others what setup and arguments you used with PhD?

danieliser commented 8 years ago

@JDGrimes Thanks for the tip, have bookmarked it to reasearch :).

oliverschloebe commented 8 years ago

@danieliser Currently I'm compiling the doc files by running this command:

phd --docbook doc-base/.manual.xml --package IDE --format json --format 'funclist'

This results in a list of function names in a single .txt file plus one json file for each PHP function.

As for parsing the version strings I'm not exactly sure which info I even want to parse and use in the Plugin Doctor. Strings like PHP 5 >= 5.1.0, PHP7`orPHP 4, PHP 5, PHP 7are self explanatory but strings likePHP 5 < 5.3.0` are quite unspecific and I'm not yet sure if that info would be useful for the Plugin Doctor.

danieliser commented 8 years ago

@AlphawolfWMP I belive the PHP 5 < 5.3.0 represents a function that was deprecated in 5.3.0.

So maybe parse them all into something like this

array(

'split' => array(
    'added' => '4',
    'deprecated' => '5.3'
)

Then you can scan for min & max php versions supported.

danieliser commented 8 years ago

The ones that I am not sure about are the PECL functions. Assume that is a php extension, not sure if its relevant to your / our needs.

oliverschloebe commented 8 years ago

@danieliser But what'd be the 'since' part for a statement like PHP 5 < 5.3.0? It tells us it was deprecated in 5.3.0 but not when it was added. If that info is missing I'm not sure about their usability assuming we want to list all used PHP functions by when they have been added so we can easily go through the list and find ways to lower the required PHP version of the checked WP plugin.

Regarding PECL I agree to omit them - at least in the current iteration of the Plugin Doctor.

danieliser commented 8 years ago

@AlphawolfWMP In this case I believe its fair to say PHP 5. Since this is WP specific you could even set it to 5.2 which is the minimum required for WP itself.

danieliser commented 7 years ago

@AlphawolfWMP Found this just now, thought it might be a shortcut to adding this quickly: http://phpduck.com/minimum-php-version-script/

oliverschloebe commented 7 years ago

@danieliser Thanks! Unfortunately can't really tell when I'll find the time to have a look at it (life and work really keeps me busy atm) but I'll try to continue working on this ASAP.