diff --git a/.gitattributes b/.gitattributes index 8943349..c7a0467 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,4 +4,6 @@ /.gitignore export-ignore /.travis.yml export-ignore /.scrutinizer.yml export-ignore -/phpunit.xml export-ignore +/phpunit.xml.dist export-ignore +/phpcs.xml.dist export-ignore +/codecov.yml export-ignore diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 08d4445..051ef9a 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,69 +1,15 @@ inherit: true +build: + nodes: + analysis: + tests: + override: [php-scrutinizer-run] + checks: - php: - verify_property_names: true - verify_argument_usable_as_reference: true - verify_access_scope_valid: true - useless_calls: true - use_statement_alias_conflict: true - variable_existence: true - unused_variables: true - unused_properties: true - unused_parameters: true - unused_methods: true - unreachable_code: true - too_many_arguments: true - sql_injection_vulnerabilities: true - simplify_boolean_return: true - side_effects_or_types: true - security_vulnerabilities: true - return_doc_comments: true - return_doc_comment_if_not_inferrable: true - require_scope_for_properties: true - require_scope_for_methods: true - require_php_tag_first: true - psr2_switch_declaration: true - psr2_class_declaration: true - property_assignments: true - prefer_while_loop_over_for_loop: true - precedence_mistakes: true - precedence_in_conditions: true - phpunit_assertions: true - php5_style_constructor: true - parse_doc_comments: true - parameter_non_unique: true - parameter_doc_comments: true - param_doc_comment_if_not_inferrable: true - optional_parameters_at_the_end: true - one_class_per_file: true - no_unnecessary_if: true - no_trailing_whitespace: true - no_property_on_interface: true - no_non_implemented_abstract_methods: true - no_error_suppression: true - no_duplicate_arguments: true - no_commented_out_code: true - newline_at_end_of_file: true - missing_arguments: true - method_calls_on_non_object: true - instanceof_class_exists: true - foreach_traversable: true - fix_line_ending: true - fix_doc_comments: true - duplication: true - deprecated_code_usage: true - deadlock_detection_in_loops: true - code_rating: true - closure_use_not_conflicting: true - catch_class_exists: true - blank_line_after_namespace_declaration: false - avoid_multiple_statements_on_same_line: true - avoid_duplicate_types: true - avoid_conflicting_incrementers: true - avoid_closing_tag: true - assignment_of_null_return: true - argument_type_checks: true + php: + code_rating: true + duplication: true filter: - paths: [src/*, tests/*] + paths: [src/*, tests/*] diff --git a/.travis.yml b/.travis.yml index 14c7a02..274ba94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,10 @@ matrix: env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1 - php: 7.0 env: DB=PGSQL PHPUNIT_TEST=1 - - php: 7.0 - env: DB=MYSQL PHPUNIT_TEST=1 - php: 7.1 env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1 + - php: 7.2 + env: DB=MYSQL PHPUNIT_TEST=1 before_script: # Init PHP @@ -31,7 +31,7 @@ before_script: script: - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi - - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src/ tests/ ; fi + - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/ *.php; fi after_success: - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi diff --git a/changelog.md b/changelog.md deleted file mode 100644 index 153ac07..0000000 --- a/changelog.md +++ /dev/null @@ -1,18 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -This project adheres to [Semantic Versioning](http://semver.org/). - -## [1.1.0] - -* Updated dependency on framework to ~3.3 -* Fix preview icons for 3.3 -* Fix filter on Token field -* Changelog added. -* Made supported -* Fixed code coverage reporting -* Add tests for 3 and 3.2 branches -* Converted to PSR-2 -* Added standard .editorconfig file -* Fixed code coverage reporting diff --git a/docs/developer-tools.md b/docs/developer-tools.md deleted file mode 100644 index 3382ec8..0000000 --- a/docs/developer-tools.md +++ /dev/null @@ -1,5 +0,0 @@ -# Developer Tools - -Get the dependencies by running `npm install`. - -After making changes to SCSS files, run the build script `npm run build`. This will compile everything for you and output minified CSS files to the `css` directory. diff --git a/docs/getting-started.md b/docs/getting-started.md deleted file mode 100644 index 594674a..0000000 --- a/docs/getting-started.md +++ /dev/null @@ -1,9 +0,0 @@ -# Getting Started - -The easiest way to install is by using [Composer](https://getcomposer.org): - -```sh -$ composer require silverstripe/sharedraftcontent -``` - -You'll also need to run `dev/build`. You should now see a link/button on the bottom-right of edit pages. Clicking the link will generate a new share link. diff --git a/docs/introduction.md b/docs/introduction.md deleted file mode 100644 index 2e2cf37..0000000 --- a/docs/introduction.md +++ /dev/null @@ -1,23 +0,0 @@ -# Introduction - -[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-sharedraftcontent.svg?style=flat-square)](https://travis-ci.org/silverstripe/silverstripe-sharedraftcontent) -[![Code Quality](http://img.shields.io/scrutinizer/g/silverstripe/silverstripe-sharedraftcontent.svg?style=flat-square)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-sharedraftcontent) -[![Version](http://img.shields.io/packagist/v/silverstripe/sharedraftcontent.svg?style=flat-square)](https://packagist.org/packages/silverstripe/silverstripe-sharedraftcontent) -[![License](http://img.shields.io/packagist/l/silverstripe/sharedraftcontent.svg?style=flat-square)](LICENSE.md) - -Share draft page content with non-CMS users. - -## Share Links - -The generated share links have a public key and hash. There can be any number of share links per-page, but all share links are unique, and cannot be used to gain access to pages other than the one each link was created for. - -## Sections - -- [Getting Started](getting-started.md) -- [Developer Tools](developer-tools.md) - -## Questions - -This module was created by [SilverStripe](https://twitter.com/silverstripe). You can ask questions on Twitter. - -You can report bugs or request features on [GitHub](https://github.com/silverstripe/silverstripe-sharedraftcontent/issues). diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..fdf26a6 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,9 @@ + + + CodeSniffer ruleset for SilverStripe coding conventions. + + + + + + \ No newline at end of file diff --git a/readme.md b/readme.md index a83cdb0..cce15a9 100644 --- a/readme.md +++ b/readme.md @@ -1,11 +1,10 @@ # Share Draft Content -[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-sharedraftcontent.svg?style=flat-square)](https://travis-ci.org/silverstripe/silverstripe-sharedraftcontent) -[![Code Quality](http://img.shields.io/scrutinizer/g/silverstripe/silverstripe-sharedraftcontent.svg?style=flat-square)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-sharedraftcontent) -[![Code Coverage](http://img.shields.io/scrutinizer/coverage/g/silverstripe/silverstripe-sharedraftcontent.svg?style=flat-square)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-sharedraftcontent) -[![Version](http://img.shields.io/packagist/v/silverstripe/sharedraftcontent.svg?style=flat-square)](https://packagist.org/packages/silverstripe/silverstripe-sharedraftcontent) -[![License](http://img.shields.io/packagist/l/silverstripe/sharedraftcontent.svg?style=flat-square)](LICENSE.md) -![helpfulrobot](https://helpfulrobot.io/silverstripe/sharedraftcontent/badge) +[![Build Status](https://travis-ci.org/silverstripe/silverstripe-sharedraftcontent.svg?branch=master)](https://travis-ci.org/silverstripe/silverstripe-sharedraftcontent) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-sharedraftcontent/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-sharedraftcontent/?branch=master) +[![codecov](https://codecov.io/gh/silverstripe/silverstripe-sharedraftcontent/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-sharedraftcontent) +[![Version](http://img.shields.io/packagist/v/silverstripe/sharedraftcontent.svg?style=flat)](https://packagist.org/packages/silverstripe/silverstripe-sharedraftcontent) +[![License](http://img.shields.io/packagist/l/silverstripe/sharedraftcontent.svg?style=flat)](LICENSE.md) Share draft page content with non-CMS users. @@ -17,17 +16,27 @@ This module adds a 'Share draft' action menu to the CMS. This enables Content Au - SilverStripe ^4.0 +Note: this version is compatible with SilverStripe 4. For SilverStripe 3, please see the 1.x release line. + ## Installation -``` +The easiest way to install is by using [Composer](https://getcomposer.org): + +```sh $ composer require silverstripe/sharedraftcontent ``` -You'll also need to run `dev/build`. +You'll also need to run `dev/build`. You should now see a link/button on the bottom-right of edit pages. Clicking the link will generate a new share link. + +# Developer Tools + +Get the dependencies by running `npm install`. + +After making changes to SCSS files, run the build script `npm run build`. This will compile everything for you and output minified CSS files to the `css` directory. -## Documentation +## Share Links -See the [docs/en](docs/en/introduction.md) folder. +The generated share links have a public key and hash. There can be any number of share links per-page, but all share links are unique, and cannot be used to gain access to pages other than the one each link was created for. ## Versioning diff --git a/src/Tasks/RemoveExpiredShareTokensTask.php b/src/Tasks/RemoveExpiredShareTokensTask.php index 7fbad11..0d9669e 100644 --- a/src/Tasks/RemoveExpiredShareTokensTask.php +++ b/src/Tasks/RemoveExpiredShareTokensTask.php @@ -3,8 +3,6 @@ namespace SilverStripe\ShareDraftContent\Tasks; use SilverStripe\Dev\BuildTask; -use SilverStripe\Security\Permission; -use SilverStripe\Security\Security; use SilverStripe\ShareDraftContent\Models\ShareToken; /** diff --git a/tests/ShareDraftContentSiteTreeExtensionTest.php b/tests/ShareDraftContentSiteTreeExtensionTest.php index 0f27609..556ba65 100644 --- a/tests/ShareDraftContentSiteTreeExtensionTest.php +++ b/tests/ShareDraftContentSiteTreeExtensionTest.php @@ -3,7 +3,6 @@ namespace SilverStripe\ShareDraftContent\Tests; use Page; -use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\HTTPRequest; use SilverStripe\Dev\FunctionalTest; use SilverStripe\ShareDraftContent\Controllers\ShareDraftController;