Problem/Motivation

Locale module makes use of update_process_info_list() to get project information. Without update module interface translations can not be downloaded or updated because the is not information about the project available. This will result in (partly) untranslated sites and thus bad user experience when for example the 'Check for updates automatically' is disabled during installation.

Proposed resolution

The proposed solution is to move the functions responsible for parsing the project information out of Update module into a file includes/project.inc

When this move is completed, the project data handling and caching can be improved in #1832946: Runtime translation download fallback works different from installer translation download fallback.

Remaining tasks

Improve the project data handling in #1832946: Runtime translation download fallback works different from installer translation download fallback

User interface changes

none

API changes

t.b.d.

none

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sutharsan’s picture

Issue tags: +D8MI, +sprint
FileSize
113.72 KB

This patch only moves code around, changes related documentation and changes function names. In https://drupal.org/node/1832946#comment-6922286 dww asked not to use the 'project' namespace as this will conflict with Project module. The patch uses 'drupal_project_' in line with existing functions in core/include/*.inc.

Following function names are changed:
update_process_info_list() to drupal_project_process_info_list()
update_get_project_name() to drupal_project_get_project_name()
update_process_project_info() to drupal_project_process_project_info()

Sutharsan’s picture

FileSize
28.78 KB

Ignore #1 patch, I forgot rebase before making the patch. This is what is was meant to be.

Sutharsan’s picture

I missed one function:
update_filter_project_info() to drupal_project_filter_project_info

Sutharsan’s picture

Status: Needs review » Needs work

Some more coming up, but need to sleep first.

Sutharsan’s picture

Status: Needs work » Needs review
FileSize
7.05 KB
24.82 KB

Ok, this is the patch. I've moved one function back.
The patch now moves drupal_project_process_info_list() and the functions its calls into a new project.inc file. These are the functions that collects and structures project information which will be used by Locale and Update module for their project processing.

update_process_info_list() changed to drupal_project_process_info_list()
update_get_project_name() changed to drupal_project_get_project_name()
update_filter_project_info() changed to drupal_project_filter_project_info()

webflo’s picture

FileSize
24.79 KB
+++ b/core/modules/update/update.api.phpundefined
@@ -28,11 +28,11 @@
- * @see update_process_info_list()
+ * @see update_process_info_list(drupal_project_process_info_list

Found one wrong @see comment and fixed it.

kfritsche’s picture

Status: Needs review » Reviewed & tested by the community

Code seems reasonable. Nothing to complain from my side.

Did also a manual test:
Freshly install of Drupal
Downloaded config_translation
Added to the config_translation.info.yml file:

project: config_translation
version: 8.x-1.0

Did a update/check and no errors occurred.

Detected that there could be a newer version because of missing publication date. Also added a datestamp and everything worked fine.

So RTCB now, when green.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

All right, let's refactor this to a small tiny utility class. After talking to @alexpott.

webflo’s picture

Status: Needs work » Needs review
FileSize
25.41 KB

We move this code to \Drupal\Core\Utility\ProjectInfo

Gábor Hojtsy’s picture

Status: Needs review » Needs work
Issue tags: +language-ui
+++ b/core/lib/Drupal/Core/Utility/ProjectInfo.phpundefined
@@ -0,0 +1,229 @@
+ * @file
+ * Definition of Drupal\Core\Utility\ProjectInfo

Contains and \Drupal....

+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.phpundefined
@@ -287,7 +287,8 @@ function testUpdateHiddenBaseTheme() {
+    $project_info = new \Drupal\Core\Utility\ProjectInfo();
+    $project_info->processInfoList($projects, $theme_data, 'theme', TRUE);

Nananananna! Do a use and then only ProjectInfo here.

webflo’s picture

Status: Needs work » Needs review
FileSize
1.42 KB
25.56 KB

Changes the docs and added a use statement.

Gábor Hojtsy’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Utility/ProjectInfo.phpundefined
@@ -2,13 +2,16 @@
- * Definition of Drupal\Core\Utility\ProjectInfo
+ * Contains Drupal\Core\Utility\ProjectInfo

Needs slash.

+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.phpundefined
@@ -7,6 +7,8 @@
+use \Drupal\Core\Utility\ProjectInfo;

Should not have slash.

webflo’s picture

Status: Needs work » Needs review
FileSize
1.86 KB
25.56 KB

Applied coding standards.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks all great now, yay!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This just pushes code around... we can now clean up up the passing the array by reference, create an interface, and define the scope of the methods in a followup.

Committed c56cb20 and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Issue tags: -sprint

Yay!