[wp-hackers] WordPress versions <-> functions map
Leonid Mamchenkov
leonid at mamchenkov.net
Sat Sep 29 16:03:08 GMT 2007
Hi,
On 9/29/07, Viper007Bond <viper at viper007bond.com> wrote:
> I've been thinking about this for the past half hour or so and I actually
> think it'd be a lot, lot easier than I had previously thought. Infact, I
> think I might actually be able to pull it off!
Here is a little help to get you started.
Generating a list of functions per WP version is a once off operation
(only needs to be repeated for each new version coming out). I guess
doing it in command line is simpler and shorter than in PHP. Here is
a working example, which I ran in a tags/ directory checked out from
WP SVN:
======
for DIR in * ; do cd $DIR && echo "Working on $DIR" && grep '^function
' `find | grep '.php' | grep -v '.svn'` | sed -e 's/^.*:function //'
-e 's/(.*$//' | sort | uniq > "../$DIR.txt" && cd .. ; done
======
It works for about half a minute on my ancient laptop and produces a
list of text files like:
2.0.txt
2.1.1.txt
2.1.2.txt
2.1.3.txt
2.1.txt
2.2.1.txt
2.2.2.txt
2.2.3.txt
2.2.txt
2.3.txt
In each of those files there is an alphabetically sorted list of
functions for that version. One function per line with no parameters
or anything. The list of functions looks something like:
__
add_action
add_clean_index
add_custom_image_header
add_feed
add_filter
add_js
add_link
addLoadEvent
add_magic_quotes
add_management_page
add_menu_page
With something as trivial as grep and diff you can find the
differences between version and all version where the function exists,
and from there - when it was first defined.
Overall it works pretty good for something I spent 10 minutes on. The
things that you should keep in mind are:
- the above looks for function definitions which only happen in .php
files and start from the beginning of line.
- the above doesn't care if the php file was actually included or not,
or if the function is commented out via multiline comment
And just to give a digital candy to anyone who finished reading this
long email, here are some simple stats from the resulting files.
Number of functions per WordPress version:
552 1.5
569 1.5.1
569 1.5.1.1
569 1.5.1.2
569 1.5.1.3
570 1.5.2
702 2.0
706 2.0.1
706 2.0.2
718 2.0.3
729 2.0.4
733 2.0.5
735 2.0.6
735 2.0.7
735 2.0.8
735 2.0.9
738 2.0.10
744 2.0.11
883 2.1
883 2.1.1
883 2.1.2
887 2.1.3
951 2.2
953 2.2.1
953 2.2.2
954 2.2.3
1058 2.3
Enjoy ;)
--
Leonid Mamchenkov
More information about the wp-hackers
mailing list