Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2025-08-21 10:35:54

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

Re: ZIP plugin file requires archive subfolder, throws error otherwise.

etc wrote #340260:

in abc_plugin2.zip/abc_plugin subdirectory, but then how we know this subdirectory name?

Additionally, the function is sensitive to the directory separator, so we’d have to test various / and \ combinations.

There seems to be an easy solution, with FL_NODIR flag, to locate manifest.json:

$zip = new ZipArchive;

if ($zip->open('path/to/abc_plugin.zip') === TRUE) {
    $index = $zip->locateName('manifest.json', ZipArchive::FL_NODIR);
    if ($index !== false) {
        dmp($zip->getFromIndex($index));
    } else {// apply defaults}
    $zip->close();
}

Offline

#17 2025-08-21 10:53:44

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

Re: ZIP plugin file requires archive subfolder, throws error otherwise.

Nice find!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#18 2025-08-21 20:30:39

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: ZIP plugin file requires archive subfolder, throws error otherwise.

etc wrote #340260:

  • at the root […] (that’s ok, but not how Windows works)

I beg to differ. The layout of a zip file is solely determined by the user who builds it. See exhibit. This is how I build on Windows, according to the zip layout requirements I learned in this thread.

The only relevant variable is your current pwd but not the O/S imho.

Offline

#19 2025-08-22 15:23:12

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

Re: ZIP plugin file requires archive subfolder, throws error otherwise.

Ok, let us say it’s not how me on Windows works. I develop plugins inside their folders and then compress the entire folder in Explorer, getting abc_plugin.zip/abc_plugin/manifest.json paths instead of abc_plugin.zip/manifest.json layout. The least effort..

Offline

#20 2025-08-23 13:56:27

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

Re: ZIP plugin file requires archive subfolder, throws error otherwise.

wet wrote #340251:

1 […] enmattification […].

Narrator: an Automattic-affiliated lawyer is heard stirring.

Offline

#21 2025-08-24 10:14:07

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: ZIP plugin file requires archive subfolder, throws error otherwise.

Let’s get serious ;)

Offline

Board footer

Powered by FluxBB