All pastes #269374 Raw Copy code Copy link Edit

Untitled

public text v1 · immutable
#269374 ·published 2006-12-06 15:19 UTC
rendered paste body
<?php
/**
*   files are not included when having a package directory
*   different from current directory AND a file in a subdir
*
*   If other files are included (thus files and dirs exist)
*   no error is thrown, just ignoring the file.
*
*   Problem is in File->_checkIgnores
*
*   Also, File.php uses ppfm v1 constants that are not available in ppfm2
*/
require_once 'PEAR/PackageFileManager2.php';


// Instanciate package file manager
$pkg = new PEAR_PackageFileManager2();

// Setting options
$e = $pkg->setOptions(
    array(
        'packagefile'       => 'ppfm-bug_1.xml',
//we have a custom package dir
        'packagedirectory'  => dirname(__FILE__) . '/test/',
        'baseinstalldir'    => 'Geeklog',
        'pathtopackagefile' => dirname(__FILE__),
        'simpleoutput'      => true,
        'include'           => array(
//and a file from a subdir of our custom package dir
//does not work
//this is the offending line
            'subtest/test.php',
//this works:
//            'test1.php'
        ),
        'dir_roles'         => array('*' => 'web'),
        'roles' => array('*' => 'web'),
    )
);

// PEAR error checking
if (PEAR::isError($e)) {
    die($e->getMessage());
}


// Set misc package information
$pkg->setPackage('demo');
$pkg->setSummary('bugdemo');
$pkg->setDescription('bugdemo');
$pkg->setChannel('pear.php.net');

$pkg->setReleaseStability('beta');
$pkg->setAPIStability('stable');
$pkg->setReleaseVersion('1.0.0');
$pkg->setAPIVersion('1.0.0');

$pkg->setLicense('GPL');
$pkg->setNotes('s');

// Our package contains PHP files (not C extension files)
$pkg->setPackageType('php');

// Must be available in new package.xml format
$pkg->setPhpDep('4.3.0');
$pkg->setPearinstallerDep('1.4.2');

// Require custom file role for our web installation
$pkg->addPackageDepWithChannel('required', 'Role_Web'       , 'pearified.com');

// Define that we will use our custom file role in this script
$e = $pkg->addUsesRole('web', 'Webfiles');
if (PEAR::isError($e)) {
    die($e->getMessage());
}

// Mapping misc roles to file name extensions
$e = $pkg->addRole('', 'web');
if (PEAR::isError($e)) {
    die($e->getMessage());
}
$e = $pkg->addRole('png', 'web');
if (PEAR::isError($e)) {
    die($e->getMessage());
}
$e = $pkg->addRole('gif', 'web');
if (PEAR::isError($e)) {
    die($e->getMessage());
}
$e = $pkg->addRole('jpeg', 'web');
if (PEAR::isError($e)) {
    die($e->getMessage());
}

$pkg->addRelease();
$pkg->addMaintainer('lead', 'tony', 'Tony Bibbs', 'tony@tonybibbs.com');
$test = $pkg->generateContents();

if (isset($argv[1]) && $argv[1] === 'make') {
    $e = $pkg->writePackageFile();
} else {
    //$e = $pkg->debugPackageFile();
}

if (PEAR::isError($e)) {
    echo $e->getMessage();
}
?>