Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-09-06 23:38:56

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

adi_prefs - Preference Sets

Summary

adi_prefs gives you an admin interface for managing different sets of preference values.

See the help supplied with the plugin, or have a look online.

The Preference Sets tab

This provides:

  • a number of sets of preferences & their values
  • the ability to add & remove preferences
  • the ability to apply preference values
  • a facility to rename the sets

Game, Set & Match

The Preference Set names default to “Current”, “Default”, “Local”, “Staging”, “Testing” & “Live”. They may be changed to anything you like in the Preference Sets tab.

The Current set is the actual preference values in use by Textpattern on your site.

The Default set is a snapshot of the preference values taken when adi_prefs was installed. This can be seen as a view of how things were when you started, e.g. a “fallback” position.

The Local, Staging, Testing & Live sets may be modified.

A message is displayed at the top of the tab to indicate with sets match the currently active preference values.

Adding & removing preferences

Preferences may be added to the sets from a popup list in the Preference Sets tab. The initial value for all sets will be taken from the current value.

If you remove a preference, all of it’s values in the different sets will be forgotten. Removal of a preference doesn’t affect it’s “current” value.

Stef’s Prefalizer is a great way of examining all preferences currently in use & their values – and may help you work out which ones to pick off the list.

Applying yourself

The Default, Local, Staging, Testing & Live sets may be “applied”. This means that their values are then used in anger on the website.

An example of usage

For every one of my websites there are typically three versions in existence:

  • the master copy locally on my Mac
  • a demo site on the Web (hidden from Google) where I can show my clients the work in progress
  • the live site

To copy the local site onto the web, I need to:

  • take a backup (using rss_admin_db_manager)
  • transfer across all modified files (CSS, images, DB backup etc)
  • restore the DB backup on the Staging or Live site (again using rss_admin_db_manager)
  • manually tweak the preferences to make it work.

And it’s the last step that is a pain (& potentially error prone). A minimum of 7 preferences need to be changed at this point – Site URL, Production Status, File directory path, Temporary directory path, Backup Path, mysqldump Path, mysql Path.

By using adi_prefs & setting up the different permutations of values in advance, the last step becomes a one-click operation.

You’ll notice that the default list of preferences when you first install adi_prefs selfishly match the above list in order to do my “copy website” operation but potentially you could use adi_prefs to apply any combination of preference values for any purpose.

Buyer Beware

No validation of “free-format” preference values is performed, so ensure that the values you enter are valid for use – otherwise you might break your site! If things go pear-shaped try applying the Default set.

If you want to be ultra cautious then take a backup (rss_admin_db_manager) before fiddling.

Version History

  • 0.3.2
    • minor layout fixes
    • TXP 4.5+ only
    • tested in 4.6
  • 0.3.1
    • fixed issue when upgrading from version 0.1
    • fixed Textpack download
  • 0.3
    • TXP 4.5-ified
    • moved install/uninstall to plugin options
    • Textpack added
    • tooltips thrown in the tip
    • code tidy up
    • now uses lifecycle events
  • 0.2.1
    • fixed: injudicious use of global variables, causing conflict with adi_matrix
  • 0.2
    • enhancement: added new set “Testing” (for Maniqui)
    • enhancement: preference set visibility
  • 0.1
    • initial release

Textpack

There is a mechanism to install a Textpack in the adi_prefs options page under the Plugins tab.

Corrections or additional language translations are most welcome and can be submitted here.

Languages currently available:

  • French (thanks Pat64)

Requirements

TXP 4.5+

Download & Installation

Download adi_prefs and install the plugin in the usual way.

A new table, called adi_prefs, will be added to the database when you make the plugin active.

Then add or remove preferences to suit, enter values, and apply.

Bugs & Limitations

  • No validation of “free-format” preference values is performed, so make sure you enter something sensible or your site might break
  • I’ve excluded some preferences, such as dbupdatetime & version, because I’m thinking it wouldn’t be sensible to muck around with them – if you see any preferences that shouldn’t be fiddled with, let me know
  • I’ve also left the Timezone preferences in the “too hard basket” for the moment

Let me know if you find any other problems.

Feedback

Comments are most welcome.

Spread the love

If you find this plugin useful and would like a warm and fuzzy feeling to go with it, please consider donating to the Textpattern development team.

Last edited by gomedia (2015-07-11 09:38:59)

Offline

#2 2010-09-07 09:13:00

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: adi_prefs - Preference Sets

Thanks Adi, this looks useful! I think I’ll give it a try soon.

Offline

#3 2010-09-07 09:20:09

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

Re: adi_prefs - Preference Sets

What a fab idea, thanks. This could be just the ticket to go from staging to live without the manual skulduggery of keeping pref sets and applying them each time we want to show the client something. Rock on!


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

#4 2010-09-08 16:55:30

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: adi_prefs - Preference Sets

Ooo!


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2010-09-15 13:31:50

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: adi_prefs - Preference Sets

Looks very useful! Staging and Live might be useful for live sites that are being moved from an old to a new web host, correct?

Offline

#6 2010-09-15 21:49:35

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_prefs - Preference Sets

Yep, that’s the idea.

Offline

#7 2010-11-29 21:29:10

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: adi_prefs - Preference Sets

Nice plugin, Adi. Really helpful.

Would you consider this feature: ability to create more sets of preferences?
Personally, for my workflow, I’d like/need one more (Local, Dev, Staging, Live).

Dev would be just like another Staging area, usually on a public-faced server, although for private usage/demos/developments. If Staging would be for deploying pre-release changes (and show them to the client) before going live, then Dev would be for deploying development changes and show them to other devs, or even the client, without going into Stage. Also, for example, Staging could be a TXP install running on client’s server, while Dev could be a TXP install running on your own server.

Waddayathink?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2010-11-29 22:04:11

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_prefs - Preference Sets

Hi Julián,

maniqui wrote:

Nice plugin, Adi. Really helpful.

Glad you find it useful.

Would you consider this feature: ability to create more sets of preferences?
Personally, for my workflow, I’d like/need one more (Local, Dev, Staging, Live).

Shouldn’t be a problem, although you might need an extra-wide “CinemaScope” screen to see all the different preference sets in one go!

I’ll look into it.

Offline

#9 2010-11-29 22:20:31

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: adi_prefs - Preference Sets

Thanks for the prompt reply, and for considering the request.

Yeah, I thought about the need of a wider screen to skim over all the pref sets at the same time. Luckily I’ve one of those ;)
In any case, I don’t think I (or anyone) will be creating too many different pref sets. In my case I’d like just one more. But it could be helpful for small teams to have also one set per developer (its functionality would be like the “local” set, but named after the developer’s name).
May it be wise to make the default ones un-deletable?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#10 2010-12-10 22:35:50

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_prefs - Preference Sets

Version 0.2 available for download.

This introduces an extra preference set – “Testing” – and an admin option to hide sets that are not required.

All preference sets will be visible by default in new adi_prefs installations. Upgrades to 0.2 will show the new “Testing” set as hidden.

Offline

#11 2011-08-04 04:24:31

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_prefs - Preference Sets

Version 0.2.1 available for download which fixes a coding faux pas that caused conflict with adi_matrix.

Offline

#12 2011-09-16 09:01:55

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 535

Re: adi_prefs - Preference Sets

I just tried installing this plugin today and received the following error message:

Warning: Data too long for column 'event' at row 1 insert into txp_prefs set name = 'adi_prefs_title_current', val = 'Current', event = 'adi_prefs_admin', html = 'text_input', type = '2', position = '0', prefs_id = 1

Everything looks to be working as it should be I wasn’t sure if the error was anything to worry about.

Offline

Board footer

Powered by FluxBB