mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-25 23:00:21 +01:00
2017-03-29 Fred Gleason <fredg@paravelsystems.com>
* Added a 'CUTS.SHA1_HASH' field to the database. * Incremented the database version to 261. * Added a 'Sha1' column to the Cut List in 'rdlibrary/audio_cart.cpp'. * Added 'RDCut::sha1Hash()' and 'RDCut::setSha1Hash()' methods in 'lib/rdcut.cpp' and 'lib/rdcut.h'. * Added a '--rehash=' directive to rddbcheck(8). * Added a 'Rehash' Web API call. * Added an 'RDRehash' class in 'lib/rdrehash.cpp' and 'lib/rdrehash.h'.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <rd.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdrehash.h>
|
||||
#include <rdmaint.h>
|
||||
#include <rdlibrary_conf.h>
|
||||
#include <rdescape_string.h>
|
||||
@@ -127,14 +128,16 @@ void MainObject::RunSystemMaintenance()
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
sql="update VERSION set LAST_MAINT_DATETIME=now()";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
PurgeCuts();
|
||||
PurgeLogs();
|
||||
PurgeElr();
|
||||
PurgeGpioEvents();
|
||||
PurgeWebapiAuths();
|
||||
sql="update VERSION set LAST_MAINT_DATETIME=now()";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
RehashCuts();
|
||||
}
|
||||
|
||||
|
||||
@@ -292,6 +295,36 @@ void MainObject::PurgeWebapiAuths()
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
void MainObject::RehashCuts()
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDRehash::ErrorCode err;
|
||||
|
||||
sql="select CUT_NAME from CUTS where SHA1_HASH is null limit 100";
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
printf("CUT: %s\n",(const char *)q->value(0).toString());
|
||||
if((err=RDRehash::rehash(maint_station,maint_user,maint_config,
|
||||
RDCut::cartNumber(q->value(0).toString()),
|
||||
RDCut::cutNumber(q->value(0).toString())))!=RDRehash::ErrorOk) {
|
||||
maint_config->
|
||||
log("rdmaint",
|
||||
RDConfig::LogErr,QString().sprintf("failed to rehash cut %s [%s]",
|
||||
(const char *)q->value(0).toString(),
|
||||
(const char *)RDRehash::errorText(err)));
|
||||
|
||||
}
|
||||
if(maint_verbose) {
|
||||
fprintf(stderr,"rehashed cut \"%s\"\n",
|
||||
(const char *)q->value(0).toString());
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user