* mu-cmd-index.c: fix progress output (fflush)
This commit is contained in:
@ -145,14 +145,14 @@ print_stats (MuIndexStats* stats, gboolean clear)
|
|||||||
|
|
||||||
if (clear) {
|
if (clear) {
|
||||||
/* optimization, this function showed up in profiles */
|
/* optimization, this function showed up in profiles */
|
||||||
static const char *backspace =
|
static char *backspace =
|
||||||
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
||||||
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
||||||
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
|
||||||
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
|
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
|
||||||
//backspace[len] = '\0';
|
backspace[len] = '\0';
|
||||||
fputs (backspace, stdout);
|
fputs (backspace, stdout);
|
||||||
//backspace[len] = '\b';
|
backspace[len] = '\b';
|
||||||
}
|
}
|
||||||
|
|
||||||
len = (unsigned)snprintf (output, sizeof(output),
|
len = (unsigned)snprintf (output, sizeof(output),
|
||||||
@ -163,6 +163,7 @@ print_stats (MuIndexStats* stats, gboolean clear)
|
|||||||
(unsigned)stats->_updated,
|
(unsigned)stats->_updated,
|
||||||
(unsigned)stats->_cleaned_up);
|
(unsigned)stats->_cleaned_up);
|
||||||
fputs (output, stdout);
|
fputs (output, stdout);
|
||||||
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,9 +183,10 @@ index_msg_cb (MuIndexStats* stats, void *user_data)
|
|||||||
static gboolean
|
static gboolean
|
||||||
database_version_check_and_update (MuConfig *opts)
|
database_version_check_and_update (MuConfig *opts)
|
||||||
{
|
{
|
||||||
const gchar *xpath;
|
const gchar *xpath, *ccache;
|
||||||
|
|
||||||
xpath = mu_runtime_path (MU_RUNTIME_PATH_XAPIANDB);
|
xpath = mu_runtime_path (MU_RUNTIME_PATH_XAPIANDB);
|
||||||
|
ccache = mu_runtime_path (MU_RUNTIME_PATH_CONTACTS);
|
||||||
|
|
||||||
if (mu_util_xapian_is_empty (xpath))
|
if (mu_util_xapian_is_empty (xpath))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -193,8 +195,9 @@ database_version_check_and_update (MuConfig *opts)
|
|||||||
* anything */
|
* anything */
|
||||||
if (opts->rebuild) {
|
if (opts->rebuild) {
|
||||||
opts->reindex = TRUE;
|
opts->reindex = TRUE;
|
||||||
g_message ("clearing database %s", xpath);
|
g_message ("clearing database [%s]", xpath);
|
||||||
return mu_util_xapian_clear (xpath);
|
g_message ("clearing contacts-cache [%s]", ccache);
|
||||||
|
return mu_util_xapian_clear (xpath, ccache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mu_util_xapian_needs_upgrade (xpath))
|
if (!mu_util_xapian_needs_upgrade (xpath))
|
||||||
@ -203,8 +206,8 @@ database_version_check_and_update (MuConfig *opts)
|
|||||||
/* ok, database is not up to date */
|
/* ok, database is not up to date */
|
||||||
if (opts->autoupgrade) {
|
if (opts->autoupgrade) {
|
||||||
opts->reindex = TRUE;
|
opts->reindex = TRUE;
|
||||||
g_message ("auto-upgrade: clearing old database first");
|
g_message ("auto-upgrade: clearing old database and cache");
|
||||||
return mu_util_xapian_clear (xpath);
|
return mu_util_xapian_clear (xpath, ccache);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_warning ();
|
update_warning ();
|
||||||
|
|||||||
Reference in New Issue
Block a user