aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/update.php81
-rw-r--r--template/default/admin/update.tpl75
2 files changed, 108 insertions, 48 deletions
diff --git a/admin/update.php b/admin/update.php
index 29cab4f87..c8ed1752a 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -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 |
diff --git a/template/default/admin/update.tpl b/template/default/admin/update.tpl
index 1f5dbee2e..5b4136ca2 100644
--- a/template/default/admin/update.tpl
+++ b/template/default/admin/update.tpl
@@ -1,36 +1,3 @@
-<!-- BEGIN introduction -->
-<div class="admin">{L_UPDATE_TITLE}</div>
-<form action="{F_ACTION}" method="post">
- <ul class="menu">
- <li>
- {L_UPDATE_SYNC_FILES}
- <ul class="menu">
- <li><input type="radio" name="sync" value="dirs" checked="checked" /> {L_UPDATE_SYNC_DIRS}</li>
- <li><input type="radio" name="sync" value="files" /> {L_UPDATE_SYNC_ALL}</li>
- <li><input type="checkbox" name="display_info" value="1" /> {L_UPDATE_DISPLAY_INFO}</li>
- <li><input type="checkbox" name="simulate" value="1" checked="checked" /> {L_UPDATE_SIMULATE}</li>
- </ul>
- </li>
- <li>
- {L_UPDATE_SYNC_METADATA}
- <ul class="menu">
- <li><input type="radio" name="sync" value="metadata_new" /> {L_UPDATE_SYNC_METADATA_NEW}</li>
- <li><input type="radio" name="sync" value="metadata_all" /> {L_UPDATE_SYNC_METADATA_ALL}</li>
- </ul>
- </li>
- <li>
- {L_UPDATE_CATS_SUBSET}<br />
- <select style="width:500px" name="cat" size="10">
- <!-- BEGIN category_option -->
- <option {introduction.category_option.SELECTED} value="{introduction.category_option.VALUE}">{introduction.category_option.OPTION}</option>
- <!-- END category_option -->
- </select>
- <input type="checkbox" name="subcats-included" value="1" checked="checked" /> {L_SEARCH_SUBCATS_INCLUDED}
- </li>
- </ul>
- <p style="text-align:center;"><input type="submit" value="{L_SUBMIT}" name="submit" class="bouton" /></p>
-</form>
-<!-- END introduction -->
<!-- BEGIN update -->
<div class="admin">{L_RESULT_UPDATE}</div>
<ul style="text-align:left;">
@@ -55,10 +22,46 @@
<!-- END errors -->
<!-- BEGIN infos -->
<div class="admin">{L_UPDATE_INFOS_TITLE}</div>
-<ul style="text-align:left;">
- <!-- BEGIN info -->
+<ul style="text-align:left;">
+ <!-- BEGIN info -->
<li>[{update.infos.info.ELEMENT}] {update.infos.info.LABEL}</li>
- <!-- END info -->
+ <!-- END info -->
</ul>
<!-- END infos -->
<!-- END update -->
+<!-- BEGIN introduction -->
+<div class="admin">{L_UPDATE_TITLE}</div>
+<form action="{F_ACTION}" method="post">
+ <ul class="menu">
+ <li>
+ {L_UPDATE_SYNC_FILES}
+ <ul class="menu">
+ <li><input type="radio" name="sync" value="dirs" {SYNC_DIRS_CHECKED} /> {L_UPDATE_SYNC_DIRS}</li>
+ <li><input type="radio" name="sync" value="files" {SYNC_ALL_CHECKED} /> {L_UPDATE_SYNC_ALL}</li>
+ <li><input type="checkbox" name="display_info" value="1" {DISPLAY_INFO_CHECKED} /> {L_UPDATE_DISPLAY_INFO}</li>
+ <li><input type="checkbox" name="simulate" value="1" checked="checked" /> {L_UPDATE_SIMULATE}</li>
+ </ul>
+ </li>
+ <li>
+ {L_UPDATE_SYNC_METADATA}
+ <ul class="menu">
+ <li><input type="radio" name="sync" value="metadata_new" /> {L_UPDATE_SYNC_METADATA_NEW}</li>
+ <li><input type="radio" name="sync" value="metadata_all" /> {L_UPDATE_SYNC_METADATA_ALL}</li>
+ </ul>
+ </li>
+ <li>
+ {L_UPDATE_CATS_SUBSET}<br />
+ <select style="width:500px" name="cat" size="10">
+ <!-- BEGIN category_option -->
+ <option {introduction.category_option.SELECTED} value="{introduction.category_option.VALUE}">{introduction.category_option.OPTION}</option>
+ <!-- END category_option -->
+ </select>
+ <input type="checkbox" name="subcats-included" value="1" {SUBCATS_INCLUDED_CHECKED} /> {L_SEARCH_SUBCATS_INCLUDED}
+ </li>
+ </ul>
+ <p style="text-align:center;">
+ <input type="submit" value="{L_SUBMIT}" name="submit" class="bouton" />
+ <input type="reset" value="{L_RESET}" name="reset" class="bouton" />
+ </p>
+</form>
+<!-- END introduction -->