Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Today 07:04:12

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,495
Website

checksum.php

Based on the latest code (this issue I think), the /textpattern/checksums.txt file doesn’t check for the admin themes, instead each amin theme has its own checksums.txt (in theory, see below). One benefit from that is I can now delete unwanted / unneeded core admin themes without having to edit the main checksums.txt file (something I have been doing for more than 18 month…). Yay, love it.

If I understand it well, any admin theme can now have a checksums.txt file. To generate it, one would need to run some checksums.php script (something on how to create plugins I guess ?).

Some questions:

  1. Is this the relevant file: github.com/textpattern/textpattern-toolbelt/blob/main/release/checksums.php ?
  2. I then download it locally and run php path/to/checksums.php path/to/admin-theme-name? Or does the admin-theme need to reside inside a Textpattern install – e.g path/to/textpattern admin-theme-name?
  3. how does the script know where to find all relevant files – js/php – css doesn’t seem included ? Or does it just iterate over all files in the folder?

Any guidance or suggestion appreciated


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

Offline

#2 Today 09:09:47

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,020
Website GitHub

Re: checksum.php

phiw13 wrote #340973:

One benefit from that is I can now delete unwanted / unneeded core admin themes without having to edit the main checksums.txt file (something I have been doing for more than 18 month…). Yay, love it.

Glad it’s useful.

If I understand it well, any admin theme can now have a checksums.txt file.

Correct.

To generate it, one would need to run some checksums.php script

Correct.

Is this the relevant file: github.com/textpattern/textpattern-toolbelt/blob/main/release/checksums.php ?

Yes (or the one in the main repo’s .github/txp-checksums.php, which is a clone).

The caveat, as you’ve found, is that it needs to be told where to find an actual instance of textpattern (because it uses txplib_misc.php, constants.php, etc to take advantage of some core functionality).

So the fastest route to market if you’re developing the theme in its own silo is to either copy it into a textpattern instance (it doesn’t have to be a working copy with database and everything set up; just the files will do) or create a symlink from the admin-themes directory to your theme’s repo.

Then you can just run:

php path/to/checksums.php path/to/your-instance/textpattern admin-themes

(note the space – it’s not a full path: the admin-themes is the script’s second argument, which I admit is a trifle confusing)

That will recalculate all admin theme checksums.txt files. We’ll probably extend the syntax so you can specify just one theme name at some point.

how does the script know where to find all relevant files – js/php – css doesn’t seem included?

It hunts for all files with .php and .js suffixes. That’s all. I’m not entirely sure why we don’t checksum .css files. Perhaps because it’s not executable, per se, so wasn’t deemed a threat(?)

It’s easy for us to change it if we want to include .css files or any others. There’s a $fpattern regex line near the top of the checksums.php script that determines what it searches for.

Last edited by Bloke (Today 09:11:01)


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 Today 09:33:17

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,495
Website

Re: checksum.php

Bloke wrote #340979:

So the fastest route to market if you’re developing the theme in its own silo is to either copy it into a textpattern instance (it doesn’t have to be a working copy with database and everything set up; just the files will do) or create a symlink from the admin-themes directory to your theme’s repo.

Ok, I think I can set up something with a bit creative symlinking. Hopefully I can even squeeze it in my build Applescript.

(note the space – it’s not a full path: the admin-themes is the script’s second argument, which I admit is a trifle confusing)

Yes that tripped me when trying to understand it all. I get it now.

It hunts for all files with .php and .js suffixes. That’s all. I’m not entirely sure why we don’t checksum .css files. Perhaps because it’s not executable, per se, so wasn’t deemed a threat(?)

It’s easy for us to change it if we want to include .css files or any others. There’s a $fpattern regex line near the top of the checksums.php script that determines what it searches for.

I don’t think CSS is a thread anymore, very bright minds in the browser & web-security world have gone through it many times to neuter it. On the flip side, it can hurt to include it.

Last edited by phiw13 (Today 09:33:37)


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

Offline

Board footer

Powered by FluxBB