Index: link.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/link/link.module,v
retrieving revision 1.24.4.1
diff -u -r1.24.4.1 link.module
--- link.module	4 Jul 2009 19:07:42 -0000	1.24.4.1
+++ link.module	13 Sep 2009 16:44:40 -0000
@@ -13,6 +13,11 @@
 define('LINK_DOMAINS', 'aero|arpa|asia|biz|com|cat|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|mobi|local');
 
 /**
+ * Maximum URLs length.
+ */
+define('LINK_URL_MAX_LENGTH', 2048);
+
+/**
  * Implementation of hook_field_info().
  */
 function link_field_info() {
@@ -139,7 +144,7 @@
 
     case 'database columns':
       return array(
-        'url' => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'sortable' => TRUE),
+        'url' => array('type' => 'varchar', 'length' => LINK_URL_MAX_LENGTH, 'not null' => FALSE, 'sortable' => TRUE),
         'title' => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'sortable' => TRUE),
         'attributes' => array('type' => 'text', 'size' => 'medium', 'not null' => FALSE),
       );
@@ -465,7 +470,7 @@
    $delta = $element['#delta'];
    $element['url'] = array(
      '#type' => 'textfield',
-     '#maxlength' => '255',
+     '#maxlength' => LINK_URL_MAX_LENGTH,
      '#title' => t('URL'),
      '#description' => $element['#description'],
      '#required' => ($delta == 0 && $field['url'] !== 'optional') ? $element['#required'] : FALSE,
Index: link.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/link/link.install,v
retrieving revision 1.5.4.1
diff -u -r1.5.4.1 link.install
--- link.install	4 Jul 2009 19:07:42 -0000	1.5.4.1
+++ link.install	13 Sep 2009 16:44:20 -0000
@@ -70,7 +70,7 @@
  */
 function link_update_6001() {
   $ret = array();
-  
+
   // Build a list of fields that need updating.
   $update_fields = array();
   foreach (content_types_install() as $type_name => $fields) {
@@ -81,7 +81,7 @@
       }
     }
   }
-  
+
   // Update each field's storage to match the current definition.
   foreach ($update_fields as $field) {
     $db_info = content_database_info($field);
@@ -90,9 +90,43 @@
       $ret[] = update_sql("UPDATE {". $db_info['table'] ."} SET ". $column['column'] ." = NULL WHERE ". $column['column'] ." = '' OR ". $column['column'] ." = 'N;'");
     }
   }
-  
+
   // Let CCK re-associate link fields with Link module and activate the fields.
   content_associate_fields('link');
-  
+
+  return $ret;
+}
+
+/**
+ * Change the databse schema to allow URLs of 2048 characters maximum.
+ */
+function link_update_6200() {
+  $ret = array();
+
+  // Build a list of fields that need updating.
+  $update_fields = array();
+  foreach (content_types_install() as $type_name => $fields) {
+    foreach ($fields as $field) {
+      if ($field['type'] == 'link') {
+        // We only process a given field once.
+        $update_fields[$field['field_name']] = $field;
+      }
+    }
+  }
+
+  // Update each field's storage to match the current definition.
+  foreach ($update_fields as $field) {
+    $db_info = content_database_info($field);
+    foreach ($db_info['columns'] as $column) {
+      if ($column['column'] == $field['field_name'] .'_url') {
+        $column['length'] = 2048;
+        db_change_field($ret, $db_info['table'], $column['column'], $column['column'], $column);
+      }
+    }
+  }
+
+  // Let CCK re-associate link fields with Link module and activate the fields.
+  content_associate_fields('link');
+
   return $ret;
 }
