Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-05-14 20:10:19

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

RFC: Production status per section / article / theme

Currently we have production status set globally. Is it viable to expand this to a per section, article or theme basis?

Offline

#2 2024-05-14 23:27:38

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

Re: RFC: Production status per section / article / theme

Interesting. I think we’ve toyed with the idea of introducing this before. Not sure why we didn’t. In fact, if memory serves, Robert suggested it many moons ago.

If we do this, my money is on a tag for ultimate flexibility. As a single:

System-wide pref is currently Production.
...
<production::status value="debug" />
Debug is now turned on from this point forward, for this page run, irrespective of the Pref.
...
<production::status value="testing" />
Testing mode is now turned on from this point forward.
...
<production::status value />
Original (Production, in this case) status is restored using valueless attribute.

Or a container:

System-wide pref is currently Production.
...
<production::status value="debug">
   Current system-wide prod status is recorded.
   Global status is altered.
...
   Contained code runs and can spit out debug info if necessary
...
   Previous global status is restored when container ends.
</production::status>
System-wide pref reverts to Production.

That way, you can put it in pages, articles, forms, themes, whatever.

@Oleg: do you think this is doable? Could even sneak into 4.9?

Last edited by Bloke (2024-05-14 23:29:31)


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 2024-05-15 05:39:28

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

Re: RFC: Production status per section / article / theme

That dedicated that sounds interesting, even or rather especially when using on already-live templates (it avoids showing eventual “errors” (PHP depreciation notices…) and parts that are not being editing presently.

On the flip side there is the need to remember to remove the tag from the templates/pages/… after the editing/modifying/testing is done.

Or would it come with a global flag that disables the tag – something something like “allow partial debugging?” under Advanced options maybe ?


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

Offline

#4 2024-05-15 07:13:30

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

Re: RFC: Production status per section / article / theme

Not adding much here except to say: I love the idea, particularly bloke’s suggestion to be able to debug selected parts of … whatever … by being able to place the tag in a theme, section or directly in an article.

And Philippe said exactly what I immediately thought about having some kind of master switch so that one doesn’t need to worry about forgetting to remove the tag.

I can see the sense in the original suggestion, particularly when using the dev theme option but I personally don’t use that facility much as I prefer to develop locally.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2024-05-15 07:42:54

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

Re: RFC: Production status per section / article / theme

That’s doable, but could be a bit tricky, since

  • Trace sets its verbosity level very early, before the article/section/theme in use is detected. We can switch it later (say, within a block), but mixing quiet/verbose modes could result in a weird trace output.
  • Some cache headers depend on the production status, we’d need to decide what to do for mixed statuses.
  • Some plugins using the production status presume it is fixed, they could go west.

So, before we opt for a global/local switch, what are possible use cases? If you want to hide the debugging messages from non-logged in users, here is a fewliner:

# Name: etc_private_debug v0.1 
# Type: Public plugin
# 
# Author: 
# URL: 
# Recommended load order: 1

# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

YToxMTp7czo0OiJuYW1lIjtzOjE3OiJldGNfcHJpdmF0ZV9kZWJ1ZyI7czo2OiJhdXRob3Ii
O3M6MDoiIjtzOjEwOiJhdXRob3JfdXJpIjtzOjA6IiI7czo3OiJ2ZXJzaW9uIjtzOjM6IjAu
MSI7czoxMToiZGVzY3JpcHRpb24iO3M6MDoiIjtzOjQ6ImNvZGUiO3M6MTc5OiJnbG9iYWwg
JHByb2R1Y3Rpb25fc3RhdHVzOw0KDQppZiAoJHByb2R1Y3Rpb25fc3RhdHVzICE9ICdsaXZl
JyAmJiAhaXNfbG9nZ2VkX2luKCkpIHsNCiAgICAkcHJvZHVjdGlvbl9zdGF0dXMgPSAkcHJl
ZnNbJ3Byb2R1Y3Rpb25fc3RhdHVzJ10gPSAnbGl2ZSc7DQogICAgVHJhY2U6OnNldFF1aWV0
KHRydWUpOw0KfSI7czo0OiJ0eXBlIjtzOjE6IjAiO3M6NToib3JkZXIiO3M6MToiMSI7czo1
OiJmbGFncyI7czoxOiIwIjtzOjQ6ImhlbHAiO2I6MDtzOjM6Im1kNSI7czozMjoiYjk4NjJl
OGExZmZhOTY1YjU3MWE1YTg1YzgyZDZlNTciO30=

Offline

#6 2024-05-15 09:16:57

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,534
Website GitHub Twitter

Re: RFC: Production status per section / article / theme

etc wrote #337196:

So, before we opt for a global/local switch, what are possible use cases? If you want to hide the debugging messages from non-logged in users, here is a fewliner:

# Name: etc_private_debug v0.1...

Nice Plugin Oleg.

Offline

#7 2024-05-15 11:14:52

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

Re: RFC: Production status per section / article / theme

Just suppressing error messages inside a tag is feasible, of course. We could even overcharge <txp:hide /> with an extra attribute to this aim.

Offline

#8 2024-05-15 12:02:22

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

Re: RFC: Production status per section / article / theme

Nice one. Forgot about the trace. That is indeed more difficult

etc wrote #337201:

Just suppressing error messages inside a tag is feasible, of course. We could even overcharge <txp:hide /> with an extra attribute to this aim.

That would work. I was thinking more along the lines of the other way round, though. You have a site in production mode and want to add a new section with a new template, or maybe tweak some tags or introduce a new plugin, and you just want to check everything works before you show the rest of the world.

The dev lane is perfect for this, but we’re still governed by the global production status. Temporarily switching it to debug to check that the new code doesn’t throw warnings might reveal other errors or tag traces to live visitors in the existing site areas.


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

#9 2024-05-17 13:38:39

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

Re: RFC: Production status per section / article / theme

So, should we automatically switch to debug mode when viewing a dev theme? Part of me says it’s what dev preview is made for, but I’m not sure.

Offline

#10 2024-05-17 17:53:07

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

Re: RFC: Production status per section / article / theme

Hmm, I don’t know. I’d rather not make such assumptions. If someone’s using out-of-date plugins then they might throw a tonne of warnings / errors which you might not want to see or might ruin the layout that you’re trying to tweak.


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

#11 2024-05-18 05:06:49

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,032
Website GitHub Mastodon Twitter

Re: RFC: Production status per section / article / theme

etc wrote #337209:

So, should we automatically switch to debug mode when viewing a dev theme? Part of me says it’s what dev preview is made for, but I’m not sure.

Wouldn’t be a good a good idea if debug and dev had an option to only show if logged in?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#12 2024-05-18 07:24:25

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,324
Website Mastodon

Re: RFC: Production status per section / article / theme

Somewhat related, but purely personal opinion: Methinks Txp has grown a very opulent set of new and specific preferences along with the extension of functionality.

I often feel slightly distracted and find myself digging around in the ‘Preferences’ sub-tabs looking for an option I know is there somewhere.

Adding yet another option won’t help (…me). Wasn’t the Txp tagline once “opinionated, not option-rich”?

tl;dr: Everything was better in the old ages ;)

Offline

Board footer

Powered by FluxBB