kontur / fontsampler-wordpress-plugin

A Wordpress plugin that let's users interactively preview and test webfonts
http://fontsampler.johannesneumeier.com
GNU General Public License v3.0
39 stars 8 forks source link

Where is Fontsampler data stored? #136

Closed shahabsiavash closed 6 years ago

shahabsiavash commented 6 years ago

Hi, My host provider decided to do a server upgrade. So after that my site went down, because the database got deleted in the process!! And after a lot of tickets they only blame Plesk. So not going to bore you with this, but no backup or database import did work. Until finally I gave them the Dropbox backup and they could restore it. I went through a nightmare and the other one is here: All fontsets and fontsamplers are gone now! I got this: The typesamplers with ID 17 can not be displayed because some files or the type sampler set are missing! You are seeing this notice because you have rights to edit posts - regular users will see an empty spot here. image

I have checked the fonts are there. And they are a lot of them! How come we restored everything and yet all Fontsampler data is gone? Where the plugin data is stored? Please help!

kontur commented 6 years ago

Hey,

Fontsampler stores all data in the same database as the rest of Wordpress, but in custom tables that are next to your other standard Wordpress tables like wpposts etc. By default (assuming the standard wp prefix) those tables are:

It is quite common for Wordpress plugins to create their own tables in the database, at least if the structure of the data does is not a good fit for using the standard post or postmeta tables. Did you lose any other data in the restoring from backup?

Does your host have an actual full backup your database? (They should, if they fail with an update like this and lose your data on top of that!) How did you create your own Wordpress backups, with a plugin, and if so with which, or the export tool?

My guess at this point is that the backup you have exported only standard Wordpress tables, not the entire database of your Wordpress installation, thus missing all the actual data (not the fonts, those are files and as you save you have them separately) and configuration of your Fontsamplers.

Hopefully this helps you figure out and find a working backup!

kontur commented 6 years ago

I changed the issue title to reflect that it is not, in fact, the plugin that is losing the data, but more generally an issue of where the plugin's data is located at.

shahabsiavash commented 6 years ago

Thanks for the reply. My backup was a full host backup and not just a Wordpresw backup. So it includes everything, such as apache files, conf, emails, subdomains, and databases and files.

So now I am checking, but other plugins are doing just fine. And the weird part is I can see your tables in my backup database file! So they are there apparently!

I don't know what should I do now!

1520008366372-454210449

kontur commented 6 years ago

How did you restore the backup? Are the Fontsampler tables in the database after the restore?

shahabsiavash commented 6 years ago

Yes since morning. They are there. I don't know if they're empty or full. But I can see them. Still there is no sets or fonts in the plugin :(

image

kontur commented 6 years ago

Can you see if there is content in the tables? It might be the tables were created empty when you reinstalled your backup, for the plugin it would have seemed like a "new install".

In your backup, do you have a .sql file with the database? If so, can you find any INSERT INTO ... statements with the Fontsampler tables?

shahabsiavash commented 6 years ago

I'm not an expert in this area. But it seems they are all empty. I didn't do a "new install." I'm sorry, but it should be a problem with Fontsampler. Because as I said this was a full backup. Everything is back. All plugins, widgets, comments, settings.

Fontsampler didn't even save the settings that I have changed months ago like the default text for the sampler or the right to left option in the basic section of the Fontsampler or even the default text alignment.

Is there any way that I could import the data that must have been saved somewhere (because it was working until 2 days ago) and add them to the new database?

It is very frustrating to add all those settings and font files and fontsets again.

kontur commented 6 years ago

Okay, like I said, probably when reinstalling from the backup for the plugin it seemed like a "fresh" install, so it started with empty tables. You can import them from your backup.

In your backup, do you have a .sql file with the database? If so, can you find any INSERT INTO ... statements with the Fontsampler tables?

You want to take only those Fontsampler specific INSERT statements to import them in your database. If you have those database backups and they contain the Fontsampler tables it is certainly possible to restore them.

shahabsiavash commented 6 years ago

No I don't. It is a .gz file with a -db file in it. So no way? And this would happen every time the plugin gets disabled or something like this happens?

kontur commented 6 years ago

You mean it's a .db extension? Look at the actual text content of that file in a file editor, does it have INSERT INTO or other SQL statements?

What I am saying is that when the plugin gets installed it will automatically create the tables. It is likely that in your restoring your backup somehow the plugin was activated, but the database tables not restored yet and then missing, which will result in the plugin assuming a new install and setting up the required database tables. Again, if you have a full database backup, one way or another, the Fontsampler tables are there and can be imported after the fact.

shahabsiavash commented 6 years ago

Hi again and thanks for the replies. Yes there are a lot of INSERT INTOs. Actually some of them are related to Fontsampler as I see it: image

I don't know why they didn't imported then!

kontur commented 6 years ago

Hey, not really sure why they didn't import, but you should be able to get the data from there.

You can copy the INSERT INTO lines pertaining to the Fontsampler tables I mentioned above and in phpMyAdmin paste them into the SQL tab and run them (one time!). Again, be sure to make a full database backup before doing anything, or running this first on a development setup.

shahabsiavash commented 6 years ago

Thanks. That would be something like this?

image

Sorry. I don't know about this stuff and very pessimist about any changes that could bring down the site!

kontur commented 6 years ago

Yes, that looks about right, but also you need all four Fontsampler tables / Insert statements, since they reference each other.

Again, please take a FULL BACKUP OF THE ENTIRE DATABASE before doing anything and ideally try this operation on a development version of your site before trying it on your live site.

shahabsiavash commented 6 years ago

Good news! I told them about that and they agreed to do the import. Because you know it was their fault in the beginning. So now they are all imported and working.

Would you please look into this? Why this happened and all that? Because I vaguely remember that once I disabled the Fontsampler and all the fontsets were gone too. It was a long time ago and there weren't too many of them, so I've created them again. It seems something worth considering to me. You can check that in a test area I guess.

kontur commented 6 years ago

Did you manage to reinstate the full working backup?

I'll double check that plugin disabling does not remove anything. Uninstalling a plugin, however, is supposed to remove any data associated with it — otherwise that data would lay around on the server or database indefinitely.

kontur commented 6 years ago

Closing this issue as not relating to the Plugin code.