Changeset 353

Show
Ignore:
Timestamp:
02/06/08 19:43:18 (6 months ago)
Author:
hans
Message:

Refs #219 - Adding new ChownTask.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.3/classes/phing/system/io/FileSystem.php

    r258 r353  
    409409    } 
    410410 
     411        /** 
     412         * Change the ownership on a file or directory. 
     413         * 
     414         * @param    string $pathname Path and name of file or directory. 
     415         * @param    string $user The user name or number of the file or directory. See http://us.php.net/chown 
     416         * 
     417         * @return void 
     418         * @throws Exception if operation failed. 
     419         */ 
     420        function chown($pathname, $user) { 
     421                if (false === @chown($pathname, $user)) {// FAILED. 
     422                        $msg = "FileSystem::chown() FAILED. Cannot chown $pathname. User $user." . (isset($php_errormsg) ? ' ' . $php_errormsg : ""); 
     423                        throw new Exception($msg); 
     424                } 
     425    } 
     426     
    411427    /** 
    412428     * Change the permissions on a file or directory. 
  • branches/2.3/classes/phing/system/io/PhingFile.php

    r325 r353  
    714714    } 
    715715 
     716        /** 
     717         * Sets the owner of the file. 
     718         * @param mixed $user User name or number. 
     719         */ 
     720        public function setUser($user) { 
     721                $fs = FileSystem::getFileSystem(); 
     722                return $fs->chown($this->getPath(), $user); 
     723    } 
     724     
     725        /** 
     726     * Retrieve the owner of this file. 
     727     * @return int User ID of the owner of this file.  
     728     */ 
     729    function getUser() { 
     730        return @fileowner($this->getPath()); 
     731    } 
     732     
    716733    /** 
    717734     * Sets the mode of the file 
  • branches/2.3/classes/phing/tasks/defaults.properties

    r340 r353  
    1111available=phing.tasks.system.AvailableTask 
    1212chmod=phing.tasks.system.ChmodTask 
     13chown=phing.tasks.system.ChownTask 
    1314concat=phing.tasks.system.AppendTask 
    1415condition=phing.tasks.system.ConditionTask