Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Plugin for VersionPress settings #171

Open
emaildano opened this issue Nov 30, 2019 · 3 comments
Open

Creating a Plugin for VersionPress settings #171

emaildano opened this issue Nov 30, 2019 · 3 comments

Comments

@emaildano
Copy link

Hey!

I'm working on adding support for VersionPress to Shifter (https://www.getshifter.io). To do that I need to modify where the .git file is stored.

For example, I would like for it to be stored in wp-content/uploads/.

The cache with supporting this on Shifter is that the wp-config.php file is managed. If I make any edits the wp-config file will be overwritten. So, I'm thinking this should be added as a plugin.

Here is the plugin I'm working on but I can't get it to move the .git folder. Can you take a look? The gist if that anything related to VersionPress cannot be stored in the root directory.

I'd be happy to post this up on on the Shifter blog once we can offer support for VersionPress as a customers have asked for it.

Thanks!

<?php

/**
 *
 * @link    https://www.getshifter.io
 * @since   0.1.0
 * @package Shifter VersionPress Helper
 *
 * @wordpress-plugin
 * Plugin Name:       Shifter VersionPress Helper
 * Plugin URI:        https://github.com/getshifter/shifter-versionpress-helper
 * Description:       Helper tool for using VersionPress on Shifter.
 * Version:           0.1.0
 * Author:            DigitalCube
 * Author URI:        https://www.getshifter.io
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       shifter-versionpress-helper
 * Domain Path:       /languages
 */


/**
 * Shifter VersionPress Settings
 */
function shifter_versionpress_helper() {

  /**
   * VersionPress Project Root
   * @link  https://docs.versionpress.net/en/getting-started/configuration/#vp_project_root
   * @since 4.0-beta2
   */
  if (class_exists('\VersionPress')) {
    $upload_dir = wp_get_upload_dir();
    $save_path = $upload_dir['basedir'] . '/versionpress';
    define('VP_PROJECT_ROOT', $save_path);
  }
  
}

add_action('init', 'shifter_versionpress_helper');
@borekb
Copy link
Member

borekb commented Dec 1, 2019

Hi @emaildano, VersionPress controls the whole WordPress installation, I'm not sure if what you're trying to achieve is possible. Can you describe in more detail how you think it would work?

@emaildano
Copy link
Author

@borekb

I want to modify some of the VersionPress settings. Really just where the .git file is stored.

In your docs you can do that 2 ways. 1. By using the WP-CLi or 2. Adding those constants to wp-config.php. In my case, I can't do either.

So, what I'm thinking is: define those constants in a mu-plugin. Will that work?

@borekb
Copy link
Member

borekb commented Dec 3, 2019

The .git directory needs to be in the site root so that commands like git status work. Also note that VersionPress needs to have write access to all the files of the site – that's how it works. I'm not that familiar with Shifter but a bit it sounds that you try to bend VersionPress in ways that it cannot be bent 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants