Make update script executable from anywhere

This commit is contained in:
Sebastian Meyer 2017-12-21 19:00:41 +01:00
parent df0866c824
commit ace2cd93a7
1 changed files with 8 additions and 2 deletions

View File

@ -59,7 +59,6 @@ if (empty($argc) || $argc != 3) {
echo "\n"; echo "\n";
echo "Example:\n"; echo "Example:\n";
echo " php update.php /tmp/import oai_dc\n"; echo " php update.php /tmp/import oai_dc\n";
echo "\n";
exit; exit;
@ -87,9 +86,16 @@ if (!is_dir($sourceDir) || !is_readable($sourceDir)) {
$sourceDir = rtrim($sourceDir, '/').'/'; $sourceDir = rtrim($sourceDir, '/').'/';
// Check dataDir permissions // Prepend script's path if dataDir is not an absolute path
$dataDir = rtrim($config['dataDirectory'], '/').'/'.$metadataPrefix.'/'; $dataDir = rtrim($config['dataDirectory'], '/').'/'.$metadataPrefix.'/';
if (strpos($dataDir, '/') !== 0) {
$dataDir = dirname(__FILE__).'/'.$dataDir;
}
// Check dataDir permissions
if (!is_dir($dataDir) || !is_writable($dataDir)) { if (!is_dir($dataDir) || !is_writable($dataDir)) {
echo "Error: $dataDir not writable\n"; echo "Error: $dataDir not writable\n";