Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Move user directory outside root folder

Started by Muut Archive 10 years ago · 5 replies · 939 views
10 years ago

Hey,
I would like to ask you if its possible to move user (data) directory outside root folder for example one level up or so...
I found that you are using a lot of hard coded paths instead of USER_DIR.
Its crucial for us since we can't write on production and we have to move user dir one level up to shared storage. I hope you can help us with this

10 years ago

You can with core grav:

Add a setup.php file inside the Grav root folder, with this content:

PHP
<?php
return [
    'streams' => [
        'schemes' => [
            'user' => [
               'type' => 'ReadOnlyStream',
               'prefixes' => [
                   '' => ["../user/"],
               ]
            ],
            'theme' => [
               'type' => 'ReadOnlyStream',
               'prefixes' => [
                   '' => ["../user/themes/antimatter"],
               ] 
            ]
        ]
    ]
];

Customize ../user to what suits your folder structure, and ../user/themes/antimatter to your theme path.

The Admin Plugin has issues with this kind of setup, I think it's never been tried yet.

10 years ago

It would be nice if there is little more about streams in docs. Kinda all I need it move user/pages outside root folder because all other directories are basicly only static files and we don't need write to them. I hope there is way to move just that one folder to another directory probably with prefixed or so... im not sure

10 years ago

Okey in this case

JS
'asset' => [
                'type' => 'Stream',
                'prefixes' => [
                    '' => ['../assets'],
                ]
            ],

Url will be https://domain.com/../assets/ and thats something I don't want.

In this case

JS
'sharedassets' => [
                'type' => 'Stream',
                'paths' => [
                    '/home/grav/www/assets'
                ]
            ],

Plus with this

JS
'asset' => [ 
                'type' => 'Stream',
                'prefixes' => [
                    '' => ['sharedassets://'],
                ]
            ],

It will end up with Absolute stream path with relative lookup not allowed.
So... yeah somehow there must be way to use absolute path and in the same way keep correct url without that ../../assets or so

10 years ago

Hm still wondering if there is way to set absolute path out of doc root any suggestions?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1352 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4064 9 years ago
Archive · by Muut Archive, 9 years ago
1 2950 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago