addReplacement with Role_Web
| From: | Tony Bibbs | Date: | Thu, 15 Feb 2007 18:15:31 +0000 |
| Subject: | addReplacement with Role_Web | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-45646@lists.php.net to get a copy of this message | ||
I've got a PHP file in a PEAR package with something like:
require '/path/to/mysoftware/config.php';
The PEAR package installs as a web application using pearified/Role_Web and what I'd like to do is during the install prevent users from having to touch the file that has that include above to use the right absolute path.
I tried using the following in my packagefilemanager script:
$pkg->addReplacement(
'public_html/file-to-edit.php',
'pear-config', '/path/to/mysoftware',
'web_dir'
);
Problem is that my web application installs into it's own directory under the web_dir so what I get after the above substitution is:
require '/var/www/config.php';
instead of:
require '/var/www/packagename/config.php';
I then tried to do a second substitution (that happens after the above substitution:
define('CONFIGSTR','packagename/config.php');
$pkg->addReplacement(
'public_html/file-to-edit.php',
'php-const',
'config.php',
CONFIGSTR
);
...but that gives me errors because addReplacement only allows actual PHP constants, not user defined constants.
Is there an easy way around this?
--Tony