print>>sys.stderr,"ERROR: bibsched seems to run with pid %d, according to %s."%(pid,pidfile)
print>>sys.stderr," Please stop bibsched before running this procedure."
sys.exit(1)
ifenable_recstruct_cache:
print">>> Searching records which need recstruct cache resetting; this may take a while..."
all_recids=intbitset(run_sql("SELECT id FROM bibrec"))
good_recids=intbitset(run_sql("SELECT bibrec.id FROM bibrec JOIN bibfmt ON bibrec.id = bibfmt.id_bibrec WHERE format='recstruct' AND modification_date < last_updated"))
recids=all_recids-good_recids
print">>> Generating recstruct cache..."
tot=len(recids)
count=0
forrecidinrecids:
value=serialize_via_marshal(get_record(recid))
run_sql("DELETE FROM bibfmt WHERE id_bibrec=%s AND format='recstruct'",(recid,))
run_sql("INSERT INTO bibfmt(id_bibrec, format, last_updated, value) VALUES(%s, 'recstruct', NOW(), %s)",(recid,value))