Problem/Motivation

Also note this:

There are cases the upgrade in #37 doesn't catch:

+-----+----------+--------+----------+
| pid | source | alias | langcode |
+-----+----------+--------+----------+
| 1 | /node/1 | /test1 | en |
| 2 | /node/2 | /biii | en |
| 3 | //node/1 | /bar | en |
+-----+----------+--------+----------+
3 rows in set (0.00 sec)
1. Adds forward slash to a source that already has a forward slash.
2. If we fixed #1, we'd additionally have to de-duplicate the /node/1 source when the alias is the same - although apparently the url_alias table has no unique key, so you can have 100% duplicate aliases and that wouldn't fatal at least.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

FileSize
5.48 KB

Extracting the existing tests from the other issue

dawehner’s picture

jibran’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: 2511962-1.patch, failed testing.

effulgentsia’s picture

Project: Drupal core » HEAD to HEAD
Version: 8.0.x-dev »
Component: system.module » Code
jhedstrom’s picture

+++ b/core/modules/system/src/Tests/Update/UpdatePathUrlAliasSlashTest.php
@@ -0,0 +1,55 @@
+    $alias = $alias_storage->load(['destination' => '/destination1']);
...
+    $alias = $alias_storage->load(['destination' => '/destination2']);

Tests are failing since this should be alias rather than destination.

jhedstrom’s picture

Status: Needs work » Needs review
FileSize
7.27 KB

Here's the start of moving #1 to beta2beta. The tests won't pass because the module is refusing to run the updates since Beta 12 isn't out yet. Will probably have to rework that logic in order to make these testable.

googletorp’s picture

jhedstrom’s picture

These tests go green if run from 8.0.0-beta12. I think we should perhaps add a way for tests to run from the latest 8.0.x if #2514858: Enable automated tests for this module is to work correctly.

Corregidor’s picture

I believe there is a mistake in the sqlite case. Also, reword to prepend instead of append:

+  // Updates {url_alias} to prepend '/'.
+  $query = \Drupal::database()->update('url_alias');
+
+  if (\Drupal::database()->databaseType() !== 'sqlite') {
+    $query->expression('source', "concat('/', source)");
+    $query->expression('alias', "concat('/', alias)");
+  }
+  else {
+    $query->expression('source', "'/' || source");
+    $query->expression('alias', "'/' || alias");
+  }
+
tanc’s picture

Also anywhere a path has been specified in block visibility settings it will need updating to add the slash. At least it seems this way from my limited testing.

jhedstrom’s picture

Version: » 8.x-1.x-dev
FileSize
753 bytes
6.66 KB

This addresses #10.

This current patch combined with #2527818: Provide beta11 to beta12 test has everything working as expected. It does not provide an update hook for #11 though.

This patch also removes the config schema, which was added in #2528402: Config schema is missing.

Status: Needs review » Needs work

The last submitted patch, 12: beta2beta-update-2509300--2511962-12.patch, failed testing.

jhedstrom’s picture

Status: Needs work » Needs review
FileSize
4.66 KB
8.07 KB

This adds an update hook (and test) for the block visibility settings noted in #11.

I've updated these tests to use the new base class introduced in #2527818: Provide beta11 to beta12 test. Note these tests won't pass until core issue #2527816: Logic error in SqlContentEntityStorage::countFieldData() attempts to drop `name` column is committed, but they are passing locally for me with that patch applied.

Status: Needs review » Needs work

The last submitted patch, 14: beta2beta-update-2509300--2511962-14.patch, failed testing.

Berdir’s picture

In #2528178: Provide an upgrade path for blocks context IDs #2354889 (context manager), we explicitly work with config objects directly to avoid hooks and so on as much as possible. Might be a good idea here as well.

jhedstrom’s picture

Status: Needs work » Needs review
FileSize
11.66 KB
9.16 KB

I've updated the tests to use more direct db insert/update statements as suggested in #16. I've also consolidated all of the tests for this update hook into one test class.

Status: Needs review » Needs work

The last submitted patch, 17: beta2beta-update-2509300--2511962-17.patch, failed testing.

Status: Needs work » Needs review
jhedstrom’s picture

Assuming the testbot one day decides to run this test and it goes green, are there any objections to the current update hooks in this patch? I think they address all concerns mentioned above at this point.

Berdir’s picture

Looks fine to me. Let's get it in, we can still fix bugs in follow-ups or extend it. I'll likely start testing this on real sites soon, thanks so much for all your work on this. Very appreciated.

  • jhedstrom committed f6d6f79 on 8.x-1.x
    Issue #2511962 by jhedstrom, dawehner: Upgrade path for 2509300
    
jhedstrom’s picture

Status: Needs review » Fixed

Committed #17.

Status: Fixed » Needs work

The last submitted patch, 17: beta2beta-update-2509300--2511962-17.patch, failed testing.

jhedstrom’s picture

Status: Needs work » Fixed

lol, it decided to run them immediately after I'd committed the patch :)

Tests are green in other issues now.

Status: Fixed » Closed (fixed)

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