[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /** 4 * @package pake 5 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 6 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 7 * @license see the LICENSE file included in the distribution 8 * @version SVN: $Id: pakeFileTask.class.php 1791 2006-08-23 21:17:06Z fabien $ 9 */ 10 11 /** 12 * 13 * . 14 * 15 * . 16 * 17 * @package pake 18 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 19 * @copyright 2004-2005 Fabien Potencier <fabien.potencier@symfony-project.com> 20 * @license see the LICENSE file included in the distribution 21 * @version SVN: $Id: pakeFileTask.class.php 1791 2006-08-23 21:17:06Z fabien $ 22 */ 23 class pakeFileTask extends pakeTask 24 { 25 public function is_needed() 26 { 27 if (!file_exists($this->get_name())) return true; 28 $latest_prereq = 0; 29 foreach ($this->prerequisites as $prerequisite) 30 { 31 $t = pakeTask::get($prerequisite)->timestamp(); 32 if ($t > $latest_prereq) 33 { 34 $latest_prereq = $t; 35 } 36 } 37 38 if ($latest_prereq == 0) 39 { 40 return false; 41 } 42 43 return ($this->timestamp() < $latest_prereq); 44 } 45 46 public function timestamp() 47 { 48 if (!file_exists($this->get_name())) 49 { 50 throw new pakeException(sprintf('File "%s" does not exist!', $this->get_name())); 51 } 52 53 $stats = stat($this->get_name()); 54 55 return $stats['mtime']; 56 } 57 58 public static function define_task($name, $deps = null) 59 { 60 $task = pakeTask::lookup($name, 'pakeFileTask'); 61 $task->add_comment(); 62 $task->enhance($deps); 63 } 64 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |