Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-05-21 22:38:50

hilaryaq
Plugin Author
Registered: 2006-08-20
Posts: 335
Website

Theme updates query

If you have a certain theme installed, theoretically, say you have tweaked the pages and forms to suit the site, then an update comes out of the theme, am I correct that if you install the theme updates you lose your customisations?

Thanks!


…………………
I <3 txp
…………………

Offline

#2 2020-05-21 23:23:56

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

Re: Theme updates query

Yes, depending on your workflow.

If you work from disk and maybe sync by hand to the DB or use etc_flat, then when you drop the new files from the updated theme in your /themes directory, they’ll of course be overwritten immediately. BUT if you have those files under version control, you’ll be able to see the differences and choose to merge the ones you want and reject any others that you may have customised.

If you work in the DB they’ll be overwritten when you drop the updated theme in your /themes directory and choose Import from disk. BUT – and here’s the clever bit – there’s nothing to stop you unpacking the theme files into a different subdirectory. Say, /themes/megatheme_v2/forms, pages, styles, etc.

You could then import that into your DB as a parallel theme. Assign it to dev workflow and preview it to see the differences. Copy any relevant changes to the dev theme by flicking between themes and pasting in your mods. When you’re happy, use Developer Preview to flick your _v2 theme live.

For neatness, you could then:

1) Archive the old theme (Export to disk).
2) Delete it from the DB (leave the disk copy intact if you want to take a backup).
3) From your file system, zip up the old theme for prosperity if you care, then delete the old theme from /themes.
4) From the Presentation->Themes panel, rename the _v2 theme back to the original name so it becomes your new baseline theme.

As you can see, there are a few ways to approach it. None of them ideal, but I can’t think of any neat way to intrinsically know what you want to do with collisions when importing.


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

Offline

#3 2020-05-22 07:26:14

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,242
GitHub

Re: Theme updates query

Bloke wrote #323138:

[…] I can’t think of any neat way to intrinsically know what you want to do with collisions when importing.

At the risk of stating the obvious (not much sleep this end):

  • scrub existing theme from /themes/
  • write theme from database to /themes/
  • commit to (private) Git repo with appropriate commit message (e.g. “example.com, May 22 2020, I Like Toast theme v1 with my mods”)
  • merge new theme into repo piece by piece, diff as you go, untangle any tangles as you go
  • test updated theme from repo side-by-side development theme on Textpattern 4.8 (invoice in the post, Bloke)
  • final checks, switch theme to live, take a victory sip beverage, prepare the client invoice for important work, wonder how many hours/days/weeks/etc you lost with dev servers in the past
  • scrub existing theme from /themes/
  • write theme from database to /themes/
  • commit to (private) Git repo with appropriate commit message (e.g. “example.com, May 22 2020, I Like Toast theme v2 with my mods”)

Offline

#4 2020-05-22 08:46:43

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

Re: Theme updates query

gaekwad wrote #323142:

At the risk of stating the obvious

That’s all good. There are many ways of doing it, and many workflows to suit. That’s the beauty of using conventions and separating the disk/DB in this manner, rather than imposing anything stricter.

A few notes:

scrub existing theme from /themes/. write theme from database to /themes/

If you’ve not added any supplementary files, yes (js, assets, etc).

merge new theme into repo piece by piece, diff as you go, untangle any tangles as you go

Yes. Uploading the theme alongside as a parallel theme means you can do this from the admin side, flicking between themes and copying form/template code over.

Alternatively, leaving your existing theme intact on disk and applying the new theme over the top of your (version controlled) theme in the file system will allow you to git diff and merge changes that way. Then just visit the admin side and either Update from disk (overwriting what you have live immediately) or temporarily renaming the incoming theme first so you can run it side-by-side and test it before switching over.


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

Offline

#5 2020-05-22 08:53:56

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,242
GitHub

Re: Theme updates query

Bloke wrote #323147:

Alternatively, leaving your existing theme intact on disk and applying the new theme over the top of your (version controlled) theme in the file system will allow you to git diff and merge changes that way. Then just visit the admin side and either Update from disk (overwriting what you have live immediately) or temporarily renaming the incoming theme first so you can run it side-by-side and test it before switching over.

Ah, of course – you’re quite right – assets! Yes!

Offline

#6 2020-05-22 09:53:17

hilaryaq
Plugin Author
Registered: 2006-08-20
Posts: 335
Website

Re: Theme updates query

Yes yes..

I like the v2 option, just not to overright you can always delete the old one after. Github would be very handy too and exporting what you have today, good solutions :)


…………………
I <3 txp
…………………

Offline

Board footer

Powered by FluxBB