Commit 23727726 authored by Ronny López's avatar Ronny López
Browse files

Copy the latest versions of the files from the current 6.x-2.x branch back to HEAD.

parent dae26082
div.link-field-column {
float: left;
width: 50%;
}
\ No newline at end of file
width: 48%;
}
div.link-field-column .form-text {
width: 95%;
}
<?php
// $Id$
/**
* @file
* Install file for the link module.
*/
/**
* Implementation of hook_install().
*/
function link_install() {
drupal_load('module', 'content');
content_notify('install', 'link');
}
......@@ -12,6 +18,7 @@ function link_install() {
* Implementation of hook_uninstall().
*/
function link_uninstall() {
drupal_load('module', 'content');
content_notify('uninstall', 'link');
}
......@@ -19,6 +26,7 @@ function link_uninstall() {
* Implementation of hook_enable().
*/
function link_enable() {
drupal_load('module', 'content');
content_notify('enable', 'link');
}
......@@ -26,41 +34,65 @@ function link_enable() {
* Implementation of hook_disable().
*/
function link_disable() {
drupal_load('module', 'content');
content_notify('disable', 'link');
}
/**
* Removed link.module created tables, move data to content.module tables
*
* Even though most everyone will not be using this particular update, several
* folks have complained that their upgrades of link.module do not work because
* of this function being missing when schema expects it. - JCF
* And on further review, I'm removing the body, since some of those calls
* no longer exist in Drupal 6. Remember to upgrade from 4.7 to 5 first, and
* *then* from 5 to 6. kthx! -JCF
*/
function link_update_1() {
$ret = array();
// GNDN
return $ret;
}
include_once(drupal_get_path('module', 'content') .'/content.module');
include_once(drupal_get_path('module', 'content') .'/content_admin.inc');
$fields = content_fields();
/**
* Ensure that content.module is updated before link module.
*/
function link_update_6000() {
if ($abort = content_check_update('link')) {
return $abort;
}
return array();
}
foreach ($fields as $field) {
switch ($field['type']) {
case 'link':
$columns = array(
'url' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''"),
'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''"),
'attributes' => array('type' => 'mediumtext', 'not null' => FALSE),
);
content_alter_db_field(array(), array(), $field, $columns);
$db_info = content_database_info($field);
if ($field['multiple']) {
$ret[] = update_sql('INSERT INTO {'. $db_info['table'] .'} (vid, delta, nid, '. $field['field_name'] .'_url, '. $field['field_name'] .'_title, '. $field['field_name'] ."_attributes) SELECT vid, delta, nid, field_url, field_title, attributes FROM {node_field_link_data} WHERE field_name = '". $field['field_name'] ."'");
}
else {
$ret[] = update_sql('UPDATE {'. $db_info['table'] .'} c, {node_field_link_data} l SET c.'. $field['field_name'] .'_url = l.field_url, c.'. $field['field_name'] .'_title = l.field_title, c.'. $field['field_name'] ."_attributes = l.attributes WHERE l.field_name = '". $field['field_name'] ."' AND c.vid = l.vid AND c.nid = l.nid");
}
/**
* Change the database schema to allow NULL values.
*/
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) {
foreach ($fields as $field) {
if ($field['type'] == 'link') {
// We only process a given field once.
$update_fields[$field['field_name']] = $field;
}
}
}
$ret[] = update_sql('DROP TABLE {node_field_link_data}');
db_query('DELETE FROM {cache}');
// 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) {
db_change_field($ret, $db_info['table'], $column['column'], $column['column'], $column);
$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;
}
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment