mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-31 14:12:29 +01:00
Merge branch 'develop' into features/reglementdon
This commit is contained in:
@@ -4,10 +4,10 @@ languages:
|
||||
JavaScript: true
|
||||
PHP: true
|
||||
engines:
|
||||
phpcodesniffer: true
|
||||
phpcodesniffer: true
|
||||
exclude_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'test/*'
|
||||
- 'htdocs/includes/*'
|
||||
- 'htdocs/includes/*'
|
||||
|
||||
3
.gitattributes
vendored
3
.gitattributes
vendored
@@ -3,7 +3,7 @@
|
||||
* text=auto
|
||||
|
||||
|
||||
# Explicitly declare text files we want to always be normalized and converted
|
||||
# Explicitly declare text files we want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.php text eol=lf
|
||||
*.pl text eol=lf
|
||||
@@ -21,6 +21,7 @@
|
||||
*.yml text eol=lf
|
||||
*.yaml text eol=lf
|
||||
*.conf text eol=lf
|
||||
*.neon text eol=lf
|
||||
|
||||
.bash_aliases text eol=lf
|
||||
|
||||
|
||||
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'
|
||||
|
||||
62
.github/workflows/phpstan.yml
vendored
Normal file
62
.github/workflows/phpstan.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# This is a basic workflow to check code with PHPSTAN tool
|
||||
|
||||
name: "PHPStan"
|
||||
|
||||
# Controls when the workflow will run
|
||||
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
|
||||
php-stan:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-version:
|
||||
# PHPStan requires PHP >= 7.2.
|
||||
#- "7.2"
|
||||
- "8.2"
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# Get PHP and addons
|
||||
- name: Setup PHP
|
||||
id: setup-php
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
tools: phpstan, cs2pr
|
||||
extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, mysql, pgsql, sqlite3, ldap, xml, mcrypt
|
||||
|
||||
# Restore old cache
|
||||
- name: Restore phpstan cache
|
||||
id: cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ./.github/tmp
|
||||
key: "phpstan-cache-${{ matrix.php-version }}-${{ github.run_id }}"
|
||||
restore-keys: |
|
||||
phpstan-cache-${{ matrix.php-version }}-
|
||||
- name: Show debug into
|
||||
run: cd ./.github/tmp && ls -al
|
||||
|
||||
# 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@v4
|
||||
if: ${{ success() || ( ! cancelled() && steps.cache.outputs.cache-hit != 'true' ) }}
|
||||
with:
|
||||
path: ./.github/tmp
|
||||
key: "phpstan-cache-${{ matrix.php-version }}-${{ github.run_id }}"
|
||||
111
.github/workflows/pre-commit.yml
vendored
Normal file
111
.github/workflows/pre-commit.yml
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
---
|
||||
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
|
||||
|
||||
# The next uses the git API because there is no clone yet.
|
||||
# This is faster for a big repo.
|
||||
- name: Get all changed php files (if PR)
|
||||
id: changed-php
|
||||
uses: tj-actions/changed-files@v42
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
files: |
|
||||
**.php
|
||||
|
||||
# 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}
|
||||
|
||||
# The next uses git, which is slow for a bit repo.
|
||||
# - name: Get all changed php files (if PR)
|
||||
# id: changed-php
|
||||
# uses: tj-actions/changed-files@v42
|
||||
# if: github.event_name == 'pull_request'
|
||||
# with:
|
||||
# files: |
|
||||
# **.php
|
||||
|
||||
- name: Setup PHPCS
|
||||
uses: shivammathur/setup-php@v2
|
||||
if: steps.changed-php.outputs.any_changed == 'true'
|
||||
with:
|
||||
php-version: 8.1
|
||||
coverage: none # disable xdebug, pcov
|
||||
tools: phpcs
|
||||
|
||||
- name: Run some pre-commit hooks on selected changed files only
|
||||
if: steps.changed-php.outputs.any_changed == 'true'
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-php.outputs.all_changed_files }}
|
||||
run: |
|
||||
set -o pipefail
|
||||
pre-commit run php-cs --files ${ALL_CHANGED_FILES} | tee -a ${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
|
||||
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -50,6 +50,9 @@ build/yarn-error.log
|
||||
build/node_modules/
|
||||
node_modules/
|
||||
|
||||
vendor/
|
||||
tmp/
|
||||
|
||||
#yarn
|
||||
yarn.lock
|
||||
|
||||
|
||||
148
.pre-commit-config.yaml
Normal file
148
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,148 @@
|
||||
---
|
||||
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.5.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.33.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.6
|
||||
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_types: [image]
|
||||
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.6
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
args: [-W, '100']
|
||||
33
.travis.yml
33
.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
|
||||
@@ -268,8 +268,9 @@ before_script:
|
||||
|
||||
- |
|
||||
export CONF_FILE=htdocs/conf/conf.php
|
||||
echo "Setting up Dolibarr $CONF_FILE"
|
||||
echo "Setting up Dolibarr '$CONF_FILE'"
|
||||
echo '<?php' > $CONF_FILE
|
||||
echo 'error_reporting(E_ALL);' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE
|
||||
@@ -393,6 +394,7 @@ script:
|
||||
# Ensure we catch errors
|
||||
set +e
|
||||
echo '<?php ' > $INSTALL_FORCED_FILE
|
||||
echo 'error_reporting(E_ALL);' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
|
||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
||||
echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE
|
||||
@@ -413,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
|
||||
@@ -481,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
|
||||
|
||||
|
||||
10
COPYRIGHT
10
COPYRIGHT
@@ -26,9 +26,9 @@ PHP libraries:
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation. Used by dynamic price only. TODO Replace with dol_eval ?
|
||||
Escpos-php 3.0 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||
MathPHP 2.8.1 MIT License Yes Modern math library for PHP
|
||||
MathPHP 2.8.1 MIT License Yes Modern math library for PHP (only few files)
|
||||
Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
NuSoap 0.9.16 LGPL 2.1+ Yes Library to develop SOAP Web services. From https://github.com/f00b4r/nusoap/tree/v0.9.16
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
ParseDown 1.7.4 MIT License Yes Markdown parser
|
||||
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
|
||||
@@ -38,10 +38,11 @@ PHP-Iban 4.1.1 LGPL-3+ Yes
|
||||
PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth
|
||||
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
PrestaShop-WS-Lib 94feb5f OSL-3.0 No Library providing API client for Prestashop.
|
||||
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
|
||||
@@ -68,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:
|
||||
@@ -78,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
|
||||
|
||||
27
SECURITY.md
27
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.
|
||||
@@ -82,18 +86,15 @@ Scope is the web application (backoffice) and the APIs.
|
||||
## Examples of vulnerabilities that are Non-qualified for reporting.
|
||||
|
||||
* "Self" XSS
|
||||
* SSL/TLS best practices
|
||||
* Denial of Service attacks
|
||||
* Clickjacking/UI redressing
|
||||
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device
|
||||
* Presence of autocomplete attribute on web forms
|
||||
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
|
||||
* Logout and other instances of low-severity Cross-Site Request Forgery
|
||||
* Missing security-related HTTP headers which do not lead directly to a vulnerability
|
||||
* Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated
|
||||
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
|
||||
* Reports on features flagged as "experimental" or "development"
|
||||
* Software version or private IP disclosure when logged-in user is admin
|
||||
* Stack traces or path disclosure when logged-in user is admin
|
||||
* 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, 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".
|
||||
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed.
|
||||
* 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
|
||||
* 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
|
||||
|
||||
|
||||
@@ -48,7 +50,7 @@ echo "Ask for web server to setup"
|
||||
db_input critical dolibarr/reconfigure-webserver || true
|
||||
|
||||
if db_go ; then
|
||||
okcancel="1"
|
||||
okcancel="1"
|
||||
else
|
||||
okcancel="0"
|
||||
fi
|
||||
|
||||
@@ -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:
|
||||
@@ -19,25 +21,25 @@ if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
|
||||
fi
|
||||
|
||||
setup_empty_conf() {
|
||||
echo Create empty file $config
|
||||
mkdir -p /etc/dolibarr
|
||||
touch /etc/dolibarr/conf.php
|
||||
chown root:www-data /etc/dolibarr/conf.php
|
||||
chmod 660 /etc/dolibarr/conf.php
|
||||
echo Create empty file $config
|
||||
mkdir -p /etc/dolibarr
|
||||
touch /etc/dolibarr/conf.php
|
||||
chown root:www-data /etc/dolibarr/conf.php
|
||||
chmod 660 /etc/dolibarr/conf.php
|
||||
}
|
||||
|
||||
is_new_upstream_version() {
|
||||
# $1 can be empty (not installed) and will result in a true value
|
||||
# for the check
|
||||
old_version=$(echo "$1" | sed -e 's/-[^-]*$//' -e 's/^[0-9]*://')
|
||||
new_version=$(dpkg-query -f '${Version}' -W dolibarr | \
|
||||
sed -e 's/-[^-]*$//' -e 's/^[0-9]*://')
|
||||
test "$old_version" != "$new_version"
|
||||
# $1 can be empty (not installed) and will result in a true value
|
||||
# for the check
|
||||
old_version=$(echo "$1" | sed -e 's/-[^-]*$//' -e 's/^[0-9]*://')
|
||||
new_version=$(dpkg-query -f '${Version}' -W dolibarr | \
|
||||
sed -e 's/-[^-]*$//' -e 's/^[0-9]*://')
|
||||
test "$old_version" != "$new_version"
|
||||
}
|
||||
|
||||
enable_install_upgrade_wizard() {
|
||||
echo Enable install wizard by removing install.lock file if present
|
||||
rm -f /var/lib/dolibarr/documents/install.lock
|
||||
rm -f /var/lib/dolibarr/documents/install.lock
|
||||
}
|
||||
|
||||
|
||||
@@ -46,24 +48,24 @@ php_install() {
|
||||
# php5endmod exists for ubuntu only
|
||||
echo "Enable php module mysqli with php5enmod"
|
||||
php5enmod mysqli
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
apache_install() {
|
||||
webserver=$1
|
||||
|
||||
|
||||
# Enable Apache 2 alias module
|
||||
if which a2enmod >/dev/null 2>&1 ;then
|
||||
echo "Enable apache module alias with a2enmod"
|
||||
a2enmod alias
|
||||
fi
|
||||
|
||||
|
||||
# Enable dolibarr conf
|
||||
if which a2enconf >/dev/null 2>&1 ;then
|
||||
# a2enconf exists for ubuntu only
|
||||
echo "Enable link for Apache config file with a2enconf"
|
||||
a2enconf dolibarr
|
||||
else
|
||||
else
|
||||
if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then
|
||||
echo "Add link for Apache config file"
|
||||
ln -s /etc/$webserver/conf-available/dolibarr.conf /etc/$webserver/conf.d/dolibarr.conf
|
||||
@@ -101,7 +103,7 @@ case "$1" in
|
||||
configure)
|
||||
if [ -z "$2" ]; then
|
||||
echo First install
|
||||
#setup_empty_conf
|
||||
#setup_empty_conf
|
||||
else
|
||||
echo This is not a first install
|
||||
fi
|
||||
@@ -109,17 +111,17 @@ case "$1" in
|
||||
php_install
|
||||
apache_install
|
||||
lighttpd_install
|
||||
|
||||
|
||||
# Remove lock file
|
||||
if is_new_upstream_version "$2"; then
|
||||
enable_install_upgrade_wizard
|
||||
enable_install_upgrade_wizard
|
||||
fi
|
||||
|
||||
# Create document directory for uploaded data files
|
||||
mkdir -p $docdir
|
||||
chown -R www-data:www-data $docdir
|
||||
chmod -R 775 $docdir
|
||||
chmod -R g+s $docdir
|
||||
|
||||
# Create document directory for uploaded data files
|
||||
mkdir -p $docdir
|
||||
chown -R www-data:www-data $docdir
|
||||
chmod -R 775 $docdir
|
||||
chmod -R g+s $docdir
|
||||
|
||||
# Copy install config file (with matching Debian values) into target directory
|
||||
superuserlogin=''
|
||||
@@ -136,14 +138,14 @@ case "$1" in
|
||||
cat $installfileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig
|
||||
fi
|
||||
chown -R root:www-data $installconfig
|
||||
chmod -R 660 $installconfig
|
||||
chmod -R 660 $installconfig
|
||||
|
||||
# If a conf already exists and its content was already completed by installer
|
||||
if [ ! -s $config ] || ! grep -q "File generated by" $config
|
||||
then
|
||||
# Create an empty conf.php with permission to web server
|
||||
setup_empty_conf
|
||||
#else
|
||||
#else
|
||||
# File already exist. We add params not found.
|
||||
#echo Add new params to overwrite path to use shared libraries/fonts
|
||||
##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
|
||||
@@ -154,18 +156,18 @@ case "$1" in
|
||||
#grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_js_JQUERY_UI" $config || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_js_JQUERY_FLOT" $config || [ ! -d "/usr/share/javascript/flot" ] || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
|
||||
#grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
|
||||
fi
|
||||
|
||||
|
||||
db_get dolibarr/reconfigure-webserver
|
||||
|
||||
|
||||
webservers="$RET"
|
||||
|
||||
|
||||
# Set up web server.
|
||||
for webserver in $webservers ; do
|
||||
webserver=${webserver%,}
|
||||
echo Complete config of server $webserver
|
||||
|
||||
|
||||
# Detect webuser and webgroup
|
||||
webuser=
|
||||
webgroup=
|
||||
@@ -181,7 +183,7 @@ case "$1" in
|
||||
|
||||
# Set permissions to web server
|
||||
chown -R $webuser:$webgroup /usr/share/dolibarr
|
||||
chown -R root:$webgroup $config
|
||||
chown -R root:$webgroup $config
|
||||
done
|
||||
|
||||
# Restart web server.
|
||||
@@ -193,33 +195,33 @@ case "$1" in
|
||||
apache_install $webserver
|
||||
fi
|
||||
# Reload webserver in any case, configuration might have changed
|
||||
# Redirection of 3 is needed because Debconf uses it and it might
|
||||
# Redirection of 3 is needed because Debconf uses it and it might
|
||||
# be inherited by webserver. See bug #446324.
|
||||
if [ -f /etc/init.d/$webserver ] ; then
|
||||
if [ -x /usr/sbin/invoke-rc.d ]; then
|
||||
echo Restart web server $server using invoke-rc.d
|
||||
# This works with Debian (5.05,...) and Ubuntu (9.10,10.04,...)
|
||||
invoke-rc.d $webserver reload 3>/dev/null || true
|
||||
else
|
||||
echo Restart web server $server using $server reload
|
||||
/etc/init.d/$webserver reload 3>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
if [ -f /etc/init.d/$webserver ] ; then
|
||||
if [ -x /usr/sbin/invoke-rc.d ]; then
|
||||
echo Restart web server $server using invoke-rc.d
|
||||
# This works with Debian (5.05,...) and Ubuntu (9.10,10.04,...)
|
||||
invoke-rc.d $webserver reload 3>/dev/null || true
|
||||
else
|
||||
echo Restart web server $server using $server reload
|
||||
/etc/init.d/$webserver reload 3>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
echo ----------
|
||||
echo "Call Dolibarr page http://localhost/dolibarr/ to complete the setup and use Dolibarr."
|
||||
echo ----------
|
||||
;;
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument $1" >&2
|
||||
exit 0
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
# shellcheck disable=1091,2006,2034,2086,2089,2090
|
||||
|
||||
#set -e
|
||||
set +e
|
||||
|
||||
@@ -30,8 +32,8 @@ lighttpd_remove() {
|
||||
fi
|
||||
# See bug #448682
|
||||
if [ -h /etc/lighttpd/conf-enabled/50-dolibarr.conf ] ; then
|
||||
echo "postrm Manually deleting lighttpd/dolibarr configuration link"
|
||||
rm /etc/lighttpd/conf-enabled/50-dolibarr.conf
|
||||
echo "postrm Manually deleting lighttpd/dolibarr configuration link"
|
||||
rm /etc/lighttpd/conf-enabled/50-dolibarr.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -46,7 +48,7 @@ apache_remove() {
|
||||
|
||||
|
||||
if [ -f /usr/share/debconf/confmodule ]; then
|
||||
. /usr/share/debconf/confmodule
|
||||
. /usr/share/debconf/confmodule
|
||||
fi
|
||||
|
||||
db_version 2.0
|
||||
@@ -62,12 +64,12 @@ lockfile="$docdir/install.lock"
|
||||
|
||||
case "$1" in
|
||||
|
||||
# Call when we upgrade
|
||||
# Call when we upgrade
|
||||
upgrade)
|
||||
echo "postrm upgrade"
|
||||
;;
|
||||
;;
|
||||
|
||||
# Call when we uninstall
|
||||
# Call when we uninstall
|
||||
remove)
|
||||
echo "postrm remove"
|
||||
rm -f $lockfile
|
||||
@@ -85,7 +87,7 @@ case "$1" in
|
||||
else
|
||||
apache_remove $webserver
|
||||
fi
|
||||
# Redirection of 3 is needed because Debconf uses it and it might
|
||||
# Redirection of 3 is needed because Debconf uses it and it might
|
||||
# be inherited by webserver. See bug #446324.
|
||||
if [ -f /etc/init.d/$webserver ] ; then
|
||||
if [ -x /usr/sbin/invoke-rc.d ]; then
|
||||
@@ -95,9 +97,9 @@ case "$1" in
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
;;
|
||||
|
||||
# Call when we uninstall and purge
|
||||
# Call when we uninstall and purge
|
||||
purge)
|
||||
echo "postrm purge"
|
||||
|
||||
@@ -111,7 +113,7 @@ case "$1" in
|
||||
set +e
|
||||
db_get dolibarr/postrm
|
||||
set -e
|
||||
|
||||
|
||||
if [ "$RET" = "true" ] ; then
|
||||
echo postrm Mysql database deletion
|
||||
# Get database configuration
|
||||
@@ -131,7 +133,7 @@ case "$1" in
|
||||
dbadmin="$superuserlogin"
|
||||
dbadmpass="$superuserpassword"
|
||||
dbtype="mysql"
|
||||
|
||||
|
||||
# To delete a mysql user (disabled)
|
||||
# Needs: $dbuser - the user name to create (or replace).
|
||||
# $dballow - what hosts to allow (defaults to %).
|
||||
@@ -144,7 +146,7 @@ case "$1" in
|
||||
# mysql
|
||||
# /usr/share/wwwconfig-coomon/mysql.get
|
||||
#. /usr/share/wwwconfig-common/${dbtype}-dropuser.sh
|
||||
|
||||
|
||||
# To delete database
|
||||
# Needs: $dbname - the database that user should have access to.
|
||||
# $dbserver - the server to connect to.
|
||||
@@ -158,85 +160,85 @@ case "$1" in
|
||||
# Define mysqlcmd
|
||||
if [ -z "$dbserver" ] || [ "$dbserver" = "localhost" ]; then
|
||||
hostopt=""
|
||||
dbserver=localhost
|
||||
dbserver=localhost
|
||||
else
|
||||
case "$dbserver" in
|
||||
:*)
|
||||
dbsocket=`echo $dbserver | sed -e 's/^://'`
|
||||
hostopt="-S $dbsocket"
|
||||
;;
|
||||
*)
|
||||
hostopt="-h $dbserver"
|
||||
;;
|
||||
esac
|
||||
case "$dbserver" in
|
||||
:*)
|
||||
dbsocket=`echo $dbserver | sed -e 's/^://'`
|
||||
hostopt="-S $dbsocket"
|
||||
;;
|
||||
*)
|
||||
hostopt="-h $dbserver"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ -z "$dbadmpass" ] ; then
|
||||
log="${log}No password used."
|
||||
passopt=""
|
||||
log="${log}No password used."
|
||||
passopt=""
|
||||
else
|
||||
passopt="--password='"`echo "$dbadmpass" | sed -e "s/'/'"'"'"'"'"'"'/g"`"'"
|
||||
passopt="--password='"`echo "$dbadmpass" | sed -e "s/'/'"'"'"'"'"'"'/g"`"'"
|
||||
fi
|
||||
mysqlcmd="mysql $hostopt $passopt -u $dbadmin"
|
||||
mysqlcmdnopass="mysql $hostopt -u $dbadmin"
|
||||
|
||||
# Now run the drop user
|
||||
|
||||
# Now run the drop user
|
||||
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'localhost';\"" ; then
|
||||
echo postrm Database login $dbuser@localhost removed
|
||||
else
|
||||
error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'localhost';\""
|
||||
error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'localhost';\""
|
||||
echo postrm $error
|
||||
fi
|
||||
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'%';\"" ; then
|
||||
echo postrm Database login $dbuser@% removed
|
||||
else
|
||||
error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'%';\""
|
||||
error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'%';\""
|
||||
echo postrm $error
|
||||
fi
|
||||
|
||||
# Now run the drop commands
|
||||
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
|
||||
log="${log}Droping database $dbname."
|
||||
# Now run the drop commands
|
||||
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
|
||||
log="${log}Dropping database $dbname."
|
||||
if eval $mysqlcmd -f -e "\"DROP DATABASE $dbname;\"" ; then
|
||||
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
|
||||
error="Database $dbname NOT successfully droped. You have to do it manually."
|
||||
echo postrm $error
|
||||
else
|
||||
status=drop
|
||||
fi
|
||||
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
|
||||
error="Database $dbname NOT successfully dropped. You have to do it manually."
|
||||
echo postrm $error
|
||||
else
|
||||
status=drop
|
||||
fi
|
||||
else
|
||||
error="Unable to run the drop database script."
|
||||
error="Unable to run the drop database script."
|
||||
echo postrm $error
|
||||
fi
|
||||
else
|
||||
else
|
||||
status=nothing
|
||||
log="${log}Database $dbname already not exists."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "postrm Remove directory $docdir"
|
||||
rm -rf $docdir ;
|
||||
|
||||
echo "postrm Remove directory $docdir"
|
||||
rm -rf $docdir ;
|
||||
|
||||
else
|
||||
echo "postrm Delete of dolibarr database and uploaded files not wanted"
|
||||
echo "postrm Delete of dolibarr database and uploaded files not wanted"
|
||||
fi
|
||||
|
||||
|
||||
rm -rf /etc/dolibarr
|
||||
|
||||
# We clean variable (we ignore errors because db_reset can fails if var was never set)
|
||||
set +e
|
||||
set +e
|
||||
db_reset dolibarr/reconfigure-webserver
|
||||
db_reset dolibarr/postrm
|
||||
set -e
|
||||
set -e
|
||||
|
||||
#db_purge
|
||||
;;
|
||||
;;
|
||||
|
||||
failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
;;
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument $1" >&2
|
||||
exit 0
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# shellcheck disable=2034,2086,2103,2164
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
|
||||
|
||||
# Download source file
|
||||
if [ -n "$1" ]; then
|
||||
uscan_opts="--download-version=$1"
|
||||
uscan_opts="--download-version=$1"
|
||||
fi
|
||||
#uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
%:
|
||||
|
||||
10
build/docker/docker-run.sh
Normal file → Executable file
10
build/docker/docker-run.sh
Normal file → Executable file
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
# Script used by the Dockerfile.
|
||||
# See README.md to know how to create a Dolibarr env with docker
|
||||
# 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);
|
||||
|
||||
@@ -253,6 +253,7 @@ int main(int argc, char **argv)
|
||||
//----------------
|
||||
int noarg,curseurarg,help=0,invalide=0;
|
||||
char option;
|
||||
char *endptr;
|
||||
|
||||
for (noarg=1;noarg<argc;noarg++) {
|
||||
if (((argv[noarg][0])=='/') || ((argv[noarg][0])=='-')) {
|
||||
@@ -261,7 +262,7 @@ for (noarg=1;noarg<argc;noarg++) {
|
||||
if (strlen(argv[noarg]) < 3) { ++noarg; curseurarg=0; }
|
||||
switch (option) {
|
||||
case 's': strncpy(Host,argv[noarg]+curseurarg,sizeof(Host)); break;
|
||||
case 'p': Port=atoi(argv[noarg]+curseurarg); break;
|
||||
case 'p': Port=strtol(argv[noarg] + curseurarg, &endptr, 10); break; // Get port from "-p80" (curseurarg = 2) or "-p 80" (curseurarg = 0)
|
||||
case '?': help=-1;break; // Help
|
||||
case 'h': help=-1;break; // Help
|
||||
case 'v': help=-1;break; // Help
|
||||
@@ -270,6 +271,20 @@ for (noarg=1;noarg<argc;noarg++) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for conversion errors
|
||||
if (*endptr != '\0') {
|
||||
// Handle error: Invalid input format
|
||||
printf("Invalid port number format\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Check for overflow
|
||||
if (Port < 0 || Port > INT_MAX) {
|
||||
// Handle error: Port number out of range
|
||||
printf("Port number out of range\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
help=!(Port > 0);
|
||||
|
||||
// Show usage
|
||||
|
||||
@@ -304,22 +304,15 @@ if (isset($_GET['img']))
|
||||
|
||||
|
||||
|
||||
// Definition de la langue et des textes
|
||||
// Definition of language and texts
|
||||
|
||||
if (isset ($_GET['lang']))
|
||||
{
|
||||
$langue = $_GET['lang'];
|
||||
}
|
||||
elseif (preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
||||
{
|
||||
if (isset ($_GET['lang'])) {
|
||||
$langue = preg_replace('/[^a-z_]/i', '', $_GET['lang']);
|
||||
} elseif (preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$langue = 'fr';
|
||||
}
|
||||
elseif (preg_match("/^es/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
||||
{
|
||||
} elseif (preg_match("/^es/", $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$langue = 'es';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langue = 'en';
|
||||
}
|
||||
|
||||
@@ -327,29 +320,25 @@ else
|
||||
// Read PHP extensions
|
||||
$loaded_extensions = get_loaded_extensions();
|
||||
$phpExtContents='';
|
||||
foreach ($loaded_extensions as $extension)
|
||||
foreach ($loaded_extensions as $extension) {
|
||||
$phpExtContents .= "<li>${extension}</li>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Read alias directory
|
||||
$listoffile=array();
|
||||
$aliasarray=array();
|
||||
$aliasContents='';
|
||||
if (is_dir($aliasDir))
|
||||
{
|
||||
if (is_dir($aliasDir)) {
|
||||
$handle=opendir($aliasDir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while ($file = readdir($handle))
|
||||
{
|
||||
if (is_resource($handle)) {
|
||||
while ($file = readdir($handle)) {
|
||||
$listoffiles[]=$file;
|
||||
}
|
||||
}
|
||||
sort($listoffiles);
|
||||
|
||||
foreach($listoffiles as $file)
|
||||
{
|
||||
foreach($listoffiles as $file) {
|
||||
if (is_file($aliasDir.$file) && preg_match('/\.conf/',$file))
|
||||
{
|
||||
$msg = '';
|
||||
@@ -374,8 +363,7 @@ if (!isset($aliasContents))
|
||||
// Read projects in www dir
|
||||
$listoffiles=array();
|
||||
$handle=opendir(".");
|
||||
if (is_resource($handle))
|
||||
{
|
||||
if (is_resource($handle)) {
|
||||
while ($file = readdir($handle))
|
||||
{
|
||||
$listoffiles[]=$file;
|
||||
@@ -383,8 +371,7 @@ if (is_resource($handle))
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
foreach($listoffiles as $file)
|
||||
{
|
||||
foreach($listoffiles as $file) {
|
||||
if (is_dir($file) && !in_array($file,$projectsListIgnore) && !in_array($file,$aliasarray))
|
||||
{
|
||||
$projectContents .= '<tr><td><ul class="projects">';
|
||||
@@ -397,9 +384,9 @@ foreach($listoffiles as $file)
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($projectContents))
|
||||
if (!isset($projectContents)) {
|
||||
$projectContents = '<tr><td colspan="3">'.$langues[$langue]['txtNoProjet'].'</td></tr>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$nameServer=getenv("COMPUTERNAME");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -636,6 +636,12 @@ if ($nboftargetok) {
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`;
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/bin`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/bin`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/*/bin`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/*/*/bin`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/*/*/*/bin`;
|
||||
}
|
||||
|
||||
# Build package for each target
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -58,8 +58,8 @@ DoliWamp is the auto-installer for Windows users with no technical knowledge to
|
||||
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM per Windows</Char_Desc_45>
|
||||
<Char_Desc_80>Gestionale open source e gratuito per piccole e medie imprese, fondazioni</Char_Desc_80>
|
||||
<Char_Desc_250>Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività.</Char_Desc_250>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibarr è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
</Italian>
|
||||
</Program_Descriptions>
|
||||
<Web_Info>
|
||||
|
||||
@@ -53,8 +53,8 @@ Note that Dolibarr is also available with an auto-installer for Windows or Ubunt
|
||||
<Char_Desc_45>Gestionale open source e gratuito</Char_Desc_45>
|
||||
<Char_Desc_80>Gestionale open source e gratuito per piccole e medie imprese, fondazioni</Char_Desc_80>
|
||||
<Char_Desc_250>Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività.</Char_Desc_250>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibarr è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
</Italian>
|
||||
<French>
|
||||
<Keywords>dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp</Keywords>
|
||||
|
||||
@@ -95,8 +95,8 @@ Dolibarr intègre en effet sa propre architecture (design patterns) permettant
|
||||
<Char_Desc_45>Gestionale open source e gratuito</Char_Desc_45>
|
||||
<Char_Desc_80>Gestionale open source e gratuito per piccole e medie imprese, fondazioni</Char_Desc_80>
|
||||
<Char_Desc_250>Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività.</Char_Desc_250>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibarr è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
</Italian>
|
||||
</Program_Descriptions>
|
||||
<Web_Info>
|
||||
|
||||
@@ -95,8 +95,8 @@ Dolibarr intègre en effet sa propre architecture (design patterns) permettant
|
||||
<Char_Desc_45>Gestionale open source e gratuito</Char_Desc_45>
|
||||
<Char_Desc_80>Gestionale open source e gratuito per piccole e medie imprese, fondazioni</Char_Desc_80>
|
||||
<Char_Desc_250>Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività.</Char_Desc_250>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibarr è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
</Italian>
|
||||
</Program_Descriptions>
|
||||
<Web_Info>
|
||||
|
||||
@@ -88,8 +88,8 @@ DoliWamp is the auto-installer for Windows users with no technical knowledge to
|
||||
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM per Windows</Char_Desc_45>
|
||||
<Char_Desc_80>Gestionale open source e gratuito per piccole e medie imprese, fondazioni</Char_Desc_80>
|
||||
<Char_Desc_250>Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività.</Char_Desc_250>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibarr è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
</Italian>
|
||||
</Program_Descriptions>
|
||||
<Web_Info>
|
||||
|
||||
@@ -88,8 +88,8 @@ DoliWamp is the auto-installer for Windows users with no technical knowledge to
|
||||
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM per Windows</Char_Desc_45>
|
||||
<Char_Desc_80>Gestionale open source e gratuito per piccole e medie imprese, fondazioni</Char_Desc_80>
|
||||
<Char_Desc_250>Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività.</Char_Desc_250>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
|
||||
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibarr è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibarr è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
|
||||
</Italian>
|
||||
</Program_Descriptions>
|
||||
<Web_Info>
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#/bin/ksh
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------------
|
||||
# \file build/patch/buildpatch.sh
|
||||
# \brief Create patch files
|
||||
@@ -6,16 +6,18 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# This script can be used 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,
|
||||
# The output patch file can then be submitted on Dolibarr dev mailing-list,
|
||||
# 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
|
||||
echo Usage: buildpatch.sh original_dir_path modified_dir_path
|
||||
echo Example: buildpatch.sh /mydirA/dolibarrold /mydirB/dolibarrnew
|
||||
then
|
||||
echo Usage: buildpatch.sh original_dir_path modified_dir_path
|
||||
echo Example: buildpatch.sh /mydirA/dolibarrold /mydirB/dolibarrnew
|
||||
else
|
||||
echo Build patch between \"$1\" and \"$2\"
|
||||
diff -BNaur --exclude=CVS --exclude="*.patch" --exclude=".#*" --exclude="*~" --exclude="*.rej" --exclude="*.orig" --exclude="*.bak" --exclude=conf.php --exclude=documents $1 $2 > mypatch.patch
|
||||
echo Build patch between \"$1\" and \"$2\"
|
||||
diff -BNaur --exclude=CVS --exclude="*.patch" --exclude=".#*" --exclude="*~" --exclude="*.rej" --exclude="*.orig" --exclude="*.bak" --exclude=conf.php --exclude=documents $1 $2 > mypatch.patch
|
||||
fi
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,8 +9,12 @@
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined("NOSESSION")) {
|
||||
define("NOSESSION", '1');
|
||||
}
|
||||
if (!defined("NOHTTPSREDIRECT")) {
|
||||
define("NOHTTPSREDIRECT", '1');
|
||||
}
|
||||
global $conf, $langs, $user, $db;
|
||||
|
||||
global $conf, $db, $langs, $user;
|
||||
include_once __DIR__ . '/../../htdocs/main.inc.php';
|
||||
|
||||
22
build/phpstan/bootstrap_action.php
Normal file
22
build/phpstan/bootstrap_action.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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');
|
||||
define('DOL_URL_ROOT', '/');
|
||||
define('DOL_MAIN_URL_ROOT', '/');
|
||||
define('MAIN_DB_PREFIX', 'llx_');
|
||||
|
||||
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",
|
||||
|
||||
@@ -41,40 +41,59 @@ With
|
||||
protected $connector;
|
||||
|
||||
|
||||
SABRE:
|
||||
------
|
||||
rm -fr ./htdocs/includes/sabre/sabre/bin;
|
||||
rm -fr ./htdocs/includes/sabre/sabre/*/bin;
|
||||
rm -fr ./htdocs/includes/sabre/sabre/*/*/bin;
|
||||
rm -fr ./htdocs/includes/sabre/sabre/*/*/*/bin;
|
||||
rm -fr ./htdocs/includes/sabre/sabre/*/*/*/*/bin;
|
||||
|
||||
|
||||
NUSOAP:
|
||||
-------
|
||||
* In file nusoap.php, to avoid a warning,
|
||||
Replace
|
||||
if (isset($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
|
||||
By
|
||||
if (! is_array($this->methodreturn) && isset($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
|
||||
* Line 1257 of file nusoap.php. Add:
|
||||
|
||||
* In file nusoap.php, to avoid a warning,
|
||||
Replace call to serialize_val with no bugged value
|
||||
libxml_disable_entity_loader(true); // Avoid load of external entities (security problem). Required only for libxml < 2.
|
||||
|
||||
|
||||
* Line 4346 of file nusoap.php
|
||||
|
||||
* In all files, replace constructor names into __construct. Replace also parent::constructor_name with parent::__construct
|
||||
$rev = array();
|
||||
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
|
||||
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
|
||||
|
||||
* Line 4222 of file nusoap.php
|
||||
|
||||
$rev = array();
|
||||
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
|
||||
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
|
||||
* Line 6566 of file nusoap.php, replace
|
||||
|
||||
if (count($attrs) > 0) {
|
||||
with
|
||||
if (is_array($attrs) && count($attrs) > 0) {
|
||||
|
||||
|
||||
|
||||
TCPDF:
|
||||
------
|
||||
* Replace in tcpdf.php:
|
||||
* Modify in tcpdf.php: make TCPDF::_out public.
|
||||
(htdocs/core/lib/pdf.lib.php uses it as a public method)
|
||||
|
||||
Change:
|
||||
protected function _out($s)
|
||||
to
|
||||
public function _out($s)
|
||||
|
||||
Change in method's _out phpdoc:
|
||||
|
||||
* @protected
|
||||
to
|
||||
* @public
|
||||
|
||||
* Replace in tcpdf.php:
|
||||
if (isset($this->imagekeys)) {
|
||||
foreach($this->imagekeys as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
with
|
||||
|
||||
if (isset($this->imagekeys)) {
|
||||
foreach($this->imagekeys as $file) {
|
||||
// DOL CHANGE If we keep this, source image files are physically destroyed
|
||||
@@ -82,8 +101,7 @@ with
|
||||
}
|
||||
}
|
||||
|
||||
* Replace in tcpdf.php
|
||||
|
||||
* Replace in tcpdf.php:
|
||||
$preserve = array(
|
||||
'file_id',
|
||||
'internal_encoding',
|
||||
@@ -91,9 +109,7 @@ with
|
||||
'bufferlen',
|
||||
'buffer',
|
||||
'cached_files',
|
||||
|
||||
with
|
||||
|
||||
$preserve = array(
|
||||
'file_id',
|
||||
'internal_encoding',
|
||||
@@ -104,14 +120,11 @@ with
|
||||
// @CHANGE DOL
|
||||
'imagekeys',
|
||||
|
||||
* Replace in tcpdf.php
|
||||
|
||||
* Replace in tcpdf.php:
|
||||
if (!@TCPDF_STATIC::file_exists($file)) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
with
|
||||
|
||||
if (!@TCPDF_STATIC::file_exists($file)) {
|
||||
// DOL CHANGE If we keep this, the image is not visible on pages after the first one.
|
||||
//var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file)));
|
||||
@@ -122,12 +135,9 @@ with
|
||||
}
|
||||
}
|
||||
|
||||
* Replace in tcpdf.php
|
||||
|
||||
* Replace in tcpdf.php:
|
||||
if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
|
||||
|
||||
with
|
||||
|
||||
// @CHANGE LDR Add support for src="file://..." links
|
||||
if (strpos($imgsrc, 'file://') === 0) {
|
||||
$imgsrc = str_replace('file://', '/', $imgsrc);
|
||||
@@ -144,12 +154,9 @@ with
|
||||
elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
|
||||
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static.php, in function fopenLocal, replace
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static.php, in function fopenLocal, replace:
|
||||
if (strpos($filename, '://') === false) {
|
||||
|
||||
with
|
||||
|
||||
if (strpos($filename, '//') === 0) {
|
||||
// Share folder on a (windows) server
|
||||
// e.g.: "//[MyServerName]/[MySharedFolder]/"
|
||||
@@ -158,21 +165,26 @@ with
|
||||
}
|
||||
elseif (strpos($filename, '://') === false)
|
||||
|
||||
* To avoid to have QRcode changed because generated with a random mask, replace
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
* To avoid to have QRcode changed because generated with a random mask, replace:
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
with
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
|
||||
* Change line:
|
||||
imagesetpixel($imgalpha, $xpx, $ypx, $alpha);
|
||||
into
|
||||
imagesetpixel($imgalpha, $xpx, $ypx, (int) $alpha);
|
||||
|
||||
* Removed useless directories ("examples", "tools")
|
||||
|
||||
* Optionnaly, removed all fonts except
|
||||
dejavusans* (used by greek, arab, persan, romanian, turkish),
|
||||
freemono* (russian),
|
||||
cid*+msungstdlight+stsongstdlight+uni2cid* (chinese),
|
||||
* 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';
|
||||
@@ -180,15 +192,15 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
|
||||
of the function, replace:
|
||||
|
||||
$roman = '';
|
||||
$roman = '';
|
||||
|
||||
with:
|
||||
with:
|
||||
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
|
||||
* Add this at begin of tcpdf_autoconfig.php
|
||||
|
||||
@@ -223,7 +235,7 @@ with:
|
||||
|
||||
* Fix syntax error by replacing
|
||||
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) {
|
||||
with
|
||||
with
|
||||
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {
|
||||
|
||||
* Fix php fatal error on php 8.0 on tcpdi.php
|
||||
@@ -314,6 +326,24 @@ RESTLER:
|
||||
empty($value[0]) ? null :
|
||||
empty($value[1]) ? null :
|
||||
|
||||
* Add a test into AutoLoader.php to complete function loadThisLoader and test if property exists before calling it. For this replace code
|
||||
|
||||
if (false !== $file = $b::$loader[1]($className) && $this->exists($className, $b::$loader[1])) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
with:
|
||||
|
||||
//avoid PHP Fatal error: Uncaught Error: Access to undeclared static property: Composer\\Autoload\\ClassLoader::$loader
|
||||
//in case of multiple autoloader systems
|
||||
if(property_exists($b, $loader[1])) {
|
||||
if (false !== $file = $b::$loader[1]($className)
|
||||
&& $this->exists($className, $b::$loader[1])) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+With swagger 2 provided into /explorer:
|
||||
----------------------------------------
|
||||
|
||||
@@ -327,16 +357,15 @@ PARSEDOWN
|
||||
* Add support of css by adding in Parsedown.php:
|
||||
|
||||
// @CHANGE LDR
|
||||
'class' => $Link['element']['attributes']['class']
|
||||
'class' => $Link['element']['attributes']['class']
|
||||
|
||||
...
|
||||
|
||||
|
||||
// @CHANGE LDR
|
||||
if (preg_match('/{([^}]+)}/', $remainder, $matches2))
|
||||
{
|
||||
$Element['attributes']['class'] = $matches2[1];
|
||||
$remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder);
|
||||
}
|
||||
if (preg_match('/{([^}]+)}/', $remainder, $matches2)) {
|
||||
$Element['attributes']['class'] = $matches2[1];
|
||||
$remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder);
|
||||
}
|
||||
|
||||
|
||||
// @CHANGE LDR
|
||||
@@ -369,7 +398,7 @@ Add into Class Google of file OAuth2/Service/Google:
|
||||
}
|
||||
$this->approvalPrompt = $prompt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
JEDITABLE.JS
|
||||
|
||||
@@ -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
|
||||
|
||||
124
dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt
Normal file
124
dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt
Normal file
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"id": "evt_123456789",
|
||||
"object": "event",
|
||||
"api_version": "2023-10-16",
|
||||
"created": 1702053463,
|
||||
"data": {
|
||||
"object": {
|
||||
"id": "pi_123456789",
|
||||
"object": "payment_intent",
|
||||
"amount": 60,
|
||||
"amount_capturable": 0,
|
||||
"amount_details": {
|
||||
"tip": {
|
||||
}
|
||||
},
|
||||
"amount_received": 0,
|
||||
"application": null,
|
||||
"application_fee_amount": null,
|
||||
"automatic_payment_methods": null,
|
||||
"canceled_at": null,
|
||||
"cancellation_reason": null,
|
||||
"capture_method": "automatic",
|
||||
"client_secret": "pi_123456789_secret_123456789",
|
||||
"confirmation_method": "automatic",
|
||||
"created": 1702053448,
|
||||
"currency": "eur",
|
||||
"customer": "cus_123456789",
|
||||
"description": "Stripe payment from makeStripeSepaRequest: DID=31262-INV=123-CUS=123 did=123 ref=FA2312-123",
|
||||
"invoice": null,
|
||||
"last_payment_error": {
|
||||
"code": "",
|
||||
"decline_code": "generic_decline",
|
||||
"message": "The transaction can't be processed because your customer's account information is missing or incorrect. Collect a new mandate and ask your customer to provide their name and address exactly as it appears on their bank account. After this, you can attempt the transaction again.",
|
||||
"payment_method": {
|
||||
"id": "pm_123456789",
|
||||
"object": "payment_method",
|
||||
"billing_details": {
|
||||
"address": {
|
||||
"city": null,
|
||||
"country": "FR",
|
||||
"line1": null,
|
||||
"line2": null,
|
||||
"postal_code": null,
|
||||
"state": null
|
||||
},
|
||||
"email": "email@example.com",
|
||||
"name": "Test example",
|
||||
"phone": null
|
||||
},
|
||||
"created": 1692688898,
|
||||
"customer": "cus_123456789",
|
||||
"livemode": false,
|
||||
"metadata": {
|
||||
"dol_version": "19.0.0-dev",
|
||||
"dol_thirdparty_id": "123",
|
||||
"ipaddress": "1.2.3.4",
|
||||
"dol_id": "123",
|
||||
"dol_type": "companypaymentmode",
|
||||
"dol_entity": "1"
|
||||
},
|
||||
"sepa_debit": {
|
||||
"bank_code": "123",
|
||||
"branch_code": "",
|
||||
"country": "AT",
|
||||
"fingerprint": "123456789",
|
||||
"generated_from": {
|
||||
"charge": null,
|
||||
"setup_attempt": null
|
||||
},
|
||||
"last4": "3202"
|
||||
},
|
||||
"type": "sepa_debit"
|
||||
},
|
||||
"type": "card_error"
|
||||
},
|
||||
"latest_charge": "py_123456789",
|
||||
"livemode": false,
|
||||
"metadata": {
|
||||
"dol_version": "19.0.0-beta",
|
||||
"dol_thirdparty_id": "123",
|
||||
"ipaddress": "1.2.3.4",
|
||||
"dol_id": "123",
|
||||
"dol_type": "facture",
|
||||
"dol_entity": "1"
|
||||
},
|
||||
"next_action": null,
|
||||
"on_behalf_of": null,
|
||||
"payment_method": null,
|
||||
"payment_method_configuration_details": null,
|
||||
"payment_method_options": {
|
||||
"card": {
|
||||
"installments": null,
|
||||
"mandate_options": null,
|
||||
"network": null,
|
||||
"request_three_d_secure": "automatic"
|
||||
},
|
||||
"sepa_debit": {
|
||||
}
|
||||
},
|
||||
"payment_method_types": [
|
||||
"card",
|
||||
"sepa_debit"
|
||||
],
|
||||
"processing": null,
|
||||
"receipt_email": null,
|
||||
"review": null,
|
||||
"setup_future_usage": null,
|
||||
"shipping": null,
|
||||
"source": null,
|
||||
"statement_descriptor": "DID=123-",
|
||||
"statement_descriptor_suffix": "DID=123-",
|
||||
"status": "requires_payment_method",
|
||||
"transfer_data": null,
|
||||
"transfer_group": null
|
||||
}
|
||||
},
|
||||
"livemode": false,
|
||||
"pending_webhooks": 1,
|
||||
"request": {
|
||||
"id": null,
|
||||
"idempotency_key": null
|
||||
},
|
||||
"type": "payment_intent.payment_failed"
|
||||
}
|
||||
@@ -48,7 +48,7 @@ require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
|
||||
|
||||
|
||||
/*
|
||||
* Parametre
|
||||
* Parameter
|
||||
*/
|
||||
|
||||
define('GEN_NUMBER_COMMANDE', $argv[1] ?? 10);
|
||||
|
||||
@@ -152,7 +152,7 @@ $user->rights->propal->creer=1;
|
||||
$user->rights->propal->propal_advance->validate=1;
|
||||
|
||||
|
||||
if (!empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/" . getDolGlobalString('PROPALE_ADDON').".php")) {
|
||||
if (getDolGlobalString('PROPALE_ADDON') && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/" . getDolGlobalString('PROPALE_ADDON').".php")) {
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/" . getDolGlobalString('PROPALE_ADDON').".php";
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ $listoflastname = array("Joe","Marc","Steve","Laurent","Nico","Isabelle","Doroth
|
||||
|
||||
|
||||
/*
|
||||
* Parametre
|
||||
* Parameter
|
||||
*/
|
||||
|
||||
define('GEN_NUMBER_SOCIETE', $argv[1] ?? 10);
|
||||
|
||||
@@ -129,7 +129,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
$object->fournisseur = $fields[8];
|
||||
|
||||
$object->name = $fields[13] ? trim($fields[13]) : $fields[0];
|
||||
$object->name_alias = $fields[0]!=$fields[13] ? trim($fields[0]) : '';
|
||||
$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : '';
|
||||
|
||||
$object->address = trim($fields[14]);
|
||||
$object->zip = trim($fields[15]);
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,8 +148,8 @@ $sqls=array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'",
|
||||
),
|
||||
'project'=>array(
|
||||
// TODO set fk_project to null on object that refer to project
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_task IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
|
||||
// TODO set fk_project to null on all objects/tables that refer to project
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."element_time WHERE elementtype = 'task' AND fk_element IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__')",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'",
|
||||
),
|
||||
|
||||
@@ -9,15 +9,17 @@
|
||||
# Regis Houssin - regis.houssin@inodbox.com
|
||||
# Laurent Destailleur - eldy@users.sourceforge.net
|
||||
#------------------------------------------------------
|
||||
# Usage: initdemo.sh confirm
|
||||
# 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//'`;
|
||||
if [ "x$mydir" = 'x' -o "x$mydir" = 'x./' ]
|
||||
then
|
||||
export mydir="."
|
||||
export mydir="."
|
||||
fi
|
||||
export id=`id -u`;
|
||||
|
||||
@@ -59,106 +61,106 @@ then
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Init Dolibarr with demo values" --clear \
|
||||
--inputbox "Input dump file :" 16 55 $dumpfile 2> $fichtemp
|
||||
--inputbox "Input dump file :" 16 55 $dumpfile 2> $fichtemp
|
||||
valret=$?
|
||||
case $valret in
|
||||
0)
|
||||
dumpfile=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
dumpfile=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm $fichtemp
|
||||
|
||||
|
||||
# ----------------------------- database name
|
||||
DIALOG=${DIALOG=dialog}
|
||||
DIALOG="$DIALOG --ascii-lines"
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Init Dolibarr with demo values" --clear \
|
||||
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
|
||||
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
|
||||
valret=$?
|
||||
case $valret in
|
||||
0)
|
||||
base=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
base=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm $fichtemp
|
||||
|
||||
|
||||
# ---------------------------- database port
|
||||
DIALOG=${DIALOG=dialog}
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Init Dolibarr with demo values" --clear \
|
||||
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
|
||||
|
||||
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
port=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
port=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm $fichtemp
|
||||
|
||||
|
||||
# ---------------------------- compte admin mysql
|
||||
DIALOG=${DIALOG=dialog}
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Init Dolibarr with demo values" --clear \
|
||||
--inputbox "Mysql user login (ex: root):" 16 55 root 2> $fichtemp
|
||||
|
||||
--inputbox "Mysql user login (ex: root):" 16 55 root 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
admin=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
admin=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm $fichtemp
|
||||
|
||||
# ---------------------------- mot de passe admin mysql
|
||||
|
||||
# ---------------------------- password admin mysql (root)
|
||||
DIALOG=${DIALOG=dialog}
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Init Dolibarr with demo values" --clear \
|
||||
--passwordbox "Password for Mysql user login :" 16 55 2> $fichtemp
|
||||
|
||||
--passwordbox "Password for Mysql user login :" 16 55 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
passwd=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
passwd=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm $fichtemp
|
||||
|
||||
|
||||
|
||||
|
||||
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
|
||||
|
||||
|
||||
# ---------------------------- confirmation
|
||||
DIALOG=${DIALOG=dialog}
|
||||
$DIALOG --title "Init Dolibarr with demo values" --clear \
|
||||
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Document dir : '$documentdir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
|
||||
|
||||
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Document dir : '$documentdir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
|
||||
|
||||
case $? in
|
||||
0) echo "Ok, start process...";;
|
||||
1) exit;;
|
||||
255) exit;;
|
||||
0) echo "Ok, start process..." ;;
|
||||
1) exit ;;
|
||||
255) exit ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
@@ -180,7 +182,7 @@ export res=$?
|
||||
if [ $res -ne 0 ]; then
|
||||
echo "Error to load database dump with mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
$mydir/updatedemo.php confirm
|
||||
export res=$?
|
||||
@@ -190,32 +192,32 @@ export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_ma
|
||||
if [ "x$documentdir" != "x" ]
|
||||
then
|
||||
$DIALOG --title "Reset document directory" --clear \
|
||||
--inputbox "DELETE and recreate document directory $documentdir/:" 16 55 n 2> $fichtemp
|
||||
|
||||
--inputbox "DELETE and recreate document directory $documentdir/:" 16 55 n 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
rep=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
rep=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
|
||||
echo "rep=$rep"
|
||||
if [ "x$rep" = "xy" ]; then
|
||||
echo rm -fr "$documentdir/*"
|
||||
rm -fr $documentdir/*
|
||||
fi
|
||||
|
||||
|
||||
echo cp -pr $mydir/documents_demo/* "$documentdir/"
|
||||
cp -pr $mydir/documents_demo/* "$documentdir/"
|
||||
|
||||
|
||||
mkdir "$documentdir/doctemplates/" 2>/dev/null
|
||||
echo cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/"
|
||||
cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/"
|
||||
|
||||
|
||||
echo cp -pr $mydir/../../htdocs/install/medias/* "$documentdir/medias/image/"
|
||||
cp -pr $mydir/../../htdocs/install/medias/* "$documentdir/medias/image/"
|
||||
|
||||
@@ -224,11 +226,11 @@ then
|
||||
rm -f "$documentdir/doctemplates/"*/index.html
|
||||
echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
||||
cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
||||
|
||||
|
||||
chmod -R u+w "$documentdir/"
|
||||
chown -R www-data "$documentdir/"
|
||||
else
|
||||
echo Detection of documents directory from $mydir failed so demo files were not copied.
|
||||
echo Detection of documents directory from $mydir failed so demo files were not copied.
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -5,15 +5,17 @@
|
||||
#
|
||||
# Laurent Destailleur - eldy@users.sourceforge.net
|
||||
#------------------------------------------------------
|
||||
# Usage: initdemopassword.sh confirm
|
||||
# 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//'`;
|
||||
if [ "x$mydir" = 'x' -o "x$mydir" = 'x./' ]
|
||||
then
|
||||
export mydir="."
|
||||
export mydir="."
|
||||
fi
|
||||
export id=`id -u`;
|
||||
|
||||
@@ -56,87 +58,87 @@ then
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Reset login password" --clear \
|
||||
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
|
||||
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
|
||||
valret=$?
|
||||
case $valret in
|
||||
0)
|
||||
base=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
base=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm $fichtemp
|
||||
|
||||
|
||||
# ---------------------------- database port
|
||||
DIALOG=${DIALOG=dialog}
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Reset login password" --clear \
|
||||
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
|
||||
|
||||
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
port=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
port=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm $fichtemp
|
||||
|
||||
|
||||
|
||||
|
||||
# ----------------------------- demo login
|
||||
DIALOG=${DIALOG=dialog}
|
||||
DIALOG="$DIALOG --ascii-lines"
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Reset login password" --clear \
|
||||
--inputbox "Login to reset :" 16 55 dolibarrdemologin 2> $fichtemp
|
||||
--inputbox "Login to reset :" 16 55 dolibarrdemologin 2> $fichtemp
|
||||
valret=$?
|
||||
case $valret in
|
||||
0)
|
||||
demologin=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
demologin=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm fichtemp
|
||||
|
||||
|
||||
# ----------------------------- demo pass
|
||||
DIALOG=${DIALOG=dialog}
|
||||
DIALOG="$DIALOG --ascii-lines"
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Reset login password" --clear \
|
||||
--inputbox "Pass to set :" 16 55 dolibarrdemopass 2> $fichtemp
|
||||
--inputbox "Pass to set :" 16 55 dolibarrdemopass 2> $fichtemp
|
||||
valret=$?
|
||||
case $valret in
|
||||
0)
|
||||
demopass=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
demopass=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
rm fichtemp
|
||||
|
||||
|
||||
|
||||
|
||||
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
|
||||
|
||||
|
||||
# ---------------------------- confirmation
|
||||
DIALOG=${DIALOG=dialog}
|
||||
$DIALOG --title "Reset login password" --clear \
|
||||
--yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55
|
||||
|
||||
--yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55
|
||||
|
||||
case $? in
|
||||
0) echo "Ok, start process...";;
|
||||
1) exit;;
|
||||
255) exit;;
|
||||
0) echo "Ok, start process..." ;;
|
||||
1) exit ;;
|
||||
255) exit ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
@@ -152,7 +154,7 @@ fi
|
||||
|
||||
if [ "x${demopasshash}" != "xpassword_hash" ]
|
||||
then
|
||||
echo '<?php echo MD5("'$demopass'"); ?>' > /tmp/tmp.php
|
||||
echo '<?php echo MD5("'$demopass'"); ?>' > /tmp/tmp.php
|
||||
newpass=`php -f /tmp/tmp.php`
|
||||
else
|
||||
echo '<?php echo password_hash("'$demopass'", PASSWORD_DEFAULT); ?>' > /tmp/tmp.php
|
||||
@@ -167,7 +169,7 @@ export res=$?
|
||||
if [ $res -ne 0 ]; then
|
||||
echo "Error to execute sql with mysql -P$port -u$admin -p***** $base"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -s "$mydir/initdemopostsql.sql" ]; then
|
||||
echo A file initdemopostsql.sql was found, we execute it.
|
||||
@@ -175,7 +177,7 @@ if [ -s "$mydir/initdemopostsql.sql" ]; then
|
||||
mysql -P$port $base < "$mydir/initdemopostsql.sql"
|
||||
else
|
||||
echo No file initdemopostsql.sql found, so no extra sql action done.
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "x$res" = "x0" ]
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -6,15 +6,15 @@
|
||||
# Regis Houssin - regis.houssin@inodbox.com
|
||||
# Laurent Destailleur - eldy@users.sourceforge.net
|
||||
#------------------------------------------------------
|
||||
# WARNING: This script erase setup of instance,
|
||||
# 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" ]
|
||||
then
|
||||
export mydir="./"
|
||||
export mydir="./"
|
||||
fi
|
||||
export id=`id -u`;
|
||||
|
||||
@@ -22,8 +22,8 @@ export id=`id -u`;
|
||||
# ----------------------------- check if root
|
||||
if [ "x$id" != "x0" -a "x$id" != "x1001" ]
|
||||
then
|
||||
echo "Script must be ran as root"
|
||||
exit
|
||||
echo "Script must be ran as root"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
@@ -32,15 +32,15 @@ DIALOG="$DIALOG --ascii-lines"
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Remove Dolibarr install" --clear \
|
||||
--yesno "Do you confirm ?" 15 40
|
||||
--yesno "Do you confirm ?" 15 40
|
||||
valret=$?
|
||||
case $valret in
|
||||
0)
|
||||
base=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
base=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
# ---------------------------- remove conf file
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------
|
||||
# Script to extrac a database with demo values.
|
||||
# Script to extract a database with demo values.
|
||||
# Note: "dialog" tool need to be available if no parameter provided.
|
||||
#
|
||||
# Regis Houssin - regis.houssin@inodbox.com
|
||||
@@ -9,12 +9,12 @@
|
||||
# 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" ]
|
||||
then
|
||||
export mydir="."
|
||||
export mydir="."
|
||||
fi
|
||||
export id=`id -u`;
|
||||
|
||||
@@ -47,97 +47,97 @@ then
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Save Dolibarr with demo values" --clear \
|
||||
--inputbox "Output dump file :" 16 55 $dumpfile 2> $fichtemp
|
||||
--inputbox "Output dump file :" 16 55 $dumpfile 2> $fichtemp
|
||||
valret=$?
|
||||
case $valret in
|
||||
0)
|
||||
dumpfile=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
dumpfile=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
|
||||
# ----------------------------- database name
|
||||
DIALOG=${DIALOG=dialog}
|
||||
DIALOG="$DIALOG --ascii-lines"
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Save Dolibarr with demo values" --clear \
|
||||
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
|
||||
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
|
||||
valret=$?
|
||||
case $valret in
|
||||
0)
|
||||
base=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
base=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
|
||||
# ---------------------------- database port
|
||||
DIALOG=${DIALOG=dialog}
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Save Dolibarr with demo values" --clear \
|
||||
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
|
||||
|
||||
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
port=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
port=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
|
||||
# ---------------------------- compte admin mysql
|
||||
DIALOG=${DIALOG=dialog}
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Save Dolibarr with demo values" --clear \
|
||||
--inputbox "Mysql root login (ex: root):" 16 55 root 2> $fichtemp
|
||||
|
||||
--inputbox "Mysql root login (ex: root):" 16 55 root 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
admin=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
admin=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
# ---------------------------- mot de passe admin mysql
|
||||
|
||||
# ---------------------------- Password for admin mysql (root)
|
||||
DIALOG=${DIALOG=dialog}
|
||||
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
$DIALOG --title "Save Dolibarr with demo values" --clear \
|
||||
--passwordbox "Password for Mysql root login :" 16 55 2> $fichtemp
|
||||
|
||||
--passwordbox "Password for Mysql root login :" 16 55 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
passwd=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
0)
|
||||
passwd=`cat $fichtemp` ;;
|
||||
1)
|
||||
exit ;;
|
||||
255)
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
|
||||
# ---------------------------- chemin d'acces du repertoire documents
|
||||
#DIALOG=${DIALOG=dialog}
|
||||
#fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
|
||||
#trap "rm -f $fichtemp" 0 1 2 5 15
|
||||
#$DIALOG --title "Save Dolibarr with demo values" --clear \
|
||||
# --inputbox "Full path to documents directory (ex: /var/www/dolibarr/documents)- no / at end :" 16 55 2> $fichtemp
|
||||
|
||||
# --inputbox "Full path to documents directory (ex: /var/www/dolibarr/documents)- no / at end :" 16 55 2> $fichtemp
|
||||
|
||||
#valret=$?
|
||||
|
||||
|
||||
#case $valret in
|
||||
# 0)
|
||||
#docs=`cat $fichtemp`;;
|
||||
@@ -146,16 +146,16 @@ then
|
||||
# 255)
|
||||
#exit;;
|
||||
#esac
|
||||
|
||||
|
||||
# ---------------------------- confirmation
|
||||
DIALOG=${DIALOG=dialog}
|
||||
$DIALOG --title "Save Dolibarr with demo values" --clear \
|
||||
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
|
||||
|
||||
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
|
||||
|
||||
case $? in
|
||||
0) echo "Ok, start process...";;
|
||||
1) exit;;
|
||||
255) exit;;
|
||||
0) echo "Ok, start process..." ;;
|
||||
1) exit ;;
|
||||
255) exit ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
@@ -167,168 +167,180 @@ then
|
||||
export passwd="-p$passwd"
|
||||
fi
|
||||
export list="
|
||||
--ignore-table=$base.llx_abonne
|
||||
--ignore-table=$base.llx_abonne_extrafields
|
||||
--ignore-table=$base.llx_abonne_type
|
||||
--ignore-table=$base.llx_abonnement
|
||||
--ignore-table=$base.llx_accountingaccount
|
||||
--ignore-table=$base.llx_accountingsystem
|
||||
--ignore-table=$base.llx_advanced_extrafields
|
||||
--ignore-table=$base.llx_advanced_extrafields_options
|
||||
--ignore-table=$base.llx_advanced_extrafields_values
|
||||
--ignore-table=$base.llx_agefodd_calendrier
|
||||
--ignore-table=$base.llx_agefodd_certif_state
|
||||
--ignore-table=$base.llx_agefodd_certificate_type
|
||||
--ignore-table=$base.llx_agefodd_contact
|
||||
--ignore-table=$base.llx_agefodd_convention
|
||||
--ignore-table=$base.llx_agefodd_convention_stagiaire
|
||||
--ignore-table=$base.llx_agefodd_cursus
|
||||
--ignore-table=$base.llx_agefodd_cursus_extrafields
|
||||
--ignore-table=$base.llx_agefodd_formateur
|
||||
--ignore-table=$base.llx_agefodd_formateur_category
|
||||
--ignore-table=$base.llx_agefodd_formateur_category_dict
|
||||
--ignore-table=$base.llx_agefodd_formateur_training
|
||||
--ignore-table=$base.llx_agefodd_formateur_type
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue_extrafields
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue_modules
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue_type
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue_type_bpf
|
||||
--ignore-table=$base.llx_agefodd_formation_cursus
|
||||
--ignore-table=$base.llx_agefodd_formation_objectifs_peda
|
||||
--ignore-table=$base.llx_agefodd_opca
|
||||
--ignore-table=$base.llx_agefodd_place
|
||||
--ignore-table=$base.llx_agefodd_reg_interieur
|
||||
--ignore-table=$base.llx_agefodd_session
|
||||
--ignore-table=$base.llx_agefodd_session_adminsitu
|
||||
--ignore-table=$base.llx_agefodd_session_admlevel
|
||||
--ignore-table=$base.llx_agefodd_session_calendrier
|
||||
--ignore-table=$base.llx_agefodd_session_commercial
|
||||
--ignore-table=$base.llx_agefodd_session_contact
|
||||
--ignore-table=$base.llx_agefodd_session_element
|
||||
--ignore-table=$base.llx_agefodd_session_extrafields
|
||||
--ignore-table=$base.llx_agefodd_session_formateur
|
||||
--ignore-table=$base.llx_agefodd_session_formateur_calendrier
|
||||
--ignore-table=$base.llx_agefodd_session_stagiaire
|
||||
--ignore-table=$base.llx_agefodd_session_stagiaire_heures
|
||||
--ignore-table=$base.llx_agefodd_session_status_type
|
||||
--ignore-table=$base.llx_agefodd_stagiaire
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_certif
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_cursus
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_extrafields
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_type
|
||||
--ignore-table=$base.llx_agefodd_training_admlevel
|
||||
--ignore-table=$base.llx_askpricesupplier
|
||||
--ignore-table=$base.llx_askpricesupplier_extrafields
|
||||
--ignore-table=$base.llx_askpricesupplierdet
|
||||
--ignore-table=$base.llx_askpricesupplierdet_extrafields
|
||||
--ignore-table=$base.llx_assetOf
|
||||
--ignore-table=$base.llx_assetOf_line
|
||||
--ignore-table=$base.llx_asset_workstation_of
|
||||
--ignore-table=$base.llx_asset_workstation_product
|
||||
--ignore-table=$base.llx_asset_workstation_task
|
||||
--ignore-table=$base.llx_assetof_amounts
|
||||
--ignore-table=$base.llx_asset_workstation_of
|
||||
--ignore-table=$base.llx_asset_workstation_of
|
||||
--ignore-table=$base.llx_asset_workstation_of
|
||||
--ignore-table=$base.llx_bookkeeping
|
||||
--ignore-table=$base.llx_bootstrap
|
||||
--ignore-table=$base.llx_bt_namemap
|
||||
--ignore-table=$base.llx_bt_speedlimit
|
||||
--ignore-table=$base.llx_bt_summary
|
||||
--ignore-table=$base.llx_bt_timestamps
|
||||
--ignore-table=$base.llx_bt_webseedfiles
|
||||
--ignore-table=$base.llx_c_civilite
|
||||
--ignore-table=$base.llx_c_dolicloud_plans
|
||||
--ignore-table=$base.llx_c_pays
|
||||
--ignore-table=$base.llx_c_source
|
||||
--ignore-table=$base.llx_c_ticketsup_category
|
||||
--ignore-table=$base.llx_c_ticketsup_severity
|
||||
--ignore-table=$base.llx_c_ticketsup_type
|
||||
--ignore-table=$base.llx_congespayes
|
||||
--ignore-table=$base.llx_congespayes_config
|
||||
--ignore-table=$base.llx_congespayes_events
|
||||
--ignore-table=$base.llx_congespayes_logs
|
||||
--ignore-table=$base.llx_congespayes_users
|
||||
--ignore-table=$base.llx_dolicloud_customers
|
||||
--ignore-table=$base.llx_dolicloud_stats
|
||||
--ignore-table=$base.llx_dolicloud_emailstemplates
|
||||
--ignore-table=$base.llx_dolireport_column
|
||||
--ignore-table=$base.llx_dolireport_criteria
|
||||
--ignore-table=$base.llx_dolireport_graph
|
||||
--ignore-table=$base.llx_dolireport_plot
|
||||
--ignore-table=$base.llx_dolireport_report
|
||||
--ignore-table=$base.llx_domain
|
||||
--ignore-table=$base.llx_ecommerce_category
|
||||
--ignore-table=$base.llx_ecommerce_commande
|
||||
--ignore-table=$base.llx_ecommerce_facture
|
||||
--ignore-table=$base.llx_ecommerce_product
|
||||
--ignore-table=$base.llx_ecommerce_site
|
||||
--ignore-table=$base.llx_ecommerce_societe
|
||||
--ignore-table=$base.llx_ecommerce_socpeople
|
||||
--ignore-table=$base.llx_element_rang
|
||||
--ignore-table=$base.llx_element_tag
|
||||
--ignore-table=$base.llx_eleves
|
||||
--ignore-table=$base.llx_eleves_extrafields
|
||||
--ignore-table=$base.llx_entity
|
||||
--ignore-table=$base.llx_entity_extrafields
|
||||
--ignore-table=$base.llx_entity_thirdparty
|
||||
--ignore-table=$base.llx_equipement_factory
|
||||
--ignore-table=$base.llx_factory
|
||||
--ignore-table=$base.llx_factory_extrafields
|
||||
--ignore-table=$base.llx_factorydet
|
||||
--ignore-table=$base.llx_filemanager_roots
|
||||
--ignore-table=$base.llx_fournisseur_ca
|
||||
--ignore-table=$base.llx_google_maps
|
||||
--ignore-table=$base.llx_lead
|
||||
--ignore-table=$base.llx_lead_extrafields
|
||||
--ignore-table=$base.llx_milestone
|
||||
--ignore-table=$base.llx_milestone
|
||||
--ignore-table=$base.llx_monitoring_probes
|
||||
--ignore-table=$base.llx_m
|
||||
--ignore-table=$base.llx_m_extrafields
|
||||
--ignore-table=$base.llx_monmodule_abcdef
|
||||
--ignore-table=$base.llx_notes
|
||||
--ignore-table=$base.llx_packages
|
||||
--ignore-table=$base.llx_packages_extrafields
|
||||
--ignore-table=$base.llx_pos_cash
|
||||
--ignore-table=$base.llx_pos_control_cash
|
||||
--ignore-table=$base.llx_pos_facture
|
||||
--ignore-table=$base.llx_pos_moviments
|
||||
--ignore-table=$base.llx_pos_ticketdet
|
||||
--ignore-table=$base.llx_pos_paiement_ticket
|
||||
--ignore-table=$base.llx_pos_places
|
||||
--ignore-table=$base.llx_pos_ticket
|
||||
--ignore-table=$base.llx_printer_ipp
|
||||
--ignore-table=$base.llx_publi_c_contact_list
|
||||
--ignore-table=$base.llx_publi_c_dnd_list
|
||||
--ignore-table=$base.llx_publi_c_method_list
|
||||
--ignore-table=$base.llx_residence
|
||||
--ignore-table=$base.llx_residence_building
|
||||
--ignore-table=$base.llx_residence_building_links
|
||||
--ignore-table=$base.llx_scaninvoices_filestoimport
|
||||
--ignore-table=$base.llx_scaninvoices_filestoimport_extrafields
|
||||
--ignore-table=$base.llx_scaninvoices_settings
|
||||
--ignore-table=$base.llx_scaninvoices_settings_extrafields
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistcontent
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistdir
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistfrom
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistip
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistmail
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistto
|
||||
--ignore-table=$base.llx_sellyoursaas_deploymentserver
|
||||
--ignore-table=$base.llx_sellyoursaas_stats
|
||||
--ignore-table=$base.llx_sellyoursaas_whitelistip
|
||||
--ignore-table=$base.llx_societe_rib2
|
||||
--ignore-table=$base.llx_sellyoursaas_cancellation
|
||||
--ignore-table=$base.llx_ticketsup
|
||||
--ignore-table=$base.llx_ultimatepdf
|
||||
--ignore-table=$base.llx_update_modules
|
||||
--ignore-table=$base.llx_ventilation_achat
|
||||
--ignore-table=$base.tmp_llx_accouting_account
|
||||
--ignore-table=$base.tmp_llx_product_batch
|
||||
--ignore-table=$base.tmp_llx_product_batch2
|
||||
"
|
||||
--ignore-table=$base.llx_abonne
|
||||
--ignore-table=$base.llx_abonne_extrafields
|
||||
--ignore-table=$base.llx_abonne_type
|
||||
--ignore-table=$base.llx_abonnement
|
||||
--ignore-table=$base.llx_accountingaccount
|
||||
--ignore-table=$base.llx_accountingsystem
|
||||
--ignore-table=$base.llx_advanced_extrafields
|
||||
--ignore-table=$base.llx_advanced_extrafields_options
|
||||
--ignore-table=$base.llx_advanced_extrafields_values
|
||||
--ignore-table=$base.llx_agefodd_calendrier
|
||||
--ignore-table=$base.llx_agefodd_certif_state
|
||||
--ignore-table=$base.llx_agefodd_certificate_type
|
||||
--ignore-table=$base.llx_agefodd_contact
|
||||
--ignore-table=$base.llx_agefodd_convention
|
||||
--ignore-table=$base.llx_agefodd_convention_stagiaire
|
||||
--ignore-table=$base.llx_agefodd_cursus
|
||||
--ignore-table=$base.llx_agefodd_cursus_extrafields
|
||||
--ignore-table=$base.llx_agefodd_formateur
|
||||
--ignore-table=$base.llx_agefodd_formateur_category
|
||||
--ignore-table=$base.llx_agefodd_formateur_category_dict
|
||||
--ignore-table=$base.llx_agefodd_formateur_training
|
||||
--ignore-table=$base.llx_agefodd_formateur_type
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue_extrafields
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue_modules
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue_type
|
||||
--ignore-table=$base.llx_agefodd_formation_catalogue_type_bpf
|
||||
--ignore-table=$base.llx_agefodd_formation_cursus
|
||||
--ignore-table=$base.llx_agefodd_formation_objectifs_peda
|
||||
--ignore-table=$base.llx_agefodd_opca
|
||||
--ignore-table=$base.llx_agefodd_place
|
||||
--ignore-table=$base.llx_agefodd_reg_interieur
|
||||
--ignore-table=$base.llx_agefodd_session
|
||||
--ignore-table=$base.llx_agefodd_session_adminsitu
|
||||
--ignore-table=$base.llx_agefodd_session_admlevel
|
||||
--ignore-table=$base.llx_agefodd_session_calendrier
|
||||
--ignore-table=$base.llx_agefodd_session_commercial
|
||||
--ignore-table=$base.llx_agefodd_session_contact
|
||||
--ignore-table=$base.llx_agefodd_session_element
|
||||
--ignore-table=$base.llx_agefodd_session_extrafields
|
||||
--ignore-table=$base.llx_agefodd_session_formateur
|
||||
--ignore-table=$base.llx_agefodd_session_formateur_calendrier
|
||||
--ignore-table=$base.llx_agefodd_session_stagiaire
|
||||
--ignore-table=$base.llx_agefodd_session_stagiaire_heures
|
||||
--ignore-table=$base.llx_agefodd_session_status_type
|
||||
--ignore-table=$base.llx_agefodd_stagiaire
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_certif
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_cursus
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_extrafields
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_type
|
||||
--ignore-table=$base.llx_agefodd_training_admlevel
|
||||
--ignore-table=$base.llx_askpricesupplier
|
||||
--ignore-table=$base.llx_askpricesupplier_extrafields
|
||||
--ignore-table=$base.llx_askpricesupplierdet
|
||||
--ignore-table=$base.llx_askpricesupplierdet_extrafields
|
||||
--ignore-table=$base.llx_assetOf
|
||||
--ignore-table=$base.llx_assetOf_line
|
||||
--ignore-table=$base.llx_asset_workstation_of
|
||||
--ignore-table=$base.llx_asset_workstation_product
|
||||
--ignore-table=$base.llx_asset_workstation_task
|
||||
--ignore-table=$base.llx_assetof_amounts
|
||||
--ignore-table=$base.llx_asset_workstation_of
|
||||
--ignore-table=$base.llx_asset_workstation_of
|
||||
--ignore-table=$base.llx_asset_workstation_of
|
||||
--ignore-table=$base.llx_bookkeeping
|
||||
--ignore-table=$base.llx_bootstrap
|
||||
--ignore-table=$base.llx_bt_namemap
|
||||
--ignore-table=$base.llx_bt_speedlimit
|
||||
--ignore-table=$base.llx_bt_summary
|
||||
--ignore-table=$base.llx_bt_timestamps
|
||||
--ignore-table=$base.llx_bt_webseedfiles
|
||||
--ignore-table=$base.llx_c_civilite
|
||||
--ignore-table=$base.llx_c_dolicloud_plans
|
||||
--ignore-table=$base.llx_c_pays
|
||||
--ignore-table=$base.llx_c_source
|
||||
--ignore-table=$base.llx_c_ticketsup_category
|
||||
--ignore-table=$base.llx_c_ticketsup_severity
|
||||
--ignore-table=$base.llx_c_ticketsup_type
|
||||
--ignore-table=$base.llx_cabinetmed_c_banques
|
||||
--ignore-table=$base.llx_cabinetmed_c_examconclusion
|
||||
--ignore-table=$base.llx_cabinetmed_cons_extrafields
|
||||
--ignore-table=$base.llx_cabinetmed_diaglec
|
||||
--ignore-table=$base.llx_cabinetmed_examaut
|
||||
--ignore-table=$base.llx_cabinetmed_exambio
|
||||
--ignore-table=$base.llx_cabinetmed_examenprescrit
|
||||
--ignore-table=$base.llx_cabinetmed_motifcons
|
||||
--ignore-table=$base.llx_cabinetmed_patient
|
||||
--ignore-table=$base.llx_cabinetmed_societe
|
||||
--ignore-table=$base.llx_congespayes
|
||||
--ignore-table=$base.llx_congespayes_config
|
||||
--ignore-table=$base.llx_congespayes_events
|
||||
--ignore-table=$base.llx_congespayes_logs
|
||||
--ignore-table=$base.llx_congespayes_users
|
||||
--ignore-table=$base.llx_dolicloud_customers
|
||||
--ignore-table=$base.llx_dolicloud_stats
|
||||
--ignore-table=$base.llx_dolicloud_emailstemplates
|
||||
--ignore-table=$base.llx_dolireport_column
|
||||
--ignore-table=$base.llx_dolireport_criteria
|
||||
--ignore-table=$base.llx_dolireport_graph
|
||||
--ignore-table=$base.llx_dolireport_plot
|
||||
--ignore-table=$base.llx_dolireport_report
|
||||
--ignore-table=$base.llx_domain
|
||||
--ignore-table=$base.llx_ecommerce_category
|
||||
--ignore-table=$base.llx_ecommerce_commande
|
||||
--ignore-table=$base.llx_ecommerce_facture
|
||||
--ignore-table=$base.llx_ecommerce_product
|
||||
--ignore-table=$base.llx_ecommerce_site
|
||||
--ignore-table=$base.llx_ecommerce_societe
|
||||
--ignore-table=$base.llx_ecommerce_socpeople
|
||||
--ignore-table=$base.llx_element_rang
|
||||
--ignore-table=$base.llx_element_tag
|
||||
--ignore-table=$base.llx_eleves
|
||||
--ignore-table=$base.llx_eleves_extrafields
|
||||
--ignore-table=$base.llx_entity
|
||||
--ignore-table=$base.llx_entity_extrafields
|
||||
--ignore-table=$base.llx_entity_thirdparty
|
||||
--ignore-table=$base.llx_equipement_factory
|
||||
--ignore-table=$base.llx_factory
|
||||
--ignore-table=$base.llx_factory_extrafields
|
||||
--ignore-table=$base.llx_factorydet
|
||||
--ignore-table=$base.llx_filemanager_roots
|
||||
--ignore-table=$base.llx_fournisseur_ca
|
||||
--ignore-table=$base.llx_google_maps
|
||||
--ignore-table=$base.llx_lead
|
||||
--ignore-table=$base.llx_lead_extrafields
|
||||
--ignore-table=$base.llx_milestone
|
||||
--ignore-table=$base.llx_milestone
|
||||
--ignore-table=$base.llx_monitoring_probes
|
||||
--ignore-table=$base.llx_m
|
||||
--ignore-table=$base.llx_m_extrafields
|
||||
--ignore-table=$base.llx_monmodule_abcdef
|
||||
--ignore-table=$base.llx_notes
|
||||
--ignore-table=$base.llx_packages
|
||||
--ignore-table=$base.llx_packages_extrafields
|
||||
--ignore-table=$base.llx_pos_cash
|
||||
--ignore-table=$base.llx_pos_control_cash
|
||||
--ignore-table=$base.llx_pos_facture
|
||||
--ignore-table=$base.llx_pos_moviments
|
||||
--ignore-table=$base.llx_pos_ticketdet
|
||||
--ignore-table=$base.llx_pos_paiement_ticket
|
||||
--ignore-table=$base.llx_pos_places
|
||||
--ignore-table=$base.llx_pos_ticket
|
||||
--ignore-table=$base.llx_printer_ipp
|
||||
--ignore-table=$base.llx_publi_c_contact_list
|
||||
--ignore-table=$base.llx_publi_c_dnd_list
|
||||
--ignore-table=$base.llx_publi_c_method_list
|
||||
--ignore-table=$base.llx_residence
|
||||
--ignore-table=$base.llx_residence_building
|
||||
--ignore-table=$base.llx_residence_building_links
|
||||
--ignore-table=$base.llx_scaninvoices_filestoimport
|
||||
--ignore-table=$base.llx_scaninvoices_filestoimport_extrafields
|
||||
--ignore-table=$base.llx_scaninvoices_settings
|
||||
--ignore-table=$base.llx_scaninvoices_settings_extrafields
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistcontent
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistdir
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistfrom
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistip
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistmail
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistto
|
||||
--ignore-table=$base.llx_sellyoursaas_deploymentserver
|
||||
--ignore-table=$base.llx_sellyoursaas_stats
|
||||
--ignore-table=$base.llx_sellyoursaas_whitelistip
|
||||
--ignore-table=$base.llx_societe_rib2
|
||||
--ignore-table=$base.llx_sellyoursaas_cancellation
|
||||
--ignore-table=$base.llx_ticketsup
|
||||
--ignore-table=$base.llx_ultimatepdf
|
||||
--ignore-table=$base.llx_update_modules
|
||||
--ignore-table=$base.llx_ventilation_achat
|
||||
--ignore-table=$base.tmp_llx_accouting_account
|
||||
--ignore-table=$base.tmp_llx_product_batch
|
||||
--ignore-table=$base.tmp_llx_product_batch2
|
||||
--ignore-table=$base.tmp_tmp
|
||||
--ignore-table=$base.tmp_user
|
||||
"
|
||||
echo "mysqldump -P$port -u$admin -p***** $list $base > $mydir/$dumpfile"
|
||||
mysqldump -P$port -u$admin $passwd $list $base > $mydir/$dumpfile
|
||||
export res=$?
|
||||
|
||||
@@ -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.
|
||||
#
|
||||
|
||||
|
||||
|
||||
85
dev/setup/git/hooks/pre-commit
Normal file → Executable file
85
dev/setup/git/hooks/pre-commit
Normal file → Executable file
@@ -1,26 +1,26 @@
|
||||
#!/bin/sh
|
||||
# To install this precommit file: put this file in your local repo in .git/hooks directory and make it executable.
|
||||
# You may need to set th DIRPHPCS to the path to your phpcs install.
|
||||
# If phpcs check fail and AUTOFIX is set to 1, then it run phpcbf to fix automaticaly the syntax, and git commit is canceled.
|
||||
# If phpcs checks fail and AUTOFIX is set to 1, then it run phpcbf to fix automatically the syntax, and git commit is canceled.
|
||||
# If you have a multiprocessor computer, you can add to the option --parallel=xx
|
||||
# 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='
|
||||
'
|
||||
SFILES="$1"
|
||||
IFS=$oIFS
|
||||
oIFS=$IFS
|
||||
IFS='
|
||||
'
|
||||
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 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=$?
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
#${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
|
||||
# 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=$?
|
||||
|
||||
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
|
||||
|
||||
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,6 +38,8 @@ error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
define('PRODUCT', "apstats");
|
||||
define('VERSION', "1.0");
|
||||
|
||||
$phpstanlevel = 3;
|
||||
|
||||
|
||||
print '***** '.constant('PRODUCT').' - '.constant('VERSION').' *****'."\n";
|
||||
if (empty($argv[1])) {
|
||||
@@ -71,6 +73,7 @@ while ($i < $argc) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
$timestart = time();
|
||||
|
||||
// Count lines of code of Dolibarr itself
|
||||
/*
|
||||
@@ -85,8 +88,12 @@ $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=includes,custom';
|
||||
$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";
|
||||
$output_arrproj = array();
|
||||
$resexecproj = 0;
|
||||
@@ -94,7 +101,7 @@ exec($commandcheck, $output_arrproj, $resexecproj);
|
||||
|
||||
|
||||
// Count lines of code of dependencies
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes';
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes htdocs/theme/common/fontawesome-5 htdocs/theme/common/octicons';
|
||||
print 'Execute SCC to count lines of code in dependencies: '.$commandcheck."\n";
|
||||
$output_arrdep = array();
|
||||
$resexecdep = 0;
|
||||
@@ -102,12 +109,22 @@ exec($commandcheck, $output_arrdep, $resexecdep);
|
||||
|
||||
|
||||
// Get technical debt
|
||||
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
|
||||
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --level='.$phpstanlevel.' -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
|
||||
print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n";
|
||||
$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(
|
||||
@@ -169,6 +186,17 @@ 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();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -224,7 +252,7 @@ th,td {
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.opacity {
|
||||
.opacitymedium {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.centpercent {
|
||||
@@ -234,10 +262,11 @@ th,td {
|
||||
display: none;
|
||||
}
|
||||
.trgroup {
|
||||
background-color: #EEE;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
.seedetail {
|
||||
color: #000088;
|
||||
cursor: pointer;
|
||||
}
|
||||
.box {
|
||||
padding: 20px;
|
||||
@@ -251,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;
|
||||
@@ -273,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)
|
||||
{
|
||||
@@ -290,22 +342,30 @@ 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="opacity">Generated on '.$currentDate.'</span>'."\n";
|
||||
$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";
|
||||
$html .= '<table class="centpercent">';
|
||||
$html .= '<tr class="loc">';
|
||||
$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>';
|
||||
@@ -314,18 +374,19 @@ $html .= '</tr>';
|
||||
foreach (array('proj', 'dep') as $source) {
|
||||
$html .= '<tr class="trgroup" id="source'.$source.'">';
|
||||
if ($source == 'proj') {
|
||||
$html .= '<td>All files from project only';
|
||||
$html .= '<td>All files without dependencies';
|
||||
} elseif ($source == 'dep') {
|
||||
$html .= '<td>All files from dependencies';
|
||||
$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) {
|
||||
@@ -334,67 +395,145 @@ 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>';
|
||||
$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 (Basic organic model) value:<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 (Basic organic model) effort<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><br>';
|
||||
$html .= ' months people</b>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
$html .= '<section class="chapter" id="technicaldebt">'."\n";
|
||||
$html .= '<h2>Technical debt ('.count($output_arrtd).')</h2><br>'."\n";
|
||||
$html .= '<div class="div-table-responsive">'."\n";
|
||||
$html .= '<table class="list_technical_debt">'."\n";
|
||||
$html .= '<tr><td>File</td><td>Line</td><td>Type</td></tr>'."\n";
|
||||
$tmp = '';
|
||||
$nblines = 0;
|
||||
foreach ($output_arrtd as $line) {
|
||||
$reg = array();
|
||||
//print $line."\n";
|
||||
preg_match('/^::error file=(.*),line=(\d+),col=(\d+)::(.*)$/', $line, $reg);
|
||||
if (!empty($reg[1])) {
|
||||
$html .= '<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><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 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();
|
||||
} );
|
||||
});
|
||||
@@ -403,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);
|
||||
@@ -410,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";
|
||||
}
|
||||
|
||||
|
||||
@@ -419,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}"{,}
|
||||
21
dev/tools/codespell/codespell-dict.txt
Normal file
21
dev/tools/codespell/codespell-dict.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
# Please add in alphabetical order->(`sort -u` like).
|
||||
EPR->ERP
|
||||
alpah->alpha
|
||||
alphanothtml->alphanohtml
|
||||
alpahnothtml->alphanohtml
|
||||
aplha->alpha
|
||||
aplhanothtml->alphanohtml
|
||||
aploha->alpha
|
||||
aplohanothtml->alphanohtml
|
||||
aplphanothtml->alphanohtml
|
||||
choosed->chosen
|
||||
dolibar->dolibarr
|
||||
dollibar->dolibarr
|
||||
dollibarr->dolibarr
|
||||
# fiche->card
|
||||
mot de passe->password
|
||||
not de passe->password
|
||||
nothtml->nohtml
|
||||
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
|
||||
@@ -29,61 +31,61 @@ fi
|
||||
# To fix
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for dir in `find htdocs/langs/$3* -type d`
|
||||
do
|
||||
dirshort=`basename $dir`
|
||||
|
||||
#echo $dirshort
|
||||
|
||||
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
|
||||
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
|
||||
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
|
||||
if [ $aaupper = "EN" ]
|
||||
then
|
||||
aaupper="US"
|
||||
fi
|
||||
if [ $aaupper = "EL" ]
|
||||
then
|
||||
aaupper="GR"
|
||||
fi
|
||||
if [ $bb = "EG" ]
|
||||
then
|
||||
aaupper="SA"
|
||||
fi
|
||||
if [ $bb = "IQ" ]
|
||||
then
|
||||
aaupper="SA"
|
||||
fi
|
||||
for dir in `find htdocs/langs/$3* -type d`
|
||||
do
|
||||
dirshort=`basename $dir`
|
||||
|
||||
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
||||
#echo $dirshort
|
||||
|
||||
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
|
||||
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
|
||||
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
|
||||
if [ $aaupper = "EN" ]
|
||||
then
|
||||
aaupper="US"
|
||||
fi
|
||||
if [ $aaupper = "EL" ]
|
||||
then
|
||||
aaupper="GR"
|
||||
fi
|
||||
if [ $bb = "EG" ]
|
||||
then
|
||||
aaupper="SA"
|
||||
fi
|
||||
if [ $bb = "IQ" ]
|
||||
then
|
||||
aaupper="SA"
|
||||
fi
|
||||
|
||||
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
||||
|
||||
echo "***** Process language "$aa"_"$bb
|
||||
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
||||
then
|
||||
reflang="htdocs/langs/"$aa"_"$aaupper
|
||||
echo $reflang" "$aa"_"$bb != $aa"_"$aaupper
|
||||
|
||||
# If $reflang is a main language to use to sanitize the alternative file
|
||||
if [ -d $reflang ]
|
||||
then
|
||||
if [ $aa"_"$bb != $aa"_"$aaupper ]
|
||||
then
|
||||
echo "***** Search original into "$reflang
|
||||
echo $dirshort is an alternative language of $reflang
|
||||
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
|
||||
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
|
||||
do f=`cat $fic | wc -l`;
|
||||
#echo $f lines into file $fic;
|
||||
if [ $f = 1 ]
|
||||
then
|
||||
echo Only one line remainging into file $fic, we delete it;
|
||||
rm $fic
|
||||
fi;
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done;
|
||||
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
||||
then
|
||||
reflang="htdocs/langs/"$aa"_"$aaupper
|
||||
echo $reflang" "$aa"_"$bb != $aa"_"$aaupper
|
||||
|
||||
# If $reflang is a main language to use to sanitize the alternative file
|
||||
if [ -d $reflang ]
|
||||
then
|
||||
if [ $aa"_"$bb != $aa"_"$aaupper ]
|
||||
then
|
||||
echo "***** Search original into "$reflang
|
||||
echo $dirshort is an alternative language of $reflang
|
||||
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
|
||||
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
|
||||
do f=`cat $fic | wc -l`;
|
||||
#echo $f lines into file $fic;
|
||||
if [ $f = 1 ]
|
||||
then
|
||||
echo "Only one line remaining into file '$fic', we delete it";
|
||||
rm $fic
|
||||
fi;
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done;
|
||||
fi
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#------------------------------------------------------
|
||||
# Usage: fixdosfiles.sh [list|fix]
|
||||
#------------------------------------------------------
|
||||
# shellcheck disable=2006,2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
@@ -18,7 +19,7 @@ fi
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
|
||||
fi
|
||||
|
||||
# To convert
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
#
|
||||
# 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" ]
|
||||
then
|
||||
echo "Detect duplicate translation keys inside a file (there is no cross file check)."
|
||||
echo "Detect duplicate translation keys inside a file (there is no cross file check)."
|
||||
echo "Usage: detectduplicatelangkey.sh (list|fix)"
|
||||
fi
|
||||
|
||||
@@ -17,19 +18,19 @@ then
|
||||
echo "Search duplicate keys into en_US lang files (there is no cross file check)"
|
||||
for file in `find htdocs/langs/en_US -name *.lang -type f`
|
||||
do
|
||||
dupes=$(
|
||||
sed "s/^\s*//" "$file" | # Remove any leading whitespace
|
||||
sed "s/\s*\=/=/" | # Remove any whitespace before =
|
||||
grep -Po "(^.*?)=" | # Non greedeely match everything before =
|
||||
sed "s/\=//" | # Remove trailing = so we get the key
|
||||
sort | uniq -d # Find duplicates
|
||||
)
|
||||
|
||||
if [ -n "$dupes" ]
|
||||
then
|
||||
echo "Duplicates found in $file"
|
||||
echo "$dupes"
|
||||
fi
|
||||
dupes=$(
|
||||
sed "s/^\s*//" "$file" | # Remove any leading whitespace
|
||||
sed "s/\s*\=/=/" | # Remove any whitespace before =
|
||||
grep -Po "(^.*?)=" | # Non greedeely match everything before =
|
||||
sed "s/\=//" | # Remove trailing = so we get the key
|
||||
sort | uniq -d # Find duplicates
|
||||
)
|
||||
|
||||
if [ -n "$dupes" ]
|
||||
then
|
||||
echo "Duplicates found in $file"
|
||||
echo "$dupes"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -17,22 +19,22 @@ fi
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
echo "Search duplicate line for lang en_US"
|
||||
for file in `find htdocs/langs/en_US -type f -name *.lang`
|
||||
do
|
||||
if [ `sort "$file" | grep -v '^$' | uniq -d | wc -l` -gt 0 ]
|
||||
then
|
||||
echo "***** $file"
|
||||
sort "$file" | grep -v '^$' | uniq -d
|
||||
fi
|
||||
done
|
||||
for file in `find htdocs/langs/en_US -type f -name *.lang`
|
||||
do
|
||||
if [ `sort "$file" | grep -v '^$' | uniq -d | wc -l` -gt 0 ]
|
||||
then
|
||||
echo "***** $file"
|
||||
sort "$file" | grep -v '^$' | uniq -d
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# To fix
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
echo "Fix duplicate line for lang en_US"
|
||||
for file in `find htdocs/langs/en_US -type f -name *.lang`
|
||||
do
|
||||
awk -i inplace ' !x[$0]++' "$file"
|
||||
done;
|
||||
for file in `find htdocs/langs/en_US -type f -name *.lang`
|
||||
do
|
||||
awk -i inplace ' !x[$0]++' "$file"
|
||||
done;
|
||||
fi
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
#/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
|
||||
sed -i -r 's/ empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *0 *: *\$user->rights->\1->\2->\3;/ !$user->hasRight("\1", "\2", "\3");/' $f
|
||||
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3", "\4")/g' $f
|
||||
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3")/g' $f
|
||||
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3", "\4")/g' $f
|
||||
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3")/g' $f
|
||||
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2")/g' $f
|
||||
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2")/g' $f
|
||||
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2")/g' $f
|
||||
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
|
||||
sed -i -r 's/ empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *0 *: *\$user->rights->\1->\2->\3;/ !$user->hasRight("\1", "\2", "\3");/' $f
|
||||
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3", "\4")/g' $f
|
||||
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3")/g' $f
|
||||
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3", "\4")/g' $f
|
||||
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3")/g' $f
|
||||
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2")/g' $f
|
||||
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2")/g' $f
|
||||
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2")/g' $f
|
||||
done
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -17,14 +19,14 @@ fi
|
||||
# To detect
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
echo Feature not yet available
|
||||
echo Feature not yet available
|
||||
fi
|
||||
|
||||
# To convert
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \;
|
||||
find ./htdocs/install/ -type d -exec chmod ug+rw {} \;
|
||||
find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \;
|
||||
find ./htdocs/install/ -type d -exec chmod ug+rw {} \;
|
||||
chmod a+x ./scripts/*/*.php
|
||||
chmod a+x ./scripts/*/*.sh
|
||||
chmod g-w ./scripts/*/*.php
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
#!/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
|
||||
echo "This bash need rpl command, you can install it with: sudo apt install rpl"
|
||||
echo "This bash need rpl command, you can install it with: sudo apt install rpl"
|
||||
fi
|
||||
|
||||
DIR_HTDOCS=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../htdocs" >/dev/null && pwd )
|
||||
|
||||
PATTERN=""
|
||||
if [[ -f $1 ]]; then
|
||||
TFile=("$1") # specific file
|
||||
TFile=("$1") # specific file
|
||||
elif [[ -n $1 ]]; then
|
||||
PATTERN=$1 # name of a particular file or pattern (ex: societe.class.php)
|
||||
PATTERN=$1 # name of a particular file or pattern (ex: societe.class.php)
|
||||
else
|
||||
PATTERN="*.class.php" # *.lib.php
|
||||
PATTERN="*.class.php" # *.lib.php
|
||||
fi
|
||||
|
||||
if [[ -n ${PATTERN} ]]; then
|
||||
TCLASSFILE=$(find "${DIR_HTDOCS}" -name "${PATTERN}" | grep -v "/custom/" | grep -v "/includes/" | grep -v -F -f "${DIR_HTDOCS}/../.gitignore")
|
||||
TFile=()
|
||||
I=0
|
||||
for f in ${TCLASSFILE}; do
|
||||
TFile[${I}]="${f}"
|
||||
((I++))
|
||||
done
|
||||
TCLASSFILE=$(find "${DIR_HTDOCS}" -name "${PATTERN}" | grep -v "/custom/" | grep -v "/includes/" | grep -v -F -f "${DIR_HTDOCS}/../.gitignore")
|
||||
TFile=()
|
||||
I=0
|
||||
for f in ${TCLASSFILE}; do
|
||||
TFile[${I}]="${f}"
|
||||
((I++))
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -32,99 +34,99 @@ REGEX_FNC_W='^([[:blank:]]*)(public|private|protected)?[ \t]*(static)?[ \t]*[^\$
|
||||
INDENT=" "
|
||||
|
||||
for f in ${TFile[@]}; do
|
||||
# echo ${f}
|
||||
# echo ${f}
|
||||
|
||||
IFS=$'\n'
|
||||
TLine=($(cat "${f}" | grep -E "${REGEX_FNC_W}"))
|
||||
IFS=$'\n'
|
||||
TLine=($(cat "${f}" | grep -E "${REGEX_FNC_W}"))
|
||||
|
||||
for LINE in ${TLine[@]}; do
|
||||
for LINE in ${TLine[@]}; do
|
||||
|
||||
if [[ ${LINE} =~ ^${REGEX_FNC_W}$ ]]; then
|
||||
FIRST_INDENT=${BASH_REMATCH[1]} # seem not work
|
||||
FNC_TYPE=${BASH_REMATCH[2]}
|
||||
STATIC=${BASH_REMATCH[3]}
|
||||
FNC_NAME=${BASH_REMATCH[4]}
|
||||
PARAMETERS_ORIGIN=${BASH_REMATCH[5]}
|
||||
BRACKET_END=${BASH_REMATCH[6]}
|
||||
if [[ ${LINE} =~ ^${REGEX_FNC_W}$ ]]; then
|
||||
FIRST_INDENT=${BASH_REMATCH[1]} # seem not work
|
||||
FNC_TYPE=${BASH_REMATCH[2]}
|
||||
STATIC=${BASH_REMATCH[3]}
|
||||
FNC_NAME=${BASH_REMATCH[4]}
|
||||
PARAMETERS_ORIGIN=${BASH_REMATCH[5]}
|
||||
BRACKET_END=${BASH_REMATCH[6]}
|
||||
|
||||
if [[ ${LINE} =~ ^([[:blank:]]*) ]]; then # but this seems work to get indentation
|
||||
FIRST_INDENT=${BASH_REMATCH[1]}
|
||||
fi
|
||||
if [[ ${LINE} =~ ^([[:blank:]]*) ]]; then # but this seems work to get indentation
|
||||
FIRST_INDENT=${BASH_REMATCH[1]}
|
||||
fi
|
||||
|
||||
[[ ${FNC_NAME} =~ ^__ ]] && continue # skip magic function
|
||||
[[ ${FNC_NAME} =~ ^__ ]] && continue # skip magic function
|
||||
|
||||
CAMEL_CASE=$(echo "${FNC_NAME}" | sed -r 's/(_)([a-zA-Z0-9])/\U\2/g')
|
||||
[[ ${CAMEL_CASE} = ${FNC_NAME} ]] && continue # skip if no difference
|
||||
CAMEL_CASE=$(echo "${FNC_NAME}" | sed -r 's/(_)([a-zA-Z0-9])/\U\2/g')
|
||||
[[ ${CAMEL_CASE} = ${FNC_NAME} ]] && continue # skip if no difference
|
||||
|
||||
#echo A: ${#FIRST_INDENT}
|
||||
#printf "${FIRST_INDENT}TEST INDENT\n"
|
||||
#echo B: ${FNC_TYPE}
|
||||
#echo C: ${STATIC}
|
||||
#echo D: ${FNC_NAME}
|
||||
#echo D: ${CAMEL_CASE}
|
||||
#echo E: ${PARAMETERS_ORIGIN}
|
||||
#echo F: ${BRACKET_END}
|
||||
#exit
|
||||
#echo A: ${#FIRST_INDENT}
|
||||
#printf "${FIRST_INDENT}TEST INDENT\n"
|
||||
#echo B: ${FNC_TYPE}
|
||||
#echo C: ${STATIC}
|
||||
#echo D: ${FNC_NAME}
|
||||
#echo D: ${CAMEL_CASE}
|
||||
#echo E: ${PARAMETERS_ORIGIN}
|
||||
#echo F: ${BRACKET_END}
|
||||
#exit
|
||||
|
||||
[[ -n $(cat "${f}" | grep -i "function[[:blank:]]*${CAMEL_CASE}") ]] && continue # skip if already exists
|
||||
[[ -n $(cat "${f}" | grep -i "function[[:blank:]]*${CAMEL_CASE}") ]] && continue # skip if already exists
|
||||
|
||||
TCommentLine=()
|
||||
J=1
|
||||
while :; do
|
||||
COMMENT=$(cat ${f} | grep -B ${J} ${LINE/\$/\\$} | head -n1 | grep -P '^[\t\ ]*(/\*\*|\*[^/]?|\*/)')
|
||||
if [[ -n ${COMMENT} ]]; then
|
||||
TCommentLine[${J}]="${COMMENT}"
|
||||
((J++))
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
TCommentLine=()
|
||||
J=1
|
||||
while :; do
|
||||
COMMENT=$(cat ${f} | grep -B ${J} ${LINE/\$/\\$} | head -n1 | grep -P '^[\t\ ]*(/\*\*|\*[^/]?|\*/)')
|
||||
if [[ -n ${COMMENT} ]]; then
|
||||
TCommentLine[${J}]="${COMMENT}"
|
||||
((J++))
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
COMMENT_ORIGIN=""
|
||||
COMMENT_ORIGIN_WITH_DEPRECATED=""
|
||||
COMMENT_DUPLICATE=""
|
||||
if [[ ${#TCommentLine[@]} -gt 0 ]]; then
|
||||
for (( idx=${#TCommentLine[@]} ; idx>0 ; idx-- )) ; do
|
||||
COMMENT_ORIGIN="${COMMENT_ORIGIN}\n${TCommentLine[idx]}"
|
||||
done
|
||||
COMMENT_ORIGIN=""
|
||||
COMMENT_ORIGIN_WITH_DEPRECATED=""
|
||||
COMMENT_DUPLICATE=""
|
||||
if [[ ${#TCommentLine[@]} -gt 0 ]]; then
|
||||
for (( idx=${#TCommentLine[@]} ; idx>0 ; idx-- )) ; do
|
||||
COMMENT_ORIGIN="${COMMENT_ORIGIN}\n${TCommentLine[idx]}"
|
||||
done
|
||||
|
||||
COMMENT_DUPLICATE=${COMMENT_ORIGIN}
|
||||
COMMENT_DUPLICATE=${COMMENT_ORIGIN}
|
||||
|
||||
COMMENT_ORIGIN_WITH_DEPRECATED=$(echo "${COMMENT_ORIGIN%?} @deprecated\n${FIRST_INDENT} * @see ${CAMEL_CASE}\n${FIRST_INDENT} */")
|
||||
fi
|
||||
COMMENT_ORIGIN_WITH_DEPRECATED=$(echo "${COMMENT_ORIGIN%?} @deprecated\n${FIRST_INDENT} * @see ${CAMEL_CASE}\n${FIRST_INDENT} */")
|
||||
fi
|
||||
|
||||
PARAMETERS=${PARAMETERS_ORIGIN}
|
||||
TParam=()
|
||||
I=0
|
||||
while [[ ${PARAMETERS} =~ (\$[a-zA-Z0-9\_\-]+) ]]; do
|
||||
TParam[${I}]=${BASH_REMATCH[1]}
|
||||
PARAMETERS=${PARAMETERS#*"${BASH_REMATCH[1]}"}
|
||||
((I++))
|
||||
done
|
||||
PARAMETERS=${PARAMETERS_ORIGIN}
|
||||
TParam=()
|
||||
I=0
|
||||
while [[ ${PARAMETERS} =~ (\$[a-zA-Z0-9\_\-]+) ]]; do
|
||||
TParam[${I}]=${BASH_REMATCH[1]}
|
||||
PARAMETERS=${PARAMETERS#*"${BASH_REMATCH[1]}"}
|
||||
((I++))
|
||||
done
|
||||
|
||||
PARAMS_STR=$(printf ", %s" "${TParam[@]}")
|
||||
PARAMS_STR=${PARAMS_STR:2}
|
||||
PARAMS_STR=$(printf ", %s" "${TParam[@]}")
|
||||
PARAMS_STR=${PARAMS_STR:2}
|
||||
|
||||
REPLACE=${LINE}
|
||||
[[ -z ${BRACKET_END} ]] && REPLACE="${LINE}\n${FIRST_INDENT}{\n${FIRST_INDENT}${INDENT}" || REPLACE="${LINE}\n${FIRST_INDENT}${INDENT}"
|
||||
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}return self::" || REPLACE="${REPLACE}return \$this->"
|
||||
REPLACE="${REPLACE}${CAMEL_CASE}(${PARAMS_STR});\n${FIRST_INDENT}}\n\n"
|
||||
REPLACE="${REPLACE}${FIRST_INDENT}${COMMENT_ORIGIN}\n${FIRST_INDENT}"
|
||||
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}${STATIC} "
|
||||
[[ -n ${FNC_TYPE} ]] && REPLACE="${REPLACE}${FNC_TYPE} "
|
||||
REPLACE="${REPLACE}function ${CAMEL_CASE}(${PARAMETERS_ORIGIN})"
|
||||
[[ -n ${BRACKET_END} ]] && REPLACE="${REPLACE}\n${FIRST_INDENT}{"
|
||||
REPLACE=${LINE}
|
||||
[[ -z ${BRACKET_END} ]] && REPLACE="${LINE}\n${FIRST_INDENT}{\n${FIRST_INDENT}${INDENT}" || REPLACE="${LINE}\n${FIRST_INDENT}${INDENT}"
|
||||
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}return self::" || REPLACE="${REPLACE}return \$this->"
|
||||
REPLACE="${REPLACE}${CAMEL_CASE}(${PARAMS_STR});\n${FIRST_INDENT}}\n\n"
|
||||
REPLACE="${REPLACE}${FIRST_INDENT}${COMMENT_ORIGIN}\n${FIRST_INDENT}"
|
||||
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}${STATIC} "
|
||||
[[ -n ${FNC_TYPE} ]] && REPLACE="${REPLACE}${FNC_TYPE} "
|
||||
REPLACE="${REPLACE}function ${CAMEL_CASE}(${PARAMETERS_ORIGIN})"
|
||||
[[ -n ${BRACKET_END} ]] && REPLACE="${REPLACE}\n${FIRST_INDENT}{"
|
||||
|
||||
echo " ${FNC_NAME} -> ${CAMEL_CASE}"
|
||||
echo " ${FNC_NAME} -> ${CAMEL_CASE}"
|
||||
|
||||
if [[ -n ${COMMENT_ORIGIN_WITH_DEPRECATED} ]]; then
|
||||
rpl -e --quiet "${COMMENT_ORIGIN}" ${COMMENT_ORIGIN_WITH_DEPRECATED} "${f}"
|
||||
fi
|
||||
rpl -e --quiet "${LINE}" ${REPLACE} "${f}"
|
||||
if [[ -n ${COMMENT_ORIGIN_WITH_DEPRECATED} ]]; then
|
||||
rpl -e --quiet "${COMMENT_ORIGIN}" ${COMMENT_ORIGIN_WITH_DEPRECATED} "${f}"
|
||||
fi
|
||||
rpl -e --quiet "${LINE}" ${REPLACE} "${f}"
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
#------------------------------------------------------
|
||||
# Usage: fixutf8bomfiles.sh [list|fix]
|
||||
#------------------------------------------------------
|
||||
# shellcheck disable=2006,2028,2086,2089,2090,2166,2268
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "Detect and fix bad UTF8 encoded files (UTF8 must not use BOM char)"
|
||||
echo "Detect and fix bad UTF8 encoded files (UTF8 must not use BOM char)"
|
||||
echo "Usage: fixutf8bomfiles.sh (list|fix) [addincludes]"
|
||||
fi
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user