Problem/Motivation

Per @webchick in #2042447-175: Install a module user interface does not install modules (or themes):

  1. "Authorize file system changes" as a title?
  2. Escaped HTML for links? Taken care of in #1885564: theme.maintenance.inc (authorize.php) - Convert theme_ functions to Twig
  3. Links going to /core/authorize.php/admin/modules and the like, which is a 403? (Apache error; same as #168).

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug
Issue priority Follow up to a major issue: #2526392: authorize.php redirects to authorize.php/<none> at the end of the batch run. Only changes page title

Comments

stefan.r created an issue. See original summary.

stefan.r’s picture

Issue tags: +Novice

Once we figure out where the double escaping comes from and have a new title for this page, this could be a novice issue

stefan.r’s picture

Issue summary: View changes
joelpittet’s picture

Issue summary: View changes
David_Rothstein’s picture

Note that #3 (links going to /core/authorize.php) is also partially fixed in the latest patches at #1885564: theme.maintenance.inc (authorize.php) - Convert theme_ functions to Twig (the reason being that it touches the same code needed to fix the double escaping, #2).

If we leave it in that issue rather than this one, that leaves this:

1. "Authorize file system changes" as a title?

Which I'm not so convinced is a novice issue. We'd need to figure out why the session variable isn't being used in this code, which is therefore causing it to fall back to the default title:

  if (isset($_SESSION['authorize_page_title'])) {
    $page_title = $_SESSION['authorize_page_title'];
  }
  else {
    $page_title = t('Authorize file system changes');
  }
stefan.r’s picture

Title: Fix confirmation screen for Update Manager (authorize.php) » Page title session variable isn't being used in confirmation screen for Update Manager (authorize.php)
Issue tags: -Novice
stefan.r’s picture

Issue summary: View changes
David_Rothstein’s picture

Status: Active » Needs review
StatusFileSize
new822 bytes
new1.71 KB

Was maybe semi-novice in the end :) Fixed by putting back some code that existed in Drupal 7 but was removed in #2192653: Remove drupal_set_title from authorize.php. Added a test also.

stefan.r’s picture

StatusFileSize
new3.48 KB

Ah, was just about to post a patch :)

@david_rothstein your patch looks good in manual testing as well. Let's remove the passing along of the title in system_authorized_init() as it's now already being set in update.authorize.inc?

stefan.r’s picture

oops I meant to remove that patch before posting the comment in #9.. I like the approach in #8

stefan.r’s picture

StatusFileSize
new1.53 KB
new3.47 KB

The last submitted patch, 8: 2547667-authorize-php-page-title-8-TESTS-ONLY.patch, failed testing.

The last submitted patch, 9: 2547667-8.patch, failed testing.

joelpittet’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new136.33 KB

Thanks @stefan.r. This looks to work well, I tried install and update a module.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work

That will break the FTP/SSH case, though - since in that case authorize.php displays a form before the batch ever runs, and the form needs the correct title too.

Maybe we should do the opposite instead, though (always set the title at the beginning of the batch, never at the end)?

David_Rothstein’s picture

Status: Needs work » Needs review
StatusFileSize
new3.53 KB
new1.82 KB

Oh actually we can't do that though (at least not easily), since system_authorized_init() is not used in those cases.

This goes back to #8, but with a code comment explaining why we can't remove the page titles from the system_authorized_init() calls. The interdiff is from #8.

David_Rothstein’s picture

StatusFileSize
new5.15 KB
new1.84 KB

My comment in #16 is wrong - we actually can do it easily (just set the title at the beginning of the batch process rather than the end). But it turns out there's already code trying to set a different title at the beginning of the batch process to use while the batch is running. It wasn't working though. So even with the above patches applied, you still see "Authorize file system changes" on the screen while the batch is in the middle of running.

The attached should make it work as desired all around. So the pattern now is:

  1. At the beginning of the batch process, if a form is displayed (only true in the FTP/SSH case) the page title is "Update manager".
  2. While the batch is running the title is either "Installing [project]" or "Installing updates".
  3. When the batch is complete, the title is "Update manager".

Note that for manually testing this, you may need to log out and log back in again each time (otherwise the title from the previous round may still be in your session and get used as a result of that, thereby making the bug look like it's fixed when it actually isn't).

stefan.r’s picture

Issue tags: +Needs manual testing

Yes, that makes sense!

stefan.r’s picture

Issue tags: -Needs manual testing
StatusFileSize
new338.27 KB
new57.97 KB
new55.81 KB
new77.61 KB

This seemed to work fine in manual testing, code looks OK to me as well

joelpittet’s picture

@David_Rothstein can you elaborate on this point you made in #18?

Note that for manually testing this, you may need to log out and log back in again each time (otherwise the title from the previous round may still be in your session and get used as a result of that, thereby making the bug look like it's fixed when it actually isn't

Will that introduce bugs for people installing multiple projects sequentially?

David_Rothstein’s picture

I should have clarified - I ran into that issue when testing the current 8.0.x behavior only (without the patch). Since some testing scenarios put the title in $_SESSION and others didn't, it was possible to run one scenario and think it worked correctly, but in actuality it only worked correctly because you had the title in $_SESSION from before.

With the patch, I believe the title gets set explicitly in every case, so if there's already something in $_SESSION it will be overwritten with the correct value. So I don't think you can run into that problem anymore.

Technically there is probably a small (existing) bug here that the page title in $_SESSION never gets unset once authorize.php is done using it... But after this patch I don't think that will matter in practice.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the clarification because when I attempted to reproduce that, I couldn't:)

andypost’s picture

Issue tags: +Needs followup

+1 to fix bug

+++ b/core/modules/update/update.authorize.inc
@@ -107,6 +110,11 @@ function update_authorize_run_install($filetransfer, $project, $updater_name, $l
+  $_SESSION['authorize_page_title'] = t('Installing %project', array('%project' => $project));

@@ -249,6 +257,7 @@ function update_authorize_update_batch_finished($success, $results) {
   $_SESSION['authorize_results']['messages'] = $results['log'];
   $_SESSION['authorize_results']['tasks'] = $results['tasks'];
+  $_SESSION['authorize_page_title'] = t('Update manager');

@@ -309,6 +318,7 @@ function update_authorize_install_batch_finished($success, $results) {
   $_SESSION['authorize_results']['messages'] = $results['log'];
   $_SESSION['authorize_results']['tasks'] = $results['tasks'];
+  $_SESSION['authorize_page_title'] = t('Update manager');

it needs follow-up to bring sanity.
"installing..." is a state of results so should live in that array key

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: 2547667-authorize-php-page-title-17.patch, failed testing.

David_Rothstein’s picture

Status: Needs work » Reviewed & tested by the community

Moving back to RTBC on the assumption that failure wasn't real.

stefan.r’s picture

Title: Page title session variable isn't being used in confirmation screen for Update Manager (authorize.php) » Fix broken page title Update Manager (authorize.php)
Issue summary: View changes
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Awesomesauce.

Committed and pushed to 8.0.x. Thanks!

  • webchick committed 89ce95a on 8.0.x
    Issue #2547667 by stefan.r, David_Rothstein, joelpittet: Fix broken page...

Status: Fixed » Closed (fixed)

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