Commit 2593103eb7d7d45352b2102d07a272a5cea4db6b
1 parent
787376a2
Exists in
master
and in
1 other branch
Alterações para descoplar a instalação do Wordpress
Showing
7 changed files
with
69 additions
and
61 deletions
Show diff stats
Vagrantfile
... | ... | @@ -7,36 +7,41 @@ require 'ffi' |
7 | 7 | VAGRANTFILE_API_VERSION = "2" |
8 | 8 | |
9 | 9 | $firstTimeScript = <<SCRIPT |
10 | -cd /vagrant && composer update && rm -r /var/www/public && ln -s /vagrant/src /var/www/public | |
11 | - | |
12 | -cp /vagrant/config/wp-config-vagrant.php /vagrant/src/wp-config.php | |
13 | -cp /vagrant/config/htaccess-vagrant /vagrant/src/.htaccess | |
14 | - | |
10 | +cd /vagrant | |
11 | +composer update | |
12 | +cp config/wp-config-vagrant.php src/wp-config.php | |
13 | +cp config/htaccess-vagrant src/.htaccess | |
14 | +cp config/file-remote.php src/file-remote.php | |
15 | +cp config/index-vagrant.php src/index.php | |
16 | +rm -f src/wp/index.php | |
15 | 17 | npm install |
16 | 18 | ./node_modules/.bin/gulp |
17 | - | |
19 | +apt-get install -y subversion | |
18 | 20 | service apache2 start |
19 | - | |
20 | 21 | service mysql start |
21 | 22 | |
22 | 23 | mysql --user=root --password=root -h 127.0.0.1 -e 'drop database participacao' |
23 | 24 | mysql --user=root --password=root -h 127.0.0.1 -e 'create database participacao' |
25 | + | |
24 | 26 | cd /vagrant/db |
25 | 27 | bunzip2 db.sql.bz2 |
26 | 28 | mysql --user=root --password=root -h 127.0.0.1 participacao < /vagrant/db/db.sql |
27 | 29 | bzip2 -9 db.sql |
28 | 30 | |
31 | +cd /vagrant/src | |
32 | +ln -s wp/wp-admin wp-admin | |
33 | + | |
29 | 34 | SCRIPT |
30 | 35 | |
31 | 36 | $updateServices = <<SCRIPT |
32 | 37 | |
33 | -service mysql start | |
38 | +service mysql restart | |
34 | 39 | |
35 | 40 | rm -r /var/www/public |
36 | 41 | ln -s /vagrant/src/ /var/www/public |
37 | 42 | chmod 777 /vagrant/src/wp-content/ |
38 | 43 | |
39 | -service apache2 start | |
44 | +service apache2 restart | |
40 | 45 | |
41 | 46 | SCRIPT |
42 | 47 | ... | ... |
composer.json
... | ... | @@ -5,21 +5,6 @@ |
5 | 5 | "url": "http://wpackagist.org" |
6 | 6 | }, |
7 | 7 | { |
8 | - "type": "package", | |
9 | - "package": { | |
10 | - "name": "wordpress", | |
11 | - "type": "webroot", | |
12 | - "version": "4.1.1", | |
13 | - "dist": { | |
14 | - "type": "zip", | |
15 | - "url": "http://br.wordpress.org/wordpress-4.1.1-pt_BR.zip" | |
16 | - }, | |
17 | - "require" : { | |
18 | - "fancyguy/webroot-installer": "1.0.0" | |
19 | - } | |
20 | - } | |
21 | - }, | |
22 | - { | |
23 | 8 | "type": "git", |
24 | 9 | "url": "https://github.com/pensandoodireito/marcocivil-tema" |
25 | 10 | }, |
... | ... | @@ -58,7 +43,7 @@ |
58 | 43 | ], |
59 | 44 | "require": { |
60 | 45 | "php": ">=5.4.0", |
61 | - "wordpress": "4.1.1", | |
46 | + "johnpbloch/wordpress": "4.1", | |
62 | 47 | "pensandoodireito/marcocivil-tema" : "dev-master", |
63 | 48 | "pensandoodireito/dadospessoais-tema" : "dev-master", |
64 | 49 | "pensandoodireito/pensandoodireito-tema" : "dev-master", |
... | ... | @@ -67,19 +52,17 @@ |
67 | 52 | "pensandoodireito/pensandoodireito-network-functions" : "dev-master", |
68 | 53 | "pensandoodireito/blog-tema" : "dev-master", |
69 | 54 | "pensandoodireito/wp-side-comments" : "dev-master", |
70 | - "ethymos/delibera" : "dev-master", | |
55 | + "ethymos/delibera" : "dev-master", | |
71 | 56 | "wpackagist-plugin/rich-text-tags": "1.7.3", |
72 | 57 | "wpackagist-plugin/json-rest-api": "1.1.1", |
73 | 58 | "wpackagist-plugin/contact-form-plugin": "3.89", |
74 | 59 | "wpackagist-plugin/sendpress": ">=1.1.7.21", |
75 | 60 | "wpackagist-plugin/social-share-button": "2.1", |
76 | 61 | "wpackagist-plugin/events-manager": "5.5.7.1", |
77 | - "fancyguy/webroot-installer": "1.0.0", | |
78 | 62 | "composer/installers": "~1.0" |
79 | 63 | }, |
80 | 64 | "extra": { |
81 | - "webroot-dir": "src", | |
82 | - "webroot-package": "wordpress", | |
65 | + "wordpress-install-dir": "src/wp", | |
83 | 66 | "installer-paths": { |
84 | 67 | "src/wp-content/plugins/{$name}/": ["type:wordpress-plugin"], |
85 | 68 | "src/wp-content/mu-plugins/{$name}/": ["type:wordpress-muplugin"], | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +<?php | |
2 | +$path = $_GET{'src'}; | |
3 | + | |
4 | +$dirs = explode('/', $path); | |
5 | +$img = implode('/', $dirs); | |
6 | + | |
7 | +if(strpos($img, ".jpg") !== false || strpos($img, ".jpeg")){ | |
8 | + $contentType = "image/jpeg"; | |
9 | +}elseif(strpos($img, ".png") !== false){ | |
10 | + $contentType = "image/png"; | |
11 | +}else{ | |
12 | + $contentType = "image/gif"; | |
13 | +} | |
14 | + | |
15 | +header("Content-Type: {$contentType}", true); | |
16 | + | |
17 | +if(file_exists($img)){ | |
18 | + $content = file_get_contents($img); | |
19 | +}else{ | |
20 | + array_pop($dirs); | |
21 | + $localDir = implode('/', $dirs); | |
22 | + if(!file_exists($localDir) || is_dir($localDir)){ | |
23 | + mkdir($localDir, 777, true); | |
24 | + } | |
25 | + $content = file_get_contents("http://pensando.mj.gov.br/{$img}"); | |
26 | + file_put_contents($img, $content); | |
27 | +} | |
28 | + | |
29 | +die($content); | ... | ... |
config/htaccess-vagrant
... | ... | @@ -6,12 +6,12 @@ RewriteRule ^index\.php$ - [L] |
6 | 6 | # add a trailing slash to /wp-admin |
7 | 7 | RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] |
8 | 8 | |
9 | -RewriteRule (^wp\-content\/[^.]+\.(jpe?g|gif|bmp|png))$ /file.php?src=$1 [L] | |
9 | +RewriteRule (^wp\-content\/[^.]+\.(jpe?g|gif|bmp|png))$ /file-remote.php?src=$1 [L] | |
10 | 10 | |
11 | 11 | RewriteCond %{REQUEST_FILENAME} -f [OR] |
12 | 12 | RewriteCond %{REQUEST_FILENAME} -d |
13 | 13 | RewriteRule ^ - [L] |
14 | 14 | RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] |
15 | -RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] | |
15 | +RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L] | |
16 | 16 | RewriteRule . index.php [L] |
17 | 17 | </IfModule> | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +<?php | |
2 | +/** | |
3 | + * Front to the WordPress application. This file doesn't do anything, but loads | |
4 | + * wp-blog-header.php which does and tells WordPress to load the theme. | |
5 | + * | |
6 | + * @package WordPress | |
7 | + */ | |
8 | + | |
9 | +/** | |
10 | + * Tells WordPress to load the WordPress theme and output it. | |
11 | + * | |
12 | + * @var bool | |
13 | + */ | |
14 | +define('WP_USE_THEMES', true); | |
15 | + | |
16 | +/** Loads the WordPress Environment and Template */ | |
17 | +require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' ); | ... | ... |
config/wp-config-vagrant.php
... | ... | @@ -97,11 +97,14 @@ define('PATH_CURRENT_SITE', '/'); |
97 | 97 | define('SITE_ID_CURRENT_SITE', 1); |
98 | 98 | define('BLOG_ID_CURRENT_SITE', 1); |
99 | 99 | |
100 | +define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/wp-content/plugins' ); | |
101 | +define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content' ); | |
102 | + | |
100 | 103 | /* Isto é tudo, pode parar de editar! :) */ |
101 | 104 | |
102 | 105 | /** Caminho absoluto para o diretório WordPress. */ |
103 | 106 | if ( !defined('ABSPATH') ) |
104 | - define('ABSPATH', dirname(__FILE__) . '/'); | |
107 | + define('ABSPATH', dirname(__FILE__) . '/wp/'); | |
105 | 108 | |
106 | 109 | /** Configura as variáveis do WordPress e arquivos inclusos. */ |
107 | 110 | require_once(ABSPATH . 'wp-settings.php'); | ... | ... |
src/file-remote.php
... | ... | @@ -1,29 +0,0 @@ |
1 | -<?php | |
2 | -$path = $_GET{'src'}; | |
3 | - | |
4 | -$dirs = explode('/', $path); | |
5 | -$img = implode('/', $dirs); | |
6 | - | |
7 | -if(strpos($img, ".jpg") !== false || strpos($img, ".jpeg")){ | |
8 | - $contentType = "image/jpeg"; | |
9 | -}elseif(strpos($img, ".png") !== false){ | |
10 | - $contentType = "image/png"; | |
11 | -}else{ | |
12 | - $contentType = "image/gif"; | |
13 | -} | |
14 | - | |
15 | -header("Content-Type: {$contentType}", true); | |
16 | - | |
17 | -if(file_exists($img)){ | |
18 | - $content = file_get_contents($img); | |
19 | -}else{ | |
20 | - array_pop($dirs); | |
21 | - $localDir = implode('/', $dirs); | |
22 | - if(!file_exists($localDir) || is_dir($localDir)){ | |
23 | - mkdir($localDir, 777, true); | |
24 | - } | |
25 | - $content = file_get_contents("http://pensando.mj.gov.br/{$img}"); | |
26 | - file_put_contents($img, $content); | |
27 | -} | |
28 | - | |
29 | -die($content); |