Plugin Directory

Changeset 3741985


Ignore:
Timestamp:
10/12/2026 03:28:39 PM (3 weeks ago)
Author:
oadev
Message:

Bundle PDF dependencies and guard missing autoloader

Location:
belegdachs-for-woocommerce/trunk
Files:
356 added
3 edited

Legend:

Unmodified
Added
Removed
  • belegdachs-for-woocommerce/trunk/belegdachs-for-woocommerce.php

    r3741459 r3741985  
    44 * Plugin URI: https://signcontract.app/privacy
    55 * Description: Generate PDF invoices for WooCommerce orders with German business invoice fields.
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: oadev
    88 * License: GPL-2.0-or-later
    … …  
    3939}
    4040
    41 define( 'BELEGDACHS_FOR_WOOCOMMERCE_VERSION', '1.0.0' );
     41define( 'BELEGDACHS_FOR_WOOCOMMERCE_VERSION', '1.0.1' );
    4242define( 'BELEGDACHS_FOR_WOOCOMMERCE_PLUGIN_FILE', __FILE__ );
    4343define( 'BELEGDACHS_FOR_WOOCOMMERCE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    … …  
    7070        }
    7171
    72         // Load Composer autoloader (DomPDF, etc.)
    73         require_once BELEGDACHS_FOR_WOOCOMMERCE_PLUGIN_DIR . 'vendor/autoload.php';
     72        $composer_autoload = BELEGDACHS_FOR_WOOCOMMERCE_PLUGIN_DIR . 'vendor/autoload.php';
     73        if ( ! is_readable( $composer_autoload ) ) {
     74                add_action(
     75                        'admin_notices',
     76                        function () {
     77                                if ( ! current_user_can( 'activate_plugins' ) ) {
     78                                        return;
     79                                }
     80
     81                                echo '<div class="notice notice-error"><p>';
     82                                echo esc_html__( 'BelegDachs cannot start because its PDF dependencies are missing. Reinstall the complete plugin ZIP package.', 'belegdachs-for-woocommerce' );
     83                                echo '</p></div>';
     84                        }
     85                );
     86                return;
     87        }
     88
     89        // Load Composer dependencies, including Dompdf.
     90        require_once $composer_autoload;
    7491
    7592        // Load plugin autoloader
  • belegdachs-for-woocommerce/trunk/build-release-zip.sh

    r3741459 r3741985  
    1010SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
    1111OUTPUT_DIR="${1:-$(dirname "$SCRIPT_DIR")}"
     12mkdir -p "$OUTPUT_DIR"
     13OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd)"
    1214VERSION="$(grep -m1 '^Stable tag:' "$SCRIPT_DIR/readme.txt" | awk '{print $3}')"
    1315ZIP_NAME="${PLUGIN}.${VERSION}.zip"
    … …  
    3234  "$SCRIPT_DIR/" "$TMP/$PLUGIN/"
    3335
     36if [[ -f "$SCRIPT_DIR/vendor/composer/installed.json" ]]; then
     37  echo "Reusing locally installed Composer dependencies..."
     38  rsync -a "$SCRIPT_DIR/vendor/" "$TMP/$PLUGIN/vendor/"
     39fi
     40
    3441echo "Installing production dependencies..."
    3542(
    3643  cd "$TMP/$PLUGIN"
    3744  composer install --no-dev --optimize-autoloader --no-interaction --no-progress
     45  if [[ ! -s vendor/autoload.php ]]; then
     46    echo "Composer did not create vendor/autoload.php" >&2
     47    exit 1
     48  fi
    3849  find vendor -type d \( -iname test -o -iname tests -o -iname docs -o -iname doc \) -prune -exec rm -rf {} +
    3950  find vendor -type f \( -iname 'phpunit.xml*' -o -iname '*.md' -o -iname '*.dist' \) -delete
    … …  
    4758)
    4859
     60if ! unzip -Z1 "$OUTPUT_DIR/$ZIP_NAME" | grep -Fx "$PLUGIN/vendor/autoload.php" >/dev/null; then
     61  echo "Release archive is missing $PLUGIN/vendor/autoload.php" >&2
     62  exit 1
     63fi
     64unzip -t "$OUTPUT_DIR/$ZIP_NAME" >/dev/null
     65
    4966echo "Done: $OUTPUT_DIR/$ZIP_NAME"
    5067unzip -l "$OUTPUT_DIR/$ZIP_NAME" | tail -5
  • belegdachs-for-woocommerce/trunk/composer.json

    r3741459 r3741985  
    1515    },
    1616    "autoload": {
    17         "classmap": ["includes/"],
    18         "files": ["vendor/autoload.php"]
     17        "classmap": ["includes/"]
    1918    },
    2019    "config": {
Note: See TracChangeset for help on using the changeset viewer.