def get_outputfile_indextxt(self, filenames_tocheck, expected, wikiname, dump_date): """ generate and return a list of text strings that provide a link to the given files, along with filename, size and date. if the file does not exist, it will be silently excluded from the list. the expected list is a list of filenames that are expected to be produced by the dump; currently no errors are generated on this basis but this may change in the future. """ dirinfo = MiscDumpDir(self.args["config"], dump_date) path = dirinfo.get_dumpdir(wikiname) output_fileinfo = {} for filename in filenames_tocheck: output_fileinfo[filename] = FileUtils.file_info(os.path.join(path, filename)) files_text = [] filenames = sorted(output_fileinfo.keys()) for filename in filenames: file_date, file_size = output_fileinfo[filename] log.info("output file %s for %s %s %s", filename, wikiname, safe(file_date), safe(file_size)) if filename in expected and file_date is None: # may do more with this sort of error in the future # for now, just get stats on the other files continue if file_date: files_text.append( "%s: %s (size %s)<br />" # FIXME check that this link is correct % ( make_link(os.path.join(wikiname, dump_date, filename), os.path.basename(filename)), file_date, file_size, ) ) return files_text
def get_fileinfo(self): ''' return a FileInfo object corresponding to the file ''' return FileUtils.file_info(self.get_path())