#!/usr/bin/env php .zip // Hochladen unter Administration → Plugins → „Plugin hochladen“, dann aktivieren. $root = dirname(__DIR__); $manifest = json_decode(file_get_contents("$root/plugin.json"), true); @mkdir("$root/dist"); $target = "$root/dist/{$manifest['slug']}-{$manifest['version']}.zip"; @unlink($target); $zip = new ZipArchive; $zip->open($target, ZipArchive::CREATE); foreach (['plugin.json', 'README.md'] as $file) { $zip->addFile("$root/$file", "{$manifest['slug']}/$file"); } $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("$root/src", FilesystemIterator::SKIP_DOTS)); foreach ($files as $file) { $zip->addFile($file->getPathname(), $manifest['slug'].'/src/'.substr($file->getPathname(), strlen("$root/src/"))); } $zip->close(); echo 'dist/'.basename($target).PHP_EOL;