Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Joe Moore

Errors when trying Advanced Setup local storage

I’m trying to migrate my DB-stored columns to local PHP storage. My code is:

add_filter('acp/storage/repositories', setup_local_storage, 10, 2);

function setup_local_storage(array $repositories, ListScreenRepositoryFactory $factory) {

        $rules = new Rules(Rules::MATCH_ANY);
        $rules->add_rule(new Rule\EqualType('events'));

        $repositories['events'] = $factory->create(
                plugin_dir_url(__FILE__).'column-settings',
                true,
                $rules
        );

        return $repositories;
    }

When I go to my Events Admin Columns settings page and attempt to Add a new Column Set (which I believe should trigger a PHP writing event), I get the following errors:

Fatal error: Uncaught ACP\Exception\FailedToCreateDirectoryException: Could not create directory https://develop.churchinfinite.com/wp-content/plugins/church-infinite-events/plugins/admin-columns-pro/column-settings. in /www/churchinfinite_372/public/wp-content/plugins/admin-columns-pro/classes/Storage/Directory.php:57 Stack trace: #0 /www/churchinfinite_372/public/wp-content/plugins/admin-columns-pro/classes/ListScreenRepository/File.php(152): ACP\Storage\Directory->create() #1 /www/churchinfinite_372/public/wp-content/plugins/admin-columns-pro/admin-columns/classes/ListScreenRepository/Storage/ListScreenRepository.php(110): ACP\ListScreenRepository\File->save(Object(ACP\ListScreen\Post)) #2 /www/churchinfinite_372/public/wp-content/plugins/admin-columns-pro/admin-columns/classes/ListScreenRepository/Storage.php(143): AC\ListScreenRepository\Storage\ListScreenRepository->save(Object(ACP\ListScreen\Post)) #3 /www/churchinfinite_372/public/wp-content/plugins/admin-columns-pro/admin-columns/classes/ListScreenRepository/Stor in /www/churchinfinite_372/public/wp-content/plugins/admin-columns-pro/classes/Storage/Directory.php on line 57

I’ve checked my file permissions and they are all 755. I’m not sure what the problem is.

2 years, 9 months ago
Stefan van den Dungen Gronovius
Developer

Instead of using plugin_dir_url, you should use plugin_dir_path so that it can actually create the directory based on your server path instead of the URL. For the rest, I don’t see anything in your code that could prevent your script from running. Can you change that and let me know if it works?

2 years, 9 months ago
Joe Moore

That was exactly it – it was staring me right in the face! Thanks for your help!

2 years, 9 months ago

You must be logged in to reply to this topic.