Merge branch 'master' into pico-1.1

Conflicts:
	.htaccess
	config/config.php.template
	content-sample/index.md
	lib/Pico.php
This commit is contained in:
Daniel Rudolf 2016-06-18 20:23:23 +02:00
commit ddf3da0391
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538
17 changed files with 134 additions and 30 deletions

View file

@ -1,11 +1,11 @@
<IfModule mod_rewrite.c>
RewriteEngine On
# May be required to access sub-directories
# May be required to access sub directories
#RewriteBase /
# 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 ^(CHANGELOG.md|composer.(json|lock)) index.php [L]
RewriteRule ^(CHANGELOG\.md|composer\.(json|lock)) index.php [L]
# Enable URL rewriting
RewriteCond %{REQUEST_FILENAME} !-f

View file

@ -2,13 +2,15 @@ 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 (`.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

View file

@ -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/

View file

@ -41,12 +41,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" "<code>$TRAVIS_BRANCH</code> 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

View file

@ -39,13 +39,18 @@ if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
"$MILESTONE 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
@ -69,7 +74,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}"

78
_build/update-phpdoc-list.sh Executable file
View file

@ -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

View file

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

View file

@ -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 `3`)
to match your installation directory. You can then enable 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 (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/ {
index index.php;
try_files $uri $uri/ /pico/$is_args$args;
}
```
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
@ -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/

View file

@ -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

View file

@ -22,8 +22,8 @@
*
* @author Gilbert Pellegrom
* @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
*/
class Pico
@ -896,7 +896,7 @@ class Pico
* for users and pure (!) theme developers ONLY.
*
* @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[] $headers known meta headers
* @return array parsed meta data

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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