TransWikia.com

Applying patch on core module failing

Drupal Answers Asked by Nabil on January 6, 2021

I am trying to apply patch on core module systems. But it is failing with the message "Could not apply patch! Skipping. The error was: Cannot apply patch patches/path-alias-8.9.2.patch". Below is my composer.json file and patch file

{
"name": "drupal-composer/drupal-project",
"description": "Project template for Drupal 8 projects with composer",
"type": "project",
"license": "GPL-2.0-or-later",
"authors": [
    {
        "name": "",
        "role": ""
    }
],
"repositories": [
    {
        "type": "composer",
        "url": "https://packages.drupal.org/8"
    }
],
"require": {
    "composer/installers": "^1.2",
    "cweagans/composer-patches": "^1.6",
    "drupal-composer/drupal-scaffold": "^2.5",
    "drupal/admin_toolbar": "^2.3",
    "drupal/apigee_edge": "1.x-dev",
    "drupal/autologout": "1.x-dev",
    "drupal/autoslave": "1.x-dev",
    "drupal/backup_migrate": "^4.0",
    "drupal/console": "^1.0.2",
    "drupal/core": "~8.9.3",
    "drupal/devel": "1.x-dev",
    "drupal/group": "^1.0@RC",
    "drupal/health_check": "1.x-dev",
    "drupal/jwt": "0.x-dev",
    "drupal/paragraphs": "^1.5",
    "drupal/permissions_filter": "^1.0",
    "drupal/rest_menu_items": "2.x-dev",
    "drupal/rest_password": "^1.3",
    "drupal/restui": "^1.15",
    "drupal/select_registration_roles": "1.x-dev",
    "drupal/simplesamlphp_auth": "^3.0",
    "drupal/smtp": "1.x-dev",
    "drupal/unlimited_number": "2.x-dev",
    "drupal/user_registrationpassword": "1.x-dev",
    "drupal/views_base_url": "1.x-dev",
    "drush/drush": "^9.0.0",
    "vlucas/phpdotenv": "^2.4",
    "webflo/drupal-finder": "^1.0.0",
    "webmozart/path-util": "^2.3"
},
"require-dev": {
    "webflo/drupal-core-require-dev": "~8.9.3"
},
"conflict": {
    "drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
    "sort-packages": true
},
"autoload": {
    "classmap": [
        "scripts/composer/ScriptHandler.php"
    ],
    "files": ["load.environment.php"]
},
"scripts": {
    "pre-install-cmd": [
        "DrupalProject\composer\ScriptHandler::checkComposerVersion"
    ],
    "pre-update-cmd": [
        "DrupalProject\composer\ScriptHandler::checkComposerVersion"
    ],
    "post-install-cmd": [
        "DrupalProject\composer\ScriptHandler::createRequiredFiles"
    ],
    "post-update-cmd": [
        "DrupalProject\composer\ScriptHandler::createRequiredFiles"
    ],
    "build-script": [
         "./vendor/bin/drush cr",
         "./vendor/bin/drush config:import --yes",
         "./vendor/bin/drush cr"
    ]
},
"extra": {
    "installer-paths": {
        "web/core": ["type:drupal-core"],
        "web/libraries/{$name}": ["type:drupal-library"],
        "web/modules/contrib/{$name}": ["type:drupal-module"],
        "web/profiles/contrib/{$name}": ["type:drupal-profile"],
        "web/themes/contrib/{$name}": ["type:drupal-theme"],
        "drush/Commands/{$name}": ["type:drupal-drush"]
    },
    "drupal-scaffold": {
        "initial": {
            ".editorconfig": "../.editorconfig",
            ".gitattributes": "../.gitattributes"
        }
    },
    "enable-patching": true,
    "patches": {
      "drupal/core": {
        "Missing table path_alias fix": "patches/path-alias-8.9.2.patch"
      }
    }
}

}

diff --git a/web/core/modules/system/system.install b/web/core/modules/system/system.install
index f8f9e5509d..12acf49401 100644
--- a/web/core/modules/system/system.install
+++ b/web/core/modules/system/system.install
@@ -2663,8 +2663,124 @@ function system_update_8802() {
 * Install the 'path_alias' entity type.
 */
 function system_update_8803() {
+  $schema['path_alias'] = [
+    'description' => 'The base table for path_alias entities.',
+    'fields' => [
+      'id' => [
+        'description' => 'Identifier',
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ],
+      'revision_id' => [
+        'description' => 'Revision ID',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ],
+      'uuid' => [
+        'description' => 'UUID',
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+      ],
+      'langcode' => [
+        'description' => 'Langcode',
+        'type' => 'varchar',
+        'length' => 12,
+        'not null' => TRUE,
+      ],
+      'path' => [
+        'description' => 'Path',
+        'type' => 'varchar',
+        'length' => 255,
+      ],
+      'alias' => [
+        'description' => 'Alias',
+        'type' => 'varchar',
+        'length' => 255,
+      ],
+      'status' => [
+        'description' => 'Status',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+      ],
+    ],
+    'indexes' => [
+      'path_alias__status' => ['status', 'id'],
+      'path_alias__alias_langcode_id_status' => ['alias', 'langcode','id', 'status'],
+      'path_alias__path_langcode_id_status' => ['path', 'langcode','id', 'status'],
+    ], 
+    'unique keys' => [
+      'path_alias_field__uuid__value' => ['uuid'],
+      'path_alias__revision_id' => ['revision_id'],
+    ],
+    'foreign keys' => [],
+    'primary key' => [
+      'id',
+    ],
+  ];   
+
+  $schema['path_alias_revision'] = [
+    'description' => 'The revision table for path_alias entities.',
+    'fields' => [
+      'id' => [
+        'description' => 'Identifier',
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ], 
+      'revision_id' => [
+        'description' => 'Revision ID',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ],
+      'langcode' => [ 
+        'description' => 'Langcode',
+        'type' => 'varchar',
+        'length' => 12,
+        'not null' => TRUE,
+      ],
+      'path' => [
+        'description' => 'Path',
+        'type' => 'varchar',
+        'length' => 255,
+      ],
+      'alias' => [
+        'description' => 'Alias',
+        'type' => 'varchar',
+        'length' => 255,
+      ],
+      'status' => [
+        'description' => 'Status',
+        'type' => 'int',
+        'size' => 'tiny',
+        'not null' => TRUE,
+      ],
+      'revision_default' => [
+        'description' => 'Revision default',
+        'type' => 'int',
+        'size' => 'tiny',
+      ],
+    ],
+    'indexes' => [
+      'path_alias__id' => ['id'],
+    ],
+    'unique keys' => [],
+    'foreign keys' => [],
+    'primary key' => [
+      'revision_id',
+    ],
+  ];
   // Enable the Path Alias module if needed.
   if (!Drupal::moduleHandler()->moduleExists('path_alias')) {
+
+    foreach ($schema as $name => $spec) {
+      Drupal::database()->schema()->createTable($name, $spec);
+    }
+
    Drupal::service('module_installer')->install(['path_alias'], FALSE);
    return t('The "path_alias" entity type has been installed.');
   }

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP