Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2020-12-12 07:04:58

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,789
Website

Re: adi_detritus - Sweep up the rubbish

/home/bici/apps/topgoods_app/sitemap.xml (Not recognized)

should this file be flagged?


…. texted postive

Offline

#12 2020-12-12 07:18:40

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

Re: adi_detritus - Sweep up the rubbish

bici wrote #327424:

/home/bici/apps/topgoods_app/sitemap.xml (Not recognized)

should this file be flagged?

If “sitemap.xml” is a standard filename that all TXP websites use then I can add it to the exemptions list. But if it’s a user-chosen filename referenced by an HTML tag in the website itself, then adi_detritus is currently not that clever.

You can always add it to the “Ignore filesystem items” preference.

Offline

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

gaekwad
Admin
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 3,350

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,303
Website

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: 4,079
Website

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.

Offline

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

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

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,303
Website

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: 4,079
Website

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.

Offline

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

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

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: 9,996
Website

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

Board footer

Powered by FluxBB