Skip to content

Commit

Permalink
MNT Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 8, 2023
1 parent 4f79962 commit 684ba27
Show file tree
Hide file tree
Showing 324 changed files with 12,842 additions and 10,719 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[composer.json]
indent_size = 4
indent_size = 4
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,24 @@ rules.overrides = [
impliedStrict: true
}
},
settings: {
react: {
version: '16'
}
},
rules: {
// These rules are not appropriate for linting markdown code blocks
'lines-around-comment': 'off',
'import/no-unresolved': 'off',
'import/extensions': 'off',
'react/jsx-no-undef': 'off',
'no-undef': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'brace-style': 'off', // it's useful to have comments before the else block
// These rules are disabled because they are difficult to adhere to right now
'jsx-a11y/label-has-associated-control': 'off',
'react/prefer-stateless-function': 'off',
}
}
];
Expand Down
57 changes: 54 additions & 3 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
# Enable all rules with default settings as a baseline
default: true

customRules:
- 'markdownlint-rule-title-case-style'

# markdownlint-rule-title-case-style: Use sentence-style headings
title-case-style:
case: 'sentence'
ignore:
- 'Apache'
- 'APIs'
- 'Composer'
- 'GitHub'
- 'GraphQL'
- 'Huntr'
- 'JavaScript'
- 'I'
- 'InnoDB'
- 'Git'
- 'jQuery'
- 'Lighttpd'
- 'MyISAM'
- 'MySQL'
- 'Nginx'
- 'Nginx,'
- 'PHPUnit'
- 'RFCs'
- 'Silverstripe'
- 'TinyMCE'
- 'Transifex'
- 'URLs'
- 'WebP'

# MD041: Ignore the frontmatter (metadata) title when checking for H1s
first-line-h1:
Expand Down Expand Up @@ -90,12 +101,52 @@ fenced-code-language:
proper-names:
code_blocks: false
names:
- 'API'
- '-api' # e.g. "#breaking-api" in anchor links
- '#api' # anchor links
- 'type/api-break' # the GitHub label
- 'CI'
- '-ci' # e.g. "#using-ci" in anchor links
- 'CMS'
- '/cms' # e.g. "silverstripe/cms"
- '-cms' # e.g. "silverstripe/recipe-cms"
- '#cms' # anchor links
- 'CSS'
- 'GitHub'
- 'GraphQL'
- '#graphql' # anchor links
- '-graphql' # e.g. "#define-graphql" in anchor links
- '/graphql' # e.g. "silverstripe/graphql"
- 'HTTP'
- 'JavaScript'
- 'JS'
- '#js' # anchor links
- '-js' # e.g. "#history-viewer-js" in anchor links
- '.js' # e.g. "Node.js"
- 'jQuery'
- '#jquery' # anchor links
- 'ORM'
- '#orm' # anchor links
- '-orm' # e.g. "#overview-orm" in anchor links
- 'PHP'
- '-php' # e.g. "#config-php" in anchor links
- 'php-' # e.g. "php-intl extension"
- '#php' # anchor links
- 'SCSS'
- 'Silverstripe'
- '#silverstripe/' # anchor links
- 'silverstripe/' # e.g. "silverstripe/framework"
- 'silverstripe-' # e.g. "silverstripe-vendormodule"
- 'SilverStripe\' # e.g. api links
- 'silverstripe.com'
- 'silverstripe.org'
- 'TinyMCE'
- '#tinymce' # anchor links
- 'UI'
- '-ui' # e.g. "#installer-ui" in anchor links
- 'URL'
- '-url' # e.g. "#admin-ui" in anchor links
- 'YAML'

# MD033: Allow specific HTML tags
no-inline-html:
Expand Down
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@
}
],
"require-dev": {
"silverstripe/markdown-php-codesniffer": "dev-pulls/1/new-repo"
"silverstripe/markdown-php-codesniffer": "dev-pulls/1/new-repo",
"slevomat/coding-standard": "^8.14"
},
"repositories": [
{
"url": "https://github.com/creative-commoners/markdown-php-codesniffer",
"type": "vcs"
}
]
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
84 changes: 43 additions & 41 deletions en/00_Getting_Started/00_Server_Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ the server to update templates, website logic, and perform upgrades or maintenan

## PHP

* PHP >=7.4, <=8.1
* PHP extensions: `ctype`, `dom`, `fileinfo`, `hash`, `intl`, `mbstring`, `session`, `simplexml`, `tokenizer`, `xml`
* PHP configuration: `memory_limit` with at least `48M`
* PHP extension for image manipulation: Either `gd` or `imagick`
* PHP extension for a database connector (e.g. `pdo` or `mysqli`)
- PHP >=7.4, <=8.1
- PHP extensions: `ctype`, `dom`, `fileinfo`, `hash`, `intl`, `mbstring`, `session`, `simplexml`, `tokenizer`, `xml`
- PHP configuration: `memory_limit` with at least `48M`
- PHP extension for image manipulation: Either `gd` or `imagick`
- PHP extension for a database connector (e.g. `pdo` or `mysqli`)

Use [phpinfo()](http://php.net/manual/en/function.phpinfo.php) to inspect your configuration.

Silverstripe CMS tracks the official [PHP release support timeline](https://www.php.net/supported-versions.php). When a PHP version reaches end-of-life, Silverstripe CMS drops support for it in the next minor release.
Silverstripe CMS tracks the official [PHP release support timeline](https://www.php.net/supported-versions.php). When a PHP version reaches end-of-life, Silverstripe CMS drops support for it in the next minor release.

## Database

* MySQL >=5.6 (
- MySQL >=5.6 (
built-in, [commercially supported](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/))
* PostgreSQL ([third party module](https://addons.silverstripe.org/add-ons/silverstripe/postgresql), community
- PostgreSQL ([third party module](https://addons.silverstripe.org/add-ons/silverstripe/postgresql), community
supported)
* SQL Server ([third party module](https://addons.silverstripe.org/add-ons/silverstripe/mssql), community supported)
* SQLite ([third party module](https://addons.silverstripe.org/add-ons/silverstripe/sqlite3), community supported)
- SQL Server ([third party module](https://addons.silverstripe.org/add-ons/silverstripe/mssql), community supported)
- SQLite ([third party module](https://addons.silverstripe.org/add-ons/silverstripe/sqlite3), community supported)

### Default MySQL Collation
### Default MySQL collation

In Silverstripe CMS Recipe 4.7 and later, new projects default to the `utf8mb4_unicode_ci` collation when running
against MySQL, which offers better support for multi-byte characters such as emoji. However, this may cause issues
Expand All @@ -56,18 +56,19 @@ setting. It is generally recommended to leave this setting as-is because it resu
some advanced cases, the sql_mode can be configured on the database connection via the configuration API (
see `MySQLDatabase::$sql_mode` for more details.) This setting is only available in Silverstripe CMS 4.7 and later.

### MySQL/MariaDB Int width in schema
### MySQL/MariaDB int width in schema

MySQL 8.0.17 stopped reporting the width attribute for integers while MariaDB did not change its behaviour.
This results in constant rebuilding of the schema when MySQLSchemaManager expects a field to look like e.g.
`INT(8)` and MySQL server reports it simply as `INT`. MySQLSchemaManager has been updated to detect the MySQL
server implementation and act accordingly. In cases when auto-detection fails, you can force the desired behaviour like this:

```yml
SilverStripe\ORM\Connect\MySQLSchemaManager:
schema_use_int_width: true # or false when INT widths should be ignored
```
## Webserver Configuration
## Webserver configuration
### Overview
Expand All @@ -87,16 +88,16 @@ secure hosting via the `public/`. See [4.1.0 upgrading guide](/changelogs/4.1.0)
During runtime, Silverstripe CMS needs read access for the webserver user to your base path (including your webroot). It
also needs write access for the webserver user to the following locations:

* `public/assets/`: Used by the CMS and other logic to [store uploads](/developer_guides/files/file_storage)
* `TEMP_PATH`: Temporary file storage used for the default filesystem-based cache adapters in
- `public/assets/`: Used by the CMS and other logic to [store uploads](/developer_guides/files/file_storage)
- `TEMP_PATH`: Temporary file storage used for the default filesystem-based cache adapters in
[Manifests](/developer_guides/execution_pipeline/manifests), [Object Caching](/developer_guides/performance/caching)
and [Partial Template Caching](/developer_guides/templates/partial_template_caching).
See [Environment Management](/getting_started/environment_management).
* `.graphql-generated`: silverstripe/graphql version 4 introduces this directory. This is where your schema is
- `.graphql-generated`: silverstripe/graphql version 4 introduces this directory. This is where your schema is
stored once it [has been built](/developer_guides/graphql/getting_started/building_the_schema). Best practice
is to create it ahead of time, but if the directory doesn't exist and your project root is writable, the graphql
is to create it ahead of time, but if the directory doesn't exist and your project root is writable, the GraphQL
module will create it for you.
* `public/_graphql`: silverstripe/graphql version 4 introduces this directory. It's used for
- `public/_graphql`: silverstripe/graphql version 4 introduces this directory. It's used for
[schema introspection](/developer_guides/graphql/tips_and_tricks#schema-introspection). You should treat this folder
the same way you treat the `.graphql-generated` folder.

Expand Down Expand Up @@ -124,7 +125,7 @@ the `File.allowed_extensions` setting
(see [File Security](/developer_guides/files/file_security#file-types)). This whitelist uses the same defaults
configured through file upload through Silverstripe CMS, so is considered a second line of defence.

### Secure Assets {#secure-assets}
### Secure assets {#secure-assets}

Files can be kept in draft stage, and access restricted to certain user groups. These files are stored in a
special `.protected/` folder (defaulting to `public/assets/.protected/`).
Expand Down Expand Up @@ -160,7 +161,7 @@ app/
Don't forget to include this additional folder in any syncing and backup processes!
### Building, Packaging and Deployment {#building-packaging-deployment}
### Building, packaging and deployment {#building-packaging-deployment}
It is common to build a Silverstripe CMS application into a package on one environment (e.g. a CI server), and then deploy
the package to a (separate) webserver environment(s). This approach relies on all auto-generated files required by
Expand All @@ -169,19 +170,19 @@ Silverstripe CMS to be included in the package, or generated on the fly on each
The easiest way to ensure this is to commit auto generated files to source control. If those changes are considered too
noisy, here's some pointers for auto-generated files to trigger and include in a deployment package:
* `public/_resources/`: Frontend assets copied from the (inaccessible) `vendor/` folder
- `public/_resources/`: Frontend assets copied from the (inaccessible) `vendor/` folder
via [silverstripe/vendor-plugin](https://github.com/silverstripe/vendor-plugin).
See [Templates: Requirements](/developer_guides/templates/requirements#exposing-assets-webroot).
* `.graphql-generated/` and `public/_graphql/`: Schema and type definitions required by CMS and any GraphQL API endpoint.
- `.graphql-generated/` and `public/_graphql/`: Schema and type definitions required by CMS and any GraphQL API endpoint.
Generated by
[silverstripe/graphql v4](https://github.com/silverstripe/silverstripe-graphql). See
[building the schema](/developer_guides/graphql/getting_started/building_the_schema) and
[deploying the schema](/developer_guides/graphql/getting_started/deploying_the_schema).
* Various recipes create default files in `app/` and `public/` on `composer install`
- Various recipes create default files in `app/` and `public/` on `composer install`
and `composer update` via
[silverstripe/recipe-plugin](https://github.com/silverstripe/recipe-plugin).
### Web Worker Concurrency
### Web worker concurrency
It's generally a good idea to run multiple workers to serve multiple HTTP requests to Silverstripe CMS concurrently. The
exact number depends on your website needs. The CMS attempts to request multiple views concurrently. It also
Expand All @@ -196,13 +197,13 @@ allows serving of files larger than your PHP memory limit. Please be aware that
PHP's [max_execution_time](https://www.php.net/manual/en/function.set-time-limit.php), which can risk exhaustion of web
worker pools for long-running downloads.
### URL Rewriting
### URL rewriting
Silverstripe CMS expects URL paths to be rewritten to `public/index.php`. For Apache, this is preconfigured
through `.htaccess` files, and expects using the `mod_rewrite` module. By default, these files are located
in `public/.htaccess` and `public/assets/.htaccess`.
### HTTP Headers
### HTTP headers
Silverstripe CMS can add HTTP headers to responses it handles directly. These headers are often sensitive, for example
preventing HTTP caching for responses displaying data based on user sessions, or when serving protected assets. You need
Expand All @@ -216,7 +217,7 @@ the systems hosting it only allow valid values for this header.
See [Developer Guide: Security - Request hostname forgery](/developer_guides/security/secure_coding#request-hostname-forgery)
.
### CDNs and other Reverse Proxies
### CDNs and other reverse proxies
If your Silverstripe CMS site is hosted behind multiple HTTP layers, you're in charge of controlling which forwarded headers
are considered valid, and which IPs can set them.
Expand Down Expand Up @@ -268,32 +269,33 @@ see [Microsoft IIS and SQL Server configuration](https://forum.silverstripe.org/
Additionally, there are community supported guides for installing Silverstripe CMS on various environments:
* [Hosting via Bitnami](https://bitnami.com/stack/silverstripe/virtual-machine): In the cloud or as a locally hosted
- [Hosting via Bitnami](https://bitnami.com/stack/silverstripe/virtual-machine): In the cloud or as a locally hosted
virtual machine
* [Vagrant/Virtualbox with CentOS](https://forum.silverstripe.org/t/installing-via-vagrant-virtualbox-with-centos/2248)
* [macOS with Homebrew](https://forum.silverstripe.org/t/installing-on-osx-with-homebrew/2247)
* [macOS with MAMP](https://forum.silverstripe.org/t/installing-on-osx-with-mamp/2249)
* [Windows with WAMP](https://forum.silverstripe.org/t/installing-on-windows-via-wamp/2250)
* [Vagrant with silverstripe-australia/vagrant-environment](https://github.com/silverstripe-australia/vagrant-environment)
* [Vagrant with BetterBrief/vagrant-skeleton](https://github.com/BetterBrief/vagrant-skeleton)
- [Vagrant/Virtualbox with CentOS](https://forum.silverstripe.org/t/installing-via-vagrant-virtualbox-with-centos/2248)
- [macOS with Homebrew](https://forum.silverstripe.org/t/installing-on-osx-with-homebrew/2247)
- [macOS with MAMP](https://forum.silverstripe.org/t/installing-on-osx-with-mamp/2249)
- [Windows with WAMP](https://forum.silverstripe.org/t/installing-on-windows-via-wamp/2250)
- [Vagrant with silverstripe-australia/vagrant-environment](https://github.com/silverstripe-australia/vagrant-environment)
- [Vagrant with BetterBrief/vagrant-skeleton](https://github.com/BetterBrief/vagrant-skeleton)
### Email
Silverstripe CMS uses SwiftMailer to send email messages. New installations setup with silverstripe/installer are configured to use a `sendmail` found in `/usr/sbin/sendmail` or another location specified via configuration. Alternatively email can be configured to use SMTP or other mail transports instead of sendmail.
You _must_ ensure emails are being sent from your _production_ environment. You can do this by testing that the ***Lost password*** form available at `/Security/lostpassword` sends an email to your inbox, or with the following code snippet that can be run via a `SilverStripe\Dev\BuildTask`:
You *must* ensure emails are being sent from your *production* environment. You can do this by testing that the ***Lost password*** form available at `/Security/lostpassword` sends an email to your inbox, or with the following code snippet that can be run via a `SilverStripe\Dev\BuildTask`:
```php
$email = new SilverStripe\Control\Email\Email('[email protected]', '[email protected]', 'My test subject', 'My email body text');
use SilverStripe\Control\Email\Email;
$email = Email::create('[email protected]', '[email protected]', 'My test subject', 'My email body text');
$email->send();
```

Using the code snippet above also tests that the ability to set the "from" address is working correctly.

See the [email section](/developer_guides/email) for further details, including how to set the administrator "from" email address, change the `sendmail` binary location and how to use SMTP or other mail transports instead of sendmail.


## PHP Requirements for older Silverstripe CMS releases {#php-support}
## PHP requirements for older Silverstripe CMS releases {#php-support}

Silverstripe CMS's PHP support has changed over time and if you are looking to upgrade PHP on your Silverstripe CMS site, this
table may be of use:
Expand All @@ -311,9 +313,9 @@ From Silverstripe CMS 5 onwards, the [Silverstripe CMS major release policy](/pr

Silverstripe CMS supports the following web browsers:

* Google Chrome
* Microsoft Edge
* Mozilla Firefox
- Google Chrome
- Microsoft Edge
- Mozilla Firefox

We aim to provide satisfactory experiences in Apple Safari. Silverstripe CMS works well across Windows, Linux, and Mac
operating systems.
Expand Down
Loading

0 comments on commit 684ba27

Please sign in to comment.