Search code examples
phpwordpressphp-deployer

Deployer php - Shared files does not work


I am trying to deploy a Wordpress web site using php deployer, but I have a problem with the wp-config.php file in the shared folder.

When I deploy, this one is not shared and I am redirected in /wp-admin/setup-config.php.

Did I forgot something in my deploy.php config file?

<?php

namespace Deployer;

require_once __DIR__.'/vendor/deployer/deployer/recipe/common.php';

// CONFIG ///////////////////////////////////////////////////////////////
set('repository', '[email protected]:myrepo/surfblog.git');

set('shared_files', ['wp-config.php']);
set('shared_files', ['wp-content/wp-cache-config.php']);

set('shared_dirs', ['wp-content/uploads']);
set('writable_dirs', ['wp-content/uploads']);

set('keep_releases', 5);
set('default_stage', 'recette');

// HOSTS ///////////////////////////////////////////////////////////////
host('?.??.??.???')
    ->user('root')
    ->stage('recette')
    ->set('deploy_path', '/home/www/surf/blog_test');

localhost()
    ->stage('localhost')
    ->set('deploy_path', '/home/kevin/Public/test');

// TASKS ///////////////////////////////////////////////////////////////
task('deploy', [
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:vendors',
    'deploy:writable',
    'deploy:symlink',
    'deploy:unlock',
    'cleanup',
])->desc('Deploy your project');

after('deploy', 'success');

It works when I do it in my localhost, but not on my online server.


Solution

  • Works like that

    // CONFIG ///////////////////////////////////////////////////////////////
    set('repository', '[email protected]:myrepo/surfblog.git');
    
    set('shared_files', array(
        'wp-config.php',
        'wp-content/wp-cache-config.php',
    ));
    set('shared_dirs', array(
        'wp-content/uploads',
    ));
    set('writable_dirs', array(
        'wp-content/uploads',
        'wp-content/cache',
    ));