我一直在使用端点https://updates.drupal.org/release-history/[module]/[version],其中模块是模块名,版本是它的版本(如8.x或7.x)。然而,这个端点对9.x不起作用。
例如,https://updates.drupal.org/release-history/search_api接口_solr/8.x工作得很好,但是https://updates.drupal.org/release-history/search_api接口_solr/9.x什么也没有,尽管是该模块的版本与Drupal 9兼容.。
此外,8.x的端点不返回SEMVER格式的新版本。
如何获得Drupal 9的模块版本?为什么不包括SEMVER版本?
发布于 2020-06-11 08:54:42
您可以使用https://updates.drupal.org/release-history/search_api接口_solr/电流获得以8.x为前缀的版本,也可以不使用API兼容性前缀。( SEMVER版本的情况就是后者。)
例如,该URL的输出包含有关此版本的信息。
<release>
<name>search_api_solr 4.1.1</name>
<version>4.1.1</version>
<tag>4.1.1</tag>
<status>published</status>
<release_link>https://www.drupal.org/project/search_api_solr/releases/4.1.1</release_link>
<download_link>https://ftp.drupal.org/files/projects/search_api_solr-4.1.1.tar.gz</download_link>
<date>1591714636</date>
<files>
<file>
<url>https://ftp.drupal.org/files/projects/search_api_solr-4.1.1.tar.gz</url>
<archive_type>tar.gz</archive_type>
<md5>7f2dbc01229b118c02c66f4ac210d430</md5>
<size>3207604</size>
<filedate>1591714636</filedate>
</file>
<file>
<url>https://ftp.drupal.org/files/projects/search_api_solr-4.1.1.zip</url>
<archive_type>zip</archive_type>
<md5>511e33c0b0ae47a0bd455109f87d07d1</md5>
<size>3792678</size>
<filedate>1591714636</filedate>
</file>
</files>
<terms>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
<security covered="1">Covered by Drupal's security advisory policy</security>
<core_compatibility>^8.8 || ^9</core_compatibility>
</release>它还包含此版本的数据。(这表明URL并不只返回SEMVER版本的信息。)
<release>
<name>search_api_solr 8.x-3.9</name>
<version>8.x-3.9</version>
<tag>8.x-3.9</tag>
<status>published</status>
<release_link>https://www.drupal.org/project/search_api_solr/releases/8.x-3.9</release_link>
<download_link>https://ftp.drupal.org/files/projects/search_api_solr-8.x-3.9.tar.gz</download_link>
<date>1581700341</date>
<files>
<file>
<url>https://ftp.drupal.org/files/projects/search_api_solr-8.x-3.9.tar.gz</url>
<archive_type>tar.gz</archive_type>
<md5>5050a8e2bd6b4965d414cade7aae3dc8</md5>
<size>1052117</size>
<filedate>1581700341</filedate>
</file>
<file>
<url>https://ftp.drupal.org/files/projects/search_api_solr-8.x-3.9.zip</url>
<archive_type>zip</archive_type>
<md5>140f15134d4e8f2239b96e682186e021</md5>
<size>1278054</size>
<filedate>1581700341</filedate>
</file>
</files>
<terms>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>New features</value>
</term>
</terms>
<security covered="1">Covered by Drupal's security advisory policy</security>
<core_compatibility>^8.7.7 || ^9</core_compatibility>
</release>不幸的是,没有一种方法可以获得与Drupal 9兼容的所有版本,而不仅仅是使用updates.drupal.org URL与Drupal 8兼容的版本。为此,您需要解析XML输出并过滤<core_compatibility>标记中包含^9的版本。
顺便指出,all,8.x,7.x端点被认为是遗留的.我想这意味着他们可以在未来被移除。
https://drupal.stackexchange.com/questions/294458
复制相似问题