pkgsubmit: store the previous path with getcwd()

This solves the problem of include files not being found after an error.
$_SERVER['DOCUMENT_ROOT'] is not reliable because the AUR might be
installed in a subdirectory.

This closes http://bugs.archlinux.org/task/16887

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
mickael9 2010-06-05 00:50:18 -04:00 committed by Loui Chang
parent b18fb08ddc
commit 3f47ee740d

View file

@ -12,6 +12,8 @@ include_once("pkgfuncs.inc"); # package functions
set_lang(); # this sets up the visitor's language
check_sid(); # see if they're still logged in
$cwd = getcwd();
if ($_COOKIE["AURSID"]):
# Track upload errors
@ -421,7 +423,7 @@ if ($_COOKIE["AURSID"]):
}
}
chdir($_SERVER['DOCUMENT_ROOT']);
chdir($cwd);
}
# Logic over, let's do some output