def cleanup_old_search_results(tmpDir, selName): isDir = ryw.is_valid_dir(tmpDir, msg='cleanup_old_search_results') if not isDir: logging.debug('cleanup_old_search_results: found no result dir.') try: files = os.listdir(tmpDir) latestFileName = os.path.join(tmpDir, selName) latestFileCtime = os.path.getctime(latestFileName) for oneFile in files: if oneFile == selName: continue oneFileName = os.path.join(tmpDir, oneFile) oneFileCtime = os.path.getctime(oneFileName) if latestFileCtime - oneFileCtime > DELETE_OLD_SEARCH_RESULT_SECONDS: ryw.cleanup_path(oneFileName, 'cleanup_old_search_results') except: ryw.give_bad_news('cleanup_old_search_results failed: ' + tmpDir + ' -- ' + selName, logging.error)
ryw.check_logging(os.path.join(RepositoryRoot, 'WWW', 'logs'), 'upload.log') logging.debug('FlushQueue: entered...') ryw.print_header() print '<TITLE>Generating Outgoing Disc</TITLE>' ryw_view.print_logo() #print 'Dear <B><I>' + name + ':</I></B>' form = cgi.FieldStorage() tmpdir = form.getfirst("tmpdir","") if tmpdir and not ryw.is_valid_dir(tmpdir, 'FlushQueue'): ryw_view.print_footer() sys.exit(1) meta = form.getfirst('meta', '') metaOnly = meta == 'true' or meta == 'on' if metaOnly: ryw.give_news2('sending metadata only.<BR>', logging.info) discLimit = form.getfirst('disc_limit', '') discLimitInt = None if discLimit: try: discLimitInt = int(discLimit)