Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2020-12-12 10:10:26

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

Re: adi_detritus - Sweep up the rubbish

gomedia wrote #327425:

If “sitemap.xml” is a standard filename that all TXP websites use then I can add it to the exemptions list.

It’s non-standard, but commonly used in CMS-agnostic web environments – see en.wikipedia.org/wiki/Sitemaps#Search_engine_submission for more info.

Offline

#14 2020-12-12 10:57:26

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

Re: adi_detritus - Sweep up the rubbish

gaekwad wrote #327426:

It’s non-standard, but commonly used …

Good enough for me. I’ll add in to the innocuous list for the next update. Thanks.

Offline

#15 2020-12-12 11:31:36

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

Re: adi_detritus - Sweep up the rubbish

Hi Adi,

This plugin has a great potential imo, but is not working on Windows. I suspect it’s because DS constant is \ here, so it can interfere with regex.

Online

#16 2020-12-12 21:04:44

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

Re: adi_detritus - Sweep up the rubbish

etc wrote #327430:

This plugin has a great potential imo, but is not working on Windows.

Hmm, not surprised – I did ‘fess up to Unix-only testing. This’ll be an interesting(!) exercise, leave it with me.

Offline

#17 2020-12-14 09:36:28

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

Re: adi_detritus - Sweep up the rubbish

Oleg, I don’t have a Windows hosting for testing, but give this one a go.

Offline

#18 2020-12-14 13:10:32

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

Re: adi_detritus - Sweep up the rubbish

Thanks Adi, the errors are gone now and the plugin seems to do its job. I still get many warnings, but that’s quite common in php 8 since it tends to unsilence them:

Warning "mime_content_type(C:\xampp\htdocs\textpattern\textpattern/.git): Failed to open stream: No such file or directory"
in C:\xampp\htdocs\textpattern\textpattern\plugins\adi_detritus\adi_detritus.php at line 413.

Online

#19 2020-12-14 21:01:26

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

Re: adi_detritus - Sweep up the rubbish

etc wrote #327490:

Thanks Adi, the errors are gone now and the plugin seems to do its job. I still get many warnings, but that’s quite common in php 8 since it tends to unsilence them:

Warning "mime_content_type(C:\xampp\htdocs\textpattern\textpattern/.git): Failed to open stream: No such file or directory"...

Yikes! The corresponding code in the plugin is:

@mime_content_type($path)

- where $path is a non-existing file at the time.

I see from the PHP 8 release notes that:

The @ operator no longer silences fatal errors

I was being a bit lazy with the use of the “@” error-control operator – which I’ll fix – but I can’t quite reconcile a so-called “fatal error” only generating a warning!

Offline

#20 2020-12-14 21:31:26

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

Re: adi_detritus - Sweep up the rubbish

gomedia wrote #327503:

I was being a bit lazy with the use of the “@” error-control operator

If it’s any consolation, core has been hit with this too and we’re gradually working out ways to eradicate the ‘@’ trick.

The proper route is probably try... catch. That means you can then choose to ignore something that you’d previously silenced as a ‘soft’ error in the catch() block. It also gives you the opportunity to actually create the file if it was missing, which is a nice by-product. We’re not there yet in core with our exception handling so we’re tending to just use defensive code around our previous ‘@’ crutches. Not perfect, but it’ll do for now.


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

#21 2020-12-15 07:13:23

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

Re: adi_detritus - Sweep up the rubbish

etc wrote #327490:

Thanks Adi, the errors are gone now and the plugin seems to do its job. I still get many warnings, but that’s quite common in php 8 since it tends to unsilence them.

No problem, hopefully the unsilenced warnings now keep quiet.

Version 0.4 available for download:

  • OS-agnosticism (thanks etc)
  • less reliance on the “@” error-control operator WRT PHP 8

Offline

#22 2020-12-15 12:16:01

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

Re: adi_detritus - Sweep up the rubbish

Ace, no more php warnings, thanks.

I’ve counted >100 silenced calls in txp code, though none seems to raise its head in php 8.

Online

#23 2020-12-15 13:02:41

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

Re: adi_detritus - Sweep up the rubbish

etc wrote #327525:

I’ve counted >100 silenced calls in txp code

Yeah. Like making new classes and retiring old functions, this is one of those things I think we should “fix as we find them” over time.

Sorry for hijacking your thread, Adi.


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

#24 2021-01-12 02:01:41

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

Re: adi_detritus - Sweep up the rubbish

Version 0.5 is here:

- fix: double notifications for .nodelete
- fix: removed objection to sitemap.xml (thanks bici)
- new: browserconfig.xml & site.webmanifest awareness
- new: check for .swf files
- new: textpattern/plugins directory checks
- more OS-agnosticism

Offline

Board footer

Powered by FluxBB