--- /home/patrickd/Desktop/module-name-1852454-90.patch +++ /home/patrickd/Desktop/module-name-1852454-97.patch @@ -1,5 +1,5 @@ diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc -index 7dc75f5..9004b45 100644 +index 4c9df06..ea71ee0 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -188,6 +188,11 @@ @@ -11,52 +11,22 @@ +const DRUPAL_EXTENSION_NAME_MAX_LENGTH = 50; + +/** - * Special system language code (only applicable to UI language). + * Time of the current request in seconds elapsed since the Unix Epoch. * - * Refers to the language used in Drupal and module/theme source code. Drupal -diff --git a/core/includes/module.inc b/core/includes/module.inc -index bc91311..bef3a2a 100644 ---- a/core/includes/module.inc -+++ b/core/includes/module.inc -@@ -8,6 +8,7 @@ - use Drupal\Component\Utility\NestedArray; - use Drupal\Core\Cache\CacheBackendInterface; - use Drupal\Core\DependencyInjection\ContainerBuilder; -+use Drupal\Core\Extension\ExtensionNameLengthException; - use Symfony\Component\DependencyInjection\ContainerInterface; - use Symfony\Component\Yaml\Parser; - -@@ -260,6 +261,13 @@ function module_enable($module_list, $enable_dependencies = TRUE) { - unset($module_list[$module]); - continue; - } -+ // Throw an exception if the module name is too long. -+ if (strlen($module) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) { -+ throw new ExtensionNameLengthException(format_string('Module name %name is over the maximum allowed length of @max characters.', array( -+ '%name' => $module, -+ '@max' => DRUPAL_EXTENSION_NAME_MAX_LENGTH, -+ ))); -+ } - $module_list[$module] = $module_data[$module]->sort; - - // Add dependencies to the list, with a placeholder weight. + * This differs from $_SERVER['REQUEST_TIME'], which is stored as a float diff --git a/core/includes/theme.inc b/core/includes/theme.inc -index 721453a..f1af249 100644 +index cf30ef8..10e0e3b 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc -@@ -10,9 +10,10 @@ - +@@ -11,6 +11,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\Config; + use Drupal\Core\Language\Language; +use Drupal\Core\Extension\ExtensionNameLengthException; use Drupal\Core\Template\Attribute; --use Drupal\Core\Utility\ThemeRegistry; + use Drupal\Core\Utility\ThemeRegistry; use Drupal\Core\Theme\ThemeSettings; -+use Drupal\Core\Utility\ThemeRegistry; - - /** - * @defgroup content_flags Content markers -@@ -1562,6 +1563,14 @@ function theme_enable($theme_list) { +@@ -1563,6 +1564,14 @@ function theme_enable($theme_list) { $theme_config = config('system.theme'); $disabled_themes = config('system.theme.disabled'); foreach ($theme_list as $key) { @@ -111,6 +81,24 @@ + * Exception thrown when the extension's name length exceeds the allowed maximum. + */ +class ExtensionNameLengthException extends \Exception { } +diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php +index 3a5ffbe..3353d87 100644 +--- a/core/lib/Drupal/Core/Extension/ModuleHandler.php ++++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php +@@ -546,6 +546,13 @@ public function enable($module_list, $enable_dependencies = TRUE) { + unset($module_list[$module]); + continue; + } ++ // Throw an exception if the module name is too long. ++ if (strlen($module) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) { ++ throw new ExtensionNameLengthException(format_string('Module name %name is over the maximum allowed length of @max characters.', array( ++ '%name' => $module, ++ '@max' => DRUPAL_EXTENSION_NAME_MAX_LENGTH, ++ ))); ++ } + $module_list[$module] = $module_data[$module]->sort; + + // Add dependencies to the list, with a placeholder weight. diff --git a/core/modules/file/file.install b/core/modules/file/file.install index 3ca855e..74b4a8c 100644 --- a/core/modules/file/file.install @@ -158,10 +146,10 @@ 'default' => 'system', ), diff --git a/core/modules/node/node.install b/core/modules/node/node.install -index b0735d3..5e1c95d 100644 +index a4cc155..0cc7256 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install -@@ -320,7 +320,7 @@ function node_schema() { +@@ -412,7 +412,7 @@ function node_schema() { 'module' => array( 'description' => 'The module defining this node type.', 'type' => 'varchar', @@ -170,28 +158,22 @@ 'not null' => TRUE, ), 'description' => array( -@@ -752,6 +752,21 @@ function node_update_8015() { +@@ -1086,6 +1086,15 @@ function node_update_8016() { + foreach (_node_update_8016_schema() as $table => $table_schema) { + db_create_table($table, $table_schema); + } ++ if (db_field_exists('node_type', 'module')) { ++ $spec = array( ++ 'description' => 'The module defining this node type.', ++ 'type' => 'varchar', ++ 'length' => 50, ++ 'not null' => TRUE, ++ ); ++ db_change_field('node_type', 'module', 'module', $spec); ++ } } /** -+ * Convert the 'module' column in {node_type} to the maximum shortname length. -+ */ -+function node_update_8016() { -+ if (db_field_exists('node_type', 'module')) { -+ $spec = array( -+ 'description' => 'The module defining this node type.', -+ 'type' => 'varchar', -+ 'length' => 50, -+ 'not null' => TRUE, -+ ); -+ db_change_field('node_type', 'module', 'module', $spec); -+ } -+} -+ -+/** - * @} End of "addtogroup updates-7.x-to-8.x" - * The next series of updates should start at 9000. - */ diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleEnable.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleEnable.php index b2d08fc..427f86f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleEnable.php @@ -342,10 +324,10 @@ + +} diff --git a/core/modules/system/system.install b/core/modules/system/system.install -index b7b4209..6ec1269 100644 +index 3824136..9368b58 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install -@@ -2193,6 +2193,25 @@ function system_update_8056() { +@@ -2194,6 +2194,25 @@ function system_update_8056() { } /** @@ -427,10 +409,10 @@ + )) + ->execute(); diff --git a/core/modules/user/user.install b/core/modules/user/user.install -index 4f22958..fc649a9 100644 +index 9819cde..df9112c 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install -@@ -59,7 +59,7 @@ function user_schema() { +@@ -60,7 +60,7 @@ function user_schema() { ), 'theme' => array( 'type' => 'varchar', @@ -439,7 +421,7 @@ 'not null' => TRUE, 'default' => '', 'description' => "User's default theme.", -@@ -166,7 +166,7 @@ function user_schema() { +@@ -167,7 +167,7 @@ function user_schema() { ), 'module' => array( 'type' => 'varchar', @@ -448,7 +430,7 @@ 'not null' => TRUE, 'default' => '', 'description' => "The module declaring the permission.", -@@ -197,7 +197,7 @@ function user_schema() { +@@ -198,7 +198,7 @@ function user_schema() { 'module' => array( 'description' => 'The name of the module declaring the variable.', 'type' => 'varchar', @@ -457,7 +439,7 @@ 'not null' => TRUE, 'default' => '', ), -@@ -1057,5 +1057,43 @@ function user_update_8017() { +@@ -1058,5 +1058,43 @@ function user_update_8017() { } /**