-
Notifications
You must be signed in to change notification settings - Fork 18
add drupal 9 support #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
add drupal 9 support #152
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,6 +193,11 @@ public function processRequestData($requestData) { | |
| $recommendedMajorVersion = (string) $requestXmlObject->recommended_major; | ||
| $supportedMajor = (string) $requestXmlObject->supported_majors; | ||
| $supportedMajorVersions = explode(',', $supportedMajor); | ||
| } else { | ||
| // TODO This will need to be reworked once Drupal 10 is out | ||
| // In the current xml file, supported_majors key doesn't exist | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bad intendation. |
||
| $recommendedMajorVersion = (string) 9; | ||
| $supportedMajorVersions = [9]; | ||
| } | ||
|
|
||
| $latestReleaseVersions = array(); | ||
|
|
@@ -210,6 +215,10 @@ public function processRequestData($requestData) { | |
| /*if (!is_null($versionInfo['extra'])) { | ||
| continue; | ||
| }*/ | ||
| }elseif(preg_match('/^(' . implode('|', $supportedMajorVersions) . ')/', $release->version, $matches)){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style problems with spacing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This RX is hard to read. |
||
| $key = array_search($matches[1], $supportedMajorVersions); | ||
| $release->version_major = $matches[1]; | ||
| $latestReleaseVersions[$supportedMajorVersions[$key]][] = $release; | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -246,7 +255,14 @@ public function processRequestData($requestData) { | |
| * @return mixed | ||
| */ | ||
| protected function getRequestUrl() { | ||
| return 'https://updates.drupal.org/release-history/' . $this->moduleRequestName . '/' . $this->moduleRequestVersion; | ||
| // TODO This might change in the future | ||
| // drupal update release history for 9.x doesn't exist, we need to use /current for now | ||
| // might change in the future | ||
| if ($this->moduleRequestName == 'drupal' && $this->moduleRequestVersion == '9.x') { | ||
| return 'https://updates.drupal.org/release-history/' . $this->moduleRequestName . '/current'; | ||
| } else { | ||
| return 'https://updates.drupal.org/release-history/' . $this->moduleRequestName . '/' . $this->moduleRequestVersion; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -292,13 +308,16 @@ protected function updateContribModules() { | |
|
|
||
| /** @var DrupalModuleDocument $module */ | ||
| foreach ($modules as $module) { | ||
| if (empty($module->getProjectName())) | ||
| continue; | ||
|
|
||
| $this->logger->addInfo('Updating - ' . $module->getProjectName() . ' for version: ' . $version); | ||
|
|
||
| try { | ||
| $this->processDrupalUpdateData($module->getProjectName(), $version); | ||
| } | ||
| catch (\Exception $e) { | ||
| $this->logger->addWarning(' - Unable to update module version [' . $version . ']: ' . $e->getMessage()); | ||
| $this->logger->addWarning(' - Unable to update module ' . $module->getProjectName() . ' version [' . $version . ']: ' . $e->getMessage()); | ||
| continue; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect it fails with Drupal 10, because the regex would capture only
0, skipping1.I suggest to use
/^(\d+)\./. It's also easier to read.Another alternative would be: