commented flag_lists failing updates
checked db table integrity, lokks like fine ...
This commit is contained in:
parent
82bb633c3e
commit
2e0abeed03
@ -204,22 +204,22 @@ function flag_lists_uninstall() {
|
||||
db_delete('variable')->condition('name', 'flag_lists%', 'LIKE')->execute();
|
||||
|
||||
$view_to_delete = views_get_view('flag_lists');
|
||||
if (!empty($view_to_delete)) {
|
||||
if (!empty($view_to_delete)) {
|
||||
views_delete_view($view_to_delete);
|
||||
}
|
||||
|
||||
$view_to_delete =views_get_view('flag_lists_content');
|
||||
if (!empty($view_to_delete)) {
|
||||
if (!empty($view_to_delete)) {
|
||||
views_delete_view($view_to_delete);
|
||||
}
|
||||
|
||||
$view_to_delete = views_get_view('flag_lists_user_lists');
|
||||
if (!empty($view_to_delete)) {
|
||||
if (!empty($view_to_delete)) {
|
||||
views_delete_view($view_to_delete);
|
||||
}
|
||||
|
||||
$view_to_delete = views_get_view('flag_lists_user_list');
|
||||
if (!empty($view_to_delete)) {
|
||||
if (!empty($view_to_delete)) {
|
||||
views_delete_view($view_to_delete);
|
||||
}
|
||||
|
||||
@ -230,32 +230,32 @@ function flag_lists_uninstall() {
|
||||
* Get rid of garbage list entries that are orphaned from a list
|
||||
*/
|
||||
function flag_lists_update_7000() {
|
||||
$orphans = db_query("SELECT flc.fcid, flc.fid, flc.content_id, flc.uid, flcounts.content_type, count
|
||||
FROM {flag_lists_content} flc
|
||||
JOIN {flag_lists_counts} flcounts ON flcounts.fid=flc.fid AND flc.content_id=flcounts.content_id
|
||||
LEFT JOIN {flag_lists_flags} flf ON flf.fid=flc.fid
|
||||
WHERE flf.fid IS NULL");
|
||||
|
||||
foreach ($orphans as $orphan) {
|
||||
$num_deleted = db_delete('flag_lists_content')
|
||||
->condition('fid', $orphan->fid)
|
||||
->condition('fcid', $orphan->fcid)
|
||||
->condition('uid', $orphan->uid)
|
||||
->execute();
|
||||
|
||||
if (!empty($num_deleted)) {
|
||||
drupal_set_message("Deleting flag_id: $orphan->fid flag_content_id: $orphan->fcid");
|
||||
|
||||
db_update('flag_lists_counts')
|
||||
->fields(array(
|
||||
'count' => ($orphan->count <= 1) ? 0 : $orphan->count - 1,
|
||||
))
|
||||
->condition('content_type', $orphan->content_type)
|
||||
->condition('fid', $orphan->fid)
|
||||
->condition('content_id', $orphan->content_id)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
// $orphans = db_query("SELECT flc.fcid, flc.fid, flc.content_id, flc.uid, flcounts.content_type, count
|
||||
// FROM {flag_lists_content} flc
|
||||
// JOIN {flag_lists_counts} flcounts ON flcounts.fid=flc.fid AND flc.content_id=flcounts.content_id
|
||||
// LEFT JOIN {flag_lists_flags} flf ON flf.fid=flc.fid
|
||||
// WHERE flf.fid IS NULL");
|
||||
//
|
||||
// foreach ($orphans as $orphan) {
|
||||
// $num_deleted = db_delete('flag_lists_content')
|
||||
// ->condition('fid', $orphan->fid)
|
||||
// ->condition('fcid', $orphan->fcid)
|
||||
// ->condition('uid', $orphan->uid)
|
||||
// ->execute();
|
||||
//
|
||||
// if (!empty($num_deleted)) {
|
||||
// drupal_set_message("Deleting flag_id: $orphan->fid flag_content_id: $orphan->fcid");
|
||||
//
|
||||
// db_update('flag_lists_counts')
|
||||
// ->fields(array(
|
||||
// 'count' => ($orphan->count <= 1) ? 0 : $orphan->count - 1,
|
||||
// ))
|
||||
// ->condition('content_type', $orphan->content_type)
|
||||
// ->condition('fid', $orphan->fid)
|
||||
// ->condition('content_id', $orphan->content_id)
|
||||
// ->execute();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@ -263,48 +263,48 @@ function flag_lists_update_7000() {
|
||||
* Update the flag_lists_flags table
|
||||
*/
|
||||
function flag_lists_update_7301() {
|
||||
db_change_field('flag_lists_flags','content_type', 'entity_type',
|
||||
array(
|
||||
'type' => 'varchar',
|
||||
'length' => '32',
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
));
|
||||
// db_change_field('flag_lists_flags','content_type', 'entity_type',
|
||||
// array(
|
||||
// 'type' => 'varchar',
|
||||
// 'length' => '32',
|
||||
// 'not null' => TRUE,
|
||||
// 'default' => '',
|
||||
// ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the flag_lists_content table
|
||||
*/
|
||||
function flag_lists_update_7302() {
|
||||
db_drop_unique_key('flag_lists_content','fid_content_id_uid_sid');
|
||||
db_drop_index('flag_lists_content','content_type_content_id');
|
||||
db_drop_index('flag_lists_content','content_type_uid_sid');
|
||||
|
||||
db_change_field('flag_lists_content','content_type', 'entity_type',
|
||||
array(
|
||||
'type' => 'varchar',
|
||||
'length' => '32',
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
));
|
||||
|
||||
db_change_field('flag_lists_content','content_id', 'entity_id',
|
||||
array(
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
));
|
||||
|
||||
db_add_unique_key('flag_lists_content',
|
||||
'fid_entity_id_uid_sid',
|
||||
array('fid', 'entity_id', 'uid', 'sid'));
|
||||
db_add_index('flag_lists_content',
|
||||
'entity_type_uid_sid',
|
||||
array('entity_type', 'uid', 'sid'));
|
||||
db_add_index('flag_lists_content',
|
||||
'entity_type_entity_id',
|
||||
array('entity_type', 'entity_id'));
|
||||
// db_drop_unique_key('flag_lists_content','fid_content_id_uid_sid');
|
||||
// db_drop_index('flag_lists_content','content_type_content_id');
|
||||
// db_drop_index('flag_lists_content','content_type_uid_sid');
|
||||
//
|
||||
// db_change_field('flag_lists_content','content_type', 'entity_type',
|
||||
// array(
|
||||
// 'type' => 'varchar',
|
||||
// 'length' => '32',
|
||||
// 'not null' => TRUE,
|
||||
// 'default' => '',
|
||||
// ));
|
||||
//
|
||||
// db_change_field('flag_lists_content','content_id', 'entity_id',
|
||||
// array(
|
||||
// 'type' => 'int',
|
||||
// 'unsigned' => TRUE,
|
||||
// 'not null' => TRUE,
|
||||
// 'default' => 0,
|
||||
// ));
|
||||
//
|
||||
// db_add_unique_key('flag_lists_content',
|
||||
// 'fid_entity_id_uid_sid',
|
||||
// array('fid', 'entity_id', 'uid', 'sid'));
|
||||
// db_add_index('flag_lists_content',
|
||||
// 'entity_type_uid_sid',
|
||||
// array('entity_type', 'uid', 'sid'));
|
||||
// db_add_index('flag_lists_content',
|
||||
// 'entity_type_entity_id',
|
||||
// array('entity_type', 'entity_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -315,29 +315,29 @@ function flag_lists_update_7303() {
|
||||
db_drop_index('flag_lists_counts','fid_content_type');
|
||||
db_drop_index('flag_lists_counts','content_type_content_id');
|
||||
|
||||
db_change_field('flag_lists_counts','content_type', 'entity_type',
|
||||
array(
|
||||
'type' => 'varchar',
|
||||
'length' => '32',
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
));
|
||||
db_change_field('flag_lists_counts','content_id', 'entity_id',
|
||||
array(
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
'disp-width' => '10',
|
||||
),
|
||||
array('primary key' => array('fid', 'entity_id')));
|
||||
// db_change_field('flag_lists_counts','content_type', 'entity_type',
|
||||
// array(
|
||||
// 'type' => 'varchar',
|
||||
// 'length' => '32',
|
||||
// 'not null' => TRUE,
|
||||
// 'default' => '',
|
||||
// ));
|
||||
// db_change_field('flag_lists_counts','content_id', 'entity_id',
|
||||
// array(
|
||||
// 'type' => 'int',
|
||||
// 'unsigned' => TRUE,
|
||||
// 'not null' => TRUE,
|
||||
// 'default' => 0,
|
||||
// 'disp-width' => '10',
|
||||
// ),
|
||||
// array('primary key' => array('fid', 'entity_id')));
|
||||
|
||||
db_add_index('flag_lists_counts',
|
||||
'fid_entity_type',
|
||||
array('fid', 'entity_type'));
|
||||
db_add_index('flag_lists_counts',
|
||||
'entity_type_entity_id',
|
||||
array('entity_type', 'entity_id'));
|
||||
// db_add_index('flag_lists_counts',
|
||||
// 'fid_entity_type',
|
||||
// array('fid', 'entity_type'));
|
||||
// db_add_index('flag_lists_counts',
|
||||
// 'entity_type_entity_id',
|
||||
// array('entity_type', 'entity_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user