Skip to content
Snippets Groups Projects
Commit ac10076c authored by Larry Garfield's avatar Larry Garfield Committed by Alex Bronstein
Browse files

Wire the new PartialMatcher and PathMatcher into the routing configuration.

parent a6d59f6d
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -15,6 +15,8 @@
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Drupal\Core\Database\Database;
/**
* Bundle class for mandatory core services.
*
......@@ -59,6 +61,13 @@ public function build(ContainerBuilder $container) {
$dispatcher = $container->get('dispatcher');
$matcher = new \Drupal\Core\Routing\ChainMatcher();
$matcher->add(new \Drupal\Core\LegacyUrlMatcher());
$nested = new \Drupal\Core\Routing\NestedMatcher();
$nested->setInitialMatcher(new \Drupal\Core\Routing\PathMatcher(Database::getConnection()));
$nested->addPartialMatcher(new \Drupal\Core\Routing\HttpMethodMatcher());
$nested->setFinalMatcher(new \Drupal\Core\Routing\FirstEntryFinalMatcher());
$matcher->add($nested, 5);
$content_negotation = new \Drupal\Core\ContentNegotiation();
$dispatcher->addSubscriber(new \Symfony\Component\HttpKernel\EventListener\RouterListener($matcher));
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\ViewSubscriber($content_negotation));
......
......@@ -1225,6 +1225,125 @@ function system_schema() {
),
);
$schema['registry'] = array(
'description' => "Each record is a function, class, or interface name and the file it is in.",
'fields' => array(
'name' => array(
'description' => 'The name of the function, class, or interface.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'type' => array(
'description' => 'Either function or class or interface.',
'type' => 'varchar',
'length' => 9,
'not null' => TRUE,
'default' => '',
),
'filename' => array(
'description' => 'Name of the file.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'module' => array(
'description' => 'Name of the module the file belongs to.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => ''
),
'weight' => array(
'description' => "The order in which this module's hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.",
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('name', 'type'),
'indexes' => array(
'hook' => array('type', 'weight', 'module'),
),
);
$schema['registry_file'] = array(
'description' => "Files parsed to build the registry.",
'fields' => array(
'filename' => array(
'description' => 'Path to the file.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'hash' => array(
'description' => "sha-256 hash of the file's contents when last parsed.",
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
),
),
'primary key' => array('filename'),
);
$schema['router'] = array(
'description' => 'Maps paths to various callbacks (access, page and title)',
'fields' => array(
'name' => array(
'description' => 'Primary Key: Machine name of this route',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'pattern' => array(
'description' => 'The path pattern for this URI',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'pattern_outline' => array(
'description' => 'The pattern',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'route_set' => array(
'description' => 'The route set grouping to which a route belongs.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'fit' => array(
'description' => 'A numeric representation of how specific the path is.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'route' => array(
'description' => 'A serialized Route object',
'type' => 'text',
),
'number_parts' => array(
'description' => 'Number of parts in this router path.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'small',
),
),
'indexes' => array(
'fit' => array('fit'),
'pattern_outline' => array('pattern_outline'),
'route_set' => array('route_set'),
),
'primary key' => array('name'),
);
$schema['semaphore'] = array(
'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.',
'fields' => array(
......@@ -1914,6 +2033,75 @@ function system_update_8019() {
db_drop_table('registry_file');
}
/*
* Create the new routing table.
*/
function system_update_8020() {
$tables['router'] = array(
'description' => 'Maps paths to various callbacks (access, page and title)',
'fields' => array(
'name' => array(
'description' => 'Primary Key: Machine name of this route',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'pattern' => array(
'description' => 'The path pattern for this URI',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'pattern_outline' => array(
'description' => 'The pattern',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'route_set' => array(
'description' => 'The route set grouping to which a route belongs.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'fit' => array(
'description' => 'A numeric representation of how specific the path is.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'route' => array(
'description' => 'A serialized Route object',
'type' => 'text',
),
'number_parts' => array(
'description' => 'Number of parts in this router path.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'small',
),
),
'indexes' => array(
'fit' => array('fit'),
'pattern_outline' => array('pattern_outline'),
'route_set' => array('route_set'),
),
'primary key' => array('name'),
);
$schema = Database::getConnection()->schema();
$schema->dropTable('router');
$schema->createTable('router', $tables['router']);
}
/**
* Conditionally enable the new Ban module.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment