Commit 633649bc authored by Sean Madsen's avatar Sean Madsen

publishing books to /web/ instead of /web/static/

parent 5c6ca1ac
......@@ -13,9 +13,11 @@
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
/web/static/*
!/web/static/css
#not sure how else to ensure that the following two files aren't deployed on prod
/web/config.php
/web/*
!/web/.htaccess
!/web/app.php
!/web/app_dev.php
!/web/robots.txt
!/web/static
......@@ -5,7 +5,7 @@
<meta charset="UTF-8">
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
<title>{% block title %}CiviCRM documentation{% endblock %}</title>
<link rel="stylesheet" href="{{ asset('css/main.css') }}" />
<link rel="stylesheet" href="{{ asset('/static/css/main.css') }}" />
{% block stylesheets %}{% endblock %}
<link media="all" href="https://civicrm.org/sites/all/themes/civicrm_bootstrap/css/style.css" rel="stylesheet" type="text/css">
</head>
......
server {
server_name docs;
root /var/www/civicrm-docs/web/static;
root /var/www/civicrm-docs/web;
location ~ ^/(admin|[[:alpha:]]+/*$|$) {
# For a development configuration, change "app" to "app_dev" everywhere
# below. Then you'll see the Symfony web debug toolbar when viewing pages.
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
try_files $uri $uri/index.html $uri/index.htm /app.php$is_args$args;
}
# PROD
location ~ ^/app\.php(/|$) {
alias /var/www/civicrm-docs/web/;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
......@@ -19,11 +20,21 @@ server {
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
#error_log /var/log/nginx/civicrm-docs-error.log;
#access_log /var/log/nginx/civicrm-docs-access.log;
}
......@@ -24,7 +24,7 @@ services:
- '@filesystem'
- '@library'
- %publisher_repos_dir%
- %kernel.root_dir%/../web/static
- %kernel.root_dir%/../web
publish.logger:
class: Monolog\Logger
......
......@@ -76,4 +76,23 @@ class Book {
return $chosen;
}
/**
* Check this book for any problems in the way it's defined.
*
* If validation succeeds, this function returns nothing
*
* If validation fails, this function throws an exception.
*/
public function validate() {
$illegalBookSlugs = array(
"bundles",
"static",
);
if (in_array($this->slug, $illegalBookSlugs)) {
throw new Exception("Book slug is '{$this->slug}' but this word is "
. "reserved in order to maintain functionality within this app. "
. "Reserved words are: " . implode(", ", $illegalBookSlugs));
}
}
}
......@@ -150,6 +150,14 @@ class Publisher {
else {
$this->addMessage('INFO', "Using book: {$this->book->name}.");
}
try {
$this->book->validate();
}
catch (Exception $e) {
$this->addMessage('CRITICAL', "The book settings for {$this->book->name}"
. "failed validation. Validation error is: " . $e->getMessage());
return FALSE;
}
return TRUE;
}
......
/* Home page */
/* Home page */
.book {
margin-bottom: 0.8em;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment