예제 #1
0
    foreach ($check as $type) {
        switch ($type) {
            case R:
                readable($folder);
                break;
            case W:
                writable($folder);
                break;
            case E:
                executable($folder);
                break;
        }
    }
}
echo 'Your permissions seem right for this user. Note, this script does not verify all paths, only the most important ones.' . PHP_EOL;
if (!newznab\utility\Utility::isWin()) {
    $user = posix_getpwuid(posix_geteuid());
    if ($user['name'] !== 'www-data') {
        echo 'If you have not already done so, please rerun this script using the www-data user: sudo -u www-data php verify_permissions.php yes' . PHP_EOL;
    }
}
function readable($folder)
{
    if (!is_readable($folder)) {
        exit('Error: This path is not readable: (' . $folder . ') resolve this and rerun the script.' . PHP_EOL);
    }
}
function writable($folder)
{
    if (!is_writable($folder)) {
        exit('Error: This path is not writable: (' . $folder . ') resolve this and rerun the script.' . PHP_EOL);
예제 #2
0
파일: Git.php 프로젝트: RickDB/newznab-tmux
 private static function check_bin($binPath = '')
 {
     $binPath = $binPath ?: '/usr/bin/git';
     $resource = proc_open('which git', [1 => ['pipe', 'w']], $pipes);
     $stdout = stream_get_contents($pipes[1]);
     foreach ($pipes as $pipe) {
         fclose($pipe);
     }
     $status = trim(proc_close($resource));
     if (!$status) {
         $binPath = trim($stdout);
     }
     if (strpos($binPath, ' ') !== false) {
         $binPath = newznab\utility\Utility::isWin() ? '"' . $binPath . '"' : str_replace(' ', '\\ ', $binPath);
     }
     self::set_bin($binPath);
     return $binPath;
 }