# AttribTask

Extends \ApplyTask

Changes the attributes of a file or all files inside specified directories.

Right now it has effect only under Windows. Each of the 4 possible permissions has its own attribute, matching the arguments for the `attrib` command.

Example:

       <attrib file="${input}" readonly="true" hidden="true" verbose="true"/>

author | Siad Ardroumli siad.ardroumli@gmail.com
package | phing.tasks.system

### Methods

## addArg

    addArg( $sign,  $attribute)

### Arguments

#### $sign

``

#### $attribute

``

## Nested adder, adds a set of dirs (nested dirset attribute).

    addDirSet(\DirSet $dirSet) : void

inherited

### Arguments

#### $dirSet

`\DirSet`

## Nested adder, adds a set of files (nested fileset attribute).

    addFileSet(\FileSet $fs) : void

inherited

### Arguments

#### $fs

`\FileSet`

## Builds the full command to execute and stores it in $realCommand.

    buildCommand() : void

inherited

## Check the attributes.

    checkConfiguration()

throws |

## Runs cleanup tasks post execution - Restore working directory

    cleanup() : void

inherited

## Supports embedded <arg> element.

    createArg() : \CommandlineArgument

inherited

### Response

`\CommandlineArgument`

## Supports embedded <filelist> element.

    createFileList() : \FileList

inherited

### Response

`\FileList`

## Supports embedded <srcfile> element.

    createSrcfile() : void

inherited

## Executes the specified command and returns the return code & output.

    executeCommand(string $command) : array

inherited

### Arguments

#### $command

`string`

### Response

`array`

array(return code, array with output)

## Returns the textual description of the task

    getDescription() : string

inherited

### Response

`string`

The text description of the task

## Prepares the filename per base directory and relative path information

    getFilePath( $filename,  $basedir,  $relative) : mixed

inherited

### Arguments

#### $filename

``

#### $basedir

``

#### $relative

``

### Response

`mixed`

processed filenames

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

    getLocation() : \Location

inherited

### Response

`\Location`

The location object describing the position of this task within the buildfile.

## Returns the owning target of this task.

    getOwningTarget() : \Target

inherited

### Response

`\Target`

The target object that owns this task

## Returns a reference to current project

    getProject() : \Project

inherited

### Response

`\Project`

Reference to current porject object

## Returns a name

    getRegisterSlot(string $slotName) : \RegisterSlot

inherited

### Arguments

#### $slotName

`string`

### Response

`\RegisterSlot`

## Returns the wrapper object for runtime configuration

    getRuntimeConfigurableWrapper() : \RuntimeConfigurable

inherited

### Response

`\RuntimeConfigurable`

The wrapper object used by this task

## getSignString

    getSignString( $attr)

static

### Arguments

#### $attr

``

## Returns the name of task, used only for log messages

    getTaskName() : string

inherited

### Response

`string`

Name of this task

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

    getTaskType() : string

inherited

### Response

`string`

The type of this task (XML Tag)

## hasAttr

    hasAttr() : boolean

### Response

`boolean`

## Called by the parser to let the task initialize properly.

    init()

inherited

Should throw a BuildException if something goes wrong with the build

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

throws |

## Initializes the task operations, i.e.

    initialize() : void

inherited

- Required information validation
- Working directory

## Logs a message with the given priority.

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

inherited

### Arguments

#### $msg

`string`

The message to be logged.

#### $level

`integer`

The message's priority at this message should have

## Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.

    main()

inherited abstract

Should throw a BuildException if someting goes wrong with the build

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

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

    maybeConfigure()

inherited

## Perfrom this task

    perform()

inherited

throws |

## Processes the files list with provided information for execution

    process(array $files, string $basedir) : void

inherited

### Arguments

#### $files

`array`

File list for processing

#### $basedir

`string`

Base directory of the file list

## To add the source filename at the end of command of automatically

    setAddsourcefile(Boolean $addsourcefile) : void

inherited

### Arguments

#### $addsourcefile

`Boolean`

Identifier for adding source file at the end of command

## Set the Archive file attribute.

    setArchive(boolean $value)

### Arguments

#### $value

`boolean`

## setCheckreturn

    setCheckreturn( $failonerror)

inherited

### Arguments

#### $failonerror

``

## Sets a textual description of the task

    setDescription(string $desc)

inherited

### Arguments

#### $desc

`string`

The text describing the task

## Specify the working directory for the command execution.

    setDir(\PhingFile $dir) : void

inherited

### Arguments

#### $dir

`\PhingFile`

Set the working directory as specified

## File to which error output should be written

    setError(\PhingFile $errorfile) : void

inherited

### Arguments

#### $errorfile

`\PhingFile`

Error log file

## Escape command using 'escapeshellcmd' before execution

    setEscape(boolean $escape) : void

inherited

### Arguments

#### $escape

`boolean`

Escape command before execution

## Sets the command executable information

    setExecutable(string $executable) : void

inherited

### Arguments

#### $executable

`string`

Executable path

## Fail on command exits with a returncode other than zero

    setFailonerror(boolean $failonerror) : void

inherited

### Arguments

#### $failonerror

`boolean`

Indicator to fail on error

## A file to be attribed.

    setFile(\PhingFile $src)

### Arguments

#### $src

`\PhingFile`

a file

## Whether to use forward-slash as file-separator on the file names

    setForwardslash(boolean $forwardslash) : void

inherited

### Arguments

#### $forwardslash

`boolean`

Indicator to use forward-slash

## Set the Hidden file attribute.

    setHidden(boolean $value)

### Arguments

#### $value

`boolean`

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

    setLocation(\Location $location)

inherited

### Arguments

#### $location

`\Location`

The location object describing the position of this task within the buildfile.

## Set max parallel.

    setMaxParallel(integer $max)

This is not allowed, and it always throws a BuildException.

throws |

### Arguments

#### $max

`integer`

ignored

## Specify OS (or multiple OS) that must match in order to execute this command.

    setOs(string $os) : void

inherited

### Arguments

#### $os

`string`

Operating system string (e.g. "Linux")

## File to which output should be written

    setOutput(\PhingFile $outputfile) : void

inherited

### Arguments

#### $outputfile

`\PhingFile`

Output log file

## The name of property to set to output value

    setOutputProperty(string $propertyname) : void

inherited

### Arguments

#### $propertyname

`string`

Property name

## Sets the owning target this task belongs to.

    setOwningTarget(\Target $target)

inherited

### Arguments

#### $target

`\Target`

## Run the command only once, appending all files as arguments

    setParallel(Boolean $parallel) : void

inherited

### Arguments

#### $parallel

`Boolean`

Identifier for files as arguments appending

## Whether to use PHP's passthru() function instead of exec()

    setPassthru(boolean $passthru) : void

inherited

### Arguments

#### $passthru

`boolean`

If passthru shall be used

## References the project to the current component.

    setProject(\Project $project) : void

inherited

### Arguments

#### $project

`\Project`

The reference to the current project

## Set the ReadOnly file attribute.

    setReadonly(boolean $value)

### Arguments

#### $value

`boolean`

## The name of property to set to return value

    setReturnProperty(string $propertyname) : void

inherited

### Arguments

#### $propertyname

`string`

Property name

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

    setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)

inherited

### Arguments

#### $wrapper

`\RuntimeConfigurable`

The wrapper object this task should use

## Whether to spawn the command and run as background process

    setSpawn(boolean $spawn) : void

inherited

### Arguments

#### $spawn

`boolean`

If the command is to be run as a background process

## Set the System file attribute.

    setSystem(boolean $value)

### Arguments

#### $value

`boolean`

## Sets the name of this task for log messages

    setTaskName(string $name) : string

inherited

### Arguments

#### $name

`string`

### Response

`string`

A string representing the name of this task for log

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

    setTaskType( $name)

inherited

### Arguments

#### $name

``

## setVerbose

    setVerbose(boolean $b)

### Arguments

#### $b

`boolean`

## Throws the exception with specified information

    throwBuildException( $information) : void

inherited

throws |

### Arguments

#### $information

``

Exception information

## Checks whether the current O.S. should be supported

    validateOS() : boolean

inherited

### Response

`boolean`

False if the exec command shall not be run

### Constants

## SOURCEFILE_ID

    SOURCEFILE_ID

inherited

### Properties

## ATTR_READONLY

    ATTR_READONLY :

static

### Type(s)

``

## ATTR_ARCHIVE

    ATTR_ARCHIVE :

static

### Type(s)

``

## ATTR_SYSTEM

    ATTR_SYSTEM :

static

### Type(s)

``

## ATTR_HIDDEN

    ATTR_HIDDEN :

static

### Type(s)

``

## SET

    SET :

static

### Type(s)

``

## UNSET

    UNSET :

static

### Type(s)

``

## attr

    attr :

### Type(s)

``

## File Set/List of files.

    filesets : array

inherited

var |

### Type(s)

`array`

## filelists

    filelists :

inherited

### Type(s)

``

## Commandline managing object

    commandline : \commandline

inherited

var |

### Type(s)

`\commandline`

## Working directory

    dir : \phingfile

inherited

var |

### Type(s)

`\phingfile`

## currentdirectory

    currentdirectory :

inherited

### Type(s)

``

## Command to be executed

    realCommand : string

inherited

var |

### Type(s)

`string`

## Escape (shell) command using 'escapeshellcmd' before execution

    escape : boolean

inherited

var |

### Type(s)

`boolean`

## Where to direct output

    output : \phingfile

inherited

var |

### Type(s)

`\phingfile`

## Where to direct error

    error : \phingfile

inherited

var |

### Type(s)

`\phingfile`

## Whether output should be appended to or overwrite an existing file

    appendoutput : boolean

inherited

var |

### Type(s)

`boolean`

## Runs the command only once, appending all files as arguments else command will be executed once for every file.

    parallel : boolean

inherited

var |

### Type(s)

`boolean`

## Whether source file name should be added to the end of command automatically

    addsourcefile : boolean

inherited

var |

### Type(s)

`boolean`

## Whether to spawn the command execution as a background process

    spawn : boolean

inherited

var |

### Type(s)

`boolean`

## Property name to set with return value

    returnProperty : string

inherited

var |

### Type(s)

`string`

## Property name to set with output value

    outputProperty : string

inherited

var |

### Type(s)

`string`

## Whether the filenames should be passed on the command line as relative pathnames (relative to the base directory of the corresponding fileset/list)

    relative : boolean

inherited

var |

### Type(s)

`boolean`

## Operating system information

    os : string

inherited

var |

### Type(s)

`string`

## currentos

    currentos :

inherited

### Type(s)

``

## osvariant

    osvariant :

inherited

### Type(s)

``

## Logging level for status messages

    loglevel : integer

inherited

var |

### Type(s)

`integer`

## Fail on command that exits with a returncode other than zero

    failonerror : boolean

inherited

var |

### Type(s)

`boolean`

## Whether to use PHP's passthru() function instead of exec()

    passthru : boolean

inherited

var |

### Type(s)

`boolean`

## Whether to use forward-slash as file-separator on the file names

    forwardslash : boolean

inherited

var |

### Type(s)

`boolean`

## Limit the amount of parallelism by passing at most this many sourcefiles at once (Set it to <= 0 for unlimited)

    maxparallel : integer

inherited

var |

### Type(s)

`integer`

## Owning Target object

    target : \Target

inherited

var |

### Type(s)

`\Target`

## Description of the task

    description : string

inherited

var |

### Type(s)

`string`

## Internal taskname (req)

    taskType : string

inherited

var |

### Type(s)

`string`

## Taskname for logger

    taskName : string

inherited

var |

### Type(s)

`string`

## Stored buildfile location

    location : \Location

inherited

var |

### Type(s)

`\Location`

## Wrapper of the task

    wrapper : \RuntimeConfigurable

inherited

var |

### Type(s)

`\RuntimeConfigurable`

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

    project : \Project

inherited

var | A reference to the current project instance

### Type(s)

`\Project`