Merge branch 'develop' into FIX_DefaultWorkstation_On_Bom
This commit is contained in:
commit
3048036009
1380 changed files with 14101 additions and 10477 deletions
|
|
@ -4,10 +4,10 @@ languages:
|
|||
JavaScript: true
|
||||
PHP: true
|
||||
engines:
|
||||
phpcodesniffer: true
|
||||
phpcodesniffer: true
|
||||
exclude_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'test/*'
|
||||
- 'htdocs/includes/*'
|
||||
- 'htdocs/includes/*'
|
||||
|
|
|
|||
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
open_collective: dolibarr
|
||||
custom: https://wiki.dolibarr.org/index.php/Subscribe
|
||||
github: [eldy]
|
||||
github: [eldy]
|
||||
|
|
|
|||
10
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
10
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -7,7 +7,7 @@ body:
|
|||
attributes:
|
||||
value: |
|
||||
This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.
|
||||
|
||||
|
||||
- type: textarea
|
||||
id: bug
|
||||
attributes:
|
||||
|
|
@ -27,19 +27,19 @@ body:
|
|||
attributes:
|
||||
label: Environment OS
|
||||
description: Server OS type and version
|
||||
|
||||
|
||||
- type: input
|
||||
id: environment-webserver
|
||||
attributes:
|
||||
label: Environment Web server
|
||||
description: Webserver type and version
|
||||
|
||||
|
||||
- type: input
|
||||
id: environment-php
|
||||
attributes:
|
||||
label: Environment PHP
|
||||
description: PHP version
|
||||
|
||||
|
||||
- type: input
|
||||
id: environment-database
|
||||
attributes:
|
||||
|
|
@ -63,7 +63,7 @@ body:
|
|||
attributes:
|
||||
label: Steps to reproduce the behavior
|
||||
description: Verbose description
|
||||
|
||||
|
||||
- type: textarea
|
||||
id: files
|
||||
attributes:
|
||||
|
|
|
|||
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
|
@ -21,7 +21,7 @@ body:
|
|||
attributes:
|
||||
label: Use case
|
||||
description: Verbose description
|
||||
|
||||
|
||||
- type: textarea
|
||||
id: suggested-implementation
|
||||
attributes:
|
||||
|
|
|
|||
417
.github/logToCs.py
vendored
Executable file
417
.github/logToCs.py
vendored
Executable file
|
|
@ -0,0 +1,417 @@
|
|||
#!/usr/bin/env python3
|
||||
# pylint: disable=invalid-name
|
||||
"""
|
||||
Convert a log to CheckStyle format.
|
||||
|
||||
Url: https://github.com/mdeweerd/LogToCheckStyle
|
||||
|
||||
The log can then be used for generating annotations in a github action.
|
||||
|
||||
Note: this script is very young and "quick and dirty".
|
||||
Patterns can be added to "PATTERNS" to match more messages.
|
||||
|
||||
# Examples
|
||||
|
||||
Assumes that logToCs.py is available as .github/logToCs.py.
|
||||
|
||||
## Example 1:
|
||||
|
||||
|
||||
```yaml
|
||||
- run: |
|
||||
pre-commit run -all-files | tee pre-commit.log
|
||||
.github/logToCs.py pre-commit.log pre-commit.xml
|
||||
- uses: staabm/annotate-pull-request-from-checkstyle-action@v1
|
||||
with:
|
||||
files: pre-commit.xml
|
||||
notices-as-warnings: true # optional
|
||||
```
|
||||
|
||||
## Example 2:
|
||||
|
||||
|
||||
```yaml
|
||||
- run: |
|
||||
pre-commit run --all-files | tee pre-commit.log
|
||||
- name: Add results to PR
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
.github/logToCs.py pre-commit.log | cs2pr
|
||||
```
|
||||
|
||||
Author(s):
|
||||
- https://github.com/mdeweerd
|
||||
|
||||
License: MIT License
|
||||
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET # nosec
|
||||
|
||||
|
||||
def remove_prefix(string, prefix):
|
||||
"""
|
||||
Remove prefix from string
|
||||
|
||||
Provided for backward compatibility.
|
||||
"""
|
||||
if prefix and string.startswith(prefix):
|
||||
return string[len(prefix) :]
|
||||
return string
|
||||
|
||||
|
||||
def convert_to_checkstyle(messages, root_path=None):
|
||||
"""
|
||||
Convert provided message to CheckStyle format.
|
||||
"""
|
||||
root = ET.Element("checkstyle")
|
||||
for message in messages:
|
||||
fields = parse_message(message)
|
||||
if fields:
|
||||
add_error_entry(root, **fields, root_path=root_path)
|
||||
return ET.tostring(root, encoding="utf_8").decode("utf_8")
|
||||
|
||||
|
||||
def convert_text_to_checkstyle(text, root_path=None):
|
||||
"""
|
||||
Convert provided message to CheckStyle format.
|
||||
"""
|
||||
root = ET.Element("checkstyle")
|
||||
for fields in parse_file(text):
|
||||
if fields:
|
||||
add_error_entry(root, **fields, root_path=root_path)
|
||||
return ET.tostring(root, encoding="utf_8").decode("utf_8")
|
||||
|
||||
|
||||
ANY_REGEX = r".*?"
|
||||
FILE_REGEX = r"\s*(?P<file_name>\S.*?)\s*?"
|
||||
FILEGROUP_REGEX = r"\s*(?P<file_group>\S.*?)\s*?"
|
||||
EOL_REGEX = r"[\r\n]"
|
||||
LINE_REGEX = r"\s*(?P<line>\d+?)\s*?"
|
||||
COLUMN_REGEX = r"\s*(?P<column>\d+?)\s*?"
|
||||
SEVERITY_REGEX = r"\s*(?P<severity>error|warning|notice|style|info)\s*?"
|
||||
MSG_REGEX = r"\s*(?P<message>.+?)\s*?"
|
||||
MULTILINE_MSG_REGEX = r"\s*(?P<message>(?:.|.[\r\n])+)"
|
||||
# cpplint confidence index
|
||||
CONFIDENCE_REGEX = r"\s*\[(?P<confidence>\d+)\]\s*?"
|
||||
|
||||
|
||||
# List of message patterns, add more specific patterns earlier in the list
|
||||
# Creating patterns by using constants makes them easier to define and read.
|
||||
PATTERNS = [
|
||||
# beautysh
|
||||
# File ftp.sh: error: "esac" before "case" in line 90.
|
||||
re.compile(
|
||||
f"^File {FILE_REGEX}:{SEVERITY_REGEX}:"
|
||||
f" {MSG_REGEX} in line {LINE_REGEX}.$"
|
||||
),
|
||||
# beautysh
|
||||
# File socks4echo.sh: error: indent/outdent mismatch: -2.
|
||||
re.compile(f"^File {FILE_REGEX}:{SEVERITY_REGEX}: {MSG_REGEX}$"),
|
||||
# yamllint
|
||||
# ##[group].pre-commit-config.yaml
|
||||
# ##[error]97:14 [trailing-spaces] trailing spaces
|
||||
# ##[endgroup]
|
||||
re.compile(rf"^##\[group\]{FILEGROUP_REGEX}$"), # Start file group
|
||||
re.compile(
|
||||
rf"^##\[{SEVERITY_REGEX}\]{LINE_REGEX}:{COLUMN_REGEX}{MSG_REGEX}$"
|
||||
), # Msg
|
||||
re.compile(r"^##(?P<file_endgroup>\[endgroup\])$"), # End file group
|
||||
# File socks4echo.sh: error: indent/outdent mismatch: -2.
|
||||
re.compile(f"^File {FILE_REGEX}:{SEVERITY_REGEX}: {MSG_REGEX}$"),
|
||||
# ESLint (JavaScript Linter), RoboCop, shellcheck
|
||||
# path/to/file.js:10:2: Some linting issue
|
||||
# path/to/file.rb:10:5: Style/Indentation: Incorrect indentation detected
|
||||
# path/to/script.sh:10:1: SC2034: Some shell script issue
|
||||
re.compile(f"^{FILE_REGEX}:{LINE_REGEX}:{COLUMN_REGEX}: {MSG_REGEX}$"),
|
||||
# Cpplint default output:
|
||||
# '%s:%s: %s [%s] [%d]\n'
|
||||
# % (filename, linenum, message, category, confidence)
|
||||
re.compile(f"^{FILE_REGEX}:{LINE_REGEX}:{MSG_REGEX}{CONFIDENCE_REGEX}$"),
|
||||
# MSVC
|
||||
# file.cpp(10): error C1234: Some error message
|
||||
re.compile(
|
||||
f"^{FILE_REGEX}\\({LINE_REGEX}\\):{SEVERITY_REGEX}{MSG_REGEX}$"
|
||||
),
|
||||
# Java compiler
|
||||
# File.java:10: error: Some error message
|
||||
re.compile(f"^{FILE_REGEX}:{LINE_REGEX}:{SEVERITY_REGEX}:{MSG_REGEX}$"),
|
||||
# Python
|
||||
# File ".../logToCs.py", line 90 (note: code line follows)
|
||||
re.compile(f'^File "{FILE_REGEX}", line {LINE_REGEX}$'),
|
||||
# Pylint, others
|
||||
# path/to/file.py:10: [C0111] Missing docstring
|
||||
# others
|
||||
re.compile(f"^{FILE_REGEX}:{LINE_REGEX}: {MSG_REGEX}$"),
|
||||
# Shellcheck:
|
||||
# In script.sh line 76:
|
||||
re.compile(
|
||||
f"^In {FILE_REGEX} line {LINE_REGEX}:{EOL_REGEX}?"
|
||||
f"({MULTILINE_MSG_REGEX})?{EOL_REGEX}{EOL_REGEX}"
|
||||
),
|
||||
# eslint:
|
||||
# /path/to/filename
|
||||
# 14:5 error Unexpected trailing comma comma-dangle
|
||||
re.compile(
|
||||
f"^{FILE_REGEX}{EOL_REGEX}"
|
||||
rf"\s+{LINE_REGEX}:{COLUMN_REGEX}\s+{SEVERITY_REGEX}\s+{MSG_REGEX}$"
|
||||
),
|
||||
]
|
||||
|
||||
# Severities available in CodeSniffer report format
|
||||
SEVERITY_NOTICE = "notice"
|
||||
SEVERITY_WARNING = "warning"
|
||||
SEVERITY_ERROR = "error"
|
||||
|
||||
|
||||
def strip_ansi(text: str):
|
||||
"""
|
||||
Strip ANSI escape sequences from string (colors, etc)
|
||||
"""
|
||||
return re.sub(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])", "", text)
|
||||
|
||||
|
||||
def parse_file(text):
|
||||
"""
|
||||
Parse all messages in a file
|
||||
|
||||
Returns the fields in a dict.
|
||||
"""
|
||||
# pylint: disable=too-many-branches
|
||||
# regex required to allow same group names
|
||||
try:
|
||||
import regex # pylint: disable=import-outside-toplevel
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"The 'parsefile' method requires 'python -m pip install regex'"
|
||||
) from exc
|
||||
|
||||
patterns = [pattern.pattern for pattern in PATTERNS]
|
||||
# patterns = [PATTERNS[0].pattern]
|
||||
|
||||
file_group = None # The file name for the group (if any)
|
||||
full_regex = "(?:(?:" + (")|(?:".join(patterns)) + "))"
|
||||
results = []
|
||||
|
||||
for fields in regex.finditer(
|
||||
full_regex, strip_ansi(text), regex.MULTILINE
|
||||
):
|
||||
if not fields:
|
||||
continue
|
||||
result = fields.groupdict()
|
||||
|
||||
if len(result) == 0:
|
||||
continue
|
||||
|
||||
severity = result.get("severity", None)
|
||||
file_name = result.get("file_name", None)
|
||||
confidence = result.pop("confidence", None)
|
||||
new_file_group = result.pop("file_group", None)
|
||||
file_endgroup = result.pop("file_endgroup", None)
|
||||
|
||||
if new_file_group is not None:
|
||||
# Start of file_group, just store file
|
||||
file_group = new_file_group
|
||||
continue
|
||||
|
||||
if file_endgroup is not None:
|
||||
file_group = None
|
||||
continue
|
||||
|
||||
if file_name is None:
|
||||
if file_group is not None:
|
||||
file_name = file_group
|
||||
result["file_name"] = file_name
|
||||
else:
|
||||
# No filename, skip
|
||||
continue
|
||||
|
||||
if confidence is not None:
|
||||
# Convert confidence level of cpplint
|
||||
# to warning, etc.
|
||||
confidence = int(confidence)
|
||||
|
||||
if confidence <= 1:
|
||||
severity = SEVERITY_NOTICE
|
||||
elif confidence >= 5:
|
||||
severity = SEVERITY_ERROR
|
||||
else:
|
||||
severity = SEVERITY_WARNING
|
||||
|
||||
if severity is None:
|
||||
severity = SEVERITY_ERROR
|
||||
else:
|
||||
severity = severity.lower()
|
||||
|
||||
if severity in ["info", "style"]:
|
||||
severity = SEVERITY_NOTICE
|
||||
|
||||
result["severity"] = severity
|
||||
|
||||
results.append(result)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def parse_message(message):
|
||||
"""
|
||||
Parse message until it matches a pattern.
|
||||
|
||||
Returns the fields in a dict.
|
||||
"""
|
||||
for pattern in PATTERNS:
|
||||
fields = pattern.match(message)
|
||||
if not fields:
|
||||
continue
|
||||
result = fields.groupdict()
|
||||
if len(result) == 0:
|
||||
continue
|
||||
|
||||
if "confidence" in result:
|
||||
# Convert confidence level of cpplint
|
||||
# to warning, etc.
|
||||
confidence = int(result["confidence"])
|
||||
del result["confidence"]
|
||||
|
||||
if confidence <= 1:
|
||||
severity = SEVERITY_NOTICE
|
||||
elif confidence >= 5:
|
||||
severity = SEVERITY_ERROR
|
||||
else:
|
||||
severity = SEVERITY_WARNING
|
||||
result["severity"] = severity
|
||||
|
||||
if "severity" not in result:
|
||||
result["severity"] = SEVERITY_ERROR
|
||||
else:
|
||||
result["severity"] = result["severity"].lower()
|
||||
|
||||
if result["severity"] in ["info", "style"]:
|
||||
result["severity"] = SEVERITY_NOTICE
|
||||
|
||||
return result
|
||||
|
||||
# Nothing matched
|
||||
return None
|
||||
|
||||
|
||||
def add_error_entry( # pylint: disable=too-many-arguments
|
||||
root,
|
||||
severity,
|
||||
file_name,
|
||||
line=None,
|
||||
column=None,
|
||||
message=None,
|
||||
source=None,
|
||||
root_path=None,
|
||||
):
|
||||
"""
|
||||
Add error information to the CheckStyle output being created.
|
||||
"""
|
||||
file_element = find_or_create_file_element(
|
||||
root, file_name, root_path=root_path
|
||||
)
|
||||
error_element = ET.SubElement(file_element, "error")
|
||||
error_element.set("severity", severity)
|
||||
if line:
|
||||
error_element.set("line", line)
|
||||
if column:
|
||||
error_element.set("column", column)
|
||||
if message:
|
||||
error_element.set("message", message)
|
||||
if source:
|
||||
# To verify if this is a valid attribute
|
||||
error_element.set("source", source)
|
||||
|
||||
|
||||
def find_or_create_file_element(root, file_name: str, root_path=None):
|
||||
"""
|
||||
Find/create file element in XML document tree.
|
||||
"""
|
||||
|
||||
if root_path is not None:
|
||||
file_name = remove_prefix(file_name, root_path)
|
||||
for file_element in root.findall("file"):
|
||||
if file_element.get("name") == file_name:
|
||||
return file_element
|
||||
file_element = ET.SubElement(root, "file")
|
||||
file_element.set("name", file_name)
|
||||
return file_element
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Parse the script arguments and get the conversion done.
|
||||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Convert messages to Checkstyle XML format."
|
||||
)
|
||||
parser.add_argument(
|
||||
"input", help="Input file. Use '-' for stdin.", nargs="?", default="-"
|
||||
)
|
||||
parser.add_argument(
|
||||
"output",
|
||||
help="Output file. Use '-' for stdout.",
|
||||
nargs="?",
|
||||
default="-",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-i",
|
||||
"--in",
|
||||
dest="input_named",
|
||||
help="Input filename. Overrides positional input.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--out",
|
||||
dest="output_named",
|
||||
help="Output filename. Overrides positional output.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--root",
|
||||
metavar="ROOT_PATH",
|
||||
help="Root directory to remove from file paths."
|
||||
" Defaults to working directory.",
|
||||
default=os.getcwd(),
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.input == "-" and args.input_named:
|
||||
with open(
|
||||
args.input_named, encoding="utf_8", errors="surrogateescape"
|
||||
) as input_file:
|
||||
text = input_file.read()
|
||||
elif args.input != "-":
|
||||
with open(
|
||||
args.input, encoding="utf_8", errors="surrogateescape"
|
||||
) as input_file:
|
||||
text = input_file.read()
|
||||
else:
|
||||
text = sys.stdin.read()
|
||||
|
||||
root_path = os.path.join(args.root, "")
|
||||
|
||||
try:
|
||||
checkstyle_xml = convert_text_to_checkstyle(text, root_path=root_path)
|
||||
except ImportError:
|
||||
checkstyle_xml = convert_to_checkstyle(
|
||||
re.split(r"[\r\n]+", text), root_path=root_path
|
||||
)
|
||||
|
||||
if args.output == "-" and args.output_named:
|
||||
with open(args.output_named, "w", encoding="utf_8") as output_file:
|
||||
output_file.write(checkstyle_xml)
|
||||
elif args.output != "-":
|
||||
with open(args.output, "w", encoding="utf_8") as output_file:
|
||||
output_file.write(checkstyle_xml)
|
||||
else:
|
||||
print(checkstyle_xml)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
6
.github/workflows/exakat.yml
vendored
6
.github/workflows/exakat.yml
vendored
|
|
@ -22,7 +22,7 @@ jobs:
|
|||
- name: Exakat
|
||||
uses: docker://exakat/exakat-ga
|
||||
with:
|
||||
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/AddZero,Structures/DropElseAfterReturn,Structures/IfWithSameConditions,Structures/MergeIfThen,Structures/NestedTernary,Structures/ElseIfElseif,Structures/ExitUsage,Structures/RepeatedPrint,Structures/RepeatedRegex,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
|
||||
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/AddZero,Structures/DropElseAfterReturn,Structures/IfWithSameConditions,Structures/MergeIfThen,Structures/NestedTernary,Structures/ElseIfElseif,Structures/ExitUsage,Structures/RepeatedPrint,Structures/RepeatedRegex,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
|
||||
ignore_dirs: '/htdocs/includes/,/htdocs/install/doctemplates/,/build/,/dev/,/doc/,/scripts/,/test/'
|
||||
file_extensions: php
|
||||
project_reports: Perfile
|
||||
file_extensions: php
|
||||
project_reports: Perfile
|
||||
|
|
|
|||
2
.github/workflows/phpcs.yml
vendored
2
.github/workflows/phpcs.yml
vendored
|
|
@ -1,6 +1,7 @@
|
|||
name: "PHPCS"
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
paths:
|
||||
- "**.php"
|
||||
|
|
@ -11,6 +12,7 @@ jobs:
|
|||
phpcs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Get git sources
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 50 # important!
|
||||
|
|
|
|||
63
.github/workflows/phpcsfixer.yml.disabled
vendored
63
.github/workflows/phpcsfixer.yml.disabled
vendored
|
|
@ -1,63 +0,0 @@
|
|||
name: GitHub CI PHPCS and PHPCBF
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
#on:
|
||||
# push:
|
||||
# paths:
|
||||
# - '**.php'
|
||||
|
||||
jobs:
|
||||
#filesChanged:
|
||||
# uses: ./.github/workflows/files_changed.yaml
|
||||
# with:
|
||||
# folder_path: .*
|
||||
|
||||
linter_name:
|
||||
name: Run & fix PHP Code Sniffer
|
||||
runs-on: ubuntu-latest
|
||||
#needs: filesChanged
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
# fetch-depth: 10
|
||||
|
||||
- name: echo Get list of all changed files
|
||||
run: |
|
||||
#echo ${{ needs.filesChanged.outputs.all_changed_files }}
|
||||
#echo boolean_output=${{ needs.filesChanged.outputs.boolean_output }}
|
||||
echo github.head_ref=${{github.head_ref}}
|
||||
echo github.base_ref=${{github.base_ref}}
|
||||
echo github.ref_name=${{github.ref_name}}
|
||||
|
||||
- uses: eldy/phpcsfixer-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
use_default_configuration_file: false
|
||||
phpcs_standard: 'dev/setup/codesniffer/ruleset.xml'
|
||||
phpcs_head_ref: ${{github.head_ref}}
|
||||
phpcs_base_ref: ${{github.base_ref}}
|
||||
phpcs_ref_name: ${{github.ref_name}}
|
||||
phpcs_github_event_name: ${{github.event_name}}
|
||||
phpcs_files: ${{ needs.filesChanged.outputs.all_changed_files }}
|
||||
|
||||
#- uses: stefanzweifel/git-auto-commit-action@v4 # auto commit the fixes action for GitHub
|
||||
# with:
|
||||
# commit_message: Fix PHPCS errors by GitHub PHPCSfixer action
|
||||
|
||||
- name: Commit changes
|
||||
uses: EndBug/add-and-commit@v9.1.3
|
||||
with:
|
||||
default_author: github_actions
|
||||
committer_name: GitHub Actions
|
||||
committer_email: actions@github.com
|
||||
#author_name: PHP CS fixer
|
||||
#author_email: eldy@destailleur.fr
|
||||
#committer_name: PHP CS fixer
|
||||
#committer_email: eldy@destailleur.fr
|
||||
message: 'PHP CS fixer github action'
|
||||
add: '*.php'
|
||||
|
||||
45
.github/workflows/phpstan.yml
vendored
45
.github/workflows/phpstan.yml
vendored
|
|
@ -1,20 +1,17 @@
|
|||
# This is a basic workflow to check code with PHPSTAN tool
|
||||
|
||||
name: PHPSTAN
|
||||
name: "PHPStan"
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Triggers the workflow on pull request events but only for the develop branch
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
on: [push, pull_request]
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# This workflow contains a single job
|
||||
php-stan:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
|
@ -28,8 +25,8 @@ jobs:
|
|||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Get PHP and addons
|
||||
- name: Setup PHP
|
||||
id: setup-php
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
|
@ -37,25 +34,29 @@ jobs:
|
|||
php-version: "${{ matrix.php-version }}"
|
||||
tools: phpstan, cs2pr
|
||||
extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, mysql, pgsql, sqlite3, ldap, xml, mcrypt
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 14.x
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
# Restore old cache
|
||||
- name: Restore phpstan cache
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ./.github/tmp
|
||||
key: "phpstan-cache-PR-${{ matrix.php-version }}-${{ github.run_id }}"
|
||||
key: "phpstan-cache-${{ matrix.php-version }}-${{ github.run_id }}"
|
||||
restore-keys: |
|
||||
phpstan-cache-PR-${{ matrix.php-version }}-
|
||||
- name: Debug
|
||||
phpstan-cache-${{ matrix.php-version }}-
|
||||
- name: Show debug into
|
||||
run: cd ./.github/tmp && ls -al
|
||||
- name: Run PHPSTAN
|
||||
run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 4G -c phpstan_action.neon | cs2pr --graceful-warnings
|
||||
|
||||
# Run PHPStan
|
||||
- name: Run PHPStan
|
||||
id: phpstan
|
||||
run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 4G -a build/phpstan/bootstrap_action.php -c phpstan.neon | cs2pr --graceful-warnings
|
||||
# continue-on-error: true
|
||||
|
||||
# Save cache
|
||||
- name: "Save phpstan cache"
|
||||
uses: actions/cache/save@v3
|
||||
if: always()
|
||||
uses: actions/cache/save@v4
|
||||
if: ${{ success() || ( ! cancelled() && steps.cache.outputs.cache-hit != 'true' ) }}
|
||||
with:
|
||||
path: ./.github/tmp
|
||||
key: "phpstan-cache-PR-${{ matrix.php-version }}-${{ github.run_id }}"
|
||||
key: "phpstan-cache-${{ matrix.php-version }}-${{ github.run_id }}"
|
||||
|
|
|
|||
74
.github/workflows/pre-commit.yml
vendored
Normal file
74
.github/workflows/pre-commit.yml
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
---
|
||||
name: pre-commit
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
LOG_TO_CS: .github/logToCs.py
|
||||
RAW_LOG: pre-commit.log
|
||||
CS_XML: pre-commit.xml
|
||||
steps:
|
||||
- name: Install required tools
|
||||
run: sudo apt-get update && sudo apt-get install cppcheck
|
||||
if: false
|
||||
# Checkout git sources to analyze
|
||||
- uses: actions/checkout@v4
|
||||
# Action setup-python needs a requirements.txt or pyproject.toml
|
||||
# This ensures one of them exists.
|
||||
- name: Create requirements.txt if no requirements.txt or pyproject.toml
|
||||
run: |-
|
||||
[ -r requirements.txt ] || [ -r pyproject.toml ] || touch requirements.txt
|
||||
# Install python and pre-commit tool
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
cache: pip
|
||||
python-version: '3.11'
|
||||
- run: python -m pip install pre-commit regex
|
||||
# Restore previous cache of precommit
|
||||
- uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ~/.cache/pre-commit/
|
||||
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
# Run all the precommit tools (defined into pre-commit-config.yaml).
|
||||
# We can force exclusion of some of them here.
|
||||
- name: Run pre-commit hooks
|
||||
env:
|
||||
# SKIP is used by pre-commit to not execute certain hooks
|
||||
SKIP: no-commit-to-branch,php-cs,php-cbf,trailing-whitespace,end-of-file-fixer
|
||||
run: |
|
||||
set -o pipefail
|
||||
pre-commit gc
|
||||
pre-commit run --show-diff-on-failure --color=always --all-files | tee ${RAW_LOG}
|
||||
# If error, we convert log in the checkstyle format
|
||||
- name: Convert Raw Log to CheckStyle format
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
python ${LOG_TO_CS} ${RAW_LOG} ${CS_XML}
|
||||
# Annotate the git sources with the log messages
|
||||
- name: Annotate Source Code with Messages
|
||||
uses: staabm/annotate-pull-request-from-checkstyle-action@v1
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
files: ${{ env.CS_XML }}
|
||||
notices-as-warnings: true # optional
|
||||
prepend-filename: true # optional
|
||||
# Save the precommit cache
|
||||
- uses: actions/cache/save@v4
|
||||
if: ${{ ! cancelled() }}
|
||||
with:
|
||||
path: ~/.cache/pre-commit/
|
||||
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml')
|
||||
}}
|
||||
# Upload result log files of precommit into the Artifact shared store
|
||||
- name: Provide log as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ ! cancelled() }}
|
||||
with:
|
||||
name: precommit-logs
|
||||
path: |
|
||||
${{ env.RAW_LOG }}
|
||||
${{ env.CS_XML }}
|
||||
retention-days: 2
|
||||
3
.github/workflows/stale-issues-safe.yml
vendored
3
.github/workflows/stale-issues-safe.yml
vendored
|
|
@ -7,7 +7,7 @@ on:
|
|||
issue_comment:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
permissions: {} # none
|
||||
|
||||
jobs:
|
||||
|
|
@ -26,4 +26,3 @@ jobs:
|
|||
days-before-close: 10
|
||||
operations-per-run: 100
|
||||
dry-run: false
|
||||
|
||||
|
|
|
|||
147
.pre-commit-config.yaml
Normal file
147
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
---
|
||||
exclude: (?x)^( htdocs/includes/ckeditor/.* )
|
||||
repos:
|
||||
# Several miscellaneous checks and fix (on yaml files, end of files fix)
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: no-commit-to-branch
|
||||
args: [--branch, develop, --pattern, \d+.0]
|
||||
- id: check-yaml
|
||||
args: [--unsafe]
|
||||
- id: check-json
|
||||
- id: mixed-line-ending
|
||||
exclude: (?x)^(htdocs/includes/tecnickcom/tcpdf/fonts/.*)$
|
||||
- id: trailing-whitespace
|
||||
exclude_types: [markdown]
|
||||
- id: end-of-file-fixer
|
||||
- id: check-merge-conflict
|
||||
- id: check-executables-have-shebangs
|
||||
- id: check-shebang-scripts-are-executable
|
||||
exclude: (?x)^( dev/tools/dolibarr-postgres2mysql.php |test/other/test_serialize.php
|
||||
|test/phpunit/textutf8.txt |test/phpunit/textiso.txt |htdocs/includes/.*
|
||||
|htdocs/modulebuilder/template/.* |build/debian/dolibarr.postrm |build/debian/dolibarr.postinst
|
||||
|build/debian/dolibarr.config )$
|
||||
- id: fix-byte-order-marker
|
||||
- id: check-case-conflict
|
||||
|
||||
# Beautify shell scripts
|
||||
- repo: https://github.com/lovesegfault/beautysh.git
|
||||
rev: v6.2.1
|
||||
hooks:
|
||||
- id: beautysh
|
||||
exclude: (?x)^(dev/setup/git/hooks/pre-commit)$
|
||||
args: [--tab]
|
||||
|
||||
# Run local script
|
||||
#
|
||||
# For instance to update the license in edited files, you could add to local.sh:
|
||||
#
|
||||
# ```shell
|
||||
# #!/bin/bash
|
||||
# MYDIR=$(dirname "$0")
|
||||
# CHANGED_INTERNALS=$(git diff --name-only | grep -v includes)
|
||||
# "$MYDIR/dev/tools/updatelicense.php" $CHANGED_INTERNALS
|
||||
# ```
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: local-precommit-script
|
||||
name: Run local script before commit if it exists
|
||||
language: system
|
||||
entry: bash -c '[ ! -x local.sh ] || ./local.sh'
|
||||
pass_filenames: false
|
||||
|
||||
# Check PHP syntax
|
||||
- repo: https://github.com/bolovsky/pre-commit-php
|
||||
rev: 1.5.1
|
||||
hooks:
|
||||
- id: php-cbf
|
||||
files: \.(php)$
|
||||
args: [--standard=dev/setup/codesniffer/ruleset.xml -p]
|
||||
- id: php-cs
|
||||
files: \.(php)$
|
||||
args: [--standard=dev/setup/codesniffer/ruleset.xml -p]
|
||||
- id: php-lint
|
||||
|
||||
# Prettier (format code, only for non common files)
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v3.0.3
|
||||
hooks:
|
||||
- id: prettier
|
||||
stages: [manual]
|
||||
exclude: (?x)^( .*\.(phar |min\.css |lock) |htdocs/(includes|theme/common)/.*
|
||||
)$
|
||||
exclude_types:
|
||||
- php
|
||||
- executable
|
||||
- binary
|
||||
- shell
|
||||
- javascript
|
||||
- markdown
|
||||
- html
|
||||
- less
|
||||
- plain-text
|
||||
- scss
|
||||
- css
|
||||
- yaml
|
||||
|
||||
# Check format of yaml files
|
||||
- repo: https://github.com/adrienverge/yamllint.git
|
||||
rev: v1.32.0
|
||||
hooks:
|
||||
- id: yamllint
|
||||
args:
|
||||
- --no-warnings
|
||||
- -d
|
||||
- '{extends: relaxed, rules: {line-length: {max: 120}}}'
|
||||
|
||||
# Execute codespell to fix typo errors (setup of codespell into dev/tools/codespell/)
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.2.5
|
||||
hooks:
|
||||
- id: codespell
|
||||
# Due to a current limitation of configuration files,
|
||||
# we can specify two dicts only on the CLI.
|
||||
# You can update the contents of the exclude-file codespell-lines-ignore with the script
|
||||
# dev/tools/codespell/addCodespellIgnores.sh
|
||||
args:
|
||||
- -D
|
||||
- '-'
|
||||
- -D
|
||||
- dev/tools/codespell/codespell-dict.txt
|
||||
- -I
|
||||
- dev/tools/codespell/codespell-ignore.txt
|
||||
- -x
|
||||
- dev/tools/codespell/codespell-lines-ignore.txt
|
||||
- --uri-ignore-words-list
|
||||
- ned
|
||||
exclude: (?x)^(.phan/stubs/.*)$
|
||||
additional_dependencies: [tomli]
|
||||
- alias: codespell-lang-en_US
|
||||
# Only for translations with specialised exceptions
|
||||
# -D contains predefined conversion dictionaries
|
||||
# -L is to ignore some words
|
||||
id: codespell
|
||||
files: ^htdocs/langs/en_US/.*$
|
||||
args:
|
||||
- -D
|
||||
- '-'
|
||||
- -D
|
||||
- dev/tools/codespell/codespell-dict.txt
|
||||
- -L
|
||||
- informations,medias,uptodate,reenable,crypted,developpers
|
||||
- -L
|
||||
- "creat,unitl,alltime,datas,referers"
|
||||
- -I
|
||||
- dev/tools/codespell/codespell-ignore.txt
|
||||
- -x
|
||||
- dev/tools/codespell/codespell-lines-ignore.txt
|
||||
- --uri-ignore-words-list
|
||||
- ned
|
||||
|
||||
# Check some shell scripts
|
||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||
rev: v0.9.0.5
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
args: [-W, '100']
|
||||
29
.travis.yml
29
.travis.yml
|
|
@ -37,7 +37,7 @@ jobs:
|
|||
- stage: PHP min and max
|
||||
if: type = push
|
||||
php: '7.1'
|
||||
env:
|
||||
env:
|
||||
- DB=postgresql
|
||||
- TRAVIS_PHP_VERSION=7.1
|
||||
- stage: PHP min and max
|
||||
|
|
@ -49,7 +49,7 @@ jobs:
|
|||
- stage: PHP 8.3
|
||||
if: type = push AND branch = develop
|
||||
php: '8.3'
|
||||
env:
|
||||
env:
|
||||
- DB=mysql
|
||||
- TRAVIS_PHP_VERSION=8.3
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ before_install:
|
|||
if [ "$TRAVIS_PHP_VERSION" = '8.3' ]; then
|
||||
sudo apt install unzip apache2 php8.3 php8.3-cli php8.3-curl php8.3-mysql php8.3-pgsql php8.3-gd php8.3-imap php8.3-intl php8.3-ldap php8.3-xml php8.3-mbstring php8.3-xml php8.3-zip libapache2-mod-php8.3
|
||||
fi
|
||||
|
||||
|
||||
- |
|
||||
echo Install pgsql if run is for pgsql
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
|
|
@ -116,15 +116,15 @@ install:
|
|||
- |
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
fi
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
fi
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.2' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php8.2
|
||||
fi
|
||||
fi
|
||||
php -i | head -
|
||||
|
||||
|
||||
- |
|
||||
echo "Updating Composer config"
|
||||
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
|
||||
|
|
@ -133,7 +133,7 @@ install:
|
|||
php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
||||
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
sudo chmod -R a+rwx /usr/local/bin/composer
|
||||
|
||||
|
||||
#sudo apt install composer
|
||||
composer -V
|
||||
composer -n config -g vendor-dir htdocs/includes
|
||||
|
|
@ -229,7 +229,7 @@ before_script:
|
|||
#sudo mysqld_safe --skip-grant-tables --socket=/tmp/aaa
|
||||
sudo mysqld_safe --skip-grant-tables --socket=/tmp/aaa &
|
||||
sleep 3
|
||||
sudo ps fauxww
|
||||
sudo ps fauxww
|
||||
echo "MySQL set root password"
|
||||
sudo mysql -u root -h 127.0.0.1 -e "FLUSH PRIVILEGES; CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8'; ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'; CREATE USER 'root'@'127.0.0.1' IDENTIFIED BY 'password'; CREATE USER 'travis'@'127.0.0.1' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON travis.* TO root@127.0.0.1; GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1; FLUSH PRIVILEGES;"
|
||||
echo "MySQL grant"
|
||||
|
|
@ -238,7 +238,7 @@ before_script:
|
|||
sudo mysql -u root -h 127.0.0.1 -ppassword -e 'use mysql; select * from user;'
|
||||
echo "List pid file"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -e "show variables like '%pid%';"
|
||||
|
||||
|
||||
#sudo kill `cat /var/lib/mysqld/mysqld.pid`
|
||||
#sudo systemctl start mariadb
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ before_script:
|
|||
sudo mysql -u root -h 127.0.0.1 -ppassword -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||
echo "MySQL flush"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -e 'FLUSH PRIVILEGES;'
|
||||
|
||||
|
||||
echo "MySQL load sql"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
fi
|
||||
|
|
@ -415,12 +415,12 @@ script:
|
|||
echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE
|
||||
#cat $INSTALL_FORCED_FILE
|
||||
echo
|
||||
|
||||
|
||||
- |
|
||||
echo "Upgrading Dolibarr"
|
||||
# Ensure we catch errors with -e. Set this to +e if you want to go to the end to see log files.
|
||||
# Note: We keep +e because with pgsql, one of upgrade process fails even if migration seems ok, so
|
||||
# I disable stop on error to be able to continue.
|
||||
# I disable stop on error to be able to continue.
|
||||
set +e
|
||||
cd htdocs/install
|
||||
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log
|
||||
|
|
@ -483,6 +483,9 @@ script:
|
|||
php upgrade.php 18.0.0 19.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade18001900.log || cat $TRAVIS_BUILD_DIR/upgrade18001900.log
|
||||
php upgrade2.php 18.0.0 19.0.0 > $TRAVIS_BUILD_DIR/upgrade18001900-2.log || cat $TRAVIS_BUILD_DIR/upgrade18001900-2.log
|
||||
php step5.php 18.0.0 19.0.0 > $TRAVIS_BUILD_DIR/upgrade18001900-3.log || cat $TRAVIS_BUILD_DIR/upgrade18001900-3.log
|
||||
php upgrade.php 19.0.0 20.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade19002000.log || cat $TRAVIS_BUILD_DIR/upgrade19002000.log
|
||||
php upgrade2.php 19.0.0 20.0.0 > $TRAVIS_BUILD_DIR/upgrade19002000-2.log || cat $TRAVIS_BUILD_DIR/upgrade19002000-2.log
|
||||
php step5.php 19.0.0 20.0.0 > $TRAVIS_BUILD_DIR/upgrade19002000-3.log || cat $TRAVIS_BUILD_DIR/upgrade19002000-3.log
|
||||
set +e
|
||||
echo
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ PrestaShop-WS-Lib 94feb5f OSL-3.0 No
|
|||
PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
|
||||
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
|
||||
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
Sabre 4.0.2 BSD Yes DAV support
|
||||
Sabre 4.6.0 BSD Yes DAV support
|
||||
Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
|
||||
Symfony/var-dumper ??? MIT License Yes Library to make var dump (used by DebugBar)
|
||||
Stripe 10.7.0 MIT Licence Yes Library for Stripe module
|
||||
|
|
@ -69,7 +69,6 @@ jQuery jquerytreeview 1.4.1 MIT License Yes
|
|||
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
||||
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
||||
jsGanttImproved 2.7.3 BSD License Yes JS library (to build Gantt reports)
|
||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||
SwaggerUI 2.2.10 GPL-2+ Yes JS library to offer the REST API explorer
|
||||
|
||||
Image libraries:
|
||||
|
|
@ -79,7 +78,7 @@ Font libraries:
|
|||
Fontawesome 5.13 Font Awesome Free Licence Yes
|
||||
|
||||
|
||||
For more licenses compatibility informations: https://www.gnu.org/licenses/licenses.en.html
|
||||
For more licenses compatibility information: https://www.gnu.org/licenses/licenses.en.html
|
||||
|
||||
|
||||
Authors
|
||||
|
|
|
|||
99
ChangeLog
99
ChangeLog
|
|
@ -3,6 +3,26 @@ English Dolibarr ChangeLog
|
|||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 19.0.0 compared to 18.0.0 *****
|
||||
|
||||
For users:
|
||||
----------
|
||||
NEW: Compatibility with PHP 8.3
|
||||
...
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
...
|
||||
|
||||
WARNING:
|
||||
--------
|
||||
|
||||
The following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* More class properties (with old name in french) are now deprecated in favor of the property name in english.
|
||||
* Some API HTTP return code were moved from 401 to 403 to better follow REST specification.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 19.0.0 compared to 18.0.0 *****
|
||||
|
||||
For users:
|
||||
|
|
@ -19,9 +39,9 @@ NEW: #22626 date filter thirdparties contracts projects (#22707)
|
|||
NEW: #24085 Add the Project filter
|
||||
NEW: #25312 Support extrafields in selectForForms
|
||||
NEW: #26312 Manage intermediate BIC - SQL Part (#26325)
|
||||
NEW: Accountancy - Add quick navigation with keyboard shortcut on ledger (#26221)
|
||||
NEW: Accountancy - FEC/FEC2 format export with attachments (#26192)
|
||||
NEW: Accountancy - Option to choose length of lettering code
|
||||
NEW: Accountancy: Add quick navigation with keyboard shortcut on ledger (#26221)
|
||||
NEW: Accountancy: FEC/FEC2 format export with attachments (#26192)
|
||||
NEW: Accountancy: Option to choose length of lettering code
|
||||
NEW: Add a button to create a product or a service from an order or an invoice (#26173)
|
||||
NEW: Add a button to re-encrypt data of a dolcrypt extrafield password
|
||||
NEW: Add a CLI tool to regenerate all documents
|
||||
|
|
@ -35,7 +55,7 @@ NEW: add constant to check if qty shipped not greater than qty ordered
|
|||
NEW: Add context for the movement stock (role toconsume/toproduce) on mrp
|
||||
NEW: Add contract link on ticket
|
||||
NEW: Add culum Technical ID in list of details lines of an order (#26164)
|
||||
NEW: ADD: custom compute for exports
|
||||
NEW: Add custom compute for exports
|
||||
NEW: Add custom Text on footer total (#26334)
|
||||
NEW: Add different picto for each type of extrafields (date, string, ...)
|
||||
NEW: Add edit line on MO (#26122)
|
||||
|
|
@ -87,12 +107,12 @@ NEW: can edit bomline workstation
|
|||
NEW: Can edit both the Test and Live stripe customer account on payment
|
||||
NEW: Can include product variants in list of products
|
||||
NEW: Can manage ODT documents for groups of users.
|
||||
NEW: Can modify the picto into modulebuilder
|
||||
NEW: Can modify the picto into ModuleBuilder
|
||||
NEW: Can restore product in stock when deleting the supplier invoice
|
||||
NEW: Can see the favicon file into setup of properties of a website
|
||||
NEW: Can switch product batch management to no management. (#21691)
|
||||
NEW: Can upload/delete ODT template for project and tasks
|
||||
NEW: chart of accounts ES PCG08-PYME-CAT in catalan language
|
||||
NEW: Chart of accounts ES PCG08-PYME-CAT in catalan language
|
||||
NEW: clone skill object (#26526)
|
||||
NEW: close notification for interventions
|
||||
NEW: column in table prelevement_lignes for fk_user (#26196)
|
||||
|
|
@ -112,7 +132,7 @@ NEW: extrafields password accepts 'dolcrypt' algorithm (reversible algo)
|
|||
NEW: Factorize a lot of code for numbering modules
|
||||
NEW: filter on from/to period rather than month/year (#26378)
|
||||
NEW: FontAwesome - Add possibility to select another version
|
||||
NEW: Form for add object's property on moduleBuilder
|
||||
NEW: Form for add object's property on ModuleBuilder
|
||||
NEW: Can generate SEPA files for salaries (#26541)
|
||||
NEW: massactions to delete projects
|
||||
NEW: Generic doc template for donations (#26338)
|
||||
|
|
@ -120,15 +140,15 @@ NEW: Get list evaluation with skills details in user fiche (#26510)
|
|||
NEW: hidden conf to disable use of dns_get_record (which can become unresponsive) (#26339)
|
||||
NEW: improved resource data structure
|
||||
NEW: Include sub warehouse in inventory
|
||||
NEW: inventory without virtual products (kits)
|
||||
NEW: Inventory without virtual products (kits)
|
||||
NEW: Invoice subtypes for customers and vendors (#26233)
|
||||
NEW: Invoice time from task, make task note better display in invoice line
|
||||
NEW: lazy load to substitute project variables (#26451)
|
||||
NEW: LDAP Active Directory UserAccountControl (#25507)
|
||||
NEW: LDAP: Active Directory UserAccountControl (#25507)
|
||||
NEW: Library including math and financial functions (#25035)
|
||||
NEW: Loan - Can upload a file with drag and drop
|
||||
NEW: Loan: can upload a file with drag and drop
|
||||
NEW: Manage rate indirect. (#26449)
|
||||
NEW: memorize model name for pdf hooks
|
||||
NEW: memorize model name for PDF hooks
|
||||
NEW: Menu editor is responsive
|
||||
NEW: Merge the "Create ..." buttons on contract into one.
|
||||
NEW: More accurate tooltip on what admin permissions are
|
||||
|
|
@ -139,38 +159,38 @@ NEW: no need to create invoice supplier object on supplier card for standalone c
|
|||
NEW: Option to show label, ref+label or only ref of product in TakePOS
|
||||
NEW: payment full amount detail tooltip
|
||||
NEW: possibility to deselect line when create a recurring invoice + missing to use fk_parent_line
|
||||
NEW: Project - List - use select2 multiselect for status
|
||||
NEW: Projects: List - use select2 multiselect for status
|
||||
NEW: Propagate invoice extrafields into template invoice (#26529)
|
||||
NEW: remove include_subwarehouse form llx_inventory database table
|
||||
NEW: resource improvements - data structure (#26285)
|
||||
NEW: Retrieve vat details from the Greek Ministry of Finance GSIS SOAP web service and autocomplete third party fields
|
||||
NEW: Retrieve VAT details from the Greek Ministry of Finance GSIS SOAP web service and autocomplete third party fields
|
||||
NEW: Right for stats orders (#24607)
|
||||
NEW: rights and check access to create portal accounts
|
||||
NEW: Row in list higher height (#26177)
|
||||
NEW: Save date of RUM creation when creating a Stripe SEPA mandate
|
||||
NEW: shipment can include service (for information and invoicing) (#26407)
|
||||
NEW: Shipment: can include service (for information and invoicing) (#26407)
|
||||
NEW: Show id of module on the tooltip module help page
|
||||
NEW: show VAT free amount on payment input close #26208 (#26209)
|
||||
NEW: start and end date for due date filter on invoice list
|
||||
NEW: Sub total in list (#26165)
|
||||
NEW: Support html content for combo list of email recipient
|
||||
NEW: Website: Support of js into the Dolibarr server preview
|
||||
NEW: TakePOS - add constant to check qty asked is available (#24820)
|
||||
NEW: TakePOS - add constant to choose contact instead of customer (#24807)
|
||||
NEW: TakePOS - amount label with or without tax in free product (#24829)
|
||||
NEW: TakePOS compatibility with lots and serials
|
||||
NEW: TakePOS compatibility with lots and serials (#26426)
|
||||
NEW: TakePOS: add constant to check qty asked is available (#24820)
|
||||
NEW: TakePOS: add constant to choose contact instead of customer (#24807)
|
||||
NEW: TakePOS: amount label with or without tax in free product (#24829)
|
||||
NEW: TakePOS: compatibility with lots and serials (#26426)
|
||||
NEW: Tooltips are using ajax by default
|
||||
NEW: Top menu support picto of modules that are font awesome picto.
|
||||
NEW: updating by adding massactions for delete projects in societe tab
|
||||
NEW: updating by adding tooltip for api section in Modulebuilder
|
||||
NEW: updating by adjust request Sql for Salary invoice (#26279)
|
||||
NEW: updating by adjust request SQL for Salary invoice (#26279)
|
||||
NEW: updating for display Help title when try to delete Don (issue #25314)
|
||||
NEW: Upgrade in module builder in menu section
|
||||
NEW: use account address in sepa mandate (#23642)
|
||||
NEW: VAT rate - Add entity
|
||||
NEW: webportal site account
|
||||
NEW: When an user unset the batch management of products, transformation of each batch stock movement in global stock movement
|
||||
|
||||
FIX: #25828 wrong odt style naming
|
||||
|
||||
SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520)
|
||||
|
|
@ -185,10 +205,12 @@ For developers or integrators:
|
|||
QUAL Reduce very seriously the technical debt (using PHPStan, Psalm and Rector)
|
||||
NEW Tool in dev/tools/rector to autofix code using style coding practice rules
|
||||
|
||||
PERFORMANCE
|
||||
PERF: Removed a useless fetch_thirdparty
|
||||
PERF: Perf avoid 2 useless fetch into the triggers of agenda.
|
||||
PERF: performance & code quality enhancements template sections
|
||||
|
||||
QUALITY
|
||||
QUAL: Remove hardcoded code for OVH sms. Generic method is ok now.
|
||||
QUAL: Code fix using rector
|
||||
QUAL: Force subclass MINVERSION (#26314)
|
||||
|
|
@ -202,25 +224,26 @@ QUAL: Use dol_clone with parameter 2 for ->oldcopy
|
|||
QUAL: use switch case instead of if elseif statements for actions
|
||||
QUAL: Better respect of REST API RFC.
|
||||
|
||||
Hooks:
|
||||
NEW: [Add hook in user bank page]
|
||||
NEW: #19501 Add two hooks in dolreceiptprinter.php (#26439)
|
||||
NEW: Accountancy - Add hooks on PrintFieldList for expensereportsjournal, purchasesjournal, sellsjournal
|
||||
NEW: add a $notrigger param to Product::updatePrice() method (#26404)
|
||||
NEW: Add a rule to fix empty($conf->global->...) into !getDolGlobal...
|
||||
NEW: Add column extraparams on societe_rib
|
||||
NEW: Add hook on selectLotDataList() function (#25368)
|
||||
NEW: add hook on selectLotDataList() function (#25368)
|
||||
NEW: add Hooks and prepare extrafields management for product invoices consumptions (#26280)
|
||||
NEW: Add hooks on import, step 5 - 6 (#24915)
|
||||
NEW: add hooks on import, step 5 - 6 (#24915)
|
||||
NEW: add hook tabContentCreateSupplierOrder (#26418)
|
||||
NEW: add hook tabContentViewSupplierInvoice (#26431)
|
||||
NEW: add new hook AfterImportInsert
|
||||
NEW: add new hook OrderCard (#26380)
|
||||
NEW: add new hook tabContentCreateOrder (#26408)
|
||||
NEW: Add phpunit for REST API of contacts
|
||||
NEW: Add triggers COMPANY_RIB_XXX already present in companybankaccount.class.php
|
||||
NEW: Add triggers on import success
|
||||
NEW: Add trigger when deleting a bank account line
|
||||
NEW: subproduct triggers in product class (#25142)
|
||||
|
||||
Triggers:
|
||||
NEW: Trigger: add trigger COMPANY_RIB_XXX already present in companybankaccount.class.php
|
||||
NEW: Trigger: add trigger on import success
|
||||
NEW: Trigger: add trigger when deleting a bank account line
|
||||
NEW: Trigger: subproduct triggers in product class (#25142)
|
||||
|
||||
ModuleBuilder:
|
||||
NEW: ModuleBuilder: add section changeLog to Doc in MB
|
||||
NEW: ModuleBuilder: Add api url to documentation in ModuleBuilder
|
||||
NEW: ModuleBuilder: Checkin comments begin and end before each actions
|
||||
|
|
@ -229,7 +252,13 @@ NEW: ModuleBuilder: remove dictionary in ModuleBuilder
|
|||
NEW: ModuleBuilder: add page for create dictionary
|
||||
NEW: ModuleBuilder: add badge for each tabs
|
||||
NEW: ModuleBuilder: for edit name of dictionary and delete it in MB
|
||||
NEW: add barcode function to check if EAN13 is valid (
|
||||
|
||||
NEW: add a $notrigger param to Product::updatePrice() method (#26404)
|
||||
NEW: add a rule to fix empty($conf->global->...) into !getDolGlobal...
|
||||
NEW: add column extraparams on societe_rib
|
||||
NEW: add phpunit for REST API of contacts
|
||||
NEW: add barcode function to check if EAN13 is valid
|
||||
|
||||
|
||||
WARNING:
|
||||
--------
|
||||
|
|
@ -7073,7 +7102,7 @@ FIX: incoterms do not output into crabe invoice PDF
|
|||
FIX: in PgSQL no quote "word style" is permitted around column name
|
||||
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
|
||||
FIX: margin tab on customer card must filter on current entity invoices
|
||||
FIX: missing column into SQL on thridparty list
|
||||
FIX: missing column into SQL on thirdparty list
|
||||
FIX: only show projects of related third if external user
|
||||
FIX: PgSQL Module Resource list crash #5637
|
||||
FIX: php Strict
|
||||
|
|
@ -7127,7 +7156,7 @@ FIX: incoterms do not output into crabe invoice PDF
|
|||
FIX: in PgSQL no quote "word style" is permitted around column name
|
||||
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
|
||||
FIX: margin tab on customer card must filter on current entity invoices
|
||||
FIX: missing column into SQL on thridparty list
|
||||
FIX: missing column into SQL on thirdparty list
|
||||
FIX: only show projects of related third if external user
|
||||
FIX: PgSQL Module Resource list crash #5637
|
||||
FIX: php Strict
|
||||
|
|
@ -7763,7 +7792,7 @@ FIX: avoid SQL error when no sortfield send to method
|
|||
FIX: bad link into project box
|
||||
FIX: Bad title line in project view when using jmobile
|
||||
FIX: Bad translation key for project "Overview"
|
||||
FIX: Can create Proposal on close thridparty #3526
|
||||
FIX: Can create Proposal on close thirdparty #3526
|
||||
FIX: Can't change state on a contact
|
||||
FIX: Can't change the admin with default setup
|
||||
FIX: Can't delete thirdparty if there is some discounts
|
||||
|
|
@ -8099,7 +8128,7 @@ FIX: [ bug #3383 ] Company name is overlapped with company direction in PDF mode
|
|||
FIX: [ bug #3426 ] Unable to create an invoice from a contract with extrafields
|
||||
FIX: [ bug #3431 ] Invoice bank account is not respected
|
||||
FIX: [ bug #3432 ] Spaces should be removed from IBAN when formatting it
|
||||
FIX: Can create Proposal on close thridparty #3526
|
||||
FIX: Can create Proposal on close thirdparty #3526
|
||||
FIX: change order date on clone (as everywhere else)
|
||||
FIX: Close #2835 Customer prices of a product shows incorrect history order
|
||||
FIX: Close #2837 Product list table column header does not match column body
|
||||
|
|
|
|||
14
SECURITY.md
14
SECURITY.md
|
|
@ -48,12 +48,16 @@ Reports are processed around once a month.
|
|||
|
||||
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
|
||||
|
||||
* The version to analyze must be the last version available in the "develop" branch or in the last stable "vX.Y" released version. Reports on vulnerabilities already fixed (so already reported) in the develop branch will not be validated.
|
||||
* The version to analyze must be the last version available in the "develop" branch. Reports on vulnerabilities already fixed (so already reported) in the develop branch will not be validated.
|
||||
* $dolibarr_main_prod must be set to 1 in conf.php
|
||||
* $dolibarr_nocsrfcheck must be kept to the value 0 in conf.php (this is the default value)
|
||||
* $dolibarr_main_force_https must be set to something else than 0.
|
||||
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 in the backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default). CSRF attacks are accepted but
|
||||
double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
|
||||
* Some constant must be set in the backoffice menu Home - Setup - Other
|
||||
- MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3
|
||||
- MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1
|
||||
- MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1
|
||||
- MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1
|
||||
CSRF attacks and HTML injections are accepted but double check this setup that is experimental setup that already fix a lot of case and soon enabled by default.
|
||||
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles in "experimental", "development" or external modules are not valid vulnerabilities).
|
||||
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
|
||||
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
|
||||
|
|
@ -87,12 +91,10 @@ Scope is the web application (backoffice) and the APIs.
|
|||
* Logout and other instances of low-severity Cross-Site Request Forgery
|
||||
* Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated
|
||||
* Reports on features on modules flagged as "deprecated", "experimental" or "development" if the module needs to be enabled for that (this is not the case on production).
|
||||
* Software or libraries versions or private IP disclosure when logged-in user is admin
|
||||
* Stack traces or path disclosure when logged-in user is admin
|
||||
* Software or libraries versions, private IP disclosure, Stack traces or path disclosure when logged-in user is admin.
|
||||
* Any vulnerabilities due to a configuration different than the one defined in chapter "Scope for qualified vulnerabilities".
|
||||
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
|
||||
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the recommended fail2ban rules were not installed.
|
||||
* SSL/TLS best practices
|
||||
* Denial of Service attacks
|
||||
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
|
||||
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ See makepack-howto.txt for prerequisites.
|
|||
|
||||
--------------------------------------------------------------------------------------------------
|
||||
|
||||
- To build developper documentation, launch the script
|
||||
- To build developer documentation, launch the script
|
||||
> perl dolibarr-doxygen-build.pl
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,40 @@
|
|||
--- HOW TO USE COMPOSER
|
||||
|
||||
* Switch to the minimal version of PHP
|
||||
|
||||
update-alternatives --config php
|
||||
|
||||
|
||||
* To list packages
|
||||
|
||||
composer show -i
|
||||
cd htdocs/includes/diroflib
|
||||
composer install
|
||||
composer show -i
|
||||
|
||||
* To test upgrade of a lib with composer:
|
||||
|
||||
* To upgrade a lib with composer using the composer.json of the library only:
|
||||
|
||||
Remove entry in composer.lock
|
||||
Edit composer.json to change version to "x.y.z"
|
||||
composer -v update --root-reqs --no-dev --no-autoloader --dry-run ccampbell/chromephp
|
||||
|
||||
* To upgrade a lib with composer:
|
||||
cd htdocs/includes/diroflib
|
||||
rm composer.lock
|
||||
|
||||
Edit composer.json to change version to "x.y.z"
|
||||
|
||||
composer -v update --root-reqs --no-dev --ignore-platform-reqs
|
||||
composer -v update --root-reqs --no-dev --ignore-platform-reqs [--no-autoloader] [--dry-run] ccampbell/chromephp
|
||||
|
||||
|
||||
* To upgrade a lib with composer using the composer.json of Dolibarr:
|
||||
|
||||
Remove entry in composer.lock
|
||||
|
||||
cd /
|
||||
mv composer.json.disabled composer.json
|
||||
rm composer.lock
|
||||
|
||||
Edit composer.json to change version to "x.y.z"
|
||||
composer -v update --root-reqs --no-dev --no-autoloader ccampbell/chromephp
|
||||
|
||||
|
||||
composer -v update --root-reqs --no-dev --ignore-platform-reqs
|
||||
composer -v update --root-reqs --no-dev --ignore-platform-reqs [--no-autoloader] [--dry-run] ccampbell/chromephp
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export QUILT_PATCHES=debian/patches
|
|||
# dpkg -l List all packages
|
||||
# dpkg -b To build binary only package
|
||||
# dpkg -c package.deb List content of package
|
||||
# dpkg -I package.deb Give informations on package
|
||||
# dpkg -I package.deb Give information on package
|
||||
# dpkg -i package.deb Install a package
|
||||
# dpkg-reconfigure -plow package Reconfigure package
|
||||
# dpkg -L packagename List content of installed package
|
||||
|
|
@ -173,7 +173,7 @@ or
|
|||
> ls /srv/chroot
|
||||
|
||||
Puis pour se connecter et préparer l'environnement
|
||||
> schroot -c name_of_chroot (exemple schroot -c unstable-amd64-sbuild)
|
||||
> schroot -c name_of_chroot (example schroot -c unstable-amd64-sbuild)
|
||||
> cat /etc/debian_chroot to check which debian branch we are into
|
||||
> apt-get install vim dialog
|
||||
> vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok)
|
||||
|
|
@ -249,7 +249,7 @@ ou
|
|||
> git-buildpackage -us -uc --git-ignore-branch --git-upstream-branch=[upstream|upstream-x.y.z]
|
||||
|
||||
Note: To build an old version, do: git checkout oldtagname -b newbranchname; git-buildpackage -us -uc --git-debian-branch=newbranchname --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommitted file
|
||||
Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match
|
||||
Note: Package is built into directory ../build-area
|
||||
Note: To compare 2 packages: debdiff package1.dsc package2.dsc
|
||||
|
|
@ -345,7 +345,7 @@ To update dolibarr debian package when only files not into debian has changed:
|
|||
|
||||
* Checkout the branch you want to work on: master of debian/...
|
||||
* Manually, add patches into debian/patches and update the file debian/series, or do the 2 steps with "quilt import filepatch.patch"
|
||||
* You can test patching of serie with "quilt push" (autant de fois que de patch). Avec "quilt pop -a", on revient a l'état du upstream sans les patch.
|
||||
* You can test patching of series with "quilt push" (autant de fois que de patch). Avec "quilt pop -a", on revient a l'état du upstream sans les patch.
|
||||
* Update the debian/changelog to add entry of change.
|
||||
|
||||
Once files has been prepared, it's time to test:
|
||||
|
|
@ -357,7 +357,7 @@ ou
|
|||
> git-buildpackage -us -uc --git-ignore-branch --git-upstream-branch=[upstream|upstream-jessie|upstream-3.5.x|3.5.5]
|
||||
|
||||
Note: To build an old version, do: git checkout oldtagname -b newbranchname; git-buildpackage -us -uc --git-debian-branch=newbranchname --git-upstream-branch=[upstream|upstream-jessie|upstream-3.5.x|3.5.5]
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommitted file
|
||||
Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match
|
||||
Note: Package is built into directory ../build-area
|
||||
Note: To compare 2 packages: debdiff package1.dsc package2.dsc
|
||||
|
|
|
|||
0
build/debian/control
Executable file → Normal file
0
build/debian/control
Executable file → Normal file
|
|
@ -64,7 +64,7 @@ License: GPL-3+
|
|||
Files: htdocs/includes/ckeditor/*
|
||||
Copyright: 2003-2012 CKSource - Frederico Knabben
|
||||
License: GPL-2+
|
||||
The ckeditor is tripple licensed under the GNU General Public License (GPL),
|
||||
The ckeditor is triple licensed under the GNU General Public License (GPL),
|
||||
GNU Lesser General Public License (LGPL), and Mozilla Public License (MPL).
|
||||
In Debian, it is distributed under the GNU General Public License (GPL).
|
||||
.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
# Debian install package run: config, preinst, prerm, postinst, postrm
|
||||
#
|
||||
|
||||
# shellcheck disable=1091,2034
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/sh
|
||||
# postinst script for dolibarr
|
||||
|
||||
# shellcheck disable=1091,2086,2154
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
# shellcheck disable=1091,2006,2034,2086,2089,2090
|
||||
|
||||
#set -e
|
||||
set +e
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# shellcheck disable=2034,2086,2103,2164
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
export DH_VERBOSE=1
|
||||
export DH_OPTIONS=-v
|
||||
|
||||
#export DH_COMPAT=7 # This is the debhelper compatability version to use, now defined into compat file
|
||||
#export DH_COMPAT=7 # This is the debhelper compatibility version to use, now defined into compat file
|
||||
|
||||
|
||||
%:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
# Script used by the Dockerfile.
|
||||
# See README.md to know how to create a Dolibarr env with docker
|
||||
|
||||
usermod -u ${HOST_USER_ID} www-data
|
||||
groupmod -g ${HOST_USER_ID} www-data
|
||||
usermod -u "${HOST_USER_ID}" www-data
|
||||
groupmod -g "${HOST_USER_ID}" www-data
|
||||
|
||||
chgrp -hR www-data /var/www/html
|
||||
chmod g+rwx /var/www/html/conf
|
||||
|
|
@ -15,8 +15,8 @@ fi
|
|||
echo "[docker-run] => Set Permission to www-data for /var/documents"
|
||||
chown -R www-data:www-data /var/documents
|
||||
|
||||
echo "[docker-run] => update ${PHP_INI_DIR}/conf.d/dolibarr-php.ini"
|
||||
cat <<EOF > ${PHP_INI_DIR}/conf.d/dolibarr-php.ini
|
||||
echo "[docker-run] => update '${PHP_INI_DIR}/conf.d/dolibarr-php.ini'"
|
||||
cat <<EOF > "${PHP_INI_DIR}/conf.d/dolibarr-php.ini"
|
||||
date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC}
|
||||
memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M}
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
FROM mariadb:latest
|
||||
# Enable comented out UTF8 charset/collation options
|
||||
# Enable commented out UTF8 charset/collation options
|
||||
RUN sed '/utf8/ s/^#//' /etc/mysql/mariadb.cnf >/tmp/t && mv /tmp/t /etc/mysql/mariadb.cnf
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/perl
|
||||
#--------------------------------------------------------------------
|
||||
# Lance la generation de la doc dev doxygen
|
||||
# Start the generation of the development documentation with doxygen
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
# Detecte repertoire du script
|
||||
# Determine the patho of this script
|
||||
($DIR=$0) =~ s/([^\/\\]+)$//;
|
||||
$DIR||='.';
|
||||
$DIR =~ s/([^\/\\])[\\\/]+$/$1/;
|
||||
|
|
|
|||
|
|
@ -283,10 +283,10 @@ TYPEDEF_HIDES_STRUCT = NO
|
|||
# For small to medium size projects (<1000 input files) the default value is
|
||||
# probably good enough. For larger projects a too small cache size can cause
|
||||
# doxygen to be busy swapping symbols to and from disk most of the time
|
||||
# causing a significant performance penality.
|
||||
# causing a significant performance penalty.
|
||||
# If the system has enough physical memory increasing the cache will improve the
|
||||
# performance by keeping more symbols in memory. Note that the value works on
|
||||
# a logarithmic scale so increasing the size by one will rougly double the
|
||||
# a logarithmic scale so increasing the size by one will roughly double the
|
||||
# memory usage. The cache size is given by this formula:
|
||||
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ html {
|
|||
--toc-background: var(--side-nav-background);
|
||||
--toc-foreground: var(--side-nav-foreground);
|
||||
|
||||
/* height of an item in any tree / collapsable table */
|
||||
/* height of an item in any tree / collapsible table */
|
||||
--tree-item-height: 30px;
|
||||
|
||||
--memname-font-size: var(--code-font-size);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ If you want to build/test package locally:
|
|||
Use URL pattern (stable):
|
||||
For stable: http://www.dolibarr.org/files/lastbuild/package_debian-ubuntu/dolibarr_x.z.*.tar.gz
|
||||
|
||||
- For Dev, you can also add link serie to GIT HEAD.
|
||||
- For Dev, you can also add link series to GIT HEAD.
|
||||
- For stable, you can init from command line
|
||||
cd bzr/dolibarr-stable
|
||||
bzr init
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ foreach my $target (keys %CHOOSEDTARGET) {
|
|||
if ($CHOOSEDTARGET{$target} < 0) {
|
||||
print "Package $target not built (bad requirement).\n";
|
||||
} else {
|
||||
print "Package $target built succeessfully in $DESTI\n";
|
||||
print "Package $target built successfully in $DESTI\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke
|
|||
See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
|
||||
> Add path to ISCC into PATH windows var:
|
||||
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
|
||||
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
|
||||
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommended),
|
||||
open file build/exe/doliwamp.iss and click on button "Compile".
|
||||
The .exe file will be build into directory build.
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ Prerequisites to build autoexe DoliWamp package from Windows:
|
|||
This files describe steps made by Dolibarr packaging team to make a
|
||||
beta version of Dolibarr, step by step.
|
||||
|
||||
- Check all files are commited.
|
||||
- Check all files are committed.
|
||||
- Update version/info in ChangeLog, for this you can:
|
||||
To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
|
||||
To generate a changelog of a major new version x.y.0 (from a repo on branch x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
|
||||
|
|
@ -72,7 +72,7 @@ Recopy the content of the output file into the file ChangeLog.
|
|||
This files describe steps made by Dolibarr packaging team to make a
|
||||
complete release of Dolibarr, step by step.
|
||||
|
||||
- Check all files are commited.
|
||||
- Check all files are committed.
|
||||
- Update version/info in ChangeLog, for this you can:
|
||||
To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
|
||||
To generate a changelog of a major new version x.y.0 (from a repo pn branch x.y), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
|
||||
|
|
|
|||
|
|
@ -54,5 +54,5 @@ OBS:QualityCategory Stable|Testing|Development|Private
|
|||
For example: https://bugzilla.novell.com/show_bug.cgi?id=848083 to be a maintener of category
|
||||
https://build.opensuse.org/project/show/Application:ERP
|
||||
- Once done, go into project, category, subproject and enter a subproject for your application.
|
||||
Fo example: Dolibarr
|
||||
For example: Dolibarr
|
||||
- Then go onto project into your home and ask a publish to the category/you project your created.
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ Building a Patch file
|
|||
##################################################
|
||||
|
||||
This directory contains tools to build a patch after a developer has made changes on files in its Dolibarr tree.
|
||||
The output patch file can then be submited on Dolibarr dev mailing-list, with explanation on its goal, for inclusion in main branch.
|
||||
The output patch file can then be submitted on Dolibarr dev mailing-list, with explanation on its goal, for inclusion in main branch.
|
||||
|
||||
Using this tool is now deprecated. You must use git pull requests to submit contributions.
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
# with explanation on its goal, for inclusion in main branch.
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# shellcheck disable=2086,2291
|
||||
|
||||
echo ----- Building patch file mypatch.patch -----
|
||||
if [ -z "$1" ] || [ -z "$2" ];
|
||||
then
|
||||
|
|
|
|||
|
|
@ -5,12 +5,16 @@ PHPStan requires PHP >= 7.1
|
|||
|
||||
Config File is: ./phpstan.neon
|
||||
|
||||
In dolibarr/build/phpstan
|
||||
= Installation =
|
||||
|
||||
cd ./build/phpstan
|
||||
mkdir phpstan
|
||||
cd phpstan
|
||||
composer require --dev phpstan/phpstan
|
||||
|
||||
Build report from CLI:
|
||||
|
||||
= Build report from CLI =
|
||||
|
||||
In dolibarr/
|
||||
mv htdocs/custom /tmp/
|
||||
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
|
||||
|
|
@ -19,4 +23,4 @@ mv /tmp/custom htdocs
|
|||
|
||||
Build HTML report from Cron:
|
||||
Example of line to add into a cron to generate a HTML report:
|
||||
0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git pull; /home/dolibarr/phpstan/vendor/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")"<br>" } { print $0"<br>" } END{ print NR } ' > /home/dolibarr/doxygen.dolibarr.org/phpstan/index.html
|
||||
0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git pull; /home/dolibarr/phpstan/vendor/bin/phpstan -v analyze --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")"<br>" } { print $0"<br>" } END{ print NR } ' > /home/dolibarr/doxygen.dolibarr.org/phpstan/index.html
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ if (!defined("NOHTTPSREDIRECT")) {
|
|||
define("NOHTTPSREDIRECT", '1');
|
||||
}
|
||||
|
||||
global $conf, $langs, $user, $db;
|
||||
global $conf, $db, $langs, $user;
|
||||
include_once __DIR__ . '/../../htdocs/main.inc.php';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,16 @@
|
|||
<?php
|
||||
|
||||
// Load the main.inc.php file to have functions env defined
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined("NOSESSION")) {
|
||||
define("NOSESSION", '1');
|
||||
}
|
||||
if (!defined("NOHTTPSREDIRECT")) {
|
||||
define("NOHTTPSREDIRECT", '1');
|
||||
}
|
||||
|
||||
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
|
||||
define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
|
||||
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
|
||||
|
|
@ -7,9 +18,5 @@ define('DOL_URL_ROOT', '/');
|
|||
define('DOL_MAIN_URL_ROOT', '/');
|
||||
define('MAIN_DB_PREFIX', 'llx_');
|
||||
|
||||
// Load the main.inc.php file to have functions env defined
|
||||
define("NOLOGIN", '1');
|
||||
define("NOHTTPSREDIRECT", '1');
|
||||
|
||||
global $conf, $db, $langs, $user;
|
||||
// include_once DOL_DOCUMENT_ROOT . '/../../htdocs/main.inc.php';
|
||||
|
|
|
|||
0
build/rpm/dolibarr_fedora.spec
Executable file → Normal file
0
build/rpm/dolibarr_fedora.spec
Executable file → Normal file
0
build/rpm/dolibarr_generic.spec
Executable file → Normal file
0
build/rpm/dolibarr_generic.spec
Executable file → Normal file
0
build/rpm/dolibarr_mandriva.spec
Executable file → Normal file
0
build/rpm/dolibarr_mandriva.spec
Executable file → Normal file
0
build/rpm/dolibarr_opensuse.spec
Executable file → Normal file
0
build/rpm/dolibarr_opensuse.spec
Executable file → Normal file
|
|
@ -33,16 +33,9 @@
|
|||
"tecnickcom/tcpdf" : "6.3.2",
|
||||
"nnnick/chartjs" : "^3.7.1",
|
||||
"stripe/stripe-php" : "10.7.0",
|
||||
"maximebf/debugbar" : "1.18.2",
|
||||
"symfony/var-dumper" : ">=3.2"
|
||||
"maximebf/debugbar" : "1.18.2"
|
||||
},
|
||||
"require-dev" : {
|
||||
"php-parallel-lint/php-parallel-lint" : "^0",
|
||||
"php-parallel-lint/php-console-highlighter" : "^0",
|
||||
"phpunit/phpunit" : "^4",
|
||||
"squizlabs/php_codesniffer" : "^2",
|
||||
"phpunit/phpunit-selenium" : "^2",
|
||||
"rector/rector" : "^0.16.0"
|
||||
},
|
||||
"suggest" : {
|
||||
"ext-mysqlnd" : "To use with MySQL or MariaDB",
|
||||
|
|
@ -50,7 +43,7 @@
|
|||
"ext-pgsql" : "To use with PostgreSQL",
|
||||
"ext-gd" : "Image manipulation (Required but maybe built-in PHP)",
|
||||
"ext-imagick" : "Generation of thumbs from PDF",
|
||||
"ext-mcrypt" : "(Required but maybe built-in PHP)",
|
||||
"ext-intl" : "Intl",
|
||||
"ext-openssl" : "Secure connections (Emails, SOAP\u2026)",
|
||||
"ext-mbstring" : "Handle non UTF-8 characters",
|
||||
"ext-soap" : "Native SOAP",
|
||||
|
|
|
|||
|
|
@ -177,14 +177,14 @@ into
|
|||
|
||||
* Removed useless directories ("examples", "tools")
|
||||
|
||||
* Optionnaly, removed all fonts except
|
||||
dejavusans* (used by greek, arab, persan, romanian, turkish),
|
||||
* Optionally, removed all fonts except
|
||||
dejavusans* (used by greek, arab, person, romanian, turkish),
|
||||
freemono* (russian),
|
||||
cid*+msungstdlight+stsongstdlight+uni2cid* (chinese),
|
||||
helvetica* (all other languages),
|
||||
zapfdingbats.php (for special chars like form checkboxes)
|
||||
|
||||
* Optionnaly, made freemono the default monotype font if we removed courier
|
||||
* Optionally, made freemono the default monotype font if we removed courier
|
||||
In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
|
||||
- protected $default_monospaced_font = 'courier';
|
||||
+ protected $default_monospaced_font = 'freemono';
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ $error = 0;
|
|||
require_once $path."../../../htdocs/master.inc.php";
|
||||
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
|
||||
|
||||
global $db, $conf, $langs;
|
||||
|
||||
//$langs->setDefaultLang('en_US'); // To change default language of $langs
|
||||
$langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
|
@ -50,7 +52,7 @@ $langs->load("main"); // To load language file for default language
|
|||
// Load user and its permissions
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
dol_print_error(null, $user->error);
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ $langs->load("main"); // To load language file for default language
|
|||
// Load user and its permissions
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
dol_print_error(null, $user->error);
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ $langs->load("main"); // To load language file for default language
|
|||
// Load user and its permissions
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
dol_print_error(null, $user->error);
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ $langs->load("main"); // To load language file for default language
|
|||
// Load user and its permissions
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
dol_print_error(null, $user->error);
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ $langs->load("main"); // To load language file for default language
|
|||
// Load user and its permissions
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
dol_print_error(null, $user->error);
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Example fo recurring event, 1 week, no end, exported by Google
|
||||
Example for recurring event, 1 week, no end, exported by Google
|
||||
|
||||
# The recurring event were recorded every monday the 20150518. This is the Recurrence-id, but then
|
||||
# first occurrence was moved on tuesday. So this record were added.
|
||||
|
|
@ -38,7 +38,7 @@ END:VEVENT
|
|||
|
||||
|
||||
|
||||
Example fo recurring event, every 2 month, no end, exported by Google
|
||||
Example for recurring event, every 2 month, no end, exported by Google
|
||||
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID=Europe/Paris:20150519T080000
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
|
|||
|
||||
|
||||
/*
|
||||
* Parametre
|
||||
* Parameter
|
||||
*/
|
||||
|
||||
define('GEN_NUMBER_COMMANDE', $argv[1] ?? 10);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ $listoflastname = array("Joe","Marc","Steve","Laurent","Nico","Isabelle","Doroth
|
|||
|
||||
|
||||
/*
|
||||
* Parametre
|
||||
* Parameter
|
||||
*/
|
||||
|
||||
define('GEN_NUMBER_SOCIETE', $argv[1] ?? 10);
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
}
|
||||
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid', 1);
|
||||
if (empty($object->cond_reglement_id)) {
|
||||
print " - Error cant find payment mode for ".$condpayment."\n";
|
||||
print " - Error can't find payment mode for ".$condpayment."\n";
|
||||
$errorrecord++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
# Usage: initdemo.sh confirm
|
||||
# usage: initdemo.sh confirm mysqldump_dolibarr_x.x.x.sql database port login pass
|
||||
#------------------------------------------------------
|
||||
# shellcheck disable=2006,2034,2046,2064,2068,2086,2155,2166,2186,2172,2268
|
||||
# shellcheck disable=2012,2016,2115
|
||||
|
||||
|
||||
export mydir=`echo "$0" | sed -e 's/initdemo.sh//'`;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
# Usage: initdemopassword.sh confirm
|
||||
# usage: initdemopassword.sh confirm base port login pass
|
||||
#------------------------------------------------------
|
||||
# shellcheck disable=2006,2034,2046,2064,2068,2086,2155,2166,2186,2172,2268
|
||||
# shellcheck disable=2012,2016,2154
|
||||
|
||||
|
||||
export mydir=`echo "$0" | sed -e 's/initdemopassword.sh//'`;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
# WARNING: This script erase setup of instance,
|
||||
# but not the database
|
||||
#------------------------------------------------------
|
||||
|
||||
# shellcheck disable=2006,2034,2046,2064,2068,2086,2155,2166,2186,2172,2268
|
||||
|
||||
export mydir=`echo "$0" | sed -e 's/removedemo.sh//'`;
|
||||
if [ "x$mydir" = "x" ]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
# Usage: savedemo.sh
|
||||
# usage: savedemo.sh mysqldump_dolibarr_x.x.x.sql database port login pass
|
||||
#------------------------------------------------------
|
||||
|
||||
# shellcheck disable=2012,2006,2034,2046,2064,2086,2155,2166,2186,2172,2268
|
||||
|
||||
export mydir=`echo "$0" | sed -e 's/savedemo.sh//'`;
|
||||
if [ "x$mydir" = "x" ]
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ print 'SFTP connect string : '.$sftpconnectstring."\n";
|
|||
|
||||
// SFTP connect
|
||||
if (!function_exists("ssh2_connect")) {
|
||||
dol_print_error('', 'ssh2_connect function does not exists');
|
||||
dol_print_error(null, 'ssh2_connect function does not exists');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
|||
10
dev/setup/README.md
Normal file
10
dev/setup/README.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Setting up for Dolibarr development
|
||||
|
||||
Check out the
|
||||
[online documentation](https://wiki.dolibarr.org/index.php?title=Environment_and_development_tools)
|
||||
for recommendations (to be updated).
|
||||
|
||||
If anything, install `pre-commit` - it will help run the tools to format and
|
||||
make some basic verifications on your submission before committing and pushing
|
||||
to github for a PR. See [a quick start guide](./pre-commit/README.md) in this
|
||||
Dolibarr repository.
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
</Files>
|
||||
|
||||
|
||||
# Log directoves
|
||||
# Log directives
|
||||
ErrorLog /var/log/apache2/myvirtualalias_error_log
|
||||
TransferLog /var/log/apache2/myvirtualalias_access_log
|
||||
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
AddEncoding gzip .jgz
|
||||
|
||||
|
||||
# Add cach performance directives
|
||||
# Add cache performance directives
|
||||
ExpiresActive On
|
||||
ExpiresByType image/x-icon A2592000
|
||||
ExpiresByType image/gif A2592000
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
README (English)
|
||||
--------------------------------
|
||||
|
||||
This directory contains ruleset files to use to develop Dolibarr EPR & CRM.
|
||||
This directory contains ruleset files to use to develop Dolibarr ERP & CRM.
|
||||
|
||||
To install/upgrade phpcs:
|
||||
> sudo pear upgrade PHP_CodeSniffer
|
||||
|
|
@ -17,5 +17,4 @@ To fix with phpcbf:
|
|||
|
||||
Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with:
|
||||
* tab value to 4
|
||||
* path of code sniffer standard to dev/codesniffer
|
||||
|
||||
* path of code sniffer standard to dev/codesniffer
|
||||
|
|
|
|||
|
|
@ -1533,7 +1533,7 @@ session.cache_expire = 180
|
|||
; - User may send URL contains active session ID
|
||||
; to other person via. email/irc/etc.
|
||||
; - URL that contains active session ID may be stored
|
||||
; in publically accessible computer.
|
||||
; in publicly accessible computer.
|
||||
; - User may access your site with the same session ID
|
||||
; always using URL stored in browser's history or bookmarks.
|
||||
; http://php.net/session.use-trans-sid
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@
|
|||
</rule> -->
|
||||
|
||||
|
||||
<!-- Check assignement have the = align on each line. Have 20 chars padding maximum and always show as errors -->
|
||||
<!-- Check assignment have the = align on each line. Have 20 chars padding maximum and always show as errors -->
|
||||
<!-- Disabled: Report some false warning
|
||||
<rule ref="Generic.Formatting.MultipleStatementAlignment">
|
||||
<properties>
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
||||
<properties>
|
||||
<property name="complexity" value="250" />
|
||||
<property name="absoluteComplexity" value="400" />
|
||||
<property name="absoluteComplexity" value="500" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="Generic.Metrics.NestingLevel">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Examle of rule you can add to fail2ban to restrict bruteforce attacks.
|
||||
# Example of rule you can add to fail2ban to restrict bruteforce attacks.
|
||||
#
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,21 +6,21 @@
|
|||
# When running git commit, it first execute this file checking only modified files, so it is faster than running on all files
|
||||
# To run the fix manually: cd ~/git/dolibarr; phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true "fileordir"
|
||||
|
||||
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
|
||||
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep -v '/includes/'| grep \\\\.php`
|
||||
PROJECT=$(php -r "echo dirname(dirname(dirname(realpath('$0'))));")
|
||||
STAGED_FILES_CMD=$(git diff --cached --name-only --diff-filter=ACMR HEAD | grep -v '/includes/'| grep \\\\.php)
|
||||
DIRPHPCS=""
|
||||
AUTOFIX=1
|
||||
|
||||
echo "Running precommit hook in .git/hooks/pre-commit" 1>&2;
|
||||
echo "Running precommit hook in .git/hooks/pre-commit" 1>&2
|
||||
|
||||
# Determine if a file list is passed
|
||||
if [ "$#" -eq 1 ]
|
||||
then
|
||||
oIFS=$IFS
|
||||
IFS='
|
||||
oIFS=$IFS
|
||||
IFS='
|
||||
'
|
||||
SFILES="$1"
|
||||
IFS=$oIFS
|
||||
SFILES="$1"
|
||||
IFS=$oIFS
|
||||
fi
|
||||
SFILES=${SFILES:-$STAGED_FILES_CMD}
|
||||
|
||||
|
|
@ -28,47 +28,50 @@ echo "Checking PHP Lint with php -l ..."
|
|||
|
||||
for FILE in $SFILES
|
||||
do
|
||||
php -l -d display_errors=0 $PROJECT/$FILE
|
||||
php -l -d display_errors=0 "$PROJECT/$FILE"
|
||||
|
||||
result1=$?
|
||||
result1=$?
|
||||
|
||||
if [ "x$result1" != "x0" ]
|
||||
then
|
||||
echo "Fix the error before commit." 1>&2;
|
||||
exit 1
|
||||
fi
|
||||
FILES="$FILES $PROJECT/$FILE"
|
||||
if [ "x$result1" != "x0" ]
|
||||
then
|
||||
echo "Fix the error before commit." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# shellcheck disable=2089
|
||||
FILES="$FILES '$PROJECT/$FILE'"
|
||||
done
|
||||
|
||||
|
||||
if [ "$FILES" != "" ]
|
||||
then
|
||||
echo "Running PHPCS Code Sniffer..."
|
||||
echo "Running PHPCS Code Sniffer..."
|
||||
|
||||
# Check Dolibarr standard
|
||||
${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
# Check Dolibarr standard
|
||||
# shellcheck disable=2086,2090
|
||||
"${DIRPHPCS}phpcs" -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
|
||||
# Check a common standard
|
||||
#${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=PSR2 --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
# Check a common standard
|
||||
#${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=PSR2 --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
|
||||
result2=$?
|
||||
result2=$?
|
||||
|
||||
if [ "x$result2" != "x0" ]
|
||||
then
|
||||
# Fix standard errors
|
||||
if [ "x$AUTOFIX" != "x0" ]
|
||||
then
|
||||
${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
if [ "x$result2" != "x0" ]
|
||||
then
|
||||
# Fix standard errors
|
||||
if [ "x$AUTOFIX" != "x0" ]
|
||||
then
|
||||
# shellcheck disable=2086,2090
|
||||
"${DIRPHPCS}phpcbf" -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
|
||||
#${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
#${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
|
||||
echo "Found some errors in syntax rules. An automatic fix has been applied. Check it before commit." 1>&2;
|
||||
exit 1
|
||||
else
|
||||
echo "Found some errors in syntax rules. Fix the error(s) before commit." 1>&2;
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "Found some errors in syntax rules. An automatic fix has been applied. Check it before commit." 1>&2
|
||||
exit 1
|
||||
else
|
||||
echo "Found some errors in syntax rules. Fix the error(s) before commit." 1>&2;
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
85
dev/setup/pre-commit/README.md
Normal file
85
dev/setup/pre-commit/README.md
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
## 'pre-commit' ("replaces" precommit)
|
||||
|
||||
### Introduction
|
||||
|
||||
[`pre-commit`](https://pre-commit.org) is a framework for managing and
|
||||
maintaining multi-language pre-commit hooks.
|
||||
|
||||
"pre-commit hooks" integrate with `git` and are run when you perform a
|
||||
`git commit` for instance.
|
||||
|
||||
Historically there was `precommit` for Dolibarr which you can find in this
|
||||
directory. That script runs `phplint`, `phpcs` and `phpcbf` upon commit.
|
||||
|
||||
`pre-commit` is not specific to Dolibarr and is deployed on many projects -
|
||||
mostly Python projects, but it is applicable to most (or *all*) code and
|
||||
documentation development.
|
||||
|
||||
You can find documentation at https://pre-commit.com/ .
|
||||
|
||||
Now you can use `pre-commit` which uses the configuration found at the root of
|
||||
the project: `pre-commit-config.yaml`.
|
||||
|
||||
### How to
|
||||
|
||||
1. Install `pre-commit`.\
|
||||
If you do not have python installed, install
|
||||
[python](https://www.python.org) first.\
|
||||
If you do not have
|
||||
[`pip`](https://pypi.org/project/pip), install that as well.\\
|
||||
|
||||
Then you can install pre-commit: `python -m pip install pre-commit`.
|
||||
|
||||
1. In you local git clone of the project, run `pre-commit install`. That will
|
||||
add the hooks.
|
||||
|
||||
### Tips
|
||||
|
||||
After installing `pre-commit` onto your local git clone, pre-commit will run
|
||||
on every commit.
|
||||
|
||||
When it finds some issue, the git commit will be aborted, so you can fix it,
|
||||
or verify it.
|
||||
|
||||
The tools run by `pre-commit` may modify your code: format PHP code
|
||||
(`phpcbf`), fix line endings, end of files, etc.
|
||||
|
||||
They may also alert about potential issues: syntax errors, spelling errors,
|
||||
code quality, an execute bit that was (not) set in the git repository, etc.
|
||||
|
||||
One way to use it is this:
|
||||
|
||||
```bash
|
||||
cd PROJECT_DIR
|
||||
pre-commit install # Only needed once
|
||||
# Repeat until success.
|
||||
git commit -a -m "My message"
|
||||
# `pre-commit` is run and reports
|
||||
# Check the results, make fixes, and re-commit (=repeat above line).
|
||||
```
|
||||
|
||||
In some cases you may want to commit despite the changes.\
|
||||
You can just add
|
||||
`--no-verify` to your git command:
|
||||
|
||||
```bash
|
||||
git commit -a -m "My message" --no-verify
|
||||
```
|
||||
|
||||
If you want to skip certain checks for whatever reason, you can set the SKIP
|
||||
environment variable:
|
||||
|
||||
```bash
|
||||
SKIP=no-commit-to-branch git commit -a -m "My message"
|
||||
|
||||
or
|
||||
|
||||
export SKIP=no-commit-to-branch # In your .bashrc or session.
|
||||
```
|
||||
|
||||
There is much more you can do with pre-commit, check out its
|
||||
[documentation](https://pre-commit.com).
|
||||
|
||||
Now your commit is less likely to fail in the Continuous Intagration (CI) run
|
||||
on github.\
|
||||
CI also runs pre-commit to help maintain code quality.
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
/**
|
||||
* \file dev/tools/apstats.php
|
||||
* \brief Script to report Advanced Statistics on a coding project
|
||||
* \brief Script to report Advanced Statistics on a coding PHP project
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ error_reporting(E_ALL & ~E_DEPRECATED);
|
|||
define('PRODUCT', "apstats");
|
||||
define('VERSION', "1.0");
|
||||
|
||||
$phpstanlevel = 2;
|
||||
$phpstanlevel = 3;
|
||||
|
||||
|
||||
print '***** '.constant('PRODUCT').' - '.constant('VERSION').' *****'."\n";
|
||||
|
|
@ -88,6 +88,10 @@ $resexec = shell_exec($commandcheck);
|
|||
$resexec = (int) (empty($resexec) ? 0 : trim($resexec));
|
||||
*/
|
||||
|
||||
// Retrieve the .git information
|
||||
$urlgit = 'https://github.com/Dolibarr/dolibarr/blob/develop/';
|
||||
|
||||
|
||||
// Count lines of code of application
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=htdocs/includes,htdocs/custom,htdocs/theme/common/fontawesome-5,htdocs/theme/common/octicons';
|
||||
print 'Execute SCC to count lines of code in project: '.$commandcheck."\n";
|
||||
|
|
@ -111,6 +115,16 @@ $output_arrtd = array();
|
|||
$resexectd = 0;
|
||||
exec($commandcheck, $output_arrtd, $resexectd);
|
||||
|
||||
|
||||
// Count lines of code of dependencies
|
||||
$commandcheck = "git log --shortstat --no-renames --no-merges --use-mailmap --pretty='format:%cI;%H;%aN;%ae;%ce'"; // --since= --until=...
|
||||
print 'Execute git log to count number of commits by day: '.$commandcheck."\n";
|
||||
$output_arrglpu = array();
|
||||
$resexecglpu = 0;
|
||||
//exec($commandcheck, $output_arrglpu, $resexecglpu);
|
||||
|
||||
|
||||
|
||||
$arrayoflineofcode = array();
|
||||
$arraycocomo = array();
|
||||
$arrayofmetrics = array(
|
||||
|
|
@ -172,6 +186,15 @@ foreach (array('proj', 'dep') as $source) {
|
|||
}
|
||||
}
|
||||
|
||||
// Search the max
|
||||
$arrayofmax = array('Lines'=>0);
|
||||
foreach (array('proj', 'dep') as $source) {
|
||||
foreach ($arrayoflineofcode[$source] as $val) {
|
||||
$arrayofmax['Lines'] = max($arrayofmax['Lines'], $val['Lines']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$timeend = time();
|
||||
|
||||
|
||||
|
|
@ -239,7 +262,7 @@ th,td {
|
|||
display: none;
|
||||
}
|
||||
.trgroup {
|
||||
background-color: #EEE;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
.seedetail {
|
||||
color: #000088;
|
||||
|
|
@ -257,6 +280,14 @@ th,td {
|
|||
text-align: center;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.boxallwidth {
|
||||
border-radius: 9px;
|
||||
border-color: #000;
|
||||
border-width: 2px;
|
||||
padding: 5px;
|
||||
border-style: solid;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
.back1 {
|
||||
background-color: #884466;
|
||||
color: #FFF;
|
||||
|
|
@ -279,8 +310,23 @@ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive
|
|||
overflow-x: auto;
|
||||
min-height: 0.01%;
|
||||
}
|
||||
|
||||
|
||||
.list_technical_debt {
|
||||
/* font-size: smaller */
|
||||
}
|
||||
.pictofixedwidth {
|
||||
font-size: smaller;
|
||||
width: 28px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.bargraph {
|
||||
background-color: #358;
|
||||
}
|
||||
.small {
|
||||
font-size: smaller;
|
||||
}
|
||||
.fr {
|
||||
float: right;
|
||||
}
|
||||
/* Force values for small screen 767 */
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
|
|
@ -296,14 +342,20 @@ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive
|
|||
|
||||
$html .= '<body>'."\n";
|
||||
|
||||
|
||||
// Header
|
||||
|
||||
$html .= '<header>'."\n";
|
||||
$html .= '<h1>Advanced Project Statistics</h1>'."\n";
|
||||
$currentDate = date("Y-m-d H:i:s"); // Format: Year-Month-Day Hour:Minute:Second
|
||||
$html .= '<span class="opacitymedium">Generated on '.$currentDate.' in '.($timeend - $timestart).' seconds</span>'."\n";
|
||||
$html .= '</header>'."\n";
|
||||
|
||||
|
||||
// Lines of code
|
||||
|
||||
$html .= '<section class="chapter" id="linesofcode">'."\n";
|
||||
$html .= '<h2>Lines of code</h2>'."\n";
|
||||
$html .= '<h2><span class="fas fa-code pictofixedwidth"></span>Lines of code</h2>'."\n";
|
||||
|
||||
$html .= '<div class="div-table-responsive">'."\n";
|
||||
$html .= '<div class="boxallwidth">'."\n";
|
||||
|
|
@ -313,6 +365,7 @@ $html .= '<th class="left">Language</th>';
|
|||
$html .= '<th class="right">Bytes</th>';
|
||||
$html .= '<th class="right">Files</th>';
|
||||
$html .= '<th class="right">Lines</th>';
|
||||
$html .= '<th></th>';
|
||||
$html .= '<th class="right">Blanks</th>';
|
||||
$html .= '<th class="right">Comments</th>';
|
||||
$html .= '<th class="right">Code</th>';
|
||||
|
|
@ -325,14 +378,15 @@ foreach (array('proj', 'dep') as $source) {
|
|||
} elseif ($source == 'dep') {
|
||||
$html .= '<td>All files of dependencies only';
|
||||
}
|
||||
$html .= ' <span class="seedetail" data-source="'.$source.'">(See detail per file type...)</span>';
|
||||
$html .= ' <div class="seedetail fr" data-source="'.$source.'"><span class="fas fa-chart-bar pictofixedwidth"></span>See detail per file type...</span>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Bytes']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Files']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Lines']).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Blanks']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Comments']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Code']).'</td>';
|
||||
$html .= '<td></td>';
|
||||
//$html .= '<td></td>';
|
||||
$html .= '</tr>';
|
||||
if (!empty($arrayoflineofcode[$source])) {
|
||||
foreach ($arrayoflineofcode[$source] as $key => $val) {
|
||||
|
|
@ -341,26 +395,35 @@ foreach (array('proj', 'dep') as $source) {
|
|||
$html .= '<td class="right"></td>';
|
||||
$html .= '<td class="right nowrap">'.(empty($val['Files']) ? '' : formatNumber($val['Files'])).'</td>';
|
||||
$html .= '<td class="right nowrap">'.(empty($val['Lines']) ? '' : formatNumber($val['Lines'])).'</td>';
|
||||
$html .= '<td class="nowrap">';
|
||||
$percent = $val['Lines'] / $arrayofmax['Lines'];
|
||||
$widthbar = round(200 * $percent);
|
||||
$html .= '<div class="bargraph" style="width: '.max(1, $widthbar).'px"> </div>';
|
||||
$html .= '</td>';
|
||||
$html .= '<td class="right nowrap">'.(empty($val['Blanks']) ? '' : formatNumber($val['Blanks'])).'</td>';
|
||||
$html .= '<td class="right nowrap">'.(empty($val['Comments']) ? '' : formatNumber($val['Comments'])).'</td>';
|
||||
$html .= '<td class="right nowrap">'.(empty($val['Code']) ? '' : formatNumber($val['Code'])).'</td>';
|
||||
//$html .= '<td class="right">'.(empty($val['Complexity']) ? '' : $val['Complexity']).'</td>';
|
||||
$html .= '<td class="nowrap">TODO graph here...</td>';
|
||||
/*$html .= '<td class="nowrap">';
|
||||
$html .= '';
|
||||
$html .= '</td>';
|
||||
*/
|
||||
$html .= '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '<tr class="trgroup">';
|
||||
$html .= '<tr class="trgrouptotal">';
|
||||
$html .= '<td class="left">Total</td>';
|
||||
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Bytes'] + $arrayofmetrics['dep']['Bytes']).'</td>';
|
||||
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Files'] + $arrayofmetrics['dep']['Files']).'</td>';
|
||||
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Lines'] + $arrayofmetrics['dep']['Lines']).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Blanks'] + $arrayofmetrics['dep']['Blanks']).'</td>';
|
||||
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Comments'] + $arrayofmetrics['dep']['Comments']).'</td>';
|
||||
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Code'] + $arrayofmetrics['dep']['Code']).'</td>';
|
||||
//$html .= '<td>'.$arrayofmetrics['Complexity'].'</td>';
|
||||
$html .= '<td></td>';
|
||||
//$html .= '<td></td>';
|
||||
$html .= '</tr>';
|
||||
$html .= '</table>';
|
||||
$html .= '</div>';
|
||||
|
|
@ -368,18 +431,55 @@ $html .= '</div>';
|
|||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
|
||||
// Contributions
|
||||
|
||||
$html .= '<section class="chapter" id="projectvalue">'."\n";
|
||||
$html .= '<h2>Project value</h2><br>'."\n";
|
||||
$html .= '<h2><span class="fas fa-tasks pictofixedwidth"></span>Contributions</h2>'."\n";
|
||||
|
||||
$html .= '<div class="boxallwidth">'."\n";
|
||||
|
||||
$html .= 'TODO...';
|
||||
|
||||
$html .= '<!-- ';
|
||||
foreach ($output_arrglpu as $line) {
|
||||
$html .= $line."\n";
|
||||
}
|
||||
$html .= ' -->';
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
|
||||
// Contributors
|
||||
|
||||
$html .= '<section class="chapter" id="projectvalue">'."\n";
|
||||
$html .= '<h2><span class="fas fa-user pictofixedwidth"></span>Contributors</h2>'."\n";
|
||||
|
||||
$html .= '<div class="boxallwidth">'."\n";
|
||||
|
||||
$html .= 'TODO...';
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
|
||||
// Project value
|
||||
|
||||
$html .= '<section class="chapter" id="projectvalue">'."\n";
|
||||
$html .= '<h2><span class="fas fa-dollar-sign pictofixedwidth"></span>Project value</h2>'."\n";
|
||||
|
||||
$html .= '<div class="boxallwidth">'."\n";
|
||||
$html .= '<div class="box inline-box back1">';
|
||||
$html .= 'COCOMO value<br><span class="small">(Basic organic model)</span><br>';
|
||||
$html .= 'COCOMO value<br><span class="small opacitymedium">(Basic organic model)</span><br>';
|
||||
$html .= '<b>$'.formatNumber((empty($arraycocomo['proj']['currency']) ? 0 : $arraycocomo['proj']['currency']) + (empty($arraycocomo['dep']['currency']) ? 0 : $arraycocomo['dep']['currency']), 2).'</b>';
|
||||
$html .= '</div>';
|
||||
$html .= '<div class="box inline-box back2">';
|
||||
$html .= 'COCOMO effort<br><span class="small">(Basic organic model)</span><br>';
|
||||
$html .= 'COCOMO effort<br><span class="small opacitymedium">(Basic organic model)</span><br>';
|
||||
$html .= '<b>'.formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj']['effort'] + $arraycocomo['dep']['people'] * $arraycocomo['dep']['effort']);
|
||||
$html .= ' monthes people</b>';
|
||||
$html .= ' months people</b>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
|
|
@ -392,31 +492,48 @@ foreach ($output_arrtd as $line) {
|
|||
//print $line."\n";
|
||||
preg_match('/^::error file=(.*),line=(\d+),col=(\d+)::(.*)$/', $line, $reg);
|
||||
if (!empty($reg[1])) {
|
||||
$tmp .= '<tr><td>'.$reg[1].'</td><td>'.$reg[2].'</td><td>'.$reg[4].'</td></tr>'."\n";
|
||||
if ($nblines < 20) {
|
||||
$tmp .= '<tr class="nohidden">';
|
||||
} else {
|
||||
$tmp .= '<tr class="hidden sourcephpstan">';
|
||||
}
|
||||
$tmp .= '<td>'.$reg[1].'</td>';
|
||||
$tmp .= '<td class="">';
|
||||
$tmp .= '<a href="'.$urlgit.$reg[1].'#L'.$reg[2].'" target="_blank">'.$reg[2].'</a>';
|
||||
$tmp .= '</td>';
|
||||
$tmp .= '<td>'.$reg[4].'</td>';
|
||||
$tmp .= '</tr>'."\n";
|
||||
$nblines++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Technical debt
|
||||
|
||||
$html .= '<section class="chapter" id="technicaldebt">'."\n";
|
||||
$html .= '<h2>Technical debt <span class="opacitymedium">(PHPStan level '.$phpstanlevel.' -> '.$nblines.' warnings)</span></h2><br>'."\n";
|
||||
$html .= '<h2><span class="fas fa-book-dead pictofixedwidth"></span>Technical debt <span class="opacitymedium">(PHPStan level '.$phpstanlevel.' -> '.$nblines.' warnings)</span></h2>'."\n";
|
||||
|
||||
$html .= '<div class="div-table-responsive">'."\n";
|
||||
$html .= '<div class="boxallwidth">'."\n";
|
||||
$html .= '<table class="list_technical_debt">'."\n";
|
||||
$html .= '<tr><td>File</td><td>Line</td><td>Type</td></tr>'."\n";
|
||||
$html .= '<table class="list_technical_debt centpercent">'."\n";
|
||||
$html .= '<tr class="trgroup"><td>File</td><td>Line</td><td>Type</td></tr>'."\n";
|
||||
$html .= $tmp;
|
||||
$html .= '<tr class="sourcephpstan"><td colspan="3"><span class="seedetail" data-source="phpstan" id="sourcephpstan">Show all...</span></td></tr>';
|
||||
$html .= '</table>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
|
||||
// JS code
|
||||
|
||||
$html .= '
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$( ".seedetail" ).on( "click", function() {
|
||||
$(".seedetail").on("click", function() {
|
||||
var source = $(this).attr("data-source");
|
||||
console.log("Click on "+source);
|
||||
console.log("Click on "+source+" so we show class .source"+source);
|
||||
jQuery(".source"+source).toggle();
|
||||
} );
|
||||
});
|
||||
|
|
@ -425,6 +542,7 @@ $( ".seedetail" ).on( "click", function() {
|
|||
$html .= '</body>';
|
||||
$html .= '</html>';
|
||||
|
||||
// Output report into a HTML file
|
||||
$fh = fopen($outputpath, 'w');
|
||||
if ($fh) {
|
||||
fwrite($fh, $html);
|
||||
|
|
@ -432,7 +550,7 @@ if ($fh) {
|
|||
|
||||
print 'Generation of output file '.$outputfile.' done.'."\n";
|
||||
} else {
|
||||
print 'Failed to open '.$outputfile.' for ouput.'."\n";
|
||||
print 'Failed to open '.$outputfile.' for output.'."\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -441,7 +559,7 @@ if ($fh) {
|
|||
*
|
||||
* @param string|int $number Number to format
|
||||
* @param int $nbdec Number of decimal digits
|
||||
* @return string Formated string
|
||||
* @return string Formatted string
|
||||
*/
|
||||
function formatNumber($number, $nbdec = 0)
|
||||
{
|
||||
|
|
|
|||
68
dev/tools/codespell/addCodespellIgnores.sh
Executable file
68
dev/tools/codespell/addCodespellIgnores.sh
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
# Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
|
||||
#
|
||||
# Script to add codespell exceptions to the ignores lines file.
|
||||
#
|
||||
# The file is named '...-lines-ignore' to make TAB expansion on the cli easier.
|
||||
#
|
||||
# The line in the ignore file must match the line in the source
|
||||
# exactly.
|
||||
#
|
||||
# To clean up or create the ignored lines file, just do
|
||||
# ```shell
|
||||
# echo > dev/tools/codespell/codespell-lines-ignore.txt
|
||||
# ```
|
||||
# and then execute this script.
|
||||
#
|
||||
# author: https://github.com/mdeweerd
|
||||
|
||||
#
|
||||
# :warning:
|
||||
#
|
||||
# This script only works properly if codespell is installed for your CLI.
|
||||
# As the configuration is in pyproject.toml, you also need tomli.
|
||||
#
|
||||
# ```shell
|
||||
# python -m pip install codespell tomli
|
||||
# # or
|
||||
# pip install codespell tomli
|
||||
# ```
|
||||
|
||||
codespell_ignore_file=dev/tools/codespell/codespell-lines-ignore.txt
|
||||
if [ -z "${0##*.sh}" ] ; then
|
||||
# Suppose running from inside script
|
||||
# Get real path
|
||||
script=$(realpath "$(test -L "$0" && readlink "$0" || echo "$0")")
|
||||
PROJECT_ROOT=$(realpath "${script}")
|
||||
|
||||
while [ "${PROJECT_ROOT}" != "/" ] ; do
|
||||
[ -r "${PROJECT_ROOT}/${codespell_ignore_file}" ] && break
|
||||
PROJECT_ROOT=$(dirname "${PROJECT_ROOT}")
|
||||
done
|
||||
if [ "${PROJECT_ROOT}" == "/" ] ; then
|
||||
echo "Project root not found from '${script}'"
|
||||
exit 1
|
||||
fi
|
||||
codespell_ignore_file=${PROJECT_ROOT}/${codespell_ignore_file}
|
||||
fi
|
||||
|
||||
|
||||
# Make sure we are at the root of the project
|
||||
[ -r "${codespell_ignore_file}" ] || { echo "${codespell_ignore_file} not found" ; exit 1 ; }
|
||||
# Then:
|
||||
# - Run codespell;
|
||||
# - Identify files that have fixes;
|
||||
# - Limit to files under git control;
|
||||
# - Run codespell on selected files;
|
||||
# - For each line, create a grep command to find the lines;
|
||||
# - Execute that command by evaluation
|
||||
codespell . \
|
||||
| sed -n -E 's@^([^:]+):.*@\1@p' \
|
||||
| xargs -r git ls-files -- \
|
||||
| xargs -r codespell -- \
|
||||
| sed -n -E 's@^([^:]+):[[:digit:]]+:[[:space:]](\S+)[[:space:]].*@grep -P '\''\\b\2\\b'\'' -- "\1" >> '"${codespell_ignore_file}"'@p' \
|
||||
| while read -r line ; do eval "$line" ; done
|
||||
|
||||
# Finally, sort and remove duplicates to make merges easier.
|
||||
sort -u -o "${codespell_ignore_file}"{,}
|
||||
13
dev/tools/codespell/codespell-dict.txt
Normal file
13
dev/tools/codespell/codespell-dict.txt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Please add in alphabetical order->(`sort -u` like).
|
||||
EPR->ERP
|
||||
alpah->alpha
|
||||
aplha->alpha
|
||||
choosed->chosen
|
||||
dolibar->dolibarr
|
||||
dollibar->dolibarr
|
||||
dollibarr->dolibarr
|
||||
mot de passe->password
|
||||
not de passe->password
|
||||
tableau de bord->state board
|
||||
tagret->target
|
||||
thridparty->thirdparty
|
||||
91
dev/tools/codespell/codespell-ignore.txt
Normal file
91
dev/tools/codespell/codespell-ignore.txt
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
# List of words codespell will ignore
|
||||
# one per line, case-sensitive (when not lowercase)
|
||||
# PROVid
|
||||
provid
|
||||
# PostgreSQL
|
||||
postgresql
|
||||
|
||||
alltime
|
||||
ba
|
||||
blacklist
|
||||
whitelist
|
||||
bu
|
||||
captial
|
||||
categorie
|
||||
categories
|
||||
crypted
|
||||
clos
|
||||
contaxt
|
||||
courant
|
||||
datea
|
||||
datee
|
||||
errorstring
|
||||
exten
|
||||
falsy
|
||||
master
|
||||
medias
|
||||
noe
|
||||
NOO
|
||||
noo
|
||||
od
|
||||
nd
|
||||
udate
|
||||
periode
|
||||
projet
|
||||
referer
|
||||
referers
|
||||
scrit
|
||||
ser
|
||||
slave
|
||||
savvy
|
||||
# Inside email
|
||||
suport
|
||||
te
|
||||
technic
|
||||
thead
|
||||
udo
|
||||
ue
|
||||
ro
|
||||
ws
|
||||
# Code string
|
||||
ect
|
||||
tempdate
|
||||
# checkES
|
||||
checkes
|
||||
sav
|
||||
files'
|
||||
# Used as array ke
|
||||
seeked
|
||||
# Used as translation key
|
||||
developpers
|
||||
# Used as var
|
||||
pice
|
||||
# Used as key
|
||||
marge
|
||||
# htdocs/projet/activity/permonth.php
|
||||
tweek
|
||||
# moral (var name)
|
||||
mor
|
||||
# reyear, remonth, reday
|
||||
reday
|
||||
# Strings used as keys for translation
|
||||
uptodate
|
||||
reenable
|
||||
# Function - rename to devalidate ?
|
||||
unvalidate
|
||||
# Some french strings
|
||||
somme
|
||||
caracteres
|
||||
cas
|
||||
sur
|
||||
Datas
|
||||
datas
|
||||
valide
|
||||
raison
|
||||
que
|
||||
dur
|
||||
fonction
|
||||
espace
|
||||
methode
|
||||
# Proper names
|
||||
tim
|
||||
65
dev/tools/codespell/codespell-lines-ignore.txt
Normal file
65
dev/tools/codespell/codespell-lines-ignore.txt
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
$objMod->dictionaries = $objMod->{"dictionnaries"}; // For backward compatibility
|
||||
if (empty($objMod->dictionaries) && !empty($objMod->{"dictionnaries"})) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&id_entrepot='.$entrepotstatic->id.'&action=transfert&pdluoid='.$pdluo->id.'">';
|
||||
$reponsesadd = str_split($obj->reponses);
|
||||
$sql .= " SET reponses = '".$db->escape($reponsesadd)."'";
|
||||
$sql .= " SET reponses = '0".$db->escape($obj->reponses)."'";
|
||||
print '<td class="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&id='.$objp->rowid.'&action=transfert&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id).'">';
|
||||
GETPOST("mouvement", 'int'),
|
||||
jQuery("#mouvement option").removeAttr("selected").change();
|
||||
jQuery("#mouvement option[value=0]").attr("selected","selected").trigger("change");
|
||||
jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change");
|
||||
jQuery("#mouvement").trigger("change");
|
||||
$action = 'transfert';
|
||||
$this->category->childs[] = $this->_cleanObjectDatas($cat);
|
||||
$tmp = array('id_users'=>$obj->id_users, 'nom'=>$obj->name, 'reponses'=>$obj->reponses);
|
||||
//si les reponses ne concerne pas la colonne effacée, on concatenate
|
||||
GETPOST("mouvement", "int"),
|
||||
GETPOST("mouvement", 'alpha'),
|
||||
GETPOST("mouvement", 'int'),
|
||||
if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled");
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=transfert">'.$langs->trans("TransferStock").'</a>';
|
||||
$action = 'transfert';
|
||||
$ensemblereponses = $obj->reponses;
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses, date_creation)';
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses, ip, date_creation)';
|
||||
$sql = 'SELECT s.reponses';
|
||||
$sql2 .= " SET reponses = '".$db->escape($newcar)."'";
|
||||
$this->category->childs = array();
|
||||
// mise a jour des reponses utilisateurs dans la base
|
||||
if ($user->hasRight('stock', 'mouvement', 'lire')) {
|
||||
jQuery("#mouvement").change(function() {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=transfert">'.$langs->trans("TransferStock").'</a>';
|
||||
$action = 'transfert';
|
||||
$ensemblereponses = $obj->reponses;
|
||||
$sql = "SELECT id_users, nom as name, id_sondage, reponses";
|
||||
$sql = "SELECT id_users, nom as name, reponses";
|
||||
$test = '/javas:cript/google.com';
|
||||
$test="<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same
|
||||
if ($user->hasRight('stock', 'mouvement', 'creer')) {
|
||||
$ensemblereponses = $obj->reponses;
|
||||
$opensurveysondage->mail_admin = $_SESSION['adresse'];
|
||||
$pdf->SetXY($savx, $savy);
|
||||
$savy = $pdf->getY();
|
||||
$somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product
|
||||
$sql .= " SET reponses = '".$db->escape($nouveauchoix)."'";
|
||||
<strong>TaskItem(<em>pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt</em>)</strong></p>
|
||||
if ($action == "transfert") {
|
||||
print '<option value="1"'.(GETPOST('mouvement') ? ' selected="selected"' : '').'>'.$langs->trans("Delete").'</option>';
|
||||
print '<select name="mouvement" id="mouvement" class="minwidth100 valignmiddle">';
|
||||
print ajax_combobox("mouvement");
|
||||
public $childs = array();
|
||||
unset($_SESSION["adresse"]);
|
||||
$permissiontoadd = $user->rights->stock->mouvement->creer;
|
||||
$permissiontodelete = $user->rights->stock->mouvement->creer; // There is no deletion permission for stock movement as we should never delete
|
||||
$permissiontoread = $user->rights->stock->mouvement->lire;
|
||||
$sql = "SELECT id_users, nom as name, id_sondage, reponses";
|
||||
$sql = 'SELECT nom as name, reponses';
|
||||
$usercancreate = $user->rights->stock->mouvement->creer;
|
||||
$usercancreate = (($user->rights->stock->mouvement->creer));
|
||||
$usercandelete = $user->rights->stock->mouvement->creer;
|
||||
$usercandelete = (($user->rights->stock->mouvement->supprimer));
|
||||
$usercanread = $user->rights->stock->mouvement->lire;
|
||||
$usercanread = (($user->rights->stock->mouvement->lire));
|
||||
if (!$user->hasRight('stock', 'mouvement', 'lire')) {
|
||||
if ($action == "transfert") {
|
||||
|
|
@ -159,7 +159,7 @@ foreach my $file (keys %filelist) {
|
|||
}
|
||||
if ($create_sql ne "") { # we are inside create table statement so lets process datatypes
|
||||
|
||||
if (/\);/i) { # end of create table squence
|
||||
if (/\);/i) { # end of create table sequence
|
||||
$create_sql =~ s/,$//g; # strip last , inside create table
|
||||
&output_create;
|
||||
&reset_vars();
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ function getfieldname($l)
|
|||
* formatsize
|
||||
*
|
||||
* @param string $s Size to format
|
||||
* @return string Formated size
|
||||
* @return string Formatted size
|
||||
*/
|
||||
function formatsize($s)
|
||||
{
|
||||
|
|
@ -417,9 +417,9 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
|||
|
||||
$before = str_replace("\"", "`", $before);
|
||||
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string'), but could also be (number, E'string'); so we cant search for the previoous '
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string'), but could also be (number, E'string'); so we can't search for the previous '
|
||||
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||
// at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data
|
||||
$after = str_replace(" (E'", " ('", $after);
|
||||
$after = str_replace(", E'", ", '", $after);
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
|||
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
|
||||
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||
// at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data
|
||||
$after = str_replace(" (E'", " ('", $after);
|
||||
$after = str_replace(", E'", ", '", $after);
|
||||
|
||||
|
|
@ -457,9 +457,9 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
|||
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
|
||||
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||
// at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data
|
||||
|
||||
// after the first line, we only need to check for it in the middle, not at the beginning of an insert (becuase the beginning will be on the first line)
|
||||
// after the first line, we only need to check for it in the middle, not at the beginning of an insert (because the beginning will be on the first line)
|
||||
// $after=str_replace(" (E'","' ('",$after);
|
||||
$line = $lines[$linenumber];
|
||||
$line = str_replace("', E'", "', '", $line);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
#
|
||||
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
|
||||
|
||||
# shellcheck disable=2006,2027,2044,2045,2046,2086,2155,2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#------------------------------------------------------
|
||||
# Usage: fixdosfiles.sh [list|fix]
|
||||
#------------------------------------------------------
|
||||
# shellcheck disable=2006,2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
# Copyright (C) 2014 Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
|
||||
|
||||
# shellcheck disable=2006,2035,2044,2061,2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
#
|
||||
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
|
||||
|
||||
# shellcheck disable=2006,2035,2044,2046,2061,2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#/bin/bash
|
||||
#!/bin/bash
|
||||
#
|
||||
# Example of script to fix code writing of permissions
|
||||
#
|
||||
# shellcheck disable=2013,2016,2086
|
||||
|
||||
for f in $(grep -l -e 'user->rights' -R); do
|
||||
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *\$user->rights->\1->\2->\3 *: *0;/$user->hasRight("\1", "\2", "\3");/' $f
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#------------------------------------------------------
|
||||
# Usage: fixnotabfiles.sh [list|fix]
|
||||
#------------------------------------------------------
|
||||
# shellcheck disable=2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
# Usage: fixperms.sh (list|fix)
|
||||
#------------------------------------------------------
|
||||
|
||||
# shellcheck disable=2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# shellcheck disable=2002,2004,2028,2034,2053,2068,2086,2116,2143,2207
|
||||
|
||||
## Need "rpl" package
|
||||
RPL_INSTALLED=$(dpkg -s rpl)
|
||||
if [[ -z ${RPL_INSTALLED} ]]; then
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#------------------------------------------------------
|
||||
# Usage: fixutf8bomfiles.sh [list|fix]
|
||||
#------------------------------------------------------
|
||||
# shellcheck disable=2006,2028,2086,2089,2090,2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
|
|
|
|||
43
dev/tools/github_authors_and_commits_bydate.sh
Executable file
43
dev/tools/github_authors_and_commits_bydate.sh
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Count number of different contributors and number of commits for a given year or month
|
||||
# Can be used for statistics (for example to generate the infography of the year)
|
||||
#
|
||||
|
||||
PERIOD=$1
|
||||
STARTYEAR=$2
|
||||
ENDYEAR=$3
|
||||
|
||||
DEBUG=${DEBUG:=0} # Example: run script with DEBUG=1 script arguments
|
||||
|
||||
echo "***** github_authors_and_commits_bydate.sh *****"
|
||||
|
||||
if [ "$PERIOD" != "byyear" ] && [ "$PERIOD" != "bymonth" ] && [ "$PERIOD" != "byday" ]; then
|
||||
echo "Usage: $0 (byyear|bymonth|byday) YEARSTART [YEAREND]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Default is byyear
|
||||
DATEFORMAT="%Y"
|
||||
if [ "$PERIOD" = "bymonth" ]; then
|
||||
DATEFORMAT="%Y%m"
|
||||
elif [ "$PERIOD" = "byday" ]; then
|
||||
DATEFORMAT="%Y%m%d"
|
||||
fi
|
||||
|
||||
FROM=${STARTYEAR}-01-01
|
||||
TO=${STARTYEAR}-12-31
|
||||
if [ "${ENDYEAR}" != "" ]; then
|
||||
TO=${ENDYEAR}-12-31
|
||||
else
|
||||
ENDYEAR=9999
|
||||
fi
|
||||
|
||||
echo "--- Number of different contributors for the period $FROM $TO"
|
||||
[ "$DEBUG" -ne 0 ] && echo "git log --use-mailmap --since '$FROM' --before '$TO' | iconv -f UTF-8 -t ASCII//TRANSLIT | grep ^Author | awk -F'<' '{ print $1 }' | sort -u -f -i -b | wc -l" >&2
|
||||
git log --since "$FROM" --before "$TO" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | grep '^Author' | awk -F"<" '{ print $1 }' | sort -u -f -i -b | wc -l
|
||||
|
||||
|
||||
echo "--- Number of commits $1"
|
||||
[ "$DEBUG" -ne 0 ] && echo "git log --use-mailmap --pretty='format:%cd' --date=format:'$DATEFORMAT' | iconv -f UTF-8 -t ASCII//TRANSLIT | sort | uniq -c | awk '{ if (\$2 >= '$1') { print \"Year: \"\$2\", commits: \"\$1 } }'" >&2
|
||||
git log --pretty='format:%cd' --date=format:"$DATEFORMAT" | iconv -f UTF-8 -t ASCII//TRANSLIT | sort | uniq -c | awk '{ if ($2 >= '"${STARTYEAR}"' && $2 <='"${ENDYEAR}"') { print "Year: "$2", commits: "$1 } }'
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Count number of different contributors and number of commits for a given year.
|
||||
# Can be used for statistics (for example to generate the inforgraphy of the year)
|
||||
#
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Usage: $0 YEARSTART [YEAREND]"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
FROM=$1-01-01
|
||||
TO=$1-12-31
|
||||
|
||||
if [ "x$2" != "x" ]; then
|
||||
TO=$2-12-31
|
||||
fi
|
||||
|
||||
echo "--- Number of contributors for the year"
|
||||
echo "git log --since $FROM --before $TO | grep ^Author | awk -F'<' '{ print $1 }' | iconv -f UTF-8 -t ASCII//TRANSLIT | sort -u -f -i -b | wc -l"
|
||||
git log --since $FROM --before $TO | grep '^Author' | awk -F"<" '{ print $1 }' | iconv -f UTF-8 -t ASCII//TRANSLIT | sort -u -f -i -b | wc -l
|
||||
|
||||
|
||||
echo "--- Number of commit for the year"
|
||||
echo "git log --pretty='format:%cd' --date=format:'%Y' | sort | uniq -c | awk '{ if (\$2 >= '"$1"') { print \"Year: \"\$2\", commits: \"\$1 } }'"
|
||||
git log --pretty='format:%cd' --date=format:'%Y' | sort | uniq -c | awk '{ if ($2 >= '$1') { print "Year: "$2", commits: "$1 } }'
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
#/bin/bash
|
||||
#!/bin/bash
|
||||
#
|
||||
# Count number of commits per user and per versions (using date for version detection)
|
||||
#
|
||||
# shellcheck disable=1113,2002,2006,2086,2164,2219
|
||||
|
||||
Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "develop")
|
||||
let "counter = 0"
|
||||
|
||||
echo "Copy script into /tmp/github_commits_perversion.sh"
|
||||
echo "Copy script into /tmp/github_commits_byversion.sh"
|
||||
cp $0 /tmp/github_commits_perversion.sh
|
||||
|
||||
echo "Delete /tmp/git"
|
||||
|
|
@ -36,7 +37,7 @@ do
|
|||
echo "Checkout into version $i"
|
||||
git checkout $i
|
||||
#git shortlog -s -n --after=YYYY-MM-DD --before=YYYY-MM-DD | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt
|
||||
git shortlog -s -n $commitidcommon.. | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt
|
||||
git shortlog -s -n $commitidcommon.. | iconv -f UTF-8 -t ASCII//TRANSLIT | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt
|
||||
#cat /tmp/github_commits_perversion.txt
|
||||
echo "Total for version $i:"
|
||||
echo -n "- Nb of commits: "
|
||||
32
dev/tools/github_lines_byuser.sh
Executable file
32
dev/tools/github_lines_byuser.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Count number of lines modified per user for a given branch
|
||||
#
|
||||
|
||||
DEBUG=${DEBUG:=0}
|
||||
|
||||
if [ "$2" = "" ]; then
|
||||
echo "***** github_lines_perusers.sh *****"
|
||||
echo "Return the number of lines of code produced by each contributor between 2 versions"
|
||||
echo "Usage: $0 origin/branchstart|tagnamestart|START origin/branchend|tagnameend|HEAD"
|
||||
echo "Example: $0 origin/18.0 origin/19.0"
|
||||
echo "Example: $0 origin/18.0 HEAD"
|
||||
exit
|
||||
fi
|
||||
|
||||
START="$1.."
|
||||
END=$2
|
||||
if [ "$START" = "START.." ]; then
|
||||
START=""
|
||||
fi
|
||||
|
||||
TMPFILE=/tmp/github_lines_perusers.tmp
|
||||
|
||||
[ "$DEBUG" ] && echo "git log '${START}${END}' --shortstat --use-mailmap | grep ... | perl ... > '${TMPFILE}'"
|
||||
git log "${START}${END}" --shortstat --use-mailmap | iconv -f UTF-8 -t ASCII//TRANSLIT --byte-subst='?' -c | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > "${TMPFILE}"
|
||||
|
||||
echo "Users and nb of lines";
|
||||
awk < "${TMPFILE}" 'BEGIN { FS="\n"; lastuser=""; } { if ($1 ~ /^Author:/) { sub(/<.*/, ""); lastuser=tolower($1) }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } ' | sort
|
||||
|
||||
# Clean up
|
||||
rm "${TMPFILE}"
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#/bin/bash
|
||||
#
|
||||
# Count number of lines modified per user for a given branch
|
||||
#
|
||||
|
||||
if [ "x$2" = "x" ]; then
|
||||
echo "Usage: $0 origin/branchstart|tagnamestart|START origin/branchend|tagnameend|HEAD"
|
||||
exit
|
||||
fi
|
||||
|
||||
START=$1
|
||||
if [ "x$START" = "xSTART" ]; then
|
||||
START=""
|
||||
fi
|
||||
|
||||
echo "git log $START..$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
|
||||
git log $START..$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp
|
||||
|
||||
cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } '
|
||||
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
# Based of: https://gist.github.com/jaymzcd/342399 and https://github.com/buren/flag-sprite-maker
|
||||
|
||||
# shellcheck disable=2006,2086,2129,2219,2231
|
||||
|
||||
# uses imagemagick to stich together all images in a folder and
|
||||
# then writes a css file with the correct offsets along with a
|
||||
# test html page for verification that its all good
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
# Borrowed from https://gist.github.com/lgiraudel/6065155
|
||||
# Inplace mode added by Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
|
||||
# shellcheck disable=2003,2006,2034,2046,2086,2166,2268
|
||||
|
||||
PROGNAME=${0##*/}
|
||||
INPUT=''
|
||||
QUIET='0'
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ MINPHPVERSION="7.0"
|
|||
|
||||
echo "***** run-php-cs-fixer.sh *****"
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Syntax: run-php-cs-fixer.sh check|fix [path_from_root_project]"
|
||||
exit 1;
|
||||
fi
|
||||
|
|
@ -60,7 +60,7 @@ PHP_CS_FIXER="${COMPOSER_VENDOR_DIR}/bin/php-cs-fixer"
|
|||
if [ ! -r "${PHP_CS_FIXER}" ] ; then
|
||||
[[ ! -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} install
|
||||
[[ -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} update
|
||||
php${MINPHPVERSION} ${COMPOSER_CMD} require --dev friendsofphp/php-cs-fixer
|
||||
"php${MINPHPVERSION}" "${COMPOSER_CMD}" require --dev friendsofphp/php-cs-fixer
|
||||
echo
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
# be able to make size fixed screenshots using
|
||||
# ALT+Print screen.
|
||||
#----------------------------------------------------
|
||||
# shellcheck disable=2086,2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" = "x" ]
|
||||
|
|
|
|||
0
dev/tools/test/namespacemig/bbb.php
Executable file → Normal file
0
dev/tools/test/namespacemig/bbb.php
Executable file → Normal file
0
dev/tools/test/testperf.php
Executable file → Normal file
0
dev/tools/test/testperf.php
Executable file → Normal file
0
dev/tools/test/testtcpdf.php
Executable file → Normal file
0
dev/tools/test/testtcpdf.php
Executable file → Normal file
154
dev/tools/updatelicense.php
Executable file
154
dev/tools/updatelicense.php
Executable file
|
|
@ -0,0 +1,154 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script to update year periods and user/email in headers.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieve Git user information
|
||||
*
|
||||
* @return array{name:string,email:string}
|
||||
*/
|
||||
function getGitUserInfo()
|
||||
{
|
||||
$name = trim(shell_exec('git config user.name'));
|
||||
$email = trim(shell_exec('git config user.email'));
|
||||
return ['name' => $name, 'email' => $email];
|
||||
}
|
||||
|
||||
const PREFIXES = [
|
||||
'sh' => ['# ', '# ', '', '#!'],
|
||||
'php' => ['/* ', ' * ', ' */', '<?php'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Update or add copyright notice in a file
|
||||
*
|
||||
* @param $filename string Path to the file to modify
|
||||
* @param $fileType string Filetype identification for the file
|
||||
* @param $name string Name of developer to add in header
|
||||
* @param $email string Email for the developer
|
||||
*
|
||||
* @return bool True if license was updated
|
||||
*/
|
||||
function updateCopyrightNotice($filename, $fileType, $name, $email)
|
||||
{
|
||||
// Determine the appropriate prefix based on file type
|
||||
if (!array_key_exists($fileType, PREFIXES)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get configuration for the filetype
|
||||
list($prefix0, $prefix1, $prefix2, $prefix3) = PREFIXES[$fileType];
|
||||
$r_prefix0 = preg_quote($prefix0);
|
||||
$r_prefix1 = preg_quote($prefix1);
|
||||
$r_prefix3 = preg_quote($prefix3);
|
||||
$r_name = preg_quote($name);
|
||||
$r_email = preg_quote($email);
|
||||
|
||||
// Read the first n lines of the file
|
||||
$n = 50;
|
||||
$lines = implode('', array_slice(file($filename), 0, $n));
|
||||
|
||||
// Define the regex pattern for matching copyright notices
|
||||
$pattern = "~(?:{$r_prefix0}|{$r_prefix1})Copyright \(C\)\s+(?:(?:\d{4}-)?(?<year>\d{4}))\s+{$r_name}\s*\<{$r_email}>~";
|
||||
|
||||
// Check if the lines match the pattern
|
||||
if (preg_match($pattern, $lines, $matches)) {
|
||||
$existingYear = $matches['year'];
|
||||
|
||||
// Check if the existing year is different from the current year
|
||||
if ($existingYear !== date('Y')) {
|
||||
// Update the year range to include or be up to the current year
|
||||
$updatedNotice = preg_replace('/(\d{4})(-\d{4})?\s+/', $existingYear . '-' . date('Y') . "\t", $matches[0]);
|
||||
|
||||
// Replace the old notice with the updated one in the file
|
||||
file_put_contents($filename, preg_replace($pattern, $updatedNotice, file_get_contents($filename)));
|
||||
return true; // Change detected
|
||||
}
|
||||
// If the existing year is the same, no need to update
|
||||
} else {
|
||||
// Adjust tabs for proper alignment
|
||||
$emailTabs = str_repeat("\t", (int) (max(0, (31 - mb_strlen($name)) / 4)));
|
||||
|
||||
// No match found, add a new line to the header
|
||||
$newNotice = "Copyright (C) " . date('Y') . "\t\t" . $name . $emailTabs . "<" . $email . ">";
|
||||
|
||||
// Read the file content
|
||||
$fileContent = file_get_contents($filename);
|
||||
|
||||
// Check if there are existing copyright notices
|
||||
$pos = max(strrpos($fileContent, "{$prefix0}Copyright"), strrpos($fileContent, "{$prefix1}Copyright"));
|
||||
|
||||
if ($pos !== false) {
|
||||
// Add the new notice behind the last preceding copyright notices
|
||||
$pos = strpos($fileContent, "\n", $pos) + 1;
|
||||
$fileContent = substr_replace($fileContent, $prefix1 . $newNotice . "\n", $pos, 0);
|
||||
} elseif (strpos($fileContent, $prefix3) !== false) {
|
||||
// Add the new notice after the shebang or '<?php' line
|
||||
$fileContent = preg_replace("~{$r_prefix3}.*\n~", "$0$prefix0$newNotice\n$prefix2\n", $fileContent, 1);
|
||||
} else {
|
||||
return false; // No change detected
|
||||
}
|
||||
|
||||
// Write the updated content back to the file
|
||||
file_put_contents($filename, $fileContent);
|
||||
return true; // Change detected
|
||||
}
|
||||
|
||||
return false; // No change detected
|
||||
}
|
||||
|
||||
// Main program
|
||||
|
||||
// Check if filenames are provided as parameters
|
||||
if ($argc < 2) {
|
||||
echo "Usage: php " . __FILE__ . " <filename1> [<filename2> ...]" . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Process each filename provided
|
||||
$changesDetected = false;
|
||||
for ($i = 1; $i < $argc; $i++) {
|
||||
$filename = $argv[$i];
|
||||
|
||||
// Determine file type based on extension
|
||||
$fileType = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
|
||||
// Retrieve Git user information
|
||||
$gitUserInfo = getGitUserInfo();
|
||||
$name = $gitUserInfo['name'];
|
||||
$email = $gitUserInfo['email'];
|
||||
|
||||
// Update or add copyright notice based on file type
|
||||
$changeDetected = updateCopyrightNotice($filename, $fileType, $name, $email);
|
||||
$changesDetected |= $changeDetected;
|
||||
if ($changeDetected) {
|
||||
echo "Copyright notice updated in '$filename'" . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$changesDetected) {
|
||||
echo "No changes needed in any file" . PHP_EOL;
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ class autoTranslator
|
|||
public function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey)
|
||||
{
|
||||
|
||||
// Set enviorment variables
|
||||
// Set environment variables
|
||||
$this->_destlang = $_destlang;
|
||||
$this->_refLang = $_refLang;
|
||||
$this->_langDir = $_langDir.self::DIR_SEPARATOR;
|
||||
|
|
@ -206,7 +206,7 @@ class autoTranslator
|
|||
}
|
||||
|
||||
/**
|
||||
* Put in array _translatedFiles[$file], line of a new tranlated pair
|
||||
* Put in array _translatedFiles[$file], line of a new translated pair
|
||||
*
|
||||
* @param string $content Existing content of dest file
|
||||
* @param string $file Target file name translated (xxxx.lang)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue