Dashboard error after deleting PageStatistic!

Permalink
Initially, I wanted to upgrade to the newest Concrete5. I went to backup database but I kept getting Error 500. The How-Tos showed me to solve this I need to delete the PageStatistic table. I went to backup using phpMyAdmin first then I empty the PageStatistic table and I drop table.

After that, I go back to Dashboard but fail. I am getting this:
Site Activity
An unexpected error occurred.
A database error occurred while processing this request.

After failing few times, my instinct is to restore the backup I made in phpMyAdmin. I went to Import, however it has error! It hangs there and I can never load phpMyAdmin.

What should I do now? Create new database and load backup there? Please help!

 
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
I must accept some culpability, I suspect that is was my old howto that was out of date for current c5 and adodb versions. I have clarified the advice to "Truncate the PageStatistics table, clearing all entries but leaving the table in place".

Before resorting to restoring the database, you could try to just restore the PageStatistics as an empty table.

To do that, in phpMyAdmin select for a direct SQL entry and copy/paste in:
CREATE TABLE IF NOT EXISTS `PageStatistics` (
  `pstID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `cID` int(10) unsigned NOT NULL DEFAULT '0',
  `date` date DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `uID` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`pstID`),
  KEY `cID` (`cID`),
  KEY `date` (`date`),
  KEY `uID` (`uID`)
);

The above is actually extracted from a full database backup, but just the part that creates the PageStatistics table.
manfred replied on at Permalink Reply
Phew...that was close. Thanks for the coding to restore PageStatistics table. The dashboard is back, up and running. However, I still get the 500 - Internal Server Error when I tried to Create New Backup at Backup & Restore. I wanna do that because I don't trust my backup at phpMyAdmin. Any advise? Should I just go ahead and upgrade Concrete?
JohntheFish replied on at Permalink Reply
JohntheFish
With PageStats slimmed down, you can still try and reduce the size of the database so that it fits into the built in backup. Depending on your version of concrete5,you can run the remove old page versions job. If not, you can pick some pages with lots and lots of versions and remove all but the last few manually.

You can try doing a backup manually outside of concrete5. The howto describes backing up with phpMyAdmin
http://www.concrete5.org/documentation/how-tos/developers/backup-a-...

You can also do it from a command line / terminal window if your host supports that using mySQL dump. I think there may be a howto on that somewhere, but do not have the link and couldn't find it with a quick search.

Another approach is my Backup Voodoo addon, which slices a backup into parts that can fit into the web server resource allowance.
JohntheFish replied on at Permalink Reply
JohntheFish
manfred replied on at Permalink Reply
Awesome John. Thanks heaps! I'll try do it