• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Not sure what happened, but image table got truncated?!

Status
Not open for further replies.

jonbenwaa

Chevereto Member
So I'm not posting a problem, as I'm sure its something I did. But I'm just trying to figure out what may have happened so i can restore the data.

I have the AUS mod installed, but not sure if that is the culprit, so that's why I'm posting in tech support. So I went live last night and had about 30 or so images uploaded. I was able to see them in the admin panel as well as the AUS gallery.

So I have been making changes to the config, for mainly stuff like the facebook plugin and such, and about an hour ago I see the gallery doesn't have any images in it. I log into the admin control panel, and there aren't any images in there either! So I upload an image, and everything is working fine, the new images get added to the gallery, as well as the admin panel. I checked the directory and the old images are still there, but when I checked the chv_image table all the records were gone. All the users are still there, as well as all the other data (i think), except for the image table.

The only thing that I know that may have caused it is a friend of mine who's helping me test it out uploaded a large gif file (or tried to) and got the error message.

I can write the queries to restore the info to the image table, thats not a problem and since it's only a few users helping me test it out, no one is going to be upset. But I don't want this to happen again so I'm trying to think of what may have happened!
 
Any way to invoke addition to the database? Can't remember where I read it but if I were to delete the missing files that got erased, and reupload them to the same directory, would that work you think?
 
You will need to manually code a php script to restore the records based on the DirectoryIteraror on the images folder.
 
How weird.. my only guess is that one of your friends messed up and deleted the records, because the aus mod has no query that would delete multiple images from your database. ONLY using the user panel "myimages" module.
 
But that would have removed the images from the directory as well? The images are still there, but the records disappeared in the db... who knows. Everything seems to be running fine now, so maybe i did something weird.
 
Some scenarios where people lost the dB records:
  • Install the site on /site and then "hey, I want to test something" and you do a test site on /test but you connect the same dB... Result: The script can't find the files because it works with relative paths so the records are deleted from the dB.
  • Somehow connect to another dB and delete the old dB... The script won't populate this new dB with the old records and the old dB is missing.
  • By mistake you truncate table :trollface:
Ways to re-made the dB records:
  • Use DirectoryIterator to craw the directory and use the Chevereto built-in methods to insert the files (Check update.php for a example)
  • If you want to restore only /old image files (thos who comes from the 1.9->2.X update) you only need to move all the files to /images, rename the thumbs from filename.th.ext to filename.ext and move this to /thumbs then run the update script.
But that would have removed the images from the directory as well?
Nope. The only way that Chevereto has to delete both records and files is when you call the delete handler.
 
Ah good
Nope. The only way that Chevereto has to delete both records and files is when you call the delete handler.

Good to know! Thanks for the replies. I knew there was some built in functions that I could prob find, but figured it'd be better to go to the source.

Thanks!
 
Status
Not open for further replies.
Back
Top