We must not forget that the wheel is reinvented so often because it is a very good idea; I’ve learned to worry more about the soundness of ideas that were invented only once.
–David L. Parnas
In my coding on several projects I have found that I sometimes need to know what the latest version of wordpress that is available. Surprisingly I couldn’t find any documented rpc service or api call from wordpress.org. I saw alot of people writing there own version checkers including this fellow at “Follow The White Rabbit”. Although incredibly old, Peter is using his own server to check against and of course you see a bunch of comments with people having problems. We also know that every version of a Wordpress install is unsecure an allows access to wp-includes/version.php. However for this project we don’t need or want the individual install version. What we want is the “latest” release from wordpress.
I made my own version and in a way it is using wordpress.org. Basically it uses there /latest redirect that serves up the latest wordpress compressed file. The filename always has the same format and you can grab just the filename using header(’content-disposition’); that way eliminating the call for the entire file. In the filename exists the version and thus you have the version number. For variety I used fsockopen instead of curl, either would work.
$v){
if(strstr($v,':')){
$arr2 = explode(':',$v);
$headers[$arr2[0]] = $arr2[1];
}
}
$datarep = $headers['Content-Disposition'];
if(isset($datarep)){
$wordpress_filename = substr($datarep,strpos($datarep,'=')+1);
echo str_replace('.tar.gz','',$wordpress_filename);
}
?>
Completely unrelated, I also found this quote
Destructors for virtual base classes are executed in the reverse order of their appearance in a depth-first left-to-right traversal of the directed acyclic graph of base classes….
– B. Stroustrup, The C++ Programming Language, p. 575
Which I would just like to point out was one of the worse books I’ve ever read. I wouldn’t of read it if it wasn’t mandatory computer science material.











