4

I am listing all modules used by site on our platform. Given a module name, how could I programmatically check if a Drupal 8 version is available?

5 Answers 5

3

The easiest way would be to consume the update feed, e.g.:

http://updates.drupal.org/release-history/module_filter/8.x

Gives you

<error>No release history available for module_filter 8.x.</error>

While

http://updates.drupal.org/release-history/views/8.x

gives you

<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Views</title>
<short_name>views</short_name>
<dc:creator>merlinofchaos</dc:creator>
<type>project_module</type>
<api_version>8.x</api_version>
<project_status>unsupported</project_status>
<link>https://www.drupal.org/project/views</link>
<terms>
<term>
<name>Projects</name>
<value>Modules</value>
</term>
<term>
<name>Maintenance status</name>
<value>Seeking co-maintainer(s)</value>
</term>
<term>
<name>Development status</name>
<value>Under active development</value>
</term>
</terms>
<releases>
<release>
<name>views 8.x-3.x-dev</name>
<version>8.x-3.x-dev</version>
<tag>8.x-3.x</tag>
<version_major>3</version_major>
<version_extra>dev</version_extra>
<status>published</status>
<release_link>https://www.drupal.org/node/1595020</release_link>
<download_link>http://ftp.drupal.org/files/projects/views-8.x-3.x-dev.tar.gz</download_link>
<date>1382152087</date>
<mdhash>b1adfb5f2d048e004fd830754546c8f9</mdhash>
<filesize>491125</filesize>
<files>
<file>
<url>http://ftp.drupal.org/files/projects/views-8.x-3.x-dev.tar.gz</url>
<archive_type>tar.gz</archive_type>
<md5>b1adfb5f2d048e004fd830754546c8f9</md5>
<size>491125</size>
<filedate>1382152087</filedate>
</file>
<file>
<url>http://ftp.drupal.org/files/projects/views-8.x-3.x-dev.zip</url>
<archive_type>zip</archive_type>
<md5>67579f47179eeeadf43b7d7501b9cf81</md5>
<size>816701</size>
<filedate>1382152088</filedate>
</file>
</files>
</release>
</releases>
</project>
1
  • This is the theoretically correct answer, the real answer is @Jonathan 's.
    – user49
    Commented Dec 9, 2015 at 0:53
3

For non programmatical way.

Download and install the Upgrade Status Module

0
1

nothing to be particularly proud about but in case it can help somebody out :

 foreach ($list_modules as $name => $modules){   

$feed_url="http://updates.drupal.org/release-history/".strtolower($name)."/8.x";
$xml = simplexml_load_file($feed_url);

 $d8='no D8 version';   
foreach($xml->children() as $child)
{
    $childname= $child->getName();

    if($childname == "releases")
    {
        $d8='';
        foreach ($child->release as $release){
            $d8.=$release->version.' - ';
        }
        $output.='<a href='.$feed_url.'><div class="versiond8">'.$d8.'</div></a>';      
    }   
}

if ($d8=='no D8 version')
    $output.='<div class="versiond8">'.$d8.'</div>';


$module_url='https://www.drupal.org/project/'.$name;    
$output.='<a href='.$module_url.'><div class="drupal_site">module doc</div></a>';


}
0

While you can programatically check whether a D8 version is nominally available, the reality is much more complex. Sometimes they are available but not working, sometimes they are deprecated in favour of a new module, sometimes in core, other times there is a fully working but unofficial version that a programtic approach would not find.

I see no worthwhile alternative to looking closely at each module.

0

Simply to track for your own purposes so you can monitor the general state of your site, see http://d8upgrade.org/

I started using their service a while back when you had to send them a list of modules. They now claim to have a way to scan your site and build the list automatically. They also maintain a module database for modules with over 300(?) users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.