Exemplo n.º 1
0
function printPath()
{
    // For some reason, getenv() doesn't see changes we make with putenv().
    $path = explode(':', mpGetPath());
    foreach ($path as $pathEl) {
        if (is_dir($pathEl)) {
            $result .= "<li><tt>{$pathEl}</tt></li>\n";
        } else {
            $result .= "<li><b><font color=#990000><tt>{$pathEl}</tt></font> - does not exist</b></li>\n";
        }
    }
    echo "<ul>\n{$result}</ul>\n";
}
Exemplo n.º 2
0
/** Does not need to be called explicitly if mpStartSession is called. */
function mpInitEnvirons()
{
    // Die if disk is at least 98% full, in order to protect the server.
    $df = shell_exec("df '" . MP_BASE_DIR . "'");
    $i = strrpos($df, "%");
    if (trim(substr($df, $i - 2, 2)) >= 98) {
        die("Server disk is more than 98% full.");
    }
    // Configure some PHP options for our use
    // comment out the following set_magic_quotes_runtime line; deprecated in PHP vers 5.3
    // set_magic_quotes_runtime(0); // off
    // Make sure our pages aren't cached by the browser.
    // Most browsers are OK without this, but we're just being safe...
    // Taken from the PHP manual:
    /*
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");               // Date in the past
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  // always modified
    header("Cache-Control: no-store, no-cache, must-revalidate");   // HTTP/1.1
    header("Cache-Control: post-check=0, pre-check=0", false);      // HTTP/1.1
    header("Pragma: no-cache");                                     // HTTP/1.0
    */
    // Set umask for files, directories, etc. that are created
    umask(MP_UMASK);
    // Set PATH for executable programs
    putenv("PATH=" . mpGetPath());
    // Source cctbx environment
    putenv("PATH=" . cctbxGetPath());
    //system("source ".MP_BASE_DIR."/build/setpaths.sh"); //bash
    //system("source ".MP_BASE_DIR."/build/setpaths.csh"); //tcsh
    // Also set location of Reduce's heterogen dictionary
    // Better here than on command line b/c it affects e.g. flipkin too
    putenv("REDUCE_HET_DICT=" . MP_REDUCE_HET_DICT);
    // Initialize location for job files
    if (!defined('MP_JOB_DATA_DIR')) {
        //try global environmental variable
        //$job_loc = getenv('MP_JOB_DATA_DIR');
        $job_loc = getenv('MP_JOB_DATA_DIR');
        if ($job_loc) {
            define("MP_JOB_DATA_DIR", $job_loc);
        } else {
            define("MP_JOB_DATA_DIR", MP_BASE_DIR . "/public_html/data/");
        }
    }
}