- no debug output in synchronization process (replaced by HTML comments,

information is still available)

- when showing result of a simulation, also displays the form with values
  given for simulation. Admin can perform another simulation or uncheck the
  simulation option


git-svn-id: http://piwigo.org/svn/trunk@691 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2005-01-15 10:31:26 +00:00
parent 59b539098e
commit de750e1a8f
2 changed files with 108 additions and 48 deletions
+69 -12
View File
@@ -247,8 +247,9 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id
$counts['del_categories'] = count($to_delete);
}
echo '<!-- scanning dirs : ';
echo get_elapsed_time($start, get_moment());
echo ' for new method scanning directories<br />';
echo ' -->'."\n";
}
// +-----------------------------------------------------------------------+
// | files / elements |
@@ -260,8 +261,7 @@ if (isset($_POST['submit']) and $_POST['sync'] == 'files')
$fs = get_fs($basedir);
echo get_elapsed_time($start, get_moment());
echo ' for get_fs<br />';
echo '<!-- get_fs : '.get_elapsed_time($start, get_moment()).' -->'."\n";
$cat_ids = array_diff(array_keys($db_categories), $to_delete);
@@ -450,8 +450,9 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
$counts['del_elements'] = count($to_delete_elements);
}
echo '<!-- scanning files : ';
echo get_elapsed_time($start_files, get_moment());
echo ' for new method scanning files<br />';
echo ' -->'."\n";
}
// +-----------------------------------------------------------------------+
// | template initialization |
@@ -468,6 +469,7 @@ $result_title.= $lang['update_part_research'];
$template->assign_vars(
array(
'L_SUBMIT'=>$lang['submit'],
'L_RESET'=>$lang['reset'],
'L_UPDATE_TITLE'=>$lang['update_default_title'],
'L_UPDATE_SYNC_FILES'=>$lang['update_sync_files'],
'L_UPDATE_SYNC_DIRS'=>$lang['update_sync_dirs'],
@@ -495,25 +497,73 @@ $template->assign_vars(
// +-----------------------------------------------------------------------+
// | introduction : choices |
// +-----------------------------------------------------------------------+
if (!isset($_POST['submit']))
if (!isset($_POST['submit']) or (isset($simulate) and $simulate))
{
$template->assign_block_vars('introduction', array());
if (isset($simulate) and $simulate)
{
switch ($_POST['sync'])
{
case 'dirs' :
{
$template->assign_vars(
array('SYNC_DIRS_CHECKED'=>'checked="checked"'));
break;
}
case 'files' :
{
$template->assign_vars(
array('SYNC_ALL_CHECKED'=>'checked="checked"'));
break;
}
}
if (isset($_POST['display_info']) and $_POST['display_info'] == 1)
{
$template->assign_vars(
array('DISPLAY_INFO_CHECKED'=>'checked="checked"'));
}
if (isset($_POST['subcats-included']) and $_POST['subcats-included'] == 1)
{
$template->assign_vars(
array('SUBCATS_INCLUDED_CHECKED'=>'checked="checked"'));
}
if (isset($_POST['cat']) and is_numeric($_POST['cat']))
{
$cat_selected = array($_POST['cat']);
}
else
{
$cat_selected = array();
}
}
else
{
$template->assign_vars(
array('SYNC_DIRS_CHECKED' => 'checked="checked"',
'SUBCATS_INCLUDED_CHECKED'=>'checked="checked"'));
$cat_selected = array();
}
$query = '
SELECT id,name,uppercats,global_rank
FROM '.CATEGORIES_TABLE.'
WHERE site_id = 1
;';
display_select_cat_wrapper($query,
array(),
$cat_selected,
'introduction.category_option',
false);
}
// +-----------------------------------------------------------------------+
// | synchronize files |
// +-----------------------------------------------------------------------+
else if (isset($_POST['submit'])
and ($_POST['sync'] == 'dirs' or $_POST['sync'] == 'files'))
if (isset($_POST['submit'])
and ($_POST['sync'] == 'dirs' or $_POST['sync'] == 'files'))
{
$template->assign_block_vars(
'update',
@@ -558,13 +608,15 @@ else if (isset($_POST['submit'])
{
$start = get_moment();
update_category('all');
echo '<!-- update_category(all) : ';
echo get_elapsed_time($start,get_moment());
echo ' for update_category(all)<br />';
echo ' -->'."\n";
$start = get_moment();
ordering();
update_global_rank();
echo '<!-- ordering categories : ';
echo get_elapsed_time($start, get_moment());
echo ' for ordering categories<br />';
echo ' -->'."\n";
}
}
// +-----------------------------------------------------------------------+
@@ -597,11 +649,16 @@ else if (isset($_POST['submit']) and preg_match('/^metadata/', $_POST['sync']))
$files = get_filelist($opts['category_id'],
$opts['recursive'],
$opts['only_new']);
echo get_elapsed_time($start, get_moment()).' for get_filelist<br />';
echo '<!-- get_filelist : ';
echo get_elapsed_time($start, get_moment());
echo ' -->'."\n";
$start = get_moment();
update_metadata($files);
echo get_elapsed_time($start, get_moment()).' for metadata update<br />';
echo '<!-- metadata update : ';
echo get_elapsed_time($start, get_moment());
echo ' -->'."\n";
}
// +-----------------------------------------------------------------------+
// | sending html code |