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