def parse_conffile_overrideables(self): """ globals like entries in 'wiki' or 'output' that can be overriden by a specific named section """ self.db_list_unsorted = MiscUtils.db_list(self.get_opt_in_overrides_or_default( "wiki", "dblist", 0), nosort=True) # permit comma-separated list of files so that eg some script # can skip all private and/or closed wikis in addition to some # other exclusion list to_skip = self.get_opt_in_overrides_or_default("wiki", "skipdblist", 0) self.skip_db_list = self.get_skipdbs(to_skip) try: self.private_list = MiscUtils.db_list(self.get_opt_in_overrides_or_default( "wiki", "privatelist", 0)) except FileNotFoundError: self.private_list = [] try: self.closed_list = MiscUtils.db_list(self.get_opt_in_overrides_or_default( "wiki", "closedlist", 0)) except FileNotFoundError: self.closed_list = [] try: self.flow_list = MiscUtils.db_list(self.get_opt_in_overrides_or_default( "wiki", "flowlist", 0)) except FileNotFoundError: self.flow_list = [] self.tablejobs = self.get_opt_in_overrides_or_default( "wiki", "tablejobs", 0) self.apijobs = self.get_opt_in_overrides_or_default( "wiki", "apijobs", 0) self.db_list_unsorted = [dbname for dbname in self.db_list_unsorted if dbname not in self.skip_db_list] self.db_list = sorted(self.db_list_unsorted) if not self.conf.has_section('output'): self.conf.add_section('output') self.public_dir = self.get_opt_in_overrides_or_default("output", "public", 0) self.private_dir = self.get_opt_in_overrides_or_default("output", "private", 0) self.temp_dir = self.get_opt_in_overrides_or_default("output", "temp", 0) self.web_root = self.get_opt_in_overrides_or_default("output", "webroot", 0) self.index = self.get_opt_in_overrides_or_default("output", "index", 0) self.template_dir = self.get_opt_in_overrides_or_default("output", "templatedir", 0) self.perdump_index = self.get_opt_in_overrides_or_default("output", "perdumpindex", 0) self.log_file = self.get_opt_in_overrides_or_default("output", "logfile", 0) self.fileperms = self.get_opt_in_overrides_or_default("output", "fileperms", 0) self.fileperms = int(self.fileperms, 0) if not self.conf.has_section('misc'): self.conf.add_section('misc') self.fixed_dump_order = self.get_opt_in_overrides_or_default("misc", "fixeddumporder", 0) self.fixed_dump_order = int(self.fixed_dump_order, 0)
def get_skipdbs(self, filenames): """ permit comma-separated list of files so that eg some script can skip all private and/or closed wikis in addition to some other exclusion list """ if ',' in filenames: skipfiles = filenames.split(',') else: skipfiles = [filenames] skip_db_list = [] for skipfile in skipfiles: skip_db_list.extend(MiscUtils.db_list(skipfile)) return list(set(skip_db_list))
def parse_conffile_globally(self): self.db_list = MiscUtils.db_list(self.conf.get("wiki", "dblist")) # permit comma-separated list of files so that eg some script # can skip all private and/or closed wikis in addition to some # other exclusion list to_skip = self.conf.get("wiki", "skipdblist") if ',' in to_skip: skipfiles = to_skip.split(',') else: skipfiles = [to_skip] self.skip_db_list = [] for skipfile in skipfiles: self.skip_db_list.extend(MiscUtils.db_list(skipfile)) self.skip_db_list = list(set(self.skip_db_list)) self.private_list = MiscUtils.db_list(self.conf.get("wiki", "privatelist")) self.closed_list = MiscUtils.db_list(self.conf.get("wiki", "closedlist")) self.flow_list = MiscUtils.db_list(self.conf.get("wiki", "flowlist")) self.tablejobs = self.conf.get("wiki", "tablejobs") self.db_list = list(set(self.db_list) - set(self.skip_db_list)) if not self.conf.has_section('database'): self.conf.add_section('database') self.max_allowed_packet = self.conf.get("database", "max_allowed_packet") if not self.conf.has_section('output'): self.conf.add_section('output') self.public_dir = self.conf.get("output", "public") self.private_dir = self.conf.get("output", "private") self.temp_dir = self.conf.get("output", "temp") self.web_root = self.conf.get("output", "webroot") self.index = self.conf.get("output", "index") self.template_dir = self.conf.get("output", "templatedir") self.perdump_index = self.conf.get("output", "perdumpindex") self.log_file = self.conf.get("output", "logfile") self.fileperms = self.conf.get("output", "fileperms") self.fileperms = int(self.fileperms, 0) if not self.conf.has_section('reporting'): self.conf.add_section('reporting') self.admin_mail = self.conf.get("reporting", "adminmail") self.mail_from = self.conf.get("reporting", "mailfrom") self.smtp_server = self.conf.get("reporting", "smtpserver") self.stale_age = self.conf.getint("reporting", "staleage") self.skip_privatetables = self.conf.getint("reporting", "skipprivatetables") if not self.conf.has_section('tools'): self.conf.add_section('tools') self.php = self.conf.get("tools", "php") self.gzip = self.conf.get("tools", "gzip") self.bzip2 = self.conf.get("tools", "bzip2") self.sevenzip = self.conf.get("tools", "sevenzip") self.mysql = self.conf.get("tools", "mysql") self.mysqldump = self.conf.get("tools", "mysqldump") self.head = self.conf.get("tools", "head") self.tail = self.conf.get("tools", "tail") self.cat = self.conf.get("tools", "cat") self.grep = self.conf.get("tools", "grep") self.checkforbz2footer = self.conf.get("tools", "checkforbz2footer") self.writeuptopageid = self.conf.get("tools", "writeuptopageid") self.recompressxml = self.conf.get("tools", "recompressxml") if not self.conf.has_section('cleanup'): self.conf.add_section('cleanup') self.keep = self.conf.getint("cleanup", "keep") if not self.conf.has_section('query'): self.conf.add_section('query') self.queryfile = self.conf.get("query", "queryfile")