• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

chv_stats does not exist

Status
Not open for further replies.

tryimg

Chevereto Member
🎯Description of the issue

Code:
Fatal error [400]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'chev.chv_stats' doesn't exist
Triggered in /lib/G/classes/class.db.php at line 234

Stack trace:
#0 /app/lib/classes/class.stat.php(23): G\DB::queryFetchSingle('SELECT * FROM chv_stats WHERE stat_type = "total"')
#1 /app/routes/route.dashboard.php(101): CHV\Stat::getTotals()
#2 /lib/G/classes/class.handler.php(232): G\Handler->{closure}(G\Handler)
#3 /lib/G/classes/class.handler.php(132): G\Handler->processRequest()
#4 /app/loader.php(788): G\Handler->__construct(Array)
#5 /index.php(20): include_once('/app/loader.php')

▶🚶‍Reproduction steps
  1. Going to Dashboard
😢Unexpected result

Unable to upload images, go to dashboard, or deleting images.

📃Error log message
 
For a quick help until the support reports I recommend you phpMyAdmin to make there the following SQL input.
SQL:
--
-- Tabellenstruktur für Tabelle `chv_stats`
--

CREATE TABLE `chv_stats` (
  `stat_id` bigint(32) NOT NULL,
  `stat_type` enum('total','date') NOT NULL,
  `stat_date_gmt` date DEFAULT NULL,
  `stat_users` bigint(32) NOT NULL DEFAULT '0',
  `stat_images` bigint(32) NOT NULL DEFAULT '0',
  `stat_albums` bigint(32) NOT NULL DEFAULT '0',
  `stat_image_views` bigint(32) NOT NULL DEFAULT '0',
  `stat_album_views` bigint(32) NOT NULL DEFAULT '0',
  `stat_image_likes` bigint(32) NOT NULL DEFAULT '0',
  `stat_album_likes` bigint(32) NOT NULL DEFAULT '0',
  `stat_disk_used` bigint(32) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Daten für Tabelle `chv_stats`
--

INSERT INTO `chv_stats` (`stat_id`, `stat_type`, `stat_date_gmt`, `stat_users`, `stat_images`, `stat_albums`, `stat_image_views`, `stat_album_views`, `stat_image_likes`, `stat_album_likes`, `stat_disk_used`) VALUES
(1, 'total', NULL, 1, 1, 0, 1, 0, 0, 0, 1024);

Because your registration unfortunately does not work anymore if the table is missing ....
Code:
Fatal error [0]: CHV\UserException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'metikulous_tryimg.chv_stats' doesn't exist in /home2/metikulous/addon/tryimg.com/app/lib/classes/class.user.php:240
Stack trace:
#0 /home2/metikulous/addon/tryimg.com/app/routes/route.signup.php(174): CHV\User::insert(Array)
#1 /home2/metikulous/addon/tryimg.com/lib/G/classes/class.handler.php(232): G\Handler->{closure}(Object(G\Handler))
#2 /home2/metikulous/addon/tryimg.com/lib/G/classes/class.handler.php(132): G\Handler->processRequest()
#3 /home2/metikulous/addon/tryimg.com/app/loader.php(788): G\Handler->__construct(Array)
#4 /home2/metikulous/addon/tryimg.com/index.php(20): include_once('/home2/metikulo...')
#5 {main}
Triggered in /app/routes/route.signup.php at line 181

Stack trace:
#0 /lib/G/classes/class.handler.php(232): G\Handler->{closure}(G\Handler)
#1 /lib/G/classes/class.handler.php(132): G\Handler->processRequest()
#2 /app/loader.php(788): G\Handler->__construct(Array)
#3 /index.php(20): include_once('/app/loader.php')
 
Last edited:
Also, to rebuild the global stats you should run this query:

SQL:
TRUNCATE TABLE `chv_stats`;

INSERT INTO `chv_stats` (stat_id, stat_date_gmt, stat_type) VALUES ("1", NULL, "total") ON DUPLICATE KEY UPDATE stat_type=stat_type;

UPDATE `chv_stats` SET
stat_images = (SELECT IFNULL(COUNT(*),0) FROM `chv_images`),
stat_albums = (SELECT IFNULL(COUNT(*),0) FROM `chv_albums`),
stat_users = (SELECT IFNULL(COUNT(*),0) FROM `chv_users`),
stat_image_views = (SELECT IFNULL(SUM(image_views),0) FROM `chv_images`),
stat_disk_used = (SELECT IFNULL(SUM(image_size) + SUM(image_thumb_size) + SUM(image_medium_size),0) FROM `chv_images`)
WHERE stat_type = "total";

INSERT INTO `chv_stats` (stat_type, stat_date_gmt, stat_images, stat_image_views, stat_disk_used)
SELECT sb.stat_type, sb.stat_date_gmt, sb.stat_images, sb.stat_image_views, sb.stat_disk_used
FROM (SELECT "date" AS stat_type, DATE(image_date_gmt) AS stat_date_gmt, COUNT(*) AS stat_images, SUM(image_views) AS stat_image_views, SUM(image_size + image_thumb_size + image_medium_size) AS stat_disk_used FROM `chv_images` GROUP BY DATE(image_date_gmt)) AS sb
ON DUPLICATE KEY UPDATE stat_images = sb.stat_images;

INSERT INTO `chv_stats` (stat_type, stat_date_gmt, stat_users)
SELECT sb.stat_type, sb.stat_date_gmt, sb.stat_users
FROM (SELECT "date" AS stat_type, DATE(user_date_gmt) AS stat_date_gmt, COUNT(*) AS stat_users FROM `chv_users` GROUP BY DATE(user_date_gmt)) AS sb
ON DUPLICATE KEY UPDATE stat_users = sb.stat_users;

INSERT INTO `chv_stats` (stat_type, stat_date_gmt, stat_albums)
SELECT sb.stat_type, sb.stat_date_gmt, sb.stat_albums
FROM (SELECT "date" AS stat_type, DATE(album_date_gmt) AS stat_date_gmt, COUNT(*) AS stat_albums FROM `chv_albums` GROUP BY DATE(album_date_gmt)) AS sb
ON DUPLICATE KEY UPDATE stat_albums = sb.stat_albums;

UPDATE `chv_users` SET user_content_views = COALESCE((SELECT SUM(image_views) FROM `chv_images` WHERE image_user_id = user_id GROUP BY user_id), "0");
 
Unfortunately, this ticket has more than seven days without a reply or feedback from the original poster. We will now consider this ticket abandoned and its now closed.

Don't hesitate to create a new ticket if this matter is still causing you issues.

Ticket closed.
 
Status
Not open for further replies.
Back
Top