mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-03 00:12:14 +02:00
simplier display of update result :
- number of new categories - number of new elements - number of deleted categories - number of deleted elements - only errors are fully listed git-svn-id: http://piwigo.org/svn/trunk@498 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -192,6 +192,8 @@ DELETE FROM '.SITES_TABLE.'
|
||||
// The function works recursively.
|
||||
function delete_categories($ids)
|
||||
{
|
||||
global $counts;
|
||||
|
||||
// destruction of all the related elements
|
||||
$query = '
|
||||
SELECT id
|
||||
@@ -251,8 +253,12 @@ DELETE FROM '.CATEGORIES_TABLE.'
|
||||
WHERE id IN ('.implode(',', $ids).')
|
||||
;';
|
||||
mysql_query($query);
|
||||
|
||||
if (isset($counts['del_categories']))
|
||||
{
|
||||
$counts['del_categories']+= count($ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The function delete_elements deletes the elements identified by the
|
||||
// (numeric) values of the array $ids. It also deletes (in the database) :
|
||||
@@ -261,7 +267,7 @@ DELETE FROM '.CATEGORIES_TABLE.'
|
||||
// - all the favorites associated to elements
|
||||
function delete_elements($ids)
|
||||
{
|
||||
global $count_deleted;
|
||||
global $counts;
|
||||
|
||||
// destruction of the comments on the image
|
||||
$query = '
|
||||
@@ -295,7 +301,10 @@ DELETE FROM '.IMAGES_TABLE.'
|
||||
;';
|
||||
mysql_query($query);
|
||||
|
||||
$count_deleted+= count($ids);
|
||||
if (isset($counts['del_elements']))
|
||||
{
|
||||
$counts['del_elements']+= count($ids);
|
||||
}
|
||||
}
|
||||
|
||||
// The delete_user function delete a user identified by the $user_id
|
||||
|
||||
+30
-26
@@ -68,7 +68,7 @@ UPDATE '.CATEGORIES_TABLE.'
|
||||
|
||||
function insert_local_category($id_uppercat)
|
||||
{
|
||||
global $conf, $page, $user, $lang;
|
||||
global $conf, $page, $user, $lang, $counts;
|
||||
|
||||
$uppercats = '';
|
||||
$output = '';
|
||||
@@ -188,7 +188,7 @@ SELECT id,dir FROM '.CATEGORIES_TABLE.'
|
||||
}
|
||||
else
|
||||
{
|
||||
$output.= '<span style="color:red;">"'.$fs_subdir.'" : ';
|
||||
$output.= '<span class="update_category_error">"'.$fs_subdir.'" : ';
|
||||
$output.= $lang['update_wrong_dirname'].'</span><br />';
|
||||
}
|
||||
}
|
||||
@@ -205,6 +205,8 @@ INSERT INTO '.CATEGORIES_TABLE.'
|
||||
$query.= '
|
||||
;';
|
||||
mysql_query($query);
|
||||
|
||||
$counts['new_categories']+= count($inserts);
|
||||
// updating uppercats field
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
@@ -265,7 +267,7 @@ SELECT id
|
||||
|
||||
function insert_local_element($dir, $category_id)
|
||||
{
|
||||
global $lang,$conf,$count_new;
|
||||
global $lang,$conf,$counts;
|
||||
|
||||
$output = '';
|
||||
|
||||
@@ -398,17 +400,12 @@ SELECT file
|
||||
$insert['date_available'] = CURRENT_DATE;
|
||||
$insert['tn_ext'] = "'".$tn_ext."'";
|
||||
|
||||
$count_new++;
|
||||
$output.= $unregistered_element;
|
||||
$output.= ' <span style="font-weight:bold;">';
|
||||
$output.= $lang['update_research_added'].'</span>';
|
||||
$output.= ' ('.$lang['update_research_tn_ext'].' '.$tn_ext.')';
|
||||
$output.= '<br />';
|
||||
$counts['new_elements']++;
|
||||
array_push($inserts, $insert);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output.= '<span style="color:orange;">';
|
||||
$output.= '<span class="update_error_element">';
|
||||
$output.= $lang['update_missing_tn'].' : '.$unregistered_element;
|
||||
$output.= ' (<span style="font-weight:bold;">';
|
||||
$output.= $conf['prefix_thumbnail'];
|
||||
@@ -449,17 +446,14 @@ SELECT file
|
||||
$insert['representative_ext'] = "'".$representative_ext."'";
|
||||
}
|
||||
|
||||
$count_new++;
|
||||
$output.= $unregistered_element;
|
||||
$output.= ' <span style="font-weight:bold;">';
|
||||
$output.= $lang['update_research_added'].'</span>';
|
||||
$output.= '<br />';
|
||||
$counts['new_elements']++;
|
||||
array_push($inserts, $insert);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$output.= '<span style="color:red;">"'.$unregistered_element.'" : ';
|
||||
$output.= '<span class="update_error_element">"';
|
||||
$output.= $unregistered_element.'" : ';
|
||||
$output.= $lang['update_wrong_dirname'].'</span><br />';
|
||||
}
|
||||
}
|
||||
@@ -552,8 +546,10 @@ $template->assign_vars(array(
|
||||
'L_CAT_UPDATE'=>$lang['update_only_cat'],
|
||||
'L_ALL_UPDATE'=>$lang['update_all'],
|
||||
'L_RESULT_UPDATE'=>$lang['update_part_research'],
|
||||
'L_NEW_CATEGORY'=>$lang['update_research_conclusion'],
|
||||
'L_DEL_CATEGORY'=>$lang['update_deletion_conclusion'],
|
||||
'L_NB_NEW_ELEMENTS'=>$lang['update_nb_new_elements'],
|
||||
'L_NB_NEW_CATEGORIES'=>$lang['update_nb_new_categories'],
|
||||
'L_NB_DEL_ELEMENTS'=>$lang['update_nb_del_elements'],
|
||||
'L_NB_DEL_CATEGORIES'=>$lang['update_nb_del_categories'],
|
||||
'L_UPDATE_SYNC_METADATA_QUESTION'=>$lang['update_sync_metadata_question'],
|
||||
|
||||
'U_CAT_UPDATE'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?page=update&update=cats'),
|
||||
@@ -570,8 +566,12 @@ else if (!isset($_GET['metadata']))
|
||||
{
|
||||
check_cat_id($_GET['update']);
|
||||
$start = get_moment();
|
||||
$count_new = 0;
|
||||
$count_deleted = 0;
|
||||
$counts = array(
|
||||
'new_elements' => 0,
|
||||
'new_categories' => 0,
|
||||
'del_elements' => 0,
|
||||
'del_categories' => 0
|
||||
);
|
||||
|
||||
if (isset($page['cat']))
|
||||
{
|
||||
@@ -582,12 +582,16 @@ else if (!isset($_GET['metadata']))
|
||||
$categories = insert_local_category('NULL');
|
||||
}
|
||||
echo get_elapsed_time($start,get_moment()).' for scanning directories<br />';
|
||||
$template->assign_block_vars('update',array(
|
||||
'CATEGORIES'=>$categories,
|
||||
'NEW_CAT'=>$count_new,
|
||||
'DEL_CAT'=>$count_deleted
|
||||
));
|
||||
if ($count_new > 0)
|
||||
$template->assign_block_vars(
|
||||
'update',
|
||||
array(
|
||||
'CATEGORIES'=>$categories,
|
||||
'NB_NEW_CATEGORIES'=>$counts['new_categories'],
|
||||
'NB_DEL_CATEGORIES'=>$counts['del_categories'],
|
||||
'NB_NEW_ELEMENTS'=>$counts['new_elements'],
|
||||
'NB_DEL_ELEMENTS'=>$counts['del_elements']
|
||||
));
|
||||
if ($counts['new_elements'] > 0)
|
||||
{
|
||||
$url = PHPWG_ROOT_PATH.'admin.php?page=update&metadata=1';
|
||||
if (isset($page['cat']))
|
||||
|
||||
@@ -261,11 +261,13 @@ $lang['update_missing_tn'] = 'the thumbnail is missing for';
|
||||
$lang['update_disappeared_tn'] = 'the thumbnail disapeared';
|
||||
$lang['update_disappeared'] = 'doesn\'t exist';
|
||||
$lang['update_part_deletion'] = 'Deletion of images that have no thumbnail or that doesn\'t exist';
|
||||
$lang['update_deletion_conclusion'] = 'pictures removed from database';
|
||||
$lang['update_part_research'] = 'Search for new images in the directories';
|
||||
$lang['update_research_added'] = 'added';
|
||||
$lang['update_research_tn_ext'] = 'thumbnail in';
|
||||
$lang['update_research_conclusion'] = 'pictures added to the database';
|
||||
$lang['update_nb_new_elements'] = 'elements added in the database';
|
||||
$lang['update_nb_del_elements'] = 'elements deleted in the database';
|
||||
$lang['update_nb_new_categories'] = 'categories added in the database';
|
||||
$lang['update_nb_del_categories'] = 'categories deleted in the database';
|
||||
$lang['update_default_title'] = 'Choose an option';
|
||||
$lang['update_only_cat'] = 'update categories, not pictures';
|
||||
$lang['update_all'] = 'update all';
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
<!-- END introduction -->
|
||||
<!-- BEGIN update -->
|
||||
<div class="admin">{L_RESULT_UPDATE}</div>
|
||||
<br /><span style="color:#9cb4ce;">{update.NEW_CAT} {L_NEW_CATEGORY}</span>
|
||||
<br /><span style="color:#ffe1e1;">{update.DEL_CAT} {L_DEL_CATEGORY}</span>
|
||||
<ul style="text-align:left;">
|
||||
<li class="update_summary_new">{update.NB_NEW_CATEGORIES} {L_NB_NEW_CATEGORIES}</li>
|
||||
<li class="update_summary_new">{update.NB_NEW_ELEMENTS} {L_NB_NEW_ELEMENTS}</li>
|
||||
<li class="update_summary_del">{update.NB_DEL_CATEGORIES} {L_NB_DEL_CATEGORIES}</li>
|
||||
<li class="update_summary_del">{update.NB_DEL_ELEMENTS} {L_NB_DEL_ELEMENTS}</li>
|
||||
</ul>
|
||||
<!-- BEGIN sync_metadata -->
|
||||
<br />[ <a href="{update.sync_metadata.U_URL}">{L_UPDATE_SYNC_METADATA_QUESTION}</a> ]
|
||||
<!-- END sync_metadata -->
|
||||
|
||||
@@ -327,3 +327,15 @@ span.thumb_picture {
|
||||
span.thumb_category {
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
span.update_error_element, span.update_category_error {
|
||||
color:orange;
|
||||
}
|
||||
|
||||
.update_summary_new {
|
||||
color:#9cb4ce;
|
||||
}
|
||||
|
||||
.update_summary_del {
|
||||
color:#ffe1e1;
|
||||
}
|
||||
Reference in New Issue
Block a user