Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2025-08-10 17:15:34

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

RFC: With Zero theme, don't install any default content

Currently (4.9.0 beta 2), if the Zero theme is selected during installation, the bulk of the default content (e.g. links; theme styles, pages, forms; categories) isn’t installed – with the exception of the default “Welcome to Textpattern” article, some default links, and their associated categories, plus the section for the default article.

This makes sense, from my perspective. An admin or designer selecting Zero is building from a blank canvas. There’s no front-side scaffold to display said article, unless you count syndication feeds, so the article seems a little redundant. An admin or designer chooses Zero consciously, and they’re either going to zap the default article with ID #1, or edit it with their own first article. The default article becomes a bit crufty in the absence of the other default content.

Proposal for comment / discussion:

If Zero theme is selected, don’t install any default content at all. No default article, no default links, no sections, no categories.

Edit: for clarity, the Zero theme includes default and error_default page scaffolds, but they’re both empty, except for a comment directing the user to the docs.

This is closer to a truly clean slate, and saves the initial post-install housekeeping of stripping out the remaining content. It also helps keep the IDs for each article, section and category a little saner as the ID #1 (#1 to #3 for categories, #1 to #5 for links) of each isn’t installed to the database and subsequently deleted. Database nerds, rejoice!

The floor is yours.

Edit: tweaked post content and title.

Last edited by gaekwad (2025-08-10 17:33:16)

Online

#2 2025-08-10 17:50:10

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

Re: RFC: With Zero theme, don't install any default content

Yes, except the only slight fly in the ointment is that Textpattern might expect an article. And the default section (and error_default) have to exist or it gets very annoyed when you visit the front end. Plus the “important” (ugh) Forms.

Not tried deleting everything to see how it behaves. Might be worth trying to see how bare bones it can go.

Pretty sure the other content types and Category etc can be left blank without issue.

I think the general thought stream was “if someone is an admin and wants a clean slate, they’re probably going to have boilerplate scaffolding they’ve prepped from other jobs, so they can import that theme instead during installation” (by dumping it in the themes dir prior to starting, so it becomes an option in the drop-down).

Whether that’s a true or misguided statement is open for debate.


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 2025-08-10 18:32:41

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

Re: RFC: With Zero theme, don't install any default content

Bloke wrote #340106:

Yes, except the only slight fly in the ointment is that Textpattern might expect an article. And the default section (and error_default) have to exist or it gets very annoyed when you visit the front end. Plus the “important” (ugh) Forms.

Not tried deleting everything to see how it behaves. Might be worth trying to see how bare bones it can go.

Thanks, Bloke. I’ve just run a fresh install of 4.9.0 beta 2, Zero theme, and manually removed all traces of articles, section, links, and categories. In debugging mode, there’s nothing warning- or error-wise shown on the front side at all. In fact, the page source is pleasingly clean (I’m guessing in no small part because there are no article tags present?):

<!-- Contents of the 'default' (home) page template goes here. -->
<!-- Trace summary:
Runtime   : 7.89 ms
Query time: 3.68 ms
Queries   : 6
Memory (*): 572 kB
Pages     : default
-->
<!-- Trace log:
  Time(ms) | Duration | Trace
      0.16 |     0.08 | [PHP includes, stage 1]
      0.25 |     2.37 | [PHP includes, stage 2]
      0.35 |          | 	[Textpattern autoload dir: 'vendors']
      0.36 |          | 	[Textpattern autoload dir: 'lib']
      2.64 |     0.50 | [SQL: SELECT nonce, name, RealName, email, privs FROM txp_users WHERE name = 'adminpete' ]
      3.14 |          | [Rows: 1]
      3.17 |     0.57 | [SQL: SELECT name, val FROM txp_prefs WHERE user_name IN ('','adminpete') ORDER BY FIELD(user_name, '','adminpete') ]
      3.74 |          | [Rows: 117]
      3.86 |     0.53 | [Loading plugins]
      3.86 |     0.52 | 	[SQL: SELECT name, version, load_order FROM txp_plugin WHERE status = 1 AND type IN (0,1,5) ORDER BY load_order ASC, name ASC ]
      4.38 |          | 	[Rows: 0]
      4.41 |     0.55 | [SQL: SELECT * FROM txp_section WHERE 1 ]
      4.97 |          | [Rows: 1]
      4.97 |     0.24 | [PHP includes, stage 3]
      5.03 |     0.03 | 	[Load: 'vendors/Txp.php']
      5.05 |     0.01 | 		[Load: 'vendors/Textpattern/Container/FactoryInterface.php']
      5.06 |          | 		[Class loaded: 'Txp']
      5.07 |     0.02 | 	[Load: 'vendors/Textpattern/Container/Container.php']
      5.09 |     0.01 | 		[Load: 'vendors/Textpattern/Container/ContainerInterface.php']
      5.09 |          | 		[Class loaded: 'Container']
      5.11 |     0.02 | 	[Load: 'vendors/Textpattern/Tag/Registry.php']
      5.12 |     0.01 | 		[Load: 'vendors/Textpattern/Container/ReusableInterface.php']
      5.13 |          | 		[Class loaded: 'Registry']
      5.22 |     0.00 | [Loading plugins]
      5.25 |     0.01 | [Load: 'vendors/Textpattern/L10n/Lang.php']
      5.26 |          | 	[Class loaded: 'Lang']
      6.04 |     1.02 | [SQL: SELECT name, data FROM txp_lang WHERE lang = 'en' AND (event IN ('public','common')) ]
*     7.07 |          | [Rows: 304]
*     7.36 |     0.51 | [SQL: SELECT user_html FROM txp_page WHERE name = 'default' AND skin = 'zero' ]
      7.87 |          | [Rows: 1]
      7.87 |          | [Page: 'zero.default']
-->
<!-- Query log:
Duration | Query
    0.50 | [SQL: SELECT nonce, name, RealName, email, privs FROM txp_users WHERE name = 'adminpete' ]
    0.57 | [SQL: SELECT name, val FROM txp_prefs WHERE user_name IN ('','adminpete') ORDER BY FIELD(user_name, '','adminpete') ]
    0.52 | [SQL: SELECT name, version, load_order FROM txp_plugin WHERE status = 1 AND type IN (0,1,5) ORDER BY load_order ASC, name ASC ]
    0.55 | [SQL: SELECT * FROM txp_section WHERE 1 ]
    1.02 | [SQL: SELECT name, data FROM txp_lang WHERE lang = 'en' AND (event IN ('public','common')) ]
    0.51 | [SQL: SELECT user_html FROM txp_page WHERE name = 'default' AND skin = 'zero' ]
-->
<html><head></head><body></body></html>

Mmm, tasty! So in a post-install-manual-housekeeping sense, it’s doable. Whether this is viable or desirable to have done automatically during install is part of the reason I posted.

I think the general thought stream was “if someone is an admin and wants a clean slate, they’re probably going to have boilerplate scaffolding they’ve prepped from other jobs, so they can import that theme instead during installation” (by dumping it in the themes dir prior to starting, so it becomes an option in the drop-down).

Whether that’s a true or misguided statement is open for debate.

I totally understand this take, and I’d file under ‘true’ not ‘misguided’. There’s also a contingent of in-browser hackers who might copy & paste from an IDE or file system, or even do raw dev in the textareas since the whole admin experience is pleasingly uncluttered. In that sense, each of the three camps would perhaps benefit from having only their content, not our content.

Edit: errant copy & paste from console; now fixed.

Last edited by gaekwad (2025-08-10 18:34:42)

Online

#4 2025-08-10 19:16:20

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

Re: RFC: With Zero theme, don't install any default content

If the front end still functions without all the content (I’m surprised it works with no sections and page templates!) then we can certainly look to get rid of it.


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 2025-08-10 19:32:57

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

Re: RFC: With Zero theme, don't install any default content

Bloke wrote #340108:

(I’m surprised it works with no sections and page templates!)

Please forgive the nitpick – there are two page templates included with the Zero theme, but they’re empty (save for a comment).

Online

#6 2025-08-10 20:19:14

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

Re: RFC: With Zero theme, don't install any default content

Crossed wires, sorry. I thought you meant you deleted the sections and pages, as in got rid of them completely. If they’re merely empty, they still exist and txp should be happy.


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

#7 Yesterday 11:41:07

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

Re: RFC: With Zero theme, don't install any default content

Out of curiosity, are these php 8.5 figures?

Runtime   : 7.89 ms
Query time: 3.68 ms
Queries   : 6
Memory (*): 572 kB

Offline

#8 Yesterday 11:51:36

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

Re: RFC: With Zero theme, don't install any default content

etc wrote #340127:

Out of curiosity, are these php 8.5 figures?

Runtime : 7.89 ms...

PHP 8.4.11 on Hetzner shared hosting (one of my no-longer-secret weapons in web tooling) with a remote MariaDB database, Apache front & centre, and a Debian base.

Textpattern version: 4.9.0-beta.2 (f9944943f5f4a849db3c7f1b2fe70bb3)
Last update: 2025-08-10 16:51:50
Textpattern path: __TXP-ROOT/textpattern
Article URL pattern: messy
Production status: debug
upload_tmp_dir: /usr/home/prbagm/.tmp
Temporary directory path: __TXP-ROOT/textpattern/tmp
PHP version: 8.4.11
GD Graphics Library: bundled (2.1.0 compatible); Supported formats: GIF, JPEG, PNG, WebP, AVIF.
Server time zone: UTC
Server local time: 2025-08-12 11:47:38
Daylight Saving Time enabled?: 0
Automatically adjust Daylight Saving Time setting?: 0
Time zone (GMT offset in seconds): UTC (+7200)
MySQL: 10.11.11-MariaDB-hz3 (Debian 12) 
Database server time: 2025-08-12 13:47:38
Database server time offset: 0 s
Database server time zone: SYSTEM
Database session time zone: SYSTEM
Locale: en_US.UTF-8
Site / Admin language: en / en
Web server: Apache
PHP server API: cgi-fcgi
PHP SSL version: OpenSSL 3.0.17 1 Jul 2025
RFC 2616 headers: 0
Server OS: Linux 6.1.0-37-amd64
Admin-side theme: hive 4.9.0-beta.2

.htaccess file contents: 
------------------------
# BEGIN Textpattern

#DirectoryIndex index.php index.html

<IfModule mod_rewrite.c>
    RewriteEngine On

    #Options +FollowSymlinks

    #RewriteBase /relative/web/path/

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+) - [PT,L]

    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*) index.php

    RewriteCond %{HTTP:Authorization}  !^$
    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

<IfModule mod_mime.c>
    AddType image/svg+xml  svg svgz
    AddEncoding gzip       svgz
</IfModule>

# For .htaccess configuration settings and explanations, please refer to:
# https://github.com/h5bp/server-configs-apache/blob/main/dist/.htaccess
# https://httpd.apache.org/docs/

# END Textpattern

------------------------

Online

#9 Yesterday 12:00:50

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

Re: RFC: With Zero theme, don't install any default content

PHP 8.5 (pre-beta) figures with blank page scaffold:

<!-- Trace summary:
Runtime   : 8.49 ms
Query time: 4.38 ms
Queries   : 7
Memory (*): 598 kB
Pages     : default
-->
<!-- Trace log:
  Time(ms) | Duration | Trace
      0.19 |     0.09 | [PHP includes, stage 1]
      0.29 |     2.07 | [PHP includes, stage 2]
      0.35 |          | 	[Textpattern autoload dir: 'vendors']
      0.36 |          | 	[Textpattern autoload dir: 'lib']
      2.39 |     1.64 | [SQL: SELECT val FROM dev_txp_prefs as txp_prefs WHERE name='concurrent_logins' ]
      4.03 |          | [Rows: 1]
      4.07 |     0.20 | [SQL: SELECT nonce, name, RealName, email, privs FROM dev_txp_users as txp_users WHERE name = 'managing-editor123' ]
      4.27 |          | [Rows: 1]
      4.29 |     0.48 | [SQL: SELECT name, val FROM dev_txp_prefs as txp_prefs WHERE user_name IN ('','managing-editor123') ORDER BY FIELD(user_name, '','managing-editor123') ]
      4.77 |          | [Rows: 112]
      4.87 |     0.19 | [Loading plugins]
      4.88 |     0.17 | 	[SQL: SELECT name, version, load_order FROM dev_txp_plugin as txp_plugin WHERE status = 1 AND type IN (0,1,5) ORDER BY load_order ASC, name ASC ]
      5.05 |          | 	[Rows: 0]
      5.09 |     0.40 | [SQL: SELECT * FROM dev_txp_section as txp_section WHERE 1 ]
      5.50 |          | [Rows: 2]
      5.50 |     0.22 | [PHP includes, stage 3]
      5.58 |     0.03 | 	[Load: 'vendors/Txp.php']
      5.60 |     0.00 | 		[Load: 'vendors/Textpattern/Container/FactoryInterface.php']
      5.61 |          | 		[Class loaded: 'Txp']
      5.62 |     0.01 | 	[Load: 'vendors/Textpattern/Container/Container.php']
      5.63 |     0.00 | 		[Load: 'vendors/Textpattern/Container/ContainerInterface.php']
      5.63 |          | 		[Class loaded: 'Container']
      5.64 |     0.01 | 	[Load: 'vendors/Textpattern/Tag/Registry.php']
      5.65 |     0.00 | 		[Load: 'vendors/Textpattern/Container/ReusableInterface.php']
      5.66 |          | 		[Class loaded: 'Registry']
      5.72 |     0.00 | [Loading plugins]
      6.19 |     0.01 | [Load: 'vendors/Textpattern/L10n/Lang.php']
      6.20 |          | 	[Class loaded: 'Lang']
      6.49 |     1.29 | [SQL: SELECT name, data FROM dev_txp_lang as txp_lang WHERE lang = 'en' AND (event IN ('public','common')) ]
*     7.79 |          | [Rows: 305]
*     8.02 |     0.20 | [SQL: SELECT user_html FROM dev_txp_page as txp_page WHERE name = 'default' AND skin = 'four-point-nine' ]
      8.22 |          | [Rows: 1]
      8.23 |          | [Page: 'four-point-nine.default']
-->
<!-- Query log:
Duration | Query
    1.64 | [SQL: SELECT val FROM dev_txp_prefs as txp_prefs WHERE name='concurrent_logins' ]
    0.20 | [SQL: SELECT nonce, name, RealName, email, privs FROM dev_txp_users as txp_users WHERE name = 'managing-editor123' ]
    0.48 | [SQL: SELECT name, val FROM dev_txp_prefs as txp_prefs WHERE user_name IN ('','managing-editor123') ORDER BY FIELD(user_name, '','managing-editor123') ]
    0.17 | [SQL: SELECT name, version, load_order FROM dev_txp_plugin as txp_plugin WHERE status = 1 AND type IN (0,1,5) ORDER BY load_order ASC, name ASC ]
    0.40 | [SQL: SELECT * FROM dev_txp_section as txp_section WHERE 1 ]
    1.29 | [SQL: SELECT name, data FROM dev_txp_lang as txp_lang WHERE lang = 'en' AND (event IN ('public','common')) ]
    0.20 | [SQL: SELECT user_html FROM dev_txp_page as txp_page WHERE name = 'default' AND skin = 'four-point-nine' ]
-->

This server isn’t properly optimised for performance – and it is a few years old, too – but it’s not far off the Hetzner box. Local Percona MySQL, Nginx, PHP-FPM:

Textpattern version: 4.9.0-dev (e8ebe69c9e246975b492d7db00e3963d)
Last update: 2025-08-12 12:00:02
Textpattern path: __TXP-ROOT/textpattern
Article URL pattern: messy
Production status: debug
PHP version: 8.5.0alpha3
GD Graphics Library: 2.3.3; Supported formats: GIF, JPEG, PNG, WebP, AVIF.
Server time zone: UTC
Server local time: 2025-08-12 12:00:37
Daylight Saving Time enabled?: 0
Automatically adjust Daylight Saving Time setting?: 0
Time zone (GMT offset in seconds):  (+3600)
MySQL: 8.4.5-5 (Percona Server (GPL), Release '5', Revision '3d3abca6') 
Database server time: 2025-08-12 12:00:37
Database server time offset: 0 s
Database server time zone: SYSTEM
Database session time zone: SYSTEM
Locale: C
Site / Admin language: en / en
Web server: nginx/1.29.0
PHP server API: fpm-fcgi
PHP SSL version: OpenSSL 3.0.16 11 Feb 2025
RFC 2616 headers: 0
Server OS: Linux 6.1.0-37-amd64
Admin-side theme: hive 4.9.0-beta.2

Pre-flight check: 
------------------------
Image directory is not writable: __TXP-ROOT/images
File directory path is not writable: __TXP-ROOT/files
Theme directory is not writable: __TXP-ROOT/themes
------------------------

Online

#10 Yesterday 13:38:38

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

Re: RFC: With Zero theme, don't install any default content

Thank you, it looks more due to server optimisations than php versions. I was influenced by dev-demo.textpattern.co/dev/ figures (php 8.4)

Runtime   : 31.06 ms
Query time: 10.14 ms
Queries   : 20
Memory (*): 3459 kB

compared to php-next-demo.textpattern.co/dev/ (php 8.5)

Runtime   : 11.16 ms
Query time: 6.37 ms
Queries   : 20
Memory (*): 905 kB

Offline

#11 Yesterday 13:41:51

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

Re: RFC: With Zero theme, don't install any default content

dev-demo and php-next-demo are on the same VPS, they use the same scaffold + config for Nginx, they use the same (local) Percona instance, and – unless I’ve fat-fingered something – they have the same PHP-FPM config.

Online

#12 Yesterday 13:48:51

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

Re: RFC: With Zero theme, don't install any default content

The main runtime difference seems to come from

dev-demo
  Time(ms) | Duration | Trace
      0.73 |     5.59 | [PHP includes, stage 1]
      7.67 |     4.10 | [PHP includes, stage 2]
*    15.50 |     8.74 | [PHP includes, stage 3]
php-next-demo
  Time(ms) | Duration | Trace
      0.22 |     0.08 | [PHP includes, stage 1]
      0.31 |     1.48 | [PHP includes, stage 2]
      4.28 |     0.20 | [PHP includes, stage 3]

as if php-next had much stuff preloaded.

The memory difference is a mystery for me.

Keep fat-fingering :-)

Offline

Board footer

Powered by FluxBB