Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-03-21 03:39:58

Summer
Member
Registered: 2018-01-29
Posts: 60

[TXP v4.7+] When a theme is stored in the database, will it lose data?

When the theme is stored in the database, will it lose data?
When exporting data from a database, it is easy to lose some of the data。

Labeled topic title. –Uli

Last edited by uli (2018-03-21 12:03:54)

Offline

#2 2018-03-21 05:21:19

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,187
Website

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

Do you mean when you update a theme from disk (Themes panel, multi-edit widget)? In that case, it is possible, depending on the state of the checkbox. If the checkbox is checked, then files (forms/templates) that are in the DB but not amongst the files on disk will be deleted.

I think… that is as far as I understand the process.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2018-03-21 05:37:18

Summer
Member
Registered: 2018-01-29
Posts: 60

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

phiw13 wrote #310170:

Do you mean when you update a theme from disk (Themes panel, multi-edit widget)? In that case, it is possible, depending on the state of the checkbox. If the checkbox is checked, then files (forms/templates) that are in the DB but not amongst the files on disk will be deleted.

I think… that is as far as I understand the process.

It’s easy to lose some of the content when exporting database data using tools like phpmyadmin.
What I mean is that when the data volume is particularly large, the loading page will not slow down.

Offline

#4 2018-03-21 06:14:38

Summer
Member
Registered: 2018-01-29
Posts: 60

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

In fact, what I want to ask is what are the advantages and disadvantages of the theme into the database?

Offline

#5 2018-03-21 08:44:31

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

Summer wrote #310173:

In fact, what I want to ask is what are the advantages and disadvantages of the theme into the database?

Using the new themes method in txp 4.7 beta, the theme used to display the homepage is always taken from database based on the theme and page template you have chosen. So, the answer to your question is that you have to use your theme in the database.

If you make changes to your template files, they will only be applied to your site once you import them into the database.

If you make changes to your templates in the Admin › Presentations panel, you only need to export them to files if you want a copy for safekeeping / file versioning, etc. As Philippe explained above, when you export or import, you have the option to merge-sync or wipe-and-sync.

There’s one very recent exception using etc_flat (see other thread), that allows you to work from files directly, but it is only there to make theme development a little easier, and is an experimental option at the moment (just a few days old).

Summer wrote #310172:

It’s easy to lose some of the content when exporting database data using tools like phpmyadmin.

Regarding phpMyadmin: as long as you export all tables, you should not lose any data.

Data you may have in template files on disk but haven’t synced to the database won’t be included, but would also not appear on the homepage. The same applies to other website assets like javascript files, webfonts, config.php etc. that are not stored in the database.

when the data volume is particularly large, the loading page will not slow down.

Textpattern has always loaded its content and page templates from the database, so this hasn’t been a choice up to very recently.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2018-03-21 09:42:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

Summer wrote #310173:

what are the advantages and disadvantages of the theme into the database?

Advantages:

  • Searchability without resorting to clumsy file-based tools like grep.
  • Cacheability: if templates don’t change, MYSQL can cache them for faster retrieval (we internally cache per page anyway).
  • Encapsulation and portability: most of your site is contained in a single database so it’s easy to back it up and move it elsewhere. The only additional content needed are the /files and /images directory contents.
  • Immediacy: save the content, it’s available to your site without any additional upload step.

Disadvantages:

  • Until 4.7.0 the only native way to edit template content was in the database via the UI. No flat-file editing in your favourite IDE or text editor.
  • No versioning/rollback. Once you save the template, it’s committed (short of restoring a database backup).

From Textpattern 4.7.0 we bring the best of both worlds, and more:

  • Edit content on disk or in the database.
  • Duplicate themes.
  • Import, export, update and share themes from disk.
  • Can use version control on disk-based assets.
  • Assign one or more assets from themes to one ore more Sections of your site. Choose the bits you want from many installed themes.
  • Theme preview for logged-in users. Work on a parallel theme on a live site, with live data, without breaking the site for existing users.

The only stipulation: if you’re working on theme assets on disk, you MUST resynchronize them with the database before you can use them on your site. Unless, as jakob says, you’re developing using the experimental etc_flat plugin, in which case the templates (not stylesheets at present) will be read from disk.

Does that help?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Online

#7 2018-03-21 10:19:06

etc
Developer
Registered: 2010-11-11
Posts: 5,186
Website GitHub

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

Summer wrote #310169:

When exporting data from a database, it is easy to lose some of the data。

That’s true, since forms with non-alphanum names are currently not exportable to the filesystem. Hence, if you export a theme and then wipe-import it, such forms will could be lost, unless we do (?) some check.

Offline

#8 2018-03-21 10:24:51

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

etc wrote #310177:

That’s true, since forms with non-alphanum names are currently not exportable to the filesystem. Hence, if you export a theme and then wipe-import it, such forms will be lost.

Is that something that can be enforced, then? On the admin-side, I guess no problem, but more difficult to enforce for filenames. I guess it could simply not sync them if they use ‘illegal’ characters.


TXP Builders – finely-crafted code, design and txp

Offline

#9 2018-03-21 10:30:20

etc
Developer
Registered: 2010-11-11
Posts: 5,186
Website GitHub

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

jakob wrote #310178:

On the admin-side, I guess no problem, but more difficult to enforce for filenames. I guess it could simply not sync them if they use ‘illegal’ characters.

Not delete, at least. But then it would not be a true sync.

Offline

#10 2018-03-21 10:35:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

It does skip them on export and issues a warning (umm, do we really need to add the regex in the error message or can we make it friendlier?!)

If someone chooses to ignore this warning and then erase-import, there’s nothing much we can do about it sensibly.

EDIT: in reverse, it will refuse to import any files with mangled names that would violate the regex either, and tell you, so if you subsequently wipe-export, you’ll lose those files. Again, nothing we can do for people who ignore the warning.

Last edited by Bloke (2018-03-21 10:38:10)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Online

#11 2018-03-21 10:43:24

etc
Developer
Registered: 2010-11-11
Posts: 5,186
Website GitHub

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

Is the warning issued before data is erased? After would be too late.

Offline

#12 2018-03-21 10:52:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: [TXP v4.7+] When a theme is stored in the database, will it lose data?

Not sure. Would have to check the code.

From what Nicolas said yesterday, the process is:

  • Merge content from any existing templates in the intended direction.
  • This includes adding new stuff so if there are any name violations, they will be flagged by this stage.
  • Gather the list of source templates, compare them to the list of destination templates and remove the differences.

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Online

Board footer

Powered by FluxBB