public function add_file_from_pathname($localname, $pathname) {
        if ($this->emptyziphack) {
            $this->close();
            $this->open($this->archivepathname, file_archive::OVERWRITE, $this->encoding);
        }

        if (!isset($this->za)) {
            return false;
        }

        if ($this->archivepathname === realpath($pathname)) {
            // Do not add self into archive.
            return false;
        }

        if (!is_readable($pathname) or is_dir($pathname)) {
            return false;
        }

        if (is_null($localname)) {
            $localname = clean_param($pathname, PARAM_PATH);
        }
        $localname = trim($localname, '/'); // No leading slashes in archives!
        $localname = $this->mangle_pathname($localname);

        if ($localname === '') {
            // Sorry - conversion failed badly.
            return false;
        }

        if (!$this->za->addFile($pathname, $localname)) {
            return false;
        }
        $this->modified = true;
        return true;
    }