diff options
| author | Georgi Nikolov <ggeorgi60@gmail.com> | 2025-02-01 18:20:15 +0200 |
|---|---|---|
| committer | Georgi Nikolov <ggeorgi60@gmail.com> | 2025-02-01 18:20:15 +0200 |
| commit | 40b78735aeba6082363e6a8d98b78da9ba230687 (patch) | |
| tree | 036207435be8d7cc27e1f468f7791c11890709c3 /controllers | |
| parent | 34903b6553f6483f52e57133fc6305779461db29 (diff) | |
| download | nowayforward_human-40b78735aeba6082363e6a8d98b78da9ba230687.tar nowayforward_human-40b78735aeba6082363e6a8d98b78da9ba230687.tar.gz nowayforward_human-40b78735aeba6082363e6a8d98b78da9ba230687.zip | |
Fixed the create table workaround
This included creating an update function that can update the archive after its creation, setting the correct title and favicon path
Diffstat (limited to 'controllers')
| -rw-r--r-- | controllers/archive.php | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/controllers/archive.php b/controllers/archive.php index 35ab1dd..ffe9c70 100644 --- a/controllers/archive.php +++ b/controllers/archive.php @@ -37,10 +37,7 @@ class DownloadPage { $page_url_pattern = $this->getCorrectLinkPattern($this->page_url); $simular_pages = Database\Webpage::getArchivePathsByPattern('%' . $page_url_pattern . '%'); if ($website_exists) { - // NOTE: This is incredibly dumb, Databas\Webpage::create returns the - // auto-incremented ID, so it should be used here. - // The logic needs to be reorganized! - $this->folder_name = Database\Webpage::getPagesCount() + 1; + $this->folder_name = Database\Webpage::create($folder_location, $this->page_url, $requester_uid, "default", "Default title"); $this->page_contents = $this->downloadFile($this->page_url); $this->createArchive($simular_pages); if (!$this->favicon_path) { @@ -48,7 +45,8 @@ class DownloadPage { // Fallback and try to download them from the server directly $this->tryDownloadFavicon(); } - Database\Webpage::create($folder_location, $this->page_url, $requester_uid, $this->favicon_path, $this->page_title); + Database\Webpage::updateNewArchive($this->folder_name, $this->favicon_path, $this->page_title); + } else { echo "Website does not exist"; } |
