Do not set #dir when on public.php

Fix #7571
Merge pull request #7575 from owncloud/issue/7571

Do not set #dir when on public.php