# tasks/ext/zendguard/ZendGuardLicenseTask.php

Produce license files using Zeng Guard.

The task can produce a license file from the given license properties or it can use a template.

Author
  Petr Rybak
Package
  phing.tasks.ext.zendguard
Since
  2.4.3
Version
  $Id: ZendGuardLicenseTask.php 1026 2011-01-06 15:13:50Z mrook $

## \ZendGuardLicenseTask
jump to top

Package: phing\tasks\ext\zendguard

Produce license files using Zeng Guard.

The task can produce a license file from the given license properties or it can use a template.

Parent(s)
  \Task < \ProjectComponent
Author
  Petr Rybak
Copyright
  2001,2002 THYRELL. All rights reserved
Since
  2.4.3
Version
  $Id: ZendGuardLicenseTask.php 1026 2011-01-06 15:13:50Z mrook $

### Properties

`string $description= ''`
inherited

description of the taskInherited from: \Task::$description
Details

Type
  string
Inherited_from
  \Task::$description

`string $expires= ''`

Expiration date of the license. Used if the license is issued with a date restriction.

Possible values: - 'Never', '0' or false: the license won't expire - A Date in format DD-MM-YYYY to set expiration for that date - Relative date supported by the PHP strtotime function (e.g. +1 month)

REQUIRED

Details

Type
  string

`bool $hardwareLocked= ''`

Option that indicates if the license will be locked to a specific machine using the Zend Host ID code(s). If set to YES, the Host-ID is required.

OPTIONAL

Details

Type
  bool

`string $hostID= ''`

Coded string (Zend Host ID) used to lock the license to a specific hardware. The Zend Host ID obtained from the machine where the encoded files and license are to be installed. The Zend Host ID code can be obtained by using the zendid utility.

For more details, see Getting the Zend Host ID.

REQUIRED if Hardware-Locked is set equal to YES. Meaningless if Hardware-Locked is set equal to NO.

User semicolon to enter more than one Host-ID

Example: Host-ID = H:MFM43-Q9CXC-B9EDX-GWYSU;H:MFM43-Q9CXC-B9EDX-GWYTY

Details

Type
  string

`string $ipRange= ''`

Limits the use of the license to IP addresses that fall within specification. Supports wildcards for any of the IP place holders, as well as the two types of net masks (filters).

Netmask pair An IP a.b.c.d, and a netmask w.x.y.z. (That is., 10.1.0.0/255.255.0.0), where the binary of mask is applied to filter IP addresses. ip/nnn (similar to a CIDR specification) This mask consists of nnn high-order 1 bits. (That is, 10.1.0.0/16 is the same as 10.1.0.0/255.255.0.0). Instead of spelling out the bits of the subnet mask, this mask notation is simply listed as the number of 1s bits that start the mask. Rather than writing the address and subnet mask as 192.60.128.0/255.255.252.0 the network address would be written simply as: 192.60.128.0/22 which indicates starting address of the network and number of 1s bits (22) in the network portion of the address. The mask in binary is (11111111.11111111.11111100.00000000).

OPTIONAL

Example (Wildcard): IP-Range = 10.1.. Example (Net Mask): IP-Range = 10.1.0.0/255.255.0.0 Example (Net Mask): IP-Range = 10.1.0.0/16

Details

Type
  string

`string $licenseTemplate= ''`

Path to license template. If specified all license properties will be ignored and the template will be used to generate the file.

Details

Type
  string

`\Location $location= ''`
inherited

stored buildfile locationInherited from: \Task::$location
Details

Type
  \Location
Inherited_from
  \Task::$location

`string $outputFile= ''`

Where to store the signed license file

Details

Type
  string

`string $privateKeyPath= ''`

Path to private key that will be used to sign the license

Details

Type
  string

`string $productName= ''`

The name assigned to Product. This must be the same name used when encoding the PHP files.

REQUIRED

Details

Type
  string

`\Project $project= 'null'`
inherited

Holds a reference to the project that a project component (a task, a target, etc.) belongs to

A reference to the current project instanceInherited from: \ProjectComponent::$project
Default value `null` Details

Type
  \Project
Inherited_from
  \ProjectComponent::$project

`string $registeredTo= ''`

The Name of the Registered owner of the license.

REQUIRED

Details

Type
  string

`\Target $target= ''`
inherited

owning Target objectInherited from: \Task::$target
Details

Type
  \Target
Inherited_from
  \Task::$target

`string $taskName= ''`
inherited

Taskname for loggerInherited from: \Task::$taskName
Details

Type
  string
Inherited_from
  \Task::$taskName

`string $taskType= ''`
inherited

internal taskname (req)Inherited from: \Task::$taskType
Details

Type
  string
Inherited_from
  \Task::$taskType

`$tmpLicensePath= ''`
Details

Type

`string $userDefinedValues= ''`

Semi-colon separated user defined values that will be part of the license. These values CANNOT be modified after the license is produced. Modification would invalidate the license.

OPTIONAL Example: Tea=Mint Flavor;Coffee=Arabica

Details

Type
  string

`\RuntimeConfigurable $wrapper= ''`
inherited

wrapper of the taskInherited from: \Task::$wrapper
Details

Type
  \RuntimeConfigurable
Inherited_from
  \Task::$wrapper

`string $xUserDefinedValues= ''`

Semi-colon separated user defined x-values that will be part of the license. These values CAN be modified after the license is produced. Modification won't invalidate the license.

OPTIONAL Example: Tea=Mint Flavor;Coffee=Arabica

Details

Type
  string

`$zendsignCommand= ''`
Details

Type

`string $zendsignPath= ''`

Path to Zend Guard zendenc_sign executable

Details

Type
  string

### Methods

`cleanupTmpFiles( ) : void`

If temporary license file was created during the process this will remove it

`generateLicense( ) : void`

Creates the signed license at the defined output path

`generateLicenseTemplate( ) : string`

It will generate a temporary license template based on the properties defined.

Returns

Type | Description
--- | ---
string | Path of the temporary license template file

`generateLicenseTemplateContent( ) : string`

Generates license template content based on the defined parameters

Returns

Type | Description
--- | ---
string |

`getDescription( ) : string`
inherited

Returns the textual description of the task

Inherited from: \Task::getDescription()
Returns

Type | Description
--- | ---
string | The text description of the task

`getLicenseTemplatePath( ) : string`

Checks if the license template path is defined and returns it.

If it the license template path is not defined it will generate a temporary template file and provide it as a template.

Returns

Type | Description
--- | ---
string |

`getLocation( ) : \Location`
inherited

Returns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.

Inherited from: \Task::getLocation()
Returns

Type | Description
--- | ---
\Location | The location object describing the position of this task within the buildfile.

`getOwningTarget( ) : \Target`
inherited

Returns the owning target of this task.

Inherited from: \Task::getOwningTarget()
Returns

Type | Description
--- | ---
\Target | The target object that owns this task

`getProject( ) : \Project`
inherited

Returns a reference to current project

Inherited from: \ProjectComponent::getProject()
Returns

Type | Description
--- | ---
\Project | Reference to current porject object

`getRegisterSlot( $slotName ) : void`
inherited

Returns a name

Inherited from: \Task::getRegisterSlot()
Parameters

Name | Type | Description
--- | --- | ---
$slotName |  |

`getRuntimeConfigurableWrapper( ) : \RuntimeConfigurable`
inherited

Returns the wrapper object for runtime configuration

Inherited from: \Task::getRuntimeConfigurableWrapper()
Returns

Type | Description
--- | ---
\RuntimeConfigurable | The wrapper object used by this task

`getTaskName( ) : string`
inherited

Returns the name of task, used only for log messages

Inherited from: \Task::getTaskName()
Returns

Type | Description
--- | ---
string | Name of this task

`getTaskType( ) : string`
inherited

Returns the name of the task under which it was invoked, usually the XML tagname

Inherited from: \Task::getTaskType()
Returns

Type | Description
--- | ---
string | The type of this task (XML Tag)

`init( ) : void`
inherited

Called by the parser to let the task initialize properly.

Inherited from: \Task::init()

Should throw a BuildException if something goes wrong with the build

This is abstract here, but may not be overloaded by subclasses.

Throws

Exception | Description
--- | ---
\BuildException |

`log( string $msg, integer $level = Project::MSG_INFO ) : void`
inherited

Provides a project level log event to the task.

Inherited from: \Task::log()

@param string $msg The message to be logged.

Parameters

Name | Type | Description
--- | --- | ---
$msg | string | The message to log
$level | integer | The priority of the message

Details

See
  \BuildEvent
See
  \BuildListener

`main( ) : void`

Do the work

Should throw a BuildException if someting goes wrong with the build

This is abstract here. Must be overloaded by real tasks.

Throws

Exception | Description
--- | ---
\BuildException |

`maybeConfigure( ) : void`
inherited

Configure this task if it hasn't been done already.

Inherited from: \Task::maybeConfigure()
`parseAndAddUserDefinedValues( \stirng $valueString, array $valueArray, string $keyPrefix = '', $pairSeparator = ';' ) : void`

Parse the given string in format like key1=value1;key2=value2;... and converts it to array (key1=>value1, key2=value2, ...)

Parameters

Name | Type | Description
--- | --- | ---
$valueString | \stirng | Semi-colon separated value pairs
$valueArray | array | Array to which the values will be added
$keyPrefix | string | Prefix to use when adding the key
$pairSeparator |  |

`perform( ) : void`
inherited

Perfrom this task

Inherited from: \Task::perform()
`prepareSignCommand( ) : string`

Prepares and returns the command that will be used to create the license.

Returns

Type | Description
--- | ---
string |

`setDescription( string $desc ) : void`
inherited

Sets a textual description of the task

Inherited from: \Task::setDescription()
Parameters

Name | Type | Description
--- | --- | ---
$desc | string | The text describing the task

`setExpires( mixed $expires ) : string`

Process the expires property. If the value is empty (false, '', ...) it will set the value to 'Never' Otherwise it will run the value through strtotime so relative date and time notation can be used (e.g. +1 month)

Parameters

Name | Type | Description
--- | --- | ---
$expires | mixed |

Returns

Type | Description
--- | ---
string |

`setHardwareLocked( $hardwareLocked ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$hardwareLocked |  |

`setHostID( $hostID ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$hostID |  |

`setIpRange( $iprange ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$iprange |  |

`setLicenseTemplate( $value ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$value |  |

`setLocation( \Location $location ) : void`
inherited

Sets the location within the buildfile this task occurs. Called by the parser to set location information.

Inherited from: \Task::setLocation()
Parameters

Name | Type | Description
--- | --- | ---
$location | \Location | The location object describing the position of this task within the buildfile.

`setOutputFile( $outputFile ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$outputFile |  |

`setOwningTarget( \Target $target ) : void`
inherited

Sets the owning target this task belongs to.

Inherited from: \Task::setOwningTarget()
Parameters

Name | Type | Description
--- | --- | ---
$target | \Target | Reference to owning target

`setPrivateKeyPath( $privateKeyPath ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$privateKeyPath |  |

`setProductName( $productName ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$productName |  |

`setProject( \Project $project ) : void`
inherited

References the project to the current component.

Inherited from: \ProjectComponent::setProject()
Parameters

Name | Type | Description
--- | --- | ---
$project | \Project | The reference to the current project

`setRegisteredTo( $registeredTo ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$registeredTo |  |

`setRuntimeConfigurableWrapper( \RuntimeConfigurable $wrapper ) : void`
inherited

Sets the wrapper object this task should use for runtime configurable elements.

Inherited from: \Task::setRuntimeConfigurableWrapper()
Parameters

Name | Type | Description
--- | --- | ---
$wrapper | \RuntimeConfigurable | The wrapper object this task should use

`setTaskName( $name ) : string`
inherited

Sets the name of this task for log messages

Inherited from: \Task::setTaskName()
Parameters

Name | Type | Description
--- | --- | ---
$name |  |

Returns

Type | Description
--- | ---
string | A string representing the name of this task for log

`setTaskType( string $name ) : void`
inherited

Sets the type of the task. Usually this is the name of the XML tag

Inherited from: \Task::setTaskType()
Parameters

Name | Type | Description
--- | --- | ---
$name | string | The type of this task (XML Tag)

`setUserDefinedValues( $userDefinedValues ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$userDefinedValues |  |

`setXUserDefinedValues( $xUserDefinedValues ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$xUserDefinedValues |  |

`setZendsignPath( $zendsignPath ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$zendsignPath |  |

`verifyConfiguration( ) : void`

Verifies that the configuration is correct

Throws

Exception | Description
--- | ---
\BuildException |

Documentation was generated by DocBlox 0.15.1.