static function execute($source, $destination, $level, $class, $is_top, $lazy) { $source = patchwork_realpath($source); if (self::$recursivePool && $lazy) { $pool =& self::$recursivePool[count(self::$recursivePool) - 1]; $pool[$source] = array($destination, $level, $class, $is_top); return; } $pool = array($source => array($destination, $level, $class, $is_top)); self::$recursivePool[] =& $pool; $tmpPool = array(); while (list($source, list($destination, $level, $class, $is_top)) = each($pool)) { $preproc = new self(); $code = $preproc->preprocess($source, $level, $class, $is_top); $tmp = PATCHWORK_PROJECT_PATH . '.~' . uniqid(mt_rand(), true); if (false !== file_put_contents($tmp, $code)) { $tmpPool[] = array($tmp, $destination); } } while (list($tmp, $destination) = array_pop($tmpPool)) { /**/ if ('\\' === DIRECTORY_SEPARATOR) { file_exists($destination) && @unlink($destination); } rename($tmp, $destination) || unlink($tmp); } array_pop(self::$recursivePool); }