Browse Source

Merge branch 'master' into pico-1.1

Conflicts:
	.htaccess
	config/config.php.template
	content-sample/index.md
	lib/Pico.php
Daniel Rudolf 9 years ago
parent
commit
ddf3da0391

+ 2 - 2
.htaccess

@@ -1,11 +1,11 @@
 <IfModule mod_rewrite.c>
 <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteEngine On
-    # May be required to access sub-directories
+    # May be required to access sub directories
     #RewriteBase /
     #RewriteBase /
 
 
     # Deny access to internal dirs and files by passing the URL to Pico
     # Deny access to internal dirs and files by passing the URL to Pico
     RewriteRule ^(\.git|config|content|content-sample|lib|vendor)(/|$) index.php [L]
     RewriteRule ^(\.git|config|content|content-sample|lib|vendor)(/|$) index.php [L]
-    RewriteRule ^(CHANGELOG.md|composer.(json|lock)) index.php [L]
+    RewriteRule ^(CHANGELOG\.md|composer\.(json|lock)) index.php [L]
 
 
     # Enable URL rewriting
     # Enable URL rewriting
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-f

+ 4 - 2
CHANGELOG.md

@@ -2,13 +2,15 @@ Pico Changelog
 ==============
 ==============
 
 
 ### Version 1.0.3
 ### Version 1.0.3
-Released: -
+Released: 2016-05-11
 
 
 ```
 ```
 * [Changed] Improve documentation
 * [Changed] Improve documentation
+* [Changed] Heavily extend nginx configuration docs
 * [Changed] Add CSS rules for definition lists to default theme
 * [Changed] Add CSS rules for definition lists to default theme
 * [Changed] Always use `on404Content...` execution path when serving a `404.md`
 * [Changed] Always use `on404Content...` execution path when serving a `404.md`
-* [Changed] Deny access to `.git` directory (`.htaccess` file)
+* [Changed] Deny access to `.git` directory, `CHANGELOG.md`, `composer.json`
+            and `composer.lock` (`.htaccess` file)
 * [Changed] Use Pico's `404.md` to deny access to `.git`, `config`, `content`,
 * [Changed] Use Pico's `404.md` to deny access to `.git`, `config`, `content`,
 *           `content-sample`, `lib` and `vendor` dirs (`.htaccess` file)
 *           `content-sample`, `lib` and `vendor` dirs (`.htaccess` file)
 * [Fixed] #342: Fix responsiveness in default theme
 * [Fixed] #342: Fix responsiveness in default theme

+ 1 - 1
README.md

@@ -109,7 +109,7 @@ You want to contribute to Pico? We really appreciate that! You can help make Pic
 [composer]: https://getcomposer.org/
 [composer]: https://getcomposer.org/
 [SemVer]: http://semver.org
 [SemVer]: http://semver.org
 [PHPServer]: http://php.net/manual/en/features.commandline.webserver.php
 [PHPServer]: http://php.net/manual/en/features.commandline.webserver.php
-[HelpUpgrade]: http://picocms.org/upgrade/
+[HelpUpgrade]: http://picocms.org/in-depth/upgrade/
 [HelpUserDocs]: http://picocms.org/docs/
 [HelpUserDocs]: http://picocms.org/docs/
 [HelpDevDocs]: http://picocms.org/development/
 [HelpDevDocs]: http://picocms.org/development/
 [OfficialPlugins]: http://picocms.org/customization/
 [OfficialPlugins]: http://picocms.org/customization/

+ 10 - 2
_build/deploy-phpdoc-branch.sh

@@ -41,12 +41,20 @@ generate-phpdoc.sh \
 [ $? -eq 0 ] || exit 1
 [ $? -eq 0 ] || exit 1
 [ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache")" ] || exit 0
 [ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache")" ] || exit 0
 
 
+# update phpDoc list
+update-phpdoc-list.sh \
+    "$DEPLOYMENT_DIR/_data/phpDoc.yml" \
+    "$TRAVIS_BRANCH" "branch" "<code>$TRAVIS_BRANCH</code> branch" "$(date +%s)"
+
 # commit phpDocs
 # commit phpDocs
 echo "Committing changes..."
 echo "Committing changes..."
-git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
+git add \
+    "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \
+    "$DEPLOYMENT_DIR/_data/phpDoc.yml"
 git commit \
 git commit \
     --message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \
     --message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \
-    "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
+    "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \
+    "$DEPLOYMENT_DIR/_data/phpDoc.yml"
 [ $? -eq 0 ] || exit 1
 [ $? -eq 0 ] || exit 1
 echo
 echo
 
 

+ 9 - 4
_build/deploy-phpdoc-release.sh

@@ -39,13 +39,18 @@ if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
         "$MILESTONE API Documentation ($TRAVIS_TAG)"
         "$MILESTONE API Documentation ($TRAVIS_TAG)"
     [ $? -eq 0 ] || exit 1
     [ $? -eq 0 ] || exit 1
 
 
-    # commit phpDocs
     if [ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID")" ]; then
     if [ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID")" ]; then
+        # update phpDoc list
+        update-phpdoc-list.sh \
+            "$DEPLOYMENT_DIR/_data/phpDoc.yml" \
+            "$TRAVIS_TAG" "version" "Pico ${TRAVIS_TAG#v}" "$(date +%s)"
+
+        # commit phpDocs
         echo "Committing phpDoc changes..."
         echo "Committing phpDoc changes..."
-        git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
+        git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml"
         git commit \
         git commit \
             --message="Update phpDocumentor class docs for $TRAVIS_TAG" \
             --message="Update phpDocumentor class docs for $TRAVIS_TAG" \
-            "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
+            "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml"
         [ $? -eq 0 ] || exit 1
         [ $? -eq 0 ] || exit 1
         echo
         echo
     fi
     fi
@@ -69,7 +74,7 @@ fi
 
 
 # update version file
 # update version file
 if [ "$DEPLOY_VERSION_FILE" == "true" ]; then
 if [ "$DEPLOY_VERSION_FILE" == "true" ]; then
-    generate-version.sh \
+    update-version-file.sh \
         "$DEPLOYMENT_DIR/_data/version.yml" \
         "$DEPLOYMENT_DIR/_data/version.yml" \
         "${TRAVIS_TAG#v}"
         "${TRAVIS_TAG#v}"
 
 

+ 78 - 0
_build/update-phpdoc-list.sh

@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+##
+# Updates the phpDoc list
+#
+# @author  Daniel Rudolf
+# @link    http://picocms.org
+# @license http://opensource.org/licenses/MIT
+#
+
+set -e
+
+# parameters
+LIST_FILE_PATH="$1"      # target file path
+LIST_ID="$2"             # phpDoc ID
+LIST_TYPE="$3"           # phpDoc type
+LIST_TITLE="$4"          # phpDoc title
+LIST_LAST_UPDATE="$5"    # phpDoc last update
+
+# print parameters
+echo "Updating phpDoc list..."
+printf 'LIST_FILE_PATH="%s"\n' "$LIST_FILE_PATH"
+printf 'LIST_ID="%s"\n' "$LIST_ID"
+printf 'LIST_TYPE="%s"\n' "$LIST_TYPE"
+printf 'LIST_TITLE="%s"\n' "$LIST_TITLE"
+printf 'LIST_LAST_UPDATE="%s"\n' "$LIST_LAST_UPDATE"
+echo
+
+# create temporary file
+printf 'Creating temporary file...\n'
+LIST_TMP_FILE="$(mktemp)"
+[ -n "$LIST_TMP_FILE" ] || exit 1
+
+exec 3> "$LIST_TMP_FILE"
+
+# walk through phpDoc list
+printf 'Walking through phpDoc list...\n'
+
+DO_REPLACE="no"
+DID_REPLACE="no"
+while IFS='' read -r LINE || [[ -n "$LINE" ]]; do
+    if [ "$DO_REPLACE" == "yes" ]; then
+        # skip lines until next entry is reached
+        [ "${LINE:0:2}" == "  " ] && continue
+        DO_REPLACE="no"
+
+    elif [ "$LINE" == "- id: $LIST_ID" ]; then
+        # update existing entry
+        printf 'Updating existing entry...\n'
+        printf -- '- id: %s\n' "$LIST_ID" >&3
+        printf -- '  type: %s\n' "$LIST_TYPE" >&3
+        printf -- '  title: %s\n' "$LIST_TITLE" >&3
+        printf -- '  last_update: %s\n' "$LIST_LAST_UPDATE" >&3
+
+        DO_REPLACE="yes"
+        DID_REPLACE="yes"
+        continue
+    fi
+
+    echo "$LINE" >&3
+done < "$LIST_FILE_PATH"
+
+# add new entry
+if [ "$DID_REPLACE" == "no" ]; then
+    printf 'Adding new entry...\n'
+    printf -- '- id: %s\n' "$LIST_ID" >&3
+    printf -- '  type: %s\n' "$LIST_TYPE" >&3
+    printf -- '  title: %s\n' "$LIST_TITLE" >&3
+    printf -- '  last_update: %s\n' "$LIST_LAST_UPDATE" >&3
+fi
+
+exec 3>&-
+
+# move temporary file
+printf 'Replacing phpDoc list...\n'
+mv "$LIST_TMP_FILE" "$LIST_FILE_PATH"
+
+echo

+ 0 - 0
_build/generate-version.sh → _build/update-version-file.sh


+ 1 - 1
config/config.php.template

@@ -11,7 +11,7 @@
  * save your changes.
  * save your changes.
  *
  *
  * @link    http://picocms.org
  * @link    http://picocms.org
- * @license http://opensource.org/licenses/MIT
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.1
  * @version 1.1
  */
  */
 
 

+ 20 - 9
content-sample/index.md

@@ -283,15 +283,25 @@ you get an error message from your web server, please make sure to enable the
 still shows no rewritten URLs, force URL rewriting by setting
 still shows no rewritten URLs, force URL rewriting by setting
 `$config['rewrite_url'] = true;` in your `config/config.php`.
 `$config['rewrite_url'] = true;` in your `config/config.php`.
 
 
-If you're using Nginx, you can use the following configuration to enable
-URL rewriting. Don't forget to adjust the path (`/pico/`; line `1` and `3`)
-to match your installation directory. You can then enable URL rewriting by
-setting `$config['rewrite_url'] = true;` in your `config/config.php`.
-
-    location /pico/ {
-        index index.php;
-        try_files $uri $uri/ /pico/$is_args$args;
-    }
+If you're using Nginx, you can use the following configuration to enable URL
+rewriting (lines `5` to `8`) and denying access to Pico's internal files
+(lines `1` to `3`). You'll need to adjust the path (`/pico` on lines `1`, `5`
+and `7`) to match your installation directory. Additionally, you'll need to
+enable URL rewriting by setting `$config['rewrite_url'] = true;` in your
+`config/config.php`. The Nginx configuration should provide the *bare minimum*
+you need for Pico. Nginx is a very extensive subject. If you have any trouble,
+please read through our [Nginx configuration docs][NginxConfig].
+
+```
+location ~ /pico/(\.htaccess|\.git|config|content|content-sample|lib|vendor|CHANGELOG\.md|composer\.(json|lock)) {
+    return 404;
+}
+
+location /pico/ {
+    index index.php;
+    try_files $uri $uri/ /pico/index.php$is_args$args;
+}
+```
 
 
 ## Documentation
 ## Documentation
 
 
@@ -305,3 +315,4 @@ For more help have a look at the Pico documentation at http://picocms.org/docs.
 [WikiPlugins]: https://github.com/picocms/Pico/wiki/Pico-Plugins
 [WikiPlugins]: https://github.com/picocms/Pico/wiki/Pico-Plugins
 [PluginUpgrade]: http://picocms.org/development/#upgrade
 [PluginUpgrade]: http://picocms.org/development/#upgrade
 [ModRewrite]: https://httpd.apache.org/docs/current/mod/mod_rewrite.html
 [ModRewrite]: https://httpd.apache.org/docs/current/mod/mod_rewrite.html
+[NginxConfig]: http://picocms.org/in-depth/nginx/

+ 1 - 1
lib/AbstractPicoPlugin.php

@@ -7,7 +7,7 @@
  *
  *
  * @author  Daniel Rudolf
  * @author  Daniel Rudolf
  * @link    http://picocms.org
  * @link    http://picocms.org
- * @license http://opensource.org/licenses/MIT
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.0
  * @version 1.0
  */
  */
 abstract class AbstractPicoPlugin implements PicoPluginInterface
 abstract class AbstractPicoPlugin implements PicoPluginInterface

+ 3 - 3
lib/Pico.php

@@ -22,8 +22,8 @@
  *
  *
  * @author  Gilbert Pellegrom
  * @author  Gilbert Pellegrom
  * @author  Daniel Rudolf
  * @author  Daniel Rudolf
- * @link    <http://picocms.org>
- * @license The MIT License <http://opensource.org/licenses/MIT>
+ * @link    http://picocms.org
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.1
  * @version 1.1
  */
  */
 class Pico
 class Pico
@@ -896,7 +896,7 @@ class Pico
      * for users and pure (!) theme developers ONLY.
      * for users and pure (!) theme developers ONLY.
      *
      *
      * @see    Pico::getFileMeta()
      * @see    Pico::getFileMeta()
-     * @see    <http://symfony.com/doc/current/components/yaml/introduction.html>
+     * @see    http://symfony.com/doc/current/components/yaml/introduction.html
      * @param  string   $rawContent the raw file contents
      * @param  string   $rawContent the raw file contents
      * @param  string[] $headers    known meta headers
      * @param  string[] $headers    known meta headers
      * @return array                parsed meta data
      * @return array                parsed meta data

+ 1 - 1
lib/PicoPluginInterface.php

@@ -22,7 +22,7 @@
  *
  *
  * @author  Daniel Rudolf
  * @author  Daniel Rudolf
  * @link    http://picocms.org
  * @link    http://picocms.org
- * @license http://opensource.org/licenses/MIT
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.0
  * @version 1.0
  */
  */
 interface PicoPluginInterface
 interface PicoPluginInterface

+ 1 - 1
lib/PicoTwigExtension.php

@@ -5,7 +5,7 @@
  *
  *
  * @author  Daniel Rudolf
  * @author  Daniel Rudolf
  * @link    http://picocms.org
  * @link    http://picocms.org
- * @license http://opensource.org/licenses/MIT
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.0
  * @version 1.0
  */
  */
 class PicoTwigExtension extends Twig_Extension
 class PicoTwigExtension extends Twig_Extension

+ 1 - 1
plugins/00-PicoDeprecated.php

@@ -38,7 +38,7 @@
  *
  *
  * @author  Daniel Rudolf
  * @author  Daniel Rudolf
  * @link    http://picocms.org
  * @link    http://picocms.org
- * @license http://opensource.org/licenses/MIT
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.0
  * @version 1.0
  */
  */
 class PicoDeprecated extends AbstractPicoPlugin
 class PicoDeprecated extends AbstractPicoPlugin

+ 1 - 1
plugins/01-PicoParsePagesContent.php

@@ -13,7 +13,7 @@
  *
  *
  * @author  Daniel Rudolf
  * @author  Daniel Rudolf
  * @link    http://picocms.org
  * @link    http://picocms.org
- * @license http://opensource.org/licenses/MIT
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.0
  * @version 1.0
  */
  */
 class PicoParsePagesContent extends AbstractPicoPlugin
 class PicoParsePagesContent extends AbstractPicoPlugin

+ 1 - 1
plugins/02-PicoExcerpt.php

@@ -15,7 +15,7 @@
  *
  *
  * @author  Daniel Rudolf
  * @author  Daniel Rudolf
  * @link    http://picocms.org
  * @link    http://picocms.org
- * @license http://opensource.org/licenses/MIT
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.0
  * @version 1.0
  */
  */
 class PicoExcerpt extends AbstractPicoPlugin
 class PicoExcerpt extends AbstractPicoPlugin

+ 1 - 1
plugins/DummyPlugin.php

@@ -8,7 +8,7 @@
  *
  *
  * @author  Daniel Rudolf
  * @author  Daniel Rudolf
  * @link    http://picocms.org
  * @link    http://picocms.org
- * @license http://opensource.org/licenses/MIT
+ * @license http://opensource.org/licenses/MIT The MIT License
  * @version 1.0
  * @version 1.0
  */
  */
 final class DummyPlugin extends AbstractPicoPlugin
 final class DummyPlugin extends AbstractPicoPlugin