WordPress ENV / WP_HOME / WP_SITE_URL - wordpress

I'm struggling to find the cause of this issue and hoping someone can point me in the right direction.
A few parts are based on roots, but I can't seem to find any answers over they to do with this.
Here is the file structure -> http://imgur.com/a/W2eYY
What seems to go on is when I go to go through the installation/setup of WordPress and enter this into the URL (framework(.)dev/public/wp/) it changes itself to this (http://framework.dev/public/wp/framework.dev/wp/wp-admin/install.php) is there any way to just make it goes to (framework(.)dev/wp/wp-admin/install.php)
Key
(.) = .
Won't let me post more than 2 links
.env file:
BB_USER=BBUSERNAME
DB_NAME=framework
DB_USER=root
DB_PASSWORD=root
DB_HOST=localhost
DB_PREFIX=wp_
WP_ENV=Development
WP_HOME=framework.dev
WP_SITEURL=${WP_HOME}/wp
composer.json:
{
"name": "framework/framework",
"description": "Modern WordPress Framework",
"type": "wordpress-core",
"authors": [
{
"name": "Name",
"email": "name#gmail.com"
}
],
"config": {
"preferred-install": "dist"
},
"repositories":[
{
"type":"composer",
"url":"https://wpackagist.org"
}
],
"scripts": {
"post-install-cmd": [
"cp -r public/wp/wp-content public/app"
]
},
"require": {
"php": ">=5.6",
"composer/installers": "1.3.0",
"johnpbloch/wordpress": "4.8.0",
"roots/wp-password-bcrypt": "1.0.0",
"timber/timber": "1.3.2",
"roots/soil": "3.7.2",
"mnsami/composer-custom-directory-installer": "1.1.1",
"vlucas/phpdotenv": "2.4.0",
"oscarotero/env": "^1.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.5.1"
},
"extra": {
"installer-paths": {
"public/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"public/app/plugins/{$name}/": ["type:wordpress-plugin"],
"public/app/themes/{$name}/": ["type:wordpress-theme"]
},
"wordpress-install-dir": "public/wp"
}
}
config/application.php
<?php
/** #var string Directory containing all of the site's files */
$root_dir = dirname(__DIR__);
/** #var string Document Root */
$webroot_dir = $root_dir . '/public';
/*
|------------------------------------------------------------------
| Expose global ENV
|------------------------------------------------------------------
|
| Expose global env() function from oscarotero/env
|
*/
Env::init();
/*
|------------------------------------------------------------------
| Dotenv Settings
|------------------------------------------------------------------
|
| Use Dotenv to set required environment variables and load .env file in root
|
*/
$dotenv = new Dotenv\Dotenv($root_dir);
if (file_exists($root_dir . '/.env')) {
$dotenv->load();
$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD', 'WP_HOME', 'WP_SITEURL']);
}
/*
|------------------------------------------------------------------
| ENV Settings
|------------------------------------------------------------------
|
| Set up our global environment constant and load its config first
| Default: Development
|
*/
define('WP_ENV', env('WP_ENV') ?: 'production');
$env_config = __DIR__ . '/environments/' . WP_ENV . '.php';
if (file_exists($env_config)) {
require_once $env_config;
}
/*
|------------------------------------------------------------------
| URL
|------------------------------------------------------------------
|
| Env's for the URL
|
*/
define('WP_HOME', env('WP_HOME'));
define('WP_SITEURL', env('WP_SITEURL'));
/*
|------------------------------------------------------------------
| Custom Content Directory
|------------------------------------------------------------------
|
| Changes where the content is stored.
|
*/
define('CONTENT_DIR', '/app');
define('WP_CONTENT_DIR', $webroot_dir . CONTENT_DIR);
define('WP_CONTENT_URL', WP_HOME . CONTENT_DIR);
/*
|------------------------------------------------------------------
| DB Settings
|------------------------------------------------------------------
|
| Uses ENV to populate the correct DB settings.
|
*/
define('DB_NAME', env('DB_NAME'));
define('DB_USER', env('DB_USER'));
define('DB_PASSWORD', env('DB_PASSWORD'));
define('DB_HOST', env('DB_HOST'));
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');
$table_prefix = env('DB_PREFIX');
/*
|------------------------------------------------------------------
| Authentication Unique Keys and Salts
|------------------------------------------------------------------
|
| Automatically Generated by the init setup command
|
*/
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
/*
|------------------------------------------------------------------
| Custom Settings
|------------------------------------------------------------------
|
| Custom Global Settings that won't be affected by the ENV
|
*/
define('AUTOMATIC_UPDATER_DISABLED', true);
define('DISABLE_WP_CRON', env('DISABLE_WP_CRON') ?: false);
define('DISALLOW_FILE_EDIT', true);
define ('WPLANG', 'en_GB');
/*
|------------------------------------------------------------------
| Roots/soil Settings
|------------------------------------------------------------------
|
| Include any number of roots/soil options here
|
*/
// add_theme_support('soil-clean-up');
// add_theme_support('soil-disable-trackbacks');
// add_theme_support('soil-relative-urls');
/*
|------------------------------------------------------------------
| Bootstrap WordPress
|------------------------------------------------------------------
|
| Bootstrap WordPress
|
*/
if (!defined('ABSPATH')) {
define('ABSPATH', $webroot_dir . '/wp/');
}
public/index.php
<?php
define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );
public/wp-config.php
<?php
require_once(dirname(__DIR__) . '/vendor/autoload.php');
require_once(dirname(__DIR__) . '/config/application.php');
require_once(ABSPATH . 'wp-settings.php');
wp-cli.yml
path: public/wp

Add http:// to your WP_HOME env variable.

This seems to work.
WP_HOME=http://example.dev/public
WP_SITEURL=${WP_HOME}/wp/

Related

How to export folderpermission of all drivers in server

Until now, my company instead of sharing a specific folder, shares all drives (C:, D:, etc)
How do I get permission from all folders in all drives to serve an audit operation?
I tried with the following code, but it is for specific drivers only
$FolderPath = Get-ChildItem -Directory -Path **"S:\"** -Recurse -Force
$Output = #()
ForEach ($Folder in $FolderPath) {
$Acl = Get-Acl -Path $Folder.FullName
ForEach ($Access in $Acl.Access) {
$Properties = [ordered]#{
'Folder Name'=$Folder.FullName;
'Group/User'=$Access.IdentityReference;
'Permissions'=$Access.FileSystemRights;
'Inherited'=$Access.IsInherited
}
$Output += New-Object -TypeName PSObject -Property $Properties
}
}
$Output | Out-GridView

jq: Use context object as key in query from root

I have a JSON object where the relevant parts are of the form
{
"_meta": {
"hostvars": {
"name_1": {
"ansible_host": "10.0.0.1"
},
"name_2": {
"ansible_host": "10.0.0.2"
},
"name_3": {
"ansible_host": "10.0.0.3"
}
}
},
...
"nodes": {
"hosts": [
"name_1",
"name_2"
]
}
}
(the output of ansible-inventory --list, for reference).
I would like to use jq to produce a list of IPs of the nodes hosts by looking up the names in ._meta.hostvars. In the example, the output should be:
10.0.0.1
10.0.0.2
Note that 10.0.0.3 should not be included because name_3 is not in the .nodes.hosts list. So just doing jq -r '._meta.hostvars[].ansible_host' doesn't work.
I've tried jq '.nodes.hosts[] | ._meta.hostvars[.].ansible_host' but that fails because ._meta doesn't scan from the root after the pipe.
You can store the root in a variable before changing the context:
jq -r '. as $root | .nodes.hosts[] | $root._meta.hostvars[.].ansible_host'
But a better solution is to just inline the "hosts" query:
jq -r '._meta.hostvars[.nodes.hosts[]].ansible_host'

Using jq to suffix a string to a field in an object not containing it

I have a json as follows:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"batchPools": {
"value": [
{
"networkConfiguration": {
"subnetId": "/subscriptions/xxxx/resourceGroups/xxx/providers/Microsoft.Network/virtualNetworks/xxxxx/subnets/sample-name-batch",
"subnetAddressPrefix": ""
}
},
{
"networkConfiguration": {
"subnetId": "/subscriptions/xxxx/resourceGroups/xxx/providers/Microsoft.Network/virtualNetworks/xxxxx/subnets/sample-name",
"subnetAddressPrefix": ""
}
}
]
}
}
}
I need to check if any of the networkConfiguration.subnetID under the array value contains the string batch. If yes then nothing needs to be done. Else, append -batch to the existing value. In this case, only the second networkConfiguration.subnetID of the array should be updated.
I tried the following:
(.parameters.batchPools.value[] | select(.networkConfiguration.subnetId | contains("-batch") | not) | .networkConfiguration.subnetId) |= (.networkConfiguration.subnetId+"-batch")
I get the following error:
jq: error (at <stdin>:38): Cannot index string with string "networkConfiguration" exit status 5
I tried this:
(.parameters.batchPools.value[] | select(.networkConfiguration.subnetId | contains("batch") | not) | .networkConfiguration.subnetId) |= "someValue"
This worked fine and replaced the entire subnetId with someValue. I am not able to figure out why the previous command is not working out. Please help.
You don't need to use the whole path of subnetId again. You've already selected that node from the pipeline before. Just use the += append operator to suffix the required string
( .parameters.batchPools.value[] |
select(.networkConfiguration.subnetId | contains("batch") | not) |
.networkConfiguration.subnetId ) += "-batch"
jqplay - Online demo

how to use path.basename with bjam?

I am currently using this action:
actions re2c {
re2c --tags -o `basename $(<)` $(>)
}
But I'd like to use the path.basename rule instead. Something along the lines:
rule re2c ( targets * : sources * : properties * )
{
import path ;
targets = [ path.basename $(targets) ] ;
}
This approach is not working for me.

jq: search by value from another array element

I have an array of objects of various types which reference one another with UUIDs (a terraform.tfstate file). I'd like to select one value from one such object based on the appearance of a different value in another object, where the two objects are related by one of those UUIDs.
By way of example, I can do this:
$ jq '.modules[].resources[]
| select(.type == "openstack_compute_instance_v2" and
.primary.attributes.name == "jumpbox").primary.id' terraform.tfstate
"5edfe2bf-94df-49d5-8118-3e91fb52946b"
$ jq '.modules[].resources[]
| select(.type =="openstack_compute_floatingip_associate_v2" and
.primary.attributes.instance_id == "5edfe2bf-94df-49d5-8118-3e91fb52946b").primary.attributes.floating_ip' terraform.tfstate
"10.120.241.21"
Giving me the external floating IP of the 'jumpbox' VM based on its name.
I'd like to make that all one jq call. Is that possible?
This would be easier to answer if you provided more sample data but
working backwards from your commands (with some reformatting)
$ jq '
.modules[].resources[]
| select(.type == "openstack_compute_instance_v2" and .primary.attributes.name == "jumpbox")
| .primary.id
' terraform.tfstate
"5edfe2bf-94df-49d5-8118-3e91fb52946b"
$ jq '
.modules[].resources[]
| select(.type =="openstack_compute_floatingip_associate_v2" and .primary.attributes.instance_id == "5edfe2bf-94df-49d5-8118-3e91fb52946b")
| .primary.attributes.floating_ip
' terraform.tfstate
"10.120.241.21"
we can infer you have data which looks like
{
"modules": [
{
"resources": [
{
"type": "openstack_compute_instance_v2",
"primary": {
"id": "5edfe2bf-94df-49d5-8118-3e91fb52946b",
"attributes": {
"name": "jumpbox"
}
}
},
{
"type": "openstack_compute_floatingip_associate_v2",
"primary": {
"attributes": {
"instance_id": "5edfe2bf-94df-49d5-8118-3e91fb52946b",
"floating_ip": "10.120.241.21"
}
}
}
]
}
]
}
The following filter demonstrates a solution using functions, variables and parenthesis ():
def get_primary_id($name):
select(.type == "openstack_compute_instance_v2"
and .primary.attributes.name == $name)
| .primary.id
;
def get_floating_ip($id):
select(.type =="openstack_compute_floatingip_associate_v2"
and .primary.attributes.instance_id == $id)
| .primary.attributes.floating_ip
;
.modules[]
| ( .resources[] | get_primary_id("jumpbox") ) as $id
| ( .resources[] | get_floating_ip($id) ) as $fip
| ($id, $fip)
if this filter is in filter.jq and data.json contains the sample data above
then
$ jq -M -f filter.jq data.json
produces the output:
"5edfe2bf-94df-49d5-8118-3e91fb52946b"
"10.120.241.21"

Resources