2017-03-29 Fred Gleason <fredg@paravelsystems.com>

* Modified rddbcheck(8) so as to process a --rehash command after
	the inexpensive checks.
This commit is contained in:
Fred Gleason
2017-03-29 14:30:08 -04:00
parent aeccd2600e
commit 4342ccd01e
3 changed files with 26 additions and 15 deletions

View File

@@ -15675,3 +15675,6 @@
* Added an 'RDRehash' class in 'lib/rdrehash.cpp' and 'lib/rdrehash.h'.
2017-03-29 Fred Gleason <fredg@paravelsystems.com>
* Added a man page for rddbcheck(8).
2017-03-29 Fred Gleason <fredg@paravelsystems.com>
* Modified rddbcheck(8) so as to process a --rehash command after
the inexpensive checks.

View File

@@ -40,9 +40,10 @@
<command>rddbcheck</command><manvolnum>8</manvolnum> is a command-line
tool for checking the consistency of a Rivendell database and (perhaps)
repairing any inconsistencies found. When invoked without any options,
<command>rddbcheck</command><manvolnum>8</manvolnum> will run all of the
&quot;inexpensive&quot; consistency checks, report any problems found
and offer to repair the problem.
<command>rddbcheck</command><manvolnum>8</manvolnum> will run a set of
consistency checks (with the exception of the check of the SHA-1 hashes),
report any problems found and offer to repair the problem. To force a
SHA-1 hash check as well, see the <option>--rehash</option> option below.
</para>
</refsect1>
@@ -90,8 +91,15 @@
</term>
<listitem>
<para>
Run the <command>REHASH</command> check. The
<replaceable>target</replaceable> value can be one of the following:
Generate SHA-1 hashes from the specified files in the audio store
and validate them against the values stored in the database. This
is an inherently expensive operation that may require a
significant amount of time to complete as each audio
file to be checked must be opened and read in its entirety.
</para>
<para>
The <replaceable>target</replaceable> value can be one of the
following:
</para>
<variablelist>
<varlistentry>

View File

@@ -174,14 +174,6 @@ MainObject::MainObject(QObject *parent)
delete q;
}
//
// Rehash
//
if(!rehash.isEmpty()) {
Rehash(rehash);
exit(0);
}
//
// Check for Orphaned Voice Tracks
//
@@ -248,6 +240,15 @@ MainObject::MainObject(QObject *parent)
ValidateAudioLengths();
printf("done.\n\n");
//
// Rehash
//
if(!rehash.isEmpty()) {
printf("Checking hashes...\n");
Rehash(rehash);
printf("done.\n\n");
}
exit(0);
}
@@ -505,7 +506,6 @@ void MainObject::CheckPendingCarts()
"(PENDING_STATION is not null)&&"+
"(PENDING_DATETIME<\""+now.addDays(-1).
toString("yyyy-MM-dd hh:mm:ss")+"\")";
printf("SQL: %s\n",(const char *)sql);
q=new QSqlQuery(sql);
while(q->next()) {
printf(" Cart %06u has stale reservation, delete cart(y/N)?",
@@ -764,7 +764,7 @@ void MainObject::RehashCut(const QString &cutnum)
else {
if(cut->sha1Hash()!=hash) {
RDCart *cart=new RDCart(RDCut::cartNumber(cutnum));
printf(" Cut %d [%s] in cart %06u [%s] has inconsistent SHA1 hash. Correct? (y/N) ",
printf(" Cut %d [%s] in cart %06u [%s] has inconsistent SHA1 hash. Fix? (y/N) ",
cut->cutNumber(),
(const char *)cut->description(),
cart->number(),