Process the extended ProFTPD log.

    Args:
        file_iterator (file): any file-like iterator for reading the log or
                              stdin (see :func:`_read_stdin`).

    Yields:
        ImportRequest: with each import.

def process_log(file_iterator):
    """
    Process the extended ProFTPD log.

    Args:
        file_iterator (file): any file-like iterator for reading the log or
                              stdin (see :func:`_read_stdin`).

    Yields:
        ImportRequest: with each import.
    """
    for line in file_iterator:
        if "," not in line:
            continue

        parsed = _parse_line(line)

        if not parsed["command"].upper() in ["DELE", "DEL"]:
            continue

        # don't react to anything else, than trigger in form of deleted
        # "lock" file
        if os.path.basename(parsed["path"]) != settings.LOCK_FILENAME:
            continue

        # react only to lock file in in home directory
        dir_name = os.path.dirname(parsed["path"])
        if settings.LOCK_ONLY_IN_HOME:
            if dir_name != settings.DATA_PATH + parsed["username"]:
                continue

        # deleted user
        if not os.path.exists(os.path.dirname(parsed["path"])):
            continue

        # old record, which doesn't need to be parsed again
        if os.path.exists(parsed["path"]):
            continue

        logger.info(
            "Request for processing from user '%s'." % parsed["username"]
        )

        yield process_import_request(
            username=parsed["username"],
            path=os.path.dirname(parsed["path"]),
            timestamp=parsed["timestamp"],
            logger_handler=logger
        )