picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 616 forks source link

WebsiteExistsException #619

Closed kowjens closed 2 years ago

kowjens commented 2 years ago

WebsiteExistsException is thrown after deleting a website and recreating it again.

Steps to reproduce:

OCA\CMSPico\Exceptions\WebsiteExistsException: 
/var/www/html/custom_apps/cms_pico/lib/Controller/WebsitesController.php - line 121:

OCA\CMSPico\Service\WebsitesService->createWebsite(OCA\CMSPico\Model\Website {}, "sample_pico")
....

Server configuration detail

Operating system: Linux 5.4.0-100-generic 113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64

Webserver: nginx/1.21.3 (fpm-fcgi)

Database: mysql 10.2.14

PHP version: 8.0.11

Modules loaded: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, pdo_sqlite, session, posix, readline, Reflection, standard, SimpleXML, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, cgi-fcgi, apcu, bcmath, exif, gd, gmp, imagick, intl, ldap, memcached, pcntl, pdo_mysql, pdo_pgsql, redis, sodium, zip, Zend OPcache

Nextcloud version: 22.2.0 - 22.2.0.2

PhrozenByte commented 2 years ago

Works for me. Looks like something went wrong when deleting the website before, so please use phpMyAdmin (or similar) to manually delete the website from the oc_cms_pico_websites table. Use the site column to properly identify the website you want to delete. Please keep in mind that website identifiers are global, i.e. another user using the same identifier will prevent you from using the same identifier. Check the user_id column.

kowjens commented 2 years ago

@PhrozenByte many thanks for your fast reply! For Nextcloud install its the database nextcloud with table cms_pico_websites. After deleting the entries manually it works now. However, in the table I also found old sites from already deleted users. Maybe an autodelete can be triggered after deleting the user to prevent existing site entries that are only accessible via cmdline or phpmyadmin. Thanks all and a good start into the week

PhrozenByte commented 2 years ago

Can't reproduce this either: When deleting an user all user websites are deleted, too.

Thanks all and a good start into the week

Dito :v: