From 4d3eace1af885210e468a2d5281da996f412c588 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 27 Apr 2016 16:47:13 +0200 Subject: [PATCH 01/11] README.md: Update upgrade URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 148538c..2d833d5 100644 --- a/README.md +++ b/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/ [SemVer]: http://semver.org [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/ [HelpDevDocs]: http://picocms.org/development/ [OfficialPlugins]: http://picocms.org/customization/ From 4c0366fa493ec0bc93ca8d3ea21ec463d08facad Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 27 Apr 2016 16:49:10 +0200 Subject: [PATCH 02/11] Build system: Move generate-version.sh --- _build/deploy-phpdoc-release.sh | 2 +- _build/{generate-version.sh => update-version-file.sh} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename _build/{generate-version.sh => update-version-file.sh} (100%) diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index 8d3410e..8ba0097 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -65,7 +65,7 @@ fi # update version file if [ "$DEPLOY_VERSION_FILE" == "true" ]; then - generate-version.sh \ + update-version-file.sh \ "$DEPLOYMENT_DIR/_data/version.yml" \ "${TRAVIS_TAG#v}" diff --git a/_build/generate-version.sh b/_build/update-version-file.sh similarity index 100% rename from _build/generate-version.sh rename to _build/update-version-file.sh From 79a14799bb26fbf181c4bc07c7213236ab935f10 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 27 Apr 2016 16:49:38 +0200 Subject: [PATCH 03/11] Build system: Add phpDoc list --- _build/deploy-phpdoc-branch.sh | 12 ++++- _build/deploy-phpdoc-release.sh | 11 +++-- _build/update-phpdoc-list.sh | 78 +++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 5 deletions(-) create mode 100755 _build/update-phpdoc-list.sh diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index c4a94a9..9a99620 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -37,12 +37,20 @@ generate-phpdoc.sh \ [ $? -eq 0 ] || exit 1 [ -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" "\`$TRAVIS_BRANCH\` branch" "$(date +%s)" + # commit phpDocs 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 \ --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 echo diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index 8ba0097..fb7dc52 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -35,13 +35,18 @@ if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then "Pico 1.0 API Documentation ($TRAVIS_TAG)" [ $? -eq 0 ] || exit 1 - # commit phpDocs 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..." - git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" + git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml" git commit \ --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 echo fi diff --git a/_build/update-phpdoc-list.sh b/_build/update-phpdoc-list.sh new file mode 100755 index 0000000..c6f48c2 --- /dev/null +++ b/_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 From 749114df610f522dae4212525610fd20c9521572 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 27 Apr 2016 19:00:44 +0200 Subject: [PATCH 04/11] Build system: Update phpDoc list formatting --- _build/deploy-phpdoc-branch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index 9a99620..40d7657 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -40,7 +40,7 @@ generate-phpdoc.sh \ # update phpDoc list update-phpdoc-list.sh \ "$DEPLOYMENT_DIR/_data/phpDoc.yml" \ - "$TRAVIS_BRANCH" "branch" "\`$TRAVIS_BRANCH\` branch" "$(date +%s)" + "$TRAVIS_BRANCH" "branch" "$TRAVIS_BRANCH branch" "$(date +%s)" # commit phpDocs echo "Committing changes..." From ee5b4f0d56fb565aac4ef50e8cd6d0dd8ae45084 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 27 Apr 2016 21:02:20 +0200 Subject: [PATCH 05/11] .htaccess: Deny access to CHANGELOG.md, composer.json, composer.lock See discussion in #343 --- .htaccess | 3 ++- CHANGELOG.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.htaccess b/.htaccess index 9e7ac73..5851794 100644 --- a/.htaccess +++ b/.htaccess @@ -5,7 +5,8 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 [L,QSA] - RewriteRule ^(.git|config|content|content-sample|lib|vendor)/.*$ index.php?$0 [L,QSA] + RewriteRule ^(\.git|config|content|content-sample|lib|vendor)(/.*)?$ index.php?$0 [L,QSA] + RewriteRule ^(CHANGELOG.md|composer.(json|lock)) index.php?404 [L] SetEnv PICO_URL_REWRITING 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c478c4..de61437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ Released: - * [Changed] Improve documentation * [Changed] Add CSS rules for definition lists to default theme * [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`, * `content-sample`, `lib` and `vendor` dirs (`.htaccess` file) * [Fixed] #342: Fix responsiveness in default theme From 86b283966038c778e838bd667c6dae302713f207 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Fri, 29 Apr 2016 18:02:19 +0200 Subject: [PATCH 06/11] Update .htaccess Thanks @smcdougall, see https://github.com/picocms/Pico/commit/ee5b4f0d56fb565aac4ef50e8cd6d0dd8ae45084#commitcomment-17304977 --- .htaccess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index 5851794..453a3e3 100644 --- a/.htaccess +++ b/.htaccess @@ -6,7 +6,7 @@ RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 [L,QSA] RewriteRule ^(\.git|config|content|content-sample|lib|vendor)(/.*)?$ index.php?$0 [L,QSA] - RewriteRule ^(CHANGELOG.md|composer.(json|lock)) index.php?404 [L] + RewriteRule ^(CHANGELOG\.md|composer\.(json|lock)) index.php?404 [L] SetEnv PICO_URL_REWRITING 1 From e32a46d6cf92e8161f9c6f5ff945d29895a236f0 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Fri, 6 May 2016 23:17:17 +0200 Subject: [PATCH 07/11] Sync docs --- content-sample/index.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/content-sample/index.md b/content-sample/index.md index 28ffb2d..5f1d707 100644 --- a/content-sample/index.md +++ b/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 `$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 `4`) -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/?$1&$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/?$1&$args; +} +``` ## 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 [PluginUpgrade]: http://picocms.org/development/#upgrade [ModRewrite]: https://httpd.apache.org/docs/current/mod/mod_rewrite.html +[NginxConfig]: http://picocms.org/in-depth/nginx/ From b2a7c7623d523258f20082459acd5d5a3665ce27 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 11 May 2016 23:28:26 +0200 Subject: [PATCH 08/11] Sync docs --- content-sample/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content-sample/index.md b/content-sample/index.md index 5f1d707..9975a72 100644 --- a/content-sample/index.md +++ b/content-sample/index.md @@ -299,7 +299,7 @@ location ~ /pico/(\.htaccess|\.git|config|content|content-sample|lib|vendor|CHAN location ~ ^/pico(.*) { index index.php; - try_files $uri $uri/ /pico/?$1&$args; + try_files $uri $uri/ /pico/index.php?$1&$args; } ``` From d17f0a8a8fbffa2d7b03f3915243f57143c0b65b Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 11 May 2016 23:32:26 +0200 Subject: [PATCH 09/11] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de61437..4245dcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,11 @@ Pico Changelog ============== ### Version 1.0.3 -Released: - +Released: 2016-05-11 ``` * [Changed] Improve documentation +* [Changed] Heavily extend nginx configuration docs * [Changed] Add CSS rules for definition lists to default theme * [Changed] Always use `on404Content...` execution path when serving a `404.md` * [Changed] Deny access to `.git` directory, `CHANGELOG.md`, `composer.json` From 94279c57f8bf4bda8fc5115f8761927aac49bc22 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Mon, 23 May 2016 15:13:56 +0200 Subject: [PATCH 11/11] Improve phpDocs class docs --- config/config.php.template | 2 +- lib/AbstractPicoPlugin.php | 2 +- lib/Pico.php | 8 +++++--- lib/PicoPluginInterface.php | 2 +- lib/PicoTwigExtension.php | 2 +- plugins/00-PicoDeprecated.php | 2 +- plugins/01-PicoParsePagesContent.php | 2 +- plugins/02-PicoExcerpt.php | 2 +- plugins/DummyPlugin.php | 2 +- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/config/config.php.template b/config/config.php.template index 0d44037..c68d507 100644 --- a/config/config.php.template +++ b/config/config.php.template @@ -12,7 +12,7 @@ * * @author Gilbert Pellegrom * @link http://picocms.org - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ diff --git a/lib/AbstractPicoPlugin.php b/lib/AbstractPicoPlugin.php index 4ee337e..fb8840e 100644 --- a/lib/AbstractPicoPlugin.php +++ b/lib/AbstractPicoPlugin.php @@ -7,7 +7,7 @@ * * @author Daniel Rudolf * @link http://picocms.org - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ abstract class AbstractPicoPlugin implements PicoPluginInterface diff --git a/lib/Pico.php b/lib/Pico.php index c498faf..dab794a 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -4,6 +4,7 @@ * Pico * * Pico is a stupidly simple, blazing fast, flat file CMS. + * * - Stupidly Simple: Pico makes creating and maintaining a * website as simple as editing text files. * - Blazing Fast: Pico is seriously lightweight and doesn't @@ -16,12 +17,13 @@ * for powerful and flexible themes. * - Open Source: Pico is completely free and open source, * released under the MIT license. + * * See for more info. * * @author Gilbert Pellegrom * @author Daniel Rudolf - * @link - * @license The MIT License + * @link http://picocms.org + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ class Pico @@ -760,7 +762,7 @@ class Pico * for users and pure (!) theme developers ONLY. * * @see Pico::getFileMeta() - * @see + * @see http://symfony.com/doc/current/components/yaml/introduction.html * @param string $rawContent the raw file contents * @param string[] $headers known meta headers * @return array parsed meta data diff --git a/lib/PicoPluginInterface.php b/lib/PicoPluginInterface.php index 8ea3ab6..ffa839b 100644 --- a/lib/PicoPluginInterface.php +++ b/lib/PicoPluginInterface.php @@ -22,7 +22,7 @@ * * @author Daniel Rudolf * @link http://picocms.org - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ interface PicoPluginInterface diff --git a/lib/PicoTwigExtension.php b/lib/PicoTwigExtension.php index aa24fbe..68cf8b3 100644 --- a/lib/PicoTwigExtension.php +++ b/lib/PicoTwigExtension.php @@ -5,7 +5,7 @@ * * @author Daniel Rudolf * @link http://picocms.org - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ class PicoTwigExtension extends Twig_Extension diff --git a/plugins/00-PicoDeprecated.php b/plugins/00-PicoDeprecated.php index 1077800..29d2bf0 100644 --- a/plugins/00-PicoDeprecated.php +++ b/plugins/00-PicoDeprecated.php @@ -38,7 +38,7 @@ * * @author Daniel Rudolf * @link http://picocms.org - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ class PicoDeprecated extends AbstractPicoPlugin diff --git a/plugins/01-PicoParsePagesContent.php b/plugins/01-PicoParsePagesContent.php index db4ed10..6611c90 100644 --- a/plugins/01-PicoParsePagesContent.php +++ b/plugins/01-PicoParsePagesContent.php @@ -13,7 +13,7 @@ * * @author Daniel Rudolf * @link http://picocms.org - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ class PicoParsePagesContent extends AbstractPicoPlugin diff --git a/plugins/02-PicoExcerpt.php b/plugins/02-PicoExcerpt.php index 7d0c449..00cae14 100644 --- a/plugins/02-PicoExcerpt.php +++ b/plugins/02-PicoExcerpt.php @@ -15,7 +15,7 @@ * * @author Daniel Rudolf * @link http://picocms.org - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ class PicoExcerpt extends AbstractPicoPlugin diff --git a/plugins/DummyPlugin.php b/plugins/DummyPlugin.php index fbdeb06..667de54 100644 --- a/plugins/DummyPlugin.php +++ b/plugins/DummyPlugin.php @@ -8,7 +8,7 @@ * * @author Daniel Rudolf * @link http://picocms.org - * @license http://opensource.org/licenses/MIT + * @license http://opensource.org/licenses/MIT The MIT License * @version 1.0 */ final class DummyPlugin extends AbstractPicoPlugin