Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dolibarr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NoCloud
docker
Dolibarr
Commits
a9492056
Verified
Commit
a9492056
authored
2 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
CLI
parent
eb8a21ba
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
doli
+99
-0
99 additions, 0 deletions
doli
doli_shell.php
+52
-0
52 additions, 0 deletions
doli_shell.php
with
151 additions
and
0 deletions
doli
0 → 100755
+
99
−
0
View file @
a9492056
#!/bin/bash
is_docker
()
{
if
[
!
-z
"
$(
which docker-compose 2>/dev/null
)
"
]
;
then
echo
"1"
else
echo
"0"
fi
}
usage
()
{
echo
-e
"Usage
$0
<command> [args]
\n
"
echo
-e
"COMMANDS
\n
"
echo
"bash"
echo
-e
"
\t
opens a bash terminal in front container or just run bash"
echo
"down"
echo
-e
"
\t
stops the docker stack"
echo
"help"
echo
-e
"
\t
displays this messages and exit"
echo
"mysql"
echo
-e
"
\t
open a mysql prompt in LNB database"
echo
"mysql_init"
echo
-e
"
\t
populate LabNbook database (Docker only)"
echo
"restart"
echo
-e
"
\t
restart the docker stack or apache2"
echo
"shell"
echo
-e
"
\t
run a php shell, same as
$0
artisan tinker"
echo
"up"
echo
-e
"
\t
starts the docker stack"
}
if
[
"
$(
is_docker
)
"
-eq
1
]
;
then
cmd
=
"docker-compose exec dolibarr"
cmdmy
=
"docker-compose exec mariadb"
cmdmyInput
=
"docker exec -i
$(
docker-compose ps
-q
mariadb
)
"
cmdrestart
=
"docker-compose restart"
cmdup
=
"docker-compose up"
cmddown
=
"docker-compose down"
else
cmdrestart
=
"apache2ctl restart"
fi
user
=
dolibarr
db
=
dolibarr
pass
=
$(
awk
-F
'='
'/PASS/{print $2}'
.env
)
mysql
=
"mysql -u
$user
$db
-p
$pass
"
DIR
=
"
$(
dirname
$0
)
"
action
=
$1
shift
# Keep actions sorted
case
$action
in
"bash"
)
$cmd
bash
;;
"down"
)
$cmddown
;;
"help"
)
usage
;;
"mysql"
)
set
-x
$cmdmy
$mysql
set
+x
;;
"mysql_init"
)
read
-p
"Do you want to init your database with default data? This command will erase your current data. (y/n). "
yn
case
$yn
in
[
Yy]
*
)
zcat dumps/internal.sql.gz |
$cmdmyInput
$mysql
;;
[
Nn]
*
)
exit
;;
*
)
echo
"Please answer yes or no."
;;
esac
;;
"restart"
)
$cmdrestart
$@
;;
"shell"
)
if
[
$(
is_docker
)
-eq
1
]
;
then
docker
cp
doli_shell.php
$(
docker-compose ps
-q
dolibarr
)
:/var/www
fi
$cmd
php
-a
-d
auto_prepend_file
=
/var/www/doli_shell.php
;;
"up"
)
$cmdup
$@
;;
*
)
echo
"ERROR: No command given"
usage
exit
1
;;
esac
This diff is collapsed.
Click to expand it.
doli_shell.php
0 → 100644
+
52
−
0
View file @
a9492056
<?php
/**
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file scripts/user/sync_groups_dolibarr2ldap.php
* \ingroup ldap core
* \brief Script de mise a jour des groupes dans LDAP depuis base Dolibarr
*/
if
(
!
defined
(
'NOSESSION'
))
{
define
(
'NOSESSION'
,
'1'
);
}
function
dd
(
$data
)
{
echo
json_encode
(
$data
,
JSON_PRETTY_PRINT
);
}
function
query
(
$raw
)
{
global
$db
;
return
$db
->
query
(
$raw
);
}
function
fetch
(
$raw
)
{
global
$db
;
$resql
=
query
(
$raw
);
if
(
$resql
)
{
return
$db
->
fetch_object
(
$resql
);
}
return
null
;
}
$sapi_type
=
php_sapi_name
();
$script_file
=
basename
(
__FILE__
);
$path
=
__DIR__
.
'/'
;
include
"/var/www/dolibarr/htdocs/master.inc.php"
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment