Example #1
0
function recompile($path)
{
    global $AR, $templateStore;
    $dh = opendir($path);
    $objectID = pathToObjectID($path);
    while (false !== ($file = readdir($dh))) {
        if ($file != "." && $file != "..") {
            $f = $path . $file;
            if (substr($file, -strlen(".pinp")) == ".pinp" && is_file($f)) {
                $templateName = substr($file, 1, -strlen(".pinp"));
                echo "Recompiling {$templateName}<br>\n";
                $pinp_code = file_get_contents($f);
                $compiler = new pinp($AR->PINP_Functions, "local->", "\$AR_this->_");
                $optimized = sprintf($AR->PINPtemplate, $compiled);
                $compiled = $compiler->compile(strtr($pinp_code, "\r", ""));
                if ($compiler->error) {
                    showCompilerError($compiler, $path . $file);
                } else {
                    $optimized = sprintf($AR->PINPtemplate, $compiled);
                    $templateStore->write($optimized, $objectID, $templateName . ".inc");
                }
            } else {
                if (is_dir($f) && $file != "CVS" && $file != ".svn") {
                    recompile("{$f}/");
                }
            }
        }
    }
    closedir($dh);
}
Example #2
0
function recurse($path)
{
    global $AR, $needsUpgrade;
    $dh = opendir($path);
    $files = array();
    $nlsFiles = array();
    $dirs = array();
    $objectID = pathToObjectID($path);
    while (is_resource($dh) && false !== ($file = readdir($dh))) {
        if ($file != "." && $file != "..") {
            $f = $path . $file;
            if (is_file($f) && $file[0] == '_') {
                $files[] = $file;
            } else {
                if (is_dir($f) && $file != "CVS" && $file != ".svn") {
                    $dirs[] = $f . "/";
                }
            }
        }
    }
    closedir($dh);
    foreach ($files as $file) {
        $info = parseFile($file);
        $nlsFiles[$info['file']][$info['nls']] = $info;
    }
    unset($files);
    foreach ($nlsFiles as $basefile => $nlsData) {
        if (count($nlsData)) {
            $needsUpgrade[$objectID] = '' . $objectID;
        }
    }
    unset($nlsFiles);
    foreach ($dirs as $dir) {
        recurse($dir);
    }
    unset($dirs);
}