Browse Source

update local snap storage paths

main
ghost 2 years ago
parent
commit
efc66d5dab
  1. 2
      README.md
  2. 11
      crontab/crawler.php
  3. 0
      public/snap/index.html

2
README.md

@ -38,7 +38,7 @@ sphinxsearch @@ -38,7 +38,7 @@ sphinxsearch
* Deploy the database using [MySQL Workbench](https://www.mysql.com/products/workbench) project presented in the `/database` folder
* Install [Sphinx Search Server](https://sphinxsearch.com)
* Configuration examples are placed at `/config` folder
* Make sure `/storage`, `/public/storage` folders writable
* Make sure `/storage`, `/public/snap` folders writable
* Set up the `/crontab` scripts by following [example](https://github.com/YGGverse/YGGo/blob/main/config/crontab.txt)
#### JSON API

11
crontab/crawler.php

@ -402,18 +402,23 @@ try { @@ -402,18 +402,23 @@ try {
$time = time();
@mkdir('../public/storage/snap/hp/' . $queueHostPage->hostPageId, 755, true);
$dir = chunk_split($queueHostPage->hostPageId, 1, '/');
@mkdir('../public/snap/hp/' . $dir, 755, true);
$zip = new ZipArchive();
if (true === $zip->open('../public/storage/snap/hp/' . $queueHostPage->hostPageId . '/' . $time . '.zip', ZipArchive::CREATE)) {
// Create new container
if (true === $zip->open('../public/snap/hp/' . $dir . $time . '.zip', ZipArchive::CREATE)) {
// Insert compressed snap data
if (true === $zip->addFromString($queueHostPage->hostPageId . '.' . $time . '.' . preg_replace('|^[A-z-]+/([A-z-]+).*|ui', '$1', Filter::mime($contentType)), $content)) {
// Update DB registry
$hostPagesSnapUrlAdded += $db->addHostPageSnapURL($queueHostPage->hostPageId,
$crc32data, // do not create duplicated content snaps
$crc32host, // multi host storage with same timestamp / crc32data
'/storage/snap/hp/' . $queueHostPage->hostPageId . '/' . $time . '.zip', // public url
'/snap/hp/' . $dir . $time . '.zip', // public url
$time);
$zip->close();

0
public/snap/index.html

Loading…
Cancel
Save