LD SoftwareBespoke Software, Web Design, Security Consultants and Host Services.

Menu

Sentinel
You have been warned!
We have caught 5883 shameful hackers.

NukeSentinel(tm)

Paypal Referral
Sign up for PayPal and start accepting credit card payments instantly.

Link Exchange
Join our free link exchange

Click Here
 
Custom File Tasks

Chapter 24. Custom File Tasks

For many small library packages, very little customization is needed. Just install and go. package.xml 1.0 is very good at this task. As packages grow in size and complexity, it is often necessary to make slight changes to the contents of files, and occasionally to external components such as databases.

package.xml 1.0 provides a single undocumented system of customizing file contents through the <replace> tag, like so:

<file name="blah.php" role="php">
 <replace from="@token@" to="version" type="package-info"/>
 <replace from="@anothertoken@" to="php_dir" type="pear-config"/>
</file>

This example above would scan the blah.php file at installation, and then use str_replace() to replace all occurences of the string @token@ with the package's version number. Then, it would replace all occurences of the string @anothertoken@ with the value of the user's php_dir configuration variable.

Although powerful, the replace tag is the only customization tag available in package.xml version 1.0. When developing package.xml version 2.0, the replace tag and innovative work of other projects such as Phing became the inspiration for an expanded kind customization called a "task".

Tasks are defined by xml children of a <file> tag. Tasks are implemented by extending the PEAR_Task_Common task.

Using a customized task in a package.xml

Tasks are defined in package.xml through the tasks namespace, which is currently http://pear.php.net/dtd/tasks-1.0. The current tasks namespace is defined by http://pear.php.net/dtd/tasks-1.0.xsd. Custom tasks bundled with PEAR include:

The xml for each of these tasks is documented here.

 

Text Ads
There isn't content right now for this block.

Community Login
Welcome,
Anonymous

Nickname
Password
   

People Online:
Visitors: 65
Members: 1
Total: 66

Online Now:
01 : Monty

Like my code
Then please make a donation.

Which help me produce more free code.


Paypal Verified

Information

Powered by PHP-Nuke

Valid CSS!


Valid Robots.txt

Bad Behavior

[Valid RSS]

[Valid RSS]
You can syndicate our News with backend.php And our Forums with rss.php
You can also access our feeds via Feedburner Site News and LD Software Forums
© 2009 ld-software.co.uk All Rights Reserved.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.58 Seconds