added list of deleted entities from flag list content
This commit is contained in:
parent
f0cb6175c1
commit
50c3e1c7d7
@ -597,3 +597,44 @@ function flag_lists_generate_lists_form_submit($form, &$form_state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean lists from deleted enties
|
||||||
|
*/
|
||||||
|
function flag_list_clean_deleted(){
|
||||||
|
|
||||||
|
drupal_set_title(t('Flag lists Clean'));
|
||||||
|
$output = '<p>' . t('This page shows all the deleted entityties id from flag lists.') . '</p>';
|
||||||
|
|
||||||
|
$total = 0;
|
||||||
|
$list = "<ul>";
|
||||||
|
|
||||||
|
$query = db_select('flag_lists_content');
|
||||||
|
$query->fields('flag_lists_content', array('entity_id', 'entity_type'));
|
||||||
|
$query->distinct();
|
||||||
|
$items = $query->execute()->fetchAll();
|
||||||
|
|
||||||
|
if ($items) {
|
||||||
|
foreach ($items as $key => $value) {
|
||||||
|
$entity = entity_load($value->entity_type, array($value->entity_id), array(), true);
|
||||||
|
// dsm($entity);
|
||||||
|
// break;
|
||||||
|
if(!isset($entity[$value->entity_id])){
|
||||||
|
$list .= "<li>".$value->entity_type ." <em>". $value->entity_id."</em> have been deleted does not exists anymore.</li>";
|
||||||
|
$total++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// db_delete('flag_lists_content')
|
||||||
|
// ->condition('entity_type', $value->entity_type)
|
||||||
|
// ->condition('entity_id', $value->entity_id)
|
||||||
|
// ->execute();
|
||||||
|
// watchdog('flag_lists', t('Deleted entry @fcid from flat_lists_content', array('@fcid' => $value->fcid)));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$list .= "</ul>";
|
||||||
|
$output .= "<p><strong>".$total ."</strong> entities have been deleted.</p>";
|
||||||
|
$output .= $list;
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
@ -56,6 +56,16 @@ function flag_lists_menu() {
|
|||||||
'type' => MENU_LOCAL_TASK,
|
'type' => MENU_LOCAL_TASK,
|
||||||
'weight' => 3,
|
'weight' => 3,
|
||||||
);
|
);
|
||||||
|
$items[FLAG_ADMIN_PATH . '/lists/clean'] = array(
|
||||||
|
'title' => 'Clean lists from deleted entities',
|
||||||
|
'page callback' => 'flag_list_clean_deleted',
|
||||||
|
'access callback' => 'user_access',
|
||||||
|
'access arguments' => array('administer flags'),
|
||||||
|
'file' => 'flag_lists.admin.inc',
|
||||||
|
'type' => MENU_LOCAL_TASK,
|
||||||
|
'weight' => 4,
|
||||||
|
);
|
||||||
|
|
||||||
if (module_exists('devel_generate')) {
|
if (module_exists('devel_generate')) {
|
||||||
$items['admin/config/development/generate/flag-lists'] = array(
|
$items['admin/config/development/generate/flag-lists'] = array(
|
||||||
'title' => 'Generate lists',
|
'title' => 'Generate lists',
|
||||||
@ -1773,5 +1783,3 @@ function flag_lists_entity_delete($entity, $type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user