diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php index 865afe506606fe643bb5abf6a0f5806aa620a7e3..bf51079c4bc0efda30a6f43b973559493f0fdab4 100644 --- a/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -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)); diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 3790f2b407d8ee5a4691a377ec4d64826a9dd4e7..5b8fd17dd2de72d91ef2642461cefcf46f1cb0a4 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -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. */