Loading
feat: #3636938 Add a manifest, checksums and a start page to the archive
Closes https://www.drupal.org/project/earkiv/issues/3636938
One commit per part.
Commits
- Add a manifest to the archive.
earkiv-manifest.jsonin the root: job ID, archived URL, when the crawl started and finished, the versions of E-Arkiv, Drupal and HTTrack, all archiver settings, the counts of URLs, files, bytes, broken links, unlinked pages and published pages with errors, the path of the start page of the site and the report files. The files left out of the archive are now one list (ARCHIVE_EXCLUDE), used by tar and byarchiveFiles(). - Add checksums of the files in the archive.
earkiv-checksums.sha256with the SHA-256 checksum of every file in the format ofsha256sum, written last so that it covers every other file. The lock is extended while the files are hashed. - Store the checksum of the archive file. New base field
checksumon the archive (installed byearkiv_post_update_archive_checksum_field()), set after compression, shown in the archive list, and written next to the stored archive asearkiv_….tar.gz.sha256, which is removed with the archive. Cleared when a job starts over. - Replace HTTrack's index with a start page for the archive. HTTrack's
index.htmllinks to every start URL, which can be thousands. It is replaced with a page that says which site was archived and when, links to the start page of the site and to the manifest and the reports, with translatable texts.backblue.gifandfade.gifare removed.
Testing
Full archive of a Drupal 11 site: 7,876 URLs, 110 broken links, 2.39 GB, 13 min 35 s with 128 connections (about a minute more than before, mostly for the checksums).
- The manifest had all fields, e.g. 7,882 files, 3.25 GB, start page
…/index/index.html, HTTrack 3.49-6. shasum -a 256 -c earkiv-checksums.sha256on the extracted archive: all 7,883 files OK, 15 s.shasum -a 256 -c earkiv_….tar.gz.sha256next to the stored archive: OK; the same checksum is on the entity and in the archive list. Deleting the job removed both files.- The start page links to the site start page and the seven files; HTTrack's images are gone.
- The exclude matcher, tested on a small mirror, leaves out the same files as tar.
- phpcs (Drupal, DrupalPractice) reports no new findings compared with 1.0.x.
AI-Generated: Yes (Used Claude Code to write the feature, test it on a full archive and write this merge request.)