wslave 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8a86816c5dce9a8b16b04e35e90d683767d59a98805e49b8fd23b89eb144ae1
4
- data.tar.gz: a0e1a81ccf6c92c79a3fce088afc2de607614af094df7135abcb0f076a7702d4
3
+ metadata.gz: 3005a61b1ba567a6fce7a42060082c45c7f325615dd3f884459c44a001b0a91b
4
+ data.tar.gz: b57388304f2e9711ee41be958749bbe0d2bc99d2be320c99ac87922745df9cf1
5
5
  SHA512:
6
- metadata.gz: 1bf3ecc124a7536421152f5dd1630e65bf3c8619ed5139327739333372dfbb6125a1ab711266fd9fefc0fd2e8524be455e973633fae5cdd435c154420a7f6b0a
7
- data.tar.gz: '05931783442e5ffa86c899aa48352c5a93f3a4d43bea20005871cb7b01ab3e0b3ee0e92fb2d38bafc9f7c57d46f58d720142133f91f4175232ee4bc2d5c0f1c8'
6
+ metadata.gz: 8b4bbb740b9c5922bb4bd01c3b2901fa6d9fa211d54d3af3d3c6da6da80c7addd765558f0f943706b8341b065f533e7ea3cf07445e1ebb4b173e448a21d1b276
7
+ data.tar.gz: 985284c6599e4675807ae3ea4ea6c2c6f363c2d14a6379fcdc6b0989cd05e3279948056f66bc36c3a336e552496cbc29ba63dc33fe295673c427241f07f37ccf
data/base/.gitignore CHANGED
@@ -1,5 +1,5 @@
1
1
  log
2
- .swp
3
- .swo
2
+ *.swp
3
+ *.swo
4
4
  db/tmp/*
5
5
  .vscode
@@ -12,7 +12,10 @@ server {
12
12
  index index.php;
13
13
 
14
14
  location / {
15
- rewrite ^/(wp-(admin|includes).*) /wordpress/$1 last;
15
+ rewrite ^/wp-admin$ /wordpress/wp-admin/ redirect;
16
+ rewrite ^/wp-admin/(.*) /wordpress/wp-admin/$1 redirect;
17
+
18
+ rewrite ^/wp-includes/(.*) /wordpress/wp-includes/$1 last;
16
19
 
17
20
  rewrite ^/$ /wordpress/index.php last;
18
21
 
@@ -20,10 +23,9 @@ server {
20
23
  if ($request_uri !~* "/wp-config.php") {
21
24
  rewrite ^/wp-(.*)\.php$ /wordpress/wp-$1.php last;
22
25
  }
23
- rewrite ^/index\.php$ /wordpress/index.php last;
24
- rewrite ^/wp-login\.php$ /hello.php last;
25
- include snippets/fastcgi-php.conf;
26
- fastcgi_pass unix:<%= server[:php_sock_path] %>;
26
+ rewrite ^/index\.php$ /wordpress/index.php last;
27
+ include snippets/fastcgi-php.conf;
28
+ fastcgi_pass unix:<%= server[:php_sock_path] %>;
27
29
  }
28
30
 
29
31
  try_files $uri $uri/ /index.php?$args;
@@ -35,9 +37,14 @@ server {
35
37
  log_not_found off;
36
38
  }
37
39
 
40
+ # Don't allow PHP to be run from the uploads folder (common attack vector)
41
+ location ~* /(?:uploads|files|wp-content\/uploads|wp-content\/files)/.*\.php$ {
42
+ deny all;
43
+ }
44
+
38
45
  location /wp-json/ { # Resolves WP Gutenberg 404 issue
39
46
  try_files $uri $uri/ /index.php;
40
- }
47
+ }
41
48
 
42
49
  location ~* \.(blade\.php)$ {
43
50
  deny all;
@@ -56,4 +63,4 @@ server {
56
63
  }
57
64
 
58
65
  client_max_body_size 4096M;
59
- }
66
+ }
@@ -1,4 +1,4 @@
1
- FROM php:8.0-apache
1
+ FROM php:7.4-apache
2
2
 
3
3
  RUN a2enmod rewrite
4
4
  RUN service apache2 restart
@@ -1,15 +1,25 @@
1
1
  server {
2
- listen 80;
3
- listen [::]:80;
2
+ listen 8001 default_server;
3
+ listen [::]:8001;
4
4
 
5
- server_name testing wsalve-nginx;
5
+ server_name _;
6
+
7
+ port_in_redirect on; # Keeps the 8001 in redirects for better local development
6
8
 
7
9
  root /var/www/html;
8
10
 
9
11
  index index.php;
10
12
 
13
+ rewrite ^http://$host/.* http://$host:$server_port$request_uri;
14
+ rewrite ^http://$host:$server_port/wp-admin$ http://$host:$server_port/wordpress/wp-admin/;
15
+
16
+ proxy_set_header Host $host:$server_port;
17
+
11
18
  location / {
12
- rewrite ^/(wp-(admin|includes).*) /wordpress/$1 last;
19
+ rewrite ^/wp-admin$ /wordpress/wp-admin/ redirect;
20
+ rewrite ^/wp-admin/(.*) /wordpress/wp-admin/$1 redirect;
21
+
22
+ rewrite ^/wp-includes/(.*) /wordpress/wp-includes/$1;
13
23
 
14
24
  rewrite ^/$ /wordpress/index.php last;
15
25
 
@@ -17,10 +27,10 @@ server {
17
27
  if ($request_uri !~* "/wp-config.php") {
18
28
  rewrite ^/wp-(.*)\.php$ /wordpress/wp-$1.php last;
19
29
  }
20
- rewrite ^/index\.php$ /wordpress/index.php last;
21
- rewrite ^/wp-login\.php$ /hello.php last;
22
- include snippets/fastcgi-php.conf;
23
- fastcgi_pass unix:/run/php/php7.4-fpm.sock;
30
+
31
+ rewrite ^/index\.php$ /wordpress/index.php last;
32
+ include snippets/fastcgi-php.conf;
33
+ fastcgi_pass unix:/run/php/php7.4-fpm.sock;
24
34
  }
25
35
 
26
36
  try_files $uri $uri/ /index.php?$args;
@@ -32,9 +42,13 @@ server {
32
42
  log_not_found off;
33
43
  }
34
44
 
45
+ location ~* /(?:uploads|files|wp-content\/uploads|wp-content\/files)/.*\.php$ {
46
+ deny all;
47
+ }
48
+
35
49
  location /wp-json/ { # Resolves WP Gutenberg 404 issue
36
50
  try_files $uri $uri/ /index.php;
37
- }
51
+ }
38
52
 
39
53
  location ~* \.(blade\.php)$ {
40
54
  deny all;
@@ -52,5 +66,5 @@ server {
52
66
  deny all;
53
67
  }
54
68
 
55
- client_max_body_size 4096M;
56
- }
69
+ client_max_body_size 0;
70
+ }
@@ -1,8 +1,8 @@
1
- version: '3.7'
1
+ version: '3.8'
2
2
 
3
3
  services:
4
4
  db:
5
- image: mariadb:10.5-focal
5
+ image: mariadb:10.7-focal
6
6
  volumes:
7
7
  - "./db/dev:/db"
8
8
  - "./db/active:/docker-entrypoint-initdb.d"
@@ -27,7 +27,7 @@ services:
27
27
  volumes:
28
28
  - "./public:/var/www/html"
29
29
  ports:
30
- - "8001:80"
30
+ - "8001:8001"
31
31
  environment:
32
32
  WORDPRESS_DB_HOST: db:3306
33
33
  WORDPRESS_DB_PASSWORD: wordpress
@@ -2,17 +2,24 @@
2
2
  RewriteEngine On
3
3
  RewriteBase /
4
4
 
5
+ # Open the subfoldered index when accessing the apex
5
6
  RewriteRule ^$ wordpress/index.php [L]
6
7
 
8
+ # Special forwarding to wp-admin
9
+ RewriteRule ^wp-admin$ wp-admin/
10
+ RewriteRule ^wp-admin/(.*) wordpress/wp-admin/$1 [R=301,L]
11
+
7
12
  # Skip real files and directories
8
13
  RewriteCond %{REQUEST_FILENAME} !-f
9
14
  RewriteCond %{REQUEST_FILENAME} !-d
10
15
 
11
16
  # Otherwise send it to WordPress
12
17
  RewriteRule .* wordpress/index.php [L]
18
+
13
19
  # BEGIN WordPress
14
20
  # END WordPress
15
21
  </IfModule>
22
+
16
23
  <FilesMatch ".+\.(blade\.php)$">
17
24
  <IfModule mod_authz_core.c>
18
25
  # Apache 2.4
@@ -24,8 +31,6 @@
24
31
  Deny from all
25
32
  </IfModule>
26
33
  </FilesMatch>
27
- php_value upload_max_filesize 4096M
28
- php_value post_max_size 4096M
29
- php_value memory_limit 512M
30
- php_value max_execution_time 1200
31
- php_value max_input_time 2400
34
+
35
+ php_value upload_max_filesize 0
36
+ php_value post_max_size 0
@@ -92,5 +92,10 @@ define('WP_CONTENT_URL', WP_HOME . '/wp-content');
92
92
  //define('WP_TEMP_DIR', realpath(ABSPATH . '../../tmp/'));
93
93
  define('FS_METHOD', 'direct');
94
94
 
95
+ define('FORCE_SSL_ADMIN', false);
96
+ define('FORCE_SSL_LOGIN', false);
97
+
98
+ define('WP_CACHE', false);
99
+
95
100
  /** Sets up WordPress vars and included files. */
96
101
  require_once(ABSPATH . 'wp-settings.php');
data/bin/wslave CHANGED
@@ -20,11 +20,18 @@ class WSlaveCLI < Thor
20
20
  option :version, default: '',
21
21
  desc: 'Specify the version, EG: "--version 5.3". To specify edge/development master use "--version edge".'
22
22
  option :wspath, default: '',
23
- desc: 'specify the path to the wslave distribution, EG: "--wspath ../wslave".'
23
+ desc: 'specify the path to the wslave distribution, EG: "--wspath ../wslave".
24
+ NOTE: This is relative to the new app path.'
25
+ option :wppath, default: '',
26
+ desc: 'specify the path to a cloned git wordpress distribution, EG: "--wppath /shared/wordpress".
27
+ NOTE: This is relative to the new app path.
28
+ NOTE: If no data is found in this directory, wslave will clone the official WordPress repository here and
29
+ copy it. Also, if there is data here that does not match the format of the official WordPress repository,
30
+ most wslave functionality will probably be broken.'
24
31
  def new(path = './')
25
32
  require_relative '../lib/wslave_new'
26
33
  real_path = File.expand_path(path)
27
- WSlaveNew.new(real_path, options['version'], options['wspath'])
34
+ WSlaveNew.new(real_path, options['version'], options['wspath'], options['wppath'])
28
35
  end
29
36
 
30
37
  desc 'update', "Updates toolchain"
data/lib/wslave_new.rb CHANGED
@@ -6,7 +6,7 @@ require 'git'
6
6
  require_relative 'wslave_tools'
7
7
 
8
8
  class WSlaveNew
9
- def initialize(path, version = '', wspath = '')
9
+ def initialize(path, version = '', wspath = '', wppath = '')
10
10
  puts '⚙ Initializing Toolchain・・・'
11
11
 
12
12
  if (wspath != '')
@@ -39,6 +39,20 @@ class WSlaveNew
39
39
 
40
40
  `cd #{path} && git init && git add --all && git commit -am "initial commit by wslave"`
41
41
 
42
+ if (wppath != '')
43
+ wppath = File.expand_path(wppath)
44
+ puts " >> Checking wppath (#{wppath}) ..."
45
+ if (File.directory? wppath)
46
+ puts " >> wppath is a folder. Copying..."
47
+ Dir.chdir path
48
+ FileUtils.cp_r wppath, "public/wordpress"
49
+ Dir.chdir "public/wordpress"
50
+ `git clean -fdx; git stash`
51
+ `git checkout master`
52
+ `git pull`
53
+ end
54
+ end
55
+
42
56
  `cd #{path} && git submodule add git://github.com/WordPress/WordPress.git public/wordpress`
43
57
  `cd #{path} && git submodule update --init --recursive public/wordpress`
44
58
  if (version == 'edge' || version == 'master')
data/lib/wslave_sage.rb CHANGED
@@ -16,11 +16,14 @@ class WSlaveSage
16
16
  project_root = Dir.pwd
17
17
 
18
18
  puts "Creating Sage theme at public/wp-content/themes/#{name}"
19
- `cd public/wp-content/themes && composer create-project roots/sage #{name} dev-master`
19
+ Dir.chdir "public/wp-content/themes"
20
+ `composer create-project roots/sage #{name}`
21
+ Dir.chdir name
22
+ `composer require roots/acorn`
20
23
 
21
24
  Dir.chdir project_root
22
25
  _write_wslave_sage_config(name)
23
- _overwrite_sage_webpack_browsersync_config
26
+ # _overwrite_sage_webpack_browsersync_config # TODO: sageの更新でwebpack.mix.jsが出力されなくなっている様子
24
27
  end
25
28
 
26
29
  def update()
data/lib/wslave_tools.rb CHANGED
@@ -11,20 +11,28 @@ class WSlaveTools
11
11
 
12
12
  def self.set_dev_perms(path = '.')
13
13
  begin
14
- unless Dir.exist?("#{path}/public/wp-content/upgrade")
15
- FileUtils.mkdir("#{path}/public/wp-content/upgrade")
16
- FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
14
+ unless Dir.exist?("#{path}/public/data")
15
+ FileUtils.mkdir("#{path}/public/data")
16
+ FileUtils.touch("#{path}/public/data/.gitkeep")
17
17
  end
18
+ FileUtils.chown(nil, 'www-data', "#{path}/public/data")
19
+ FileUtils.chmod(0775, "#{path}/public/data")
20
+
18
21
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/themes")
19
22
  FileUtils.chmod(0775, "#{path}/public/wp-content/themes")
23
+
20
24
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/uploads")
21
25
  FileUtils.chmod(0775, "#{path}/public/wp-content/uploads")
26
+
22
27
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/plugins")
23
28
  FileUtils.chmod(0775, "#{path}/public/wp-content/plugins")
29
+
30
+ unless Dir.exist?("#{path}/public/wp-content/upgrade")
31
+ FileUtils.mkdir("#{path}/public/wp-content/upgrade")
32
+ FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
33
+ end
24
34
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/upgrade")
25
35
  FileUtils.chmod(0775, "#{path}/public/wp-content/upgrade")
26
- FileUtils.chown(nil, 'www-data', "#{path}/public/data")
27
- FileUtils.chmod(0775, "#{path}/public/data")
28
36
 
29
37
  unless Dir.exist?("#{path}/db")
30
38
  FileUtils.mkdir("#{path}/db")
@@ -59,6 +67,7 @@ class WSlaveTools
59
67
  end
60
68
  FileUtils.chown(nil, 'www-data', "#{path}/db/production")
61
69
  FileUtils.chmod(0775, "#{path}/db/production")
70
+
62
71
  rescue Errno::EPERM
63
72
  puts "!!!WARNING!!! Your user does not belong to the www-data group!\n" \
64
73
  " >>> Unable to make folders writable for devlopment. <<<\n" \
data/lib/wslave_update.rb CHANGED
@@ -24,6 +24,7 @@ class WSlaveUpdate
24
24
  FileUtils.cp_r("#{base_path}/docker", "#{path}/")
25
25
  FileUtils.cp("#{base_path}/docker-compose.yml", "#{path}/docker-compose.yml")
26
26
  FileUtils.cp("#{base_path}/public/.htaccess", "#{path}/public/.htaccess")
27
+ FileUtils.cp("#{base_path}/public/wp-config.php", "#{path}/public/wp-config.php")
27
28
  FileUtils.cp_r(Dir.glob("#{base_path}/config/*"), "#{path}/config")
28
29
  FileUtils.cp("#{template_path}/config/database.yml", "#{path}/config/database.yml") unless File.exist? "#{path}/config/database.yml"
29
30
  FileUtils.cp("#{template_path}/config/definitions.yml", "#{path}/config/definitions.yml") unless File.exist? "#{path}/config/definitions.yml"
data/wslave.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wslave'
3
- s.version = '0.3.4'
3
+ s.version = '0.3.5'
4
4
  s.licenses = ['GPL-3.0', 'AGPL-3.0']
5
5
  s.summary = '"Word Slave" generates and controls a WordPress installation'
6
6
  s.description = 'Word Slave includes the wslave command and a control library to generate a ' \
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'capistrano-scm-copy', '~> 0.7', '0.7.0'
26
26
  s.add_dependency 'capistrano-file-permissions', '~> 1.0', '1.0.0'
27
27
 
28
- s.add_dependency 'git', '~> 1.8', '1.8.1'
28
+ s.add_dependency 'git', '~> 1.10', '1.10.2'
29
29
 
30
- s.add_dependency 'thor', '~> 1.1', '1.1.0'
30
+ s.add_dependency 'thor', '~> 1.2', '1.2.1'
31
31
  s.add_dependency 'haikunator', '~> 1.1', '1.1.1'
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wslave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-07 00:00:00.000000000 Z
11
+ date: 2022-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -90,40 +90,40 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '1.8'
93
+ version: '1.10'
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.8.1
96
+ version: 1.10.2
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.8'
103
+ version: '1.10'
104
104
  - - '='
105
105
  - !ruby/object:Gem::Version
106
- version: 1.8.1
106
+ version: 1.10.2
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: thor
109
109
  requirement: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - "~>"
112
112
  - !ruby/object:Gem::Version
113
- version: '1.1'
113
+ version: '1.2'
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 1.1.0
116
+ version: 1.2.1
117
117
  type: :runtime
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '1.1'
123
+ version: '1.2'
124
124
  - - '='
125
125
  - !ruby/object:Gem::Version
126
- version: 1.1.0
126
+ version: 1.2.1
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: haikunator
129
129
  requirement: !ruby/object:Gem::Requirement
@@ -164,8 +164,6 @@ files:
164
164
  - base/config/deploy-tools/wp-config.php.erb
165
165
  - base/config/deploy-tools/wp-config.php.local
166
166
  - base/config/deploy.rb
167
- - base/config/deploy/.production.rb.swp
168
- - base/config/deploy/.staging.rb.swp
169
167
  - base/config/deploy/production.rb
170
168
  - base/config/deploy/staging.rb
171
169
  - base/docker-compose.yml
@@ -205,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
203
  - !ruby/object:Gem::Version
206
204
  version: '0'
207
205
  requirements: []
208
- rubygems_version: 3.2.15
206
+ rubygems_version: 3.3.7
209
207
  signing_key:
210
208
  specification_version: 4
211
209
  summary: '"Word Slave" generates and controls a WordPress installation'
Binary file
Binary file