This commit is contained in:
Dennis Eichhorn 2020-02-11 20:01:11 +01:00
commit 4bb316b355
24 changed files with 346 additions and 225 deletions

13
.github/workflows/greetings.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Greetings
on: [pull_request, issues]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Thank you for createing this issue. We will check it as soon as possible.'
pr-message: 'Thank you for your pull request. We will check it as soon as possible.'

View File

@ -1,5 +1,5 @@
# Introduction # Introduction
This developer guides intention is to provide useful information for developers to help you to understand the structure of the application, important classes, workflows and standards for code quality as well as code style. The intention is to provide enough information to get a basic understanding of these key elements for module developers, frontend developers or developers working on the core application. This developer guides intention is to provide useful information for developers to help you to understand the structure of the application, important api functions, workflows and standards for code quality as well as code style. The intention is to provide enough information to get a basic understanding of these key elements for module developers, frontend developers or developers working on the core application.
The guide is **not** explaining in detail how to use classes, for this you can find the automatically generated code documentation. All the provided information are very important to ensure the quality of the published code and often are mandatory. Not following these guides can cause security issues, worsen the user experience or even cause malfunction as well as make it difficult for other developers to understand the code. The guide is **not** explaining in detail how to use all of the api, for this you can find the automatically generated code documentation or even better use the test cases. All the provided information are very important to ensure the quality of the published code and often are mandatory. Not following these guides can cause security issues, worsen the user experience or even cause malfunction as well as make it difficult for other developers to understand the code.

View File

@ -1,72 +1,47 @@
# Summary # General
* [Introduction]({%}?page=README) * [Introduction]({%}?page=README)
* [Application Structure]({%}?page=application/structure) * [Setup]({%}?page=general/setup)
* [Application Sample]({%}?page=application/sample) * [Application Structure]({%}?page=general/structure)
## Setup ## Quality & Standards
* [Installation]({%}?page=setup/installation) * [Code Inspection]({%}?page=quality/inspections)
* [Developer Environment]({%}?page=setup/developer_environment) * [Documentation Standards]({%}?page=standards/documentation)
* [General Code Standards]({%}?page=standards/general)
* [Security Standards]({%}?page=security/security_guidelines)
* [Html Coding Standards]({%}?page=standards/html)
* [Php Coding Standards]({%}?page=standards/php)
## Standards ## Examples
* [General]({%}?page=standards/general) * [Application Sample]({%}?page=example_app/app)
* [Documentation]({%}?page=standards/documentation) * [Modules]({%}?page=example_module/module)
* [Html]({%}?page=standards/html) * [Packages]({%}?page=example_module/packages)
* [Php]({%}?page=standards/php)
## Basics ## API
* [Routing]({%}?page=basics/routing) * [Routing]({%}?page=basics/routing)
* [Dispatching]({%}?page=basics/dispatching) * [Dispatching]({%}?page=basics/dispatching)
* [Views]({%}?page=basics/views) * [Views]({%}?page=basics/views)
* [Requests]({%}?page=basics/requests) * [Requests]({%}?page=basics/requests)
* [Responses]({%}?page=basics/responses) * [Responses]({%}?page=basics/responses)
## Security
* [Security Guidelines]({%}?page=security/security_guidelines)
## DataStorage
* [Cache]({%}?page=datastorage/cache) * [Cache]({%}?page=datastorage/cache)
* [Session]({%}?page=datastorage/session) * [Session]({%}?page=datastorage/session)
* [Cookie]({%}?page=datastorage/cookie) * [Cookie]({%}?page=datastorage/cookie)
* [LocalStorage]({%}?page=datastorage/localstorage) * [LocalStorage]({%}?page=datastorage/localstorage)
* [Database Connection]({%}?page=datastorage/database/connection)
### Database
* [Connection]({%}?page=datastorage/database/connection)
* [DataMapper]({%}?page=datastorage/database/datamapper) * [DataMapper]({%}?page=datastorage/database/datamapper)
* [Queries]({%}?page=datastorage/database/queries) * [Queries]({%}?page=datastorage/database/queries)
## Code Quality
* [Code Quality]({%}?page=quality/code_quality)
* [Inspections]({%}?page=quality/inspections)
* [Tests]({%}?page=quality/tests)
## Frontend
* [Styles and Layout]({%}?page=frontend/styles_and_layout) * [Styles and Layout]({%}?page=frontend/styles_and_layout)
* [Charting]({%}?page=services/charting) * [Charting]({%}?page=services/charting)
* [Codes]({%}?page=services/codes) * [Codes]({%}?page=services/codes)
## Components
* [Modules]({%}?page=components/modules)
* [Packages]({%}?page=components/packages)
## System
* [Events]({%}?page=services/events) * [Events]({%}?page=services/events)
* [Filesystem]({%}?page=services/filesystem) * [Filesystem]({%}?page=services/filesystem)
* [Logging]({%}?page=services/logging) * [Logging]({%}?page=services/logging)
* [Tasks]({%}?page=services/tasks) * [Tasks]({%}?page=services/tasks)
## Message
* [Mail]({%}?page=services/mail) * [Mail]({%}?page=services/mail)
* [Encoding]({%}?page=services/encoding) * [Encoding]({%}?page=services/encoding)
* [Encryption]({%}?page=services/encryption) * [Encryption]({%}?page=services/encryption)
## Localization
* [Localization]({%}?page=services/localization) * [Localization]({%}?page=services/localization)
* [Money]({%}?page=services/money) * [Money]({%}?page=services/money)
## Stdl
* [Queues]({%}?page=services/queues) * [Queues]({%}?page=services/queues)
* [Collection]({%}?page=services/collection) * [Collection]({%}?page=services/collection)
## Helper
* [Validation]({%}?page=services/validation) * [Validation]({%}?page=services/validation)
* [Uri]({%}?page=services/uri) * [Uri]({%}?page=services/uri)

View File

@ -41,11 +41,11 @@ $dispatcher->dispatch(function($para1, $para2) { ... }, $staticToCallPara1, $sta
The dispatcher accepts the resoults from the `route()` method of the router which is an array of routes. The dispatcher accepts the resoults from the `route()` method of the router which is an array of routes.
```php ```php
$dispatcher->dispatch($router->route($request)) $dispatcher->dispatch($router->route($request->getUri()->getRoute()));
``` ```
Based on the function definition returned by the router it's possible to pass more parameters to the function such e.g. request and response objects. Based on the function definition returned by the router it's possible to pass more parameters to the function such e.g. request and response objects.
```php ```php
$dispatcher->dispatch($router->route($request), $request, $response) $dispatcher->dispatch($router->route($request->getUri()->getRoute()), $request, $response);
``` ```

View File

@ -114,3 +114,37 @@ $query->prefix(...)->select(...)->from(...)->where(...)->groupBy('columnA', 'col
### Schema Builder ### Schema Builder
The schema builder is used for schema related operations such as `DROP`, `CREATE` etc. The schema builder is used for schema related operations such as `DROP`, `CREATE` etc.
#### Drop Database
A database can be dropped with `dropDatabase`.
```php
$query->dropDatabase('test');
```
#### Create Table
A table can be created with `createTable`.
```php
$query->createTable('user_roles')
->field('user_id', 'INT', null, false, true, true, 'users', 'ext1_id')
->field('role_id', 'VARCHAR(10)', '1', true, false, false, 'roles', 'ext2_id');
```
#### Show Tables
All tables of a database can be returned with `selectTables`.
```php
$query->selectTables();
```
#### Show Table Fields
All table fields of a table can be returned with `selectFields`.
```php
$query->selectFields('test');
```

View File

@ -212,7 +212,7 @@ use app\view\TestView;
class TestController class TestController
{ {
private $app = null; private ApplicationAbstract $app;
/* the dispatcher passes the ApplicationAbstract reference to the controller */ /* the dispatcher passes the ApplicationAbstract reference to the controller */
public function __construct(ApplicationAbstract $app) public function __construct(ApplicationAbstract $app)

View File

@ -5,6 +5,7 @@ The following directory structure should roughly visualize how modules are struc
* {UniqueModuleName} * {UniqueModuleName}
* Admin * Admin
* Install * Install
* db.json
* Navigation.install.json * Navigation.install.json
* Navigation.php * Navigation.php
* Routes * Routes
@ -51,6 +52,83 @@ The content of the navigation install file highly depends on the module and shou
Some modules can be used without requiring any additional installations it all depends on how the other modules got implemented. Thats also why many modules don't offer any integration at all and Some modules can be used without requiring any additional installations it all depends on how the other modules got implemented. Thats also why many modules don't offer any integration at all and
are almost stand-alone without the possibility to get extended. are almost stand-alone without the possibility to get extended.
### Database schema
The database schema of a module is defined in the `db.json` file and is automatically installed during the installation process.
In the following you can find a sample `db.json` file.
```json
{
"task": {
"name": "task",
"fields": {
"task_id": {
"name": "task_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"task_title": {
"name": "task_title",
"type": "VARCHAR(255)",
"null": false
},
"task_desc": {
"name": "task_desc",
"type": "TEXT",
"null": false
},
"task_type": {
"name": "task_type",
"type": "TINYINT",
"null": false
},
"task_created_at": {
"name": "task_created_at",
"type": "DATETIME",
"default": null,
"null": true
},
"task_created_by": {
"name": "task_created_by",
"type": "INT",
"null": false,
"foreignTable": "account",
"foreignKey": "account_id"
}
}
},
"task_media": {
"name": "task_media",
"fields": {
"task_media_id": {
"name": "task_media_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"task_media_src": {
"name": "task_media_src",
"type": "INT",
"null": false,
"foreignTable": "task",
"foreignKey": "task_id"
},
"task_media_dst": {
"name": "task_media_dst",
"type": "INT",
"null": false,
"foreignTable": "media",
"foreignKey": "media_id"
}
}
}
}
```
### Installer.php ### Installer.php
In contrast to the install file for other modules this file has to follow more strict standards. The following example shows you the bare minimum requirements of a installation file: In contrast to the install file for other modules this file has to follow more strict standards. The following example shows you the bare minimum requirements of a installation file:

View File

@ -34,7 +34,32 @@ In the files directory all files are stored.
The `package.json` file contains information of the package. The `package.json` file contains information of the package.
```json ```json
{
"name": "{MODULE_NAME|RESOURCE_NAME|phpOMS|jsOMS|cssOMS}",
"type": "Modules",
"version": "1.0.1",
"update": [
{
"download": {
"{download_uri}": "{save_to_path/file_name}"
},
"move": {
"{file_or_directory_to_move}": "{new_destination}"
},
"copy": {
"{file_or_directory_to_copy}": [
"{new_destination}"
]
},
"delete": [
"{file_or_directory_to_delete}"
],
"cmd": [
"{php|sh|batch_script_to_execute}",
]
}
]
}
``` ```
### Other ### Other

0
example_module/update.md Normal file
View File

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

3
general/base_uml.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 43 KiB

0
general/overview.md Normal file
View File

91
general/setup.md Normal file
View File

@ -0,0 +1,91 @@
# Setup
In order to setup the application for development for the first time please see the following instructions and recommendations.
## Dev-Environment Requirements
Make sure your dev-environment or server fulfills the following requirements:
* PHP >= 7.4
* PHP extensions: mbstring, gd, zip, dom, mysql/pgsql/sqlsrv, sqlite, bcmath, imap*, redis*, memcached*, ftp*, socket*, curl*, xml*
* databases: mysql, postgresql, sqlsrv
* webserver: apache2
* mod_headers
The application and frameworks can use different databases. For the normal development process you only need one (whichever you prefer). However, in order to test against all supported databases and all code paths you would have to install all above mentioned databases.
Extensions marked with `*` are optional. They are only required in special situations.
Steps which are not explained in this documentation are how to install and setup the above mentioned software and extensions. You also should configure the webserver paths accordingly in order to access the application in the browser.
## Option 1: Linux Shell Script
This also installs all required dev tools and sets up the directory structure by itself. Using this method also tears down previous installs for a fresh install perfect for re-installing from the current development version. Furthermore, the use of PHPUnit also makes sure that the application is working as intended. The PHPUnit install also provides lots of dummy data for better integration and functionality testing of your own code/modules.
### Steps
The following steps will setup the application, download all necessary tools and perform extensive code quality checks and documentation tasks:
1. Go to the directory where you want to install the build script
2. Run `git clone -b develop https://github.com/Orange-Management/Build.git`
3. Modify `config.sh` (most likely the db credentials and paths)
4. Run `chmod +x buildProject.sh`
5. Run `./buildProject.sh`
After the installation you'll have access to the following content:
* Application: `http://127.0.0.1`
* Code Coverager: `http://127.0.0.1/Build/coverage/`
* Test Report: `${INSPECTION_PATH}/test/ReportExternal`
* Unit Test Report: `${INSPECTION_PATH}/test/testdox.txt`
* PHPStan Report: `${INSPECTION_PATH}/test/phpstan.json`
* ... and more
### Annotation
During this process the database automatically gets dropped (if existing) and re-created. If you don't have `xdebug` installed but `phpdbg` you can replace `php phpunit.phar ...` with `phpdbg -qrr phpunit.phar ...` or use `pcov` for much faster code coverage generation.
## Option 2: PHPUnit Test Suits
This wil only setup the application including some dummy data and also perform the code tests but no quality checks.
### Steps
1. Go to the directory where you want to install the application
2. Run `git clone -b develop https://github.com/Orange-Management/Orange-Management.git`
3. Run `git submodule update --init --recursive >/dev/null`
4. Run `git submodule foreach git checkout develop >/dev/null`
5. Install Composer
6. Run `composer install` inside `Orange-Management`
7. Run `php vendor/bin/phpunit --configuration tests/phpunit_no_coverage.xml` inside `Orange-Management` or open `http://127.0.0.1/Install`
After the installation you'll have access to the following content:
* Application: `http://127.0.0.1`
* Code Coverager: `http://127.0.0.1/Build/coverage/`
### Annotation
During this process the database automatically gets dropped (if existing) and re-created. If you don't have `xdebug` installed but `phpdbg` you can replace `php phpunit.phar ...` with `phpdbg -qrr phpunit.phar ...` or use `pcov` for much faster code coverage generation.
## Git Hooks (Linux only)
The git hooks perform various checks and validations during the `commit` and warn the developer about invalid code or code style/guideline violations.
For developers it is recommended to copy the contents of the `default.sh` file in the `Build` repository under `Hooks` to your `pre-commit` file in the `.git/hooks` directory. If the `pre-commit` file doesn't exist just create it.
The same should be done with every module. Simply go to `.git/modules/**/hooks` and also add the content of the `default.sh` file to all `pre-commit` files.
By doing this every commit will be inspected and either pass without warnings, pass with warnings or stop with errors. This will allow you to fix code before committing it. Be aware only changed files will be inspected. Also make sure all `pre-commit` have `+x` permissions.
## Tools
The following tools are important to test the application and to ensure the code quality. The configurations and sample shell executions can be found in the `Build` directory. These tools are also downloaded during the setup process of the `buildProject.sh` script.
* composer
* phploc
* phpunit
* phpcs
* phpmetrics
* documentor
* phpstan

View File

@ -4,7 +4,7 @@ The user request gets passed through the entire application to all modules. The
The routes usually reference endpoints in the module `controllers` which collects the model data through the model `mapper` and creates a partial response `view` with an assigned `template` and the collected model data. The routes usually reference endpoints in the module `controllers` which collects the model data through the model `mapper` and creates a partial response `view` with an assigned `template` and the collected model data.
![Application Flow](Developer-Guide/application/app_flow.svg) ![Application Flow](Developer-Guide/general/app_flow.svg)
In the following only the WebApplication and Application are mentioned as the other components are explained in detail in their respective documentation. In the following only the WebApplication and Application are mentioned as the other components are explained in detail in their respective documentation.
@ -28,3 +28,9 @@ The `Application` workload depends heavily on the type of the application but in
* Page View * Page View
Furthermore the Application also performs a `CSRF` check, defines the `CSP`, authenticates the user and handles global errors such as invalid application permission, database connection error etc. Furthermore the Application also performs a `CSRF` check, defines the `CSP`, authenticates the user and handles global errors such as invalid application permission, database connection error etc.
## Database
A short extract of the database structure can be seen below. Please note that this only contains the very basic tables from a fresh install without very limited modules and even then we only included the key tables for simplicity reasons.
![Application Flow](Developer-Guide/general/base_uml.svg)

View File

@ -6,17 +6,53 @@ Code inspections are very important in order to maintain the same code quality t
Tools used for the code inspection are: Tools used for the code inspection are:
* PhpLoc * PHPUnit
* PhpMetrics * PHPStan
* PhpUnit (see tests) * Jasmine
* Jasmine (see tests) * PHPCS
* Custom scripts/tools * Custom scripts/tools
These tools are all installed by running the `setup.sh` script from the Build repository. These tools are all installed by running the `setup.sh` script from the Build repository.
## External Tools ## PHPUnit
As external tool scrutinizer is used to automate code inspection and provide insight on issues, bugs, best practices etc. This application uses PHPUnit as unit testing framework. Unit tests for specific classes need to be named in the same manner as the testing class.
In order to run all tests and also creating the dummy data for UI tests, execute the following command:
```sh
php vendor/bin/phpunit -c tests/PHPUnit/phpunit_no_coverage.xml
```
In order to also create a code coverage report run:
```sh
php vendor/bin/phpunit -c tests/PHPUnit/phpunit_default.xml
```
### Modules
Every module needs to have a `Admin` directory containing a class called `AdminTest.php` which is used for testing the installation, activation, deactivation, uninstall and remove of the module. Tests that install, update, remove etc. a module need to have a group called `admin`. After running the `AdminTest.php` test the final state of the module should be installed and active, only this way it's possible to further test the controller and models. A code coverage of at least 80% is mandatory for every module for integration.
## PHPStan
With phpstan the code base is statically analyzed based on its configuration. This will help you to follow some of the "best" practices we enforce.
```sh
php vendor/bin/phpstan analyse --autoload-file=phpOMS/Autoloader.php -l 7 -c Build/Config/phpstan.neon --error-format=prettyJson ./ > Build/test/phpstan.json
```
## Jasmine
The javascript testing is done with jasmine. The javascript testing directory is structured the same way as the `Framework`. Unit tests for specific classes need to be named in the same manner as the testing class.
## PHP CS
Besides the code tests and static code analysis the code style is another very imporant inspection to ensure the code quality.
```sh
php vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" -s --report-junit=Build/test/junit_phpcs.xml
```
## Git Hooks (Linux only) ## Git Hooks (Linux only)

View File

@ -1,27 +0,0 @@
# Tests
The applications goal is to achive 90% code coverage, which applies for the framework, applications as well as all modules. All unit tests are located in the corresponding `tests` directories.
## PHPUnit
This application uses PHPUnit as unit testing framework. Unit tests for specific classes need to be named in the same manner as the testing class.
In order to run all tests and also creating the dummy data for UI tests, execute the following command:
```sh
php phpunit.phar -c tests/PHPUnit/phpunit_no_coverage.xml
```
In order to also create a code coverage report run:
```sh
php phpunit.phar -c tests/PHPUnit/phpunit_default.xml
```
### Modules
Every module needs to have a `Admin` directory containing a class called `AdminTest.php` which is used for testing the installation, activation, deactivation, uninstall and remove of the module. Tests that install, update, remove etc. a module need to have a group called `admin`. After running the `AdminTest.php` test the final state of the module should be installed and active, only this way it's possible to further test the controller and models. A code coverage of at least 80% is mandatory for every module for integration.
## Jasmine
The javascript testing is done with jasmine. The javascript testing directory is structured the same way as the `Framework`. Unit tests for specific classes need to be named in the same manner as the testing class.

View File

@ -107,23 +107,23 @@ Input validation be implemented on multiple levels.
1. Regex validation in html/javascript by using the `pattern=""` attribute 1. Regex validation in html/javascript by using the `pattern=""` attribute
2. Type hints for method parameters wherever possible. 2. Type hints for method parameters wherever possible.
3. Making use of the `Validation` classes as much as possible 3. Making use of the `Validation` classes as much as possible
4. **Don't** sanitize at all! Accept or dismiss. 4. **Don't** sanitize! Accept or dismiss.
## Inclusion and file paths ## Inclusion and file paths
Be vigilant of where and how the path for the following scenarios comes from: Be vigilant of where and how the path for the following scenarios comes from:
1. `include $path;` 1. `include $path;`
2. `fopen($path);` 2. `\fopen($path);`
3. `file_get_contents('../relative/path/to/' . $path);` 3. `\file_get_contents('../relative/path/to/' . $path);`
4. `mkdir($path);` 4. `\mkdir($path);`
These are just a few examples but it is very important to make sure, that these paths only have access to wherever the programmer intended them for. At first it is always a good idea to get the `$path = realpath($path)` of a path in order to make sure the path exists and for further validation. These are just a few examples but it is very important to make sure, that these paths only have access to wherever the programmer intended them for. At first it is always a good idea to get the `$path = \realpath($path)` of a path in order to make sure the path exists and for further validation.
Example usage: Example usage:
```php ```php
if(($pathNew = realpath($path)) === false) { if(($pathNew = \realpath($path)) === false) {
throw new PathException($path); throw new PathException($path);
} }
``` ```

View File

@ -10,7 +10,7 @@ Supported codes are:
* Aztec * Aztec
* QR * QR
All codes expect the string to encode as parameter, the basic dimensions (width, height) and optionally the orientation for barcodes. The hoirzontal barcode image size will be adjusted automatically based on its length. All codes expect the string to encode as parameter, the basic dimensions (width, height) and optionally the orientation for barcodes. The horizontal barcode image size will be adjusted automatically based on its length.
```php ```php
$c128b = new C128b('ABcdeFG0123+-!@?', 200, 50); $c128b = new C128b('ABcdeFG0123+-!@?', 200, 50);

View File

@ -1,39 +0,0 @@
# Developer Environment
The following points are only recommendations to help with the development process. Support for other settings or tools cannot be guaranteed.
## IDE/Editor
The following IDEs and editors are recommended
1. PHPStorm
2. Visual Studio Code
1. Markdown All in One
2. PHP Debug
3. PHP IntelliSense
4. PHP Server
5. PHPUnit
6. SVG Viewer
## Tools
The following tools are important to test the application and to ensure the code quality. The configurations and sample shell executions can be found in the `Build` directory. These tools are also downloaded during the setup process of the `buildProject.sh` script (see installation documentation).
* composer
* phploc
* phpunit
* phpcs
* phpmetrics
* documentor
* phpstan
* phan
## Git Hooks (Linux only)
The git hooks perform various checks and validations during the `commit` and warn the developer about invalid code or code style/guideline violations.
For developers it is recommended to copy the contents of the `default.sh` file in the `Build` repository under `Hooks` to your `pre-commit` file in the `.git/hooks` directory. If the `pre-commit` file doesn't exist just create it.
The same should be done with every module. Simply go to `.git/modules/**/hooks` and also add the content of the `default.sh` file to all `pre-commit` files.
By doing this every commit will be inspected and either pass without warnings, pass with warnings or stop with errors. This will allow you to fix code before committing it. Be aware only changed files will be inspected. Also make sure all `pre-commit` have `+x` permissions.

View File

@ -1,67 +0,0 @@
# Installation
Installing the application as a developer can be achived by following one of the following instructions.
## Server Requirements
* PHP >= 7.2
* PDO PHP Extension
* mbstring
* database such as mysql
* apache2
* mod_headers
### Recommended Extensions
The following extensions are recommended for tests and in some cases required by the build tools
* ast
* phear
* memcache
* Sqlite
* socket
* curl
* imap
* bcmath
* zip
* php*-dev
* dom
* xml
* phar
* opcache
* gd / gd2
## Linux Shell Script
This is the preferred way to install the application since this also installs all required dev tools and sets up the directory structure by itself. Using this method also tears down previous installs for a fresh install perfect for re-installing from the current development version. Furthermore the use of phpUnit also makes sure that the application is working as intended. The phpUnit install also provides lots of dummy data for better integration and functionality testing of your own code/modules.
### Steps
The following steps will setup the application, download all necessary tools and perform extensive code quality checks and documentation tasks:
1. Go somewhere where you want to install the build script
2. Enter `git clone -b develop https://github.com/Orange-Management/Build.git`
3. Modify `config.sh`
4. Run `chmod +x buildProject.sh`
5. Run `./buildProject.sh`
Alternatively after cloning the git repository:
1. Run `php composor.phar install` inside `Orange-Management`
2. Run `php phpunit.phar --configuration tests/phpunit_no_coverage.xml` inside `Orange-Management` or open `http://your_url.com/Install`
This wil only setup the application instead of also performing additional code quality checks.
### Annotation
During this process the database automatically gets dropped (if existing) and re-created. The database user and password can't be changed right now since the install config relies on the same data. Future releases will make use of a new user that will get set up by the install script as well. If you don't have `xdebug` installed but `phpdbg` you can replace `php phpunit.phar ...` with `phpdbg -qrr phpunit.phar ...`.
## Git Hooks (Linux only)
The git hooks perform various checks and validations during the `commit` and warn the developer about invalid code or code style/guideline violations.
For developers it is recommended to copy the contents of the `default.sh` file in the `Build` repository under `Hooks` to your `pre-commit` file in the `.git/hooks` directory. If the `pre-commit` file doesn't exist just create it.
The same should be done with every module. Simply go to `.git/modules/**/hooks` and also add the content of the `default.sh` file to all `pre-commit` files.
By doing this every commit will be inspected and either pass without warnings, pass with warnings or stop with errors. This will allow you to fix code before committing it. Be aware only changed files will be inspected. Also make sure all `pre-commit` have `+x` permissions.

View File

@ -87,7 +87,7 @@ The javascript documentation is based on JsDoc, therefore only valid JsDoc comme
```js ```js
/** /**
* File description * File description.
* *
* @package Package name * @package Package name
* @copyright Orange Management * @copyright Orange Management

View File

@ -92,7 +92,6 @@ function()
```php ```php
class Test class Test
{ {
} }
``` ```
@ -160,3 +159,17 @@ All string representations should use single quotes `''` unless `""` provides si
```js ```js
'This is a string' 'This is a string'
``` ```
## Todos
Most issues should be documented in the code as todos and vice versa.
```php
/**
* @todo Orange-Management/Repository#IssueNumber
* Below comes the issue/todo description.
* This way developers can see todos directly in the code without going to an external source.
* Todos must not have empty lines in their descriptions.
* If the external ressources have empty lines they must be removed in the todo comment.
*/
```

View File

@ -155,23 +155,3 @@ The following functions and (super-) global variables MAY only be used in the ph
* `flock()` * `flock()`
* `socket_create()` * `socket_create()`
* `socket_connect()` * `socket_connect()`
The usage of the following functions SHOULD be avoided and inspected for any kind of possible injection.
* `include()`
* `include_once()`
* `require()`
* `require_once()`
* `fopen()`
* `delete()`
* `copy()`
* `file()`
* `file_get_contents()`
* `file_put_contents()`
* `readfile()`
* `rename()`
* `symlink()`
* `rmdir()`
* `mkdir()`
* `touch()`
* `unlink()`