Work on debian package
This commit is contained in:
parent
89abdb1874
commit
429ba54e3e
@ -1,6 +0,0 @@
|
||||
# This file seems to be useless for Ubuntu
|
||||
# Good way to add menu on Ubuntu is adding file dolibarr.desktop
|
||||
?package(dolibarr):needs="X11" section="Applications/Office"\
|
||||
title="Dolibarr ERP & CRM" longtitle="The manager for small and medium enterprises or foundations"\
|
||||
description="Dolibarr ERP & CRM features agenda, orders, invoices and stock management, marketing campaigns, POS, etc."\
|
||||
command="/usr/share/dolibarr/build/deb/rundolibarr.sh" icon="/usr/share/pixmaps/dolibarr.xpm"
|
||||
@ -16,7 +16,8 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
||||
ttf-dejavu-core,
|
||||
xdg-utils,
|
||||
mysql-server,
|
||||
${misc:Depends}
|
||||
${misc:Depends},
|
||||
${perl:Depends}
|
||||
Recommends: apache2 | lighttpd | httpd, mysql-client
|
||||
Suggests: www-browser
|
||||
Architecture: all
|
||||
@ -5,7 +5,8 @@ Maintainer: Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
Installed-Size: 61200
|
||||
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
|
||||
php5-mysql | php5-mysqli,
|
||||
php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip
|
||||
php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip,
|
||||
libnusoap-php,
|
||||
libphp-pclzip,
|
||||
ckeditor,
|
||||
ttf-dejavu-core,
|
||||
@ -49,7 +49,7 @@ echo Run the dolibarr postinst script
|
||||
|
||||
# Define vars
|
||||
docdir='/var/lib/dolibarr/documents'
|
||||
installfileorig="/usr/share/dolibarr/build/deb/install.forced.php.install"
|
||||
installfileorig="/usr/share/dolibarr/build/debian/install.forced.php.install"
|
||||
installconfig="/etc/dolibarr/install.forced.php"
|
||||
config="/etc/dolibarr/conf.php"
|
||||
|
||||
@ -30,3 +30,14 @@ To submit a package on LaunchPad:
|
||||
bzr dailydeb dolibarr.recipe working-dir
|
||||
This will create a directory "working-dir" with dolibarr sources and will add sources from ~eldy/dolibarr/debian
|
||||
|
||||
- Create a file /.pbuilderrc with content
|
||||
$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build
|
||||
|
||||
- Create chroot ubuntu env
|
||||
sudo pbuilder create
|
||||
- Test package sources
|
||||
sudo pbuilder build <working-dir>/<project>_<version>.dsc
|
||||
|
||||
|
||||
|
||||
|
||||
@ -593,26 +593,27 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/dmg`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/pad/README`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/tgz/README`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/README`;
|
||||
#$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/po`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/changelog`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/compat`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/config`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/control.*`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/copyright`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/dolibarr.desktop`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/dolibarr.menu`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/format`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/install`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/menu`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/postrm`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/postinst`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/rules`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/README.debian`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/templates`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/templates.futur`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/deb/wash`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/README`;
|
||||
#$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/po`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/source`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/changelog`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/compat`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/config`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/control*`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/copyright`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/dolibarr.desktop`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/dolibarr.lintian-overrides`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/format`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/install`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/menu`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/postrm`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/postinst`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/rules`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/README.debian`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/templates`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/templates.futur`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/debian/wash`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/doap`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/exe`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/build/launchpad`;
|
||||
@ -631,16 +632,16 @@ if ($nboftargetok) {
|
||||
# Apache and lighttpd conf files
|
||||
print "Copy apache.conf file into $BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf\n";
|
||||
$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT"`;
|
||||
$ret=`cp "$SOURCE/build/deb/apache.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf"`;
|
||||
$ret=`cp "$SOURCE/build/debian/apache.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf"`;
|
||||
print "Copy lighttpd.conf file into $BUILDROOT/$PROJECT.tmp/etc/$PROJECT/lighttpd.conf\n";
|
||||
$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT"`;
|
||||
$ret=`cp "$SOURCE/build/deb/lighttpd.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/lighttpd.conf"`;
|
||||
$ret=`cp "$SOURCE/build/debian/lighttpd.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/lighttpd.conf"`;
|
||||
|
||||
# dolibarr.desktop
|
||||
print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/applications\n";
|
||||
$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/applications"`;
|
||||
print "Copy desktop file into $BUILDROOT/$PROJECT.tmp/usr/share/applications/dolibarr.desktop\n";
|
||||
$ret=`cp "$SOURCE/build/deb/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/usr/share/applications/dolibarr.desktop"`;
|
||||
$ret=`cp "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/usr/share/applications/dolibarr.desktop"`;
|
||||
|
||||
# pixmap
|
||||
print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/pixmaps\n";
|
||||
@ -652,7 +653,7 @@ if ($nboftargetok) {
|
||||
$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT"`;
|
||||
|
||||
# changelog (to build binary package directly without sources. Useless if we build from sources)
|
||||
$ret=`gzip -9 -c "$SOURCE/build/deb/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.gz`;
|
||||
$ret=`gzip -9 -c "$SOURCE/build/debian/changelog" > $BUILDROOT/$PROJECT.tmp/usr/share/doc/$PROJECT/changelog.gz`;
|
||||
|
||||
# Set owners
|
||||
print "Set owners on files/dir\n";
|
||||
@ -681,15 +682,15 @@ if ($nboftargetok) {
|
||||
# Prepare binary package (init DEBIAN dir)
|
||||
print "Create directory $BUILDROOT/$PROJECT.tmp/DEBIAN\n";
|
||||
$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
print "Copy $SOURCE/build/deb/xxx to $BUILDROOT/$PROJECT.tmp/DEBIAN\n";
|
||||
$ret=`cp -f "$SOURCE/build/deb/config" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/postinst" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/postrm" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/templates" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`cp -fr "$SOURCE/build/deb/po" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/DEBIAN\n";
|
||||
$ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
|
||||
print "Edit version in file $BUILDROOT/$PROJECT.tmp/DEBIAN/control\n";
|
||||
open (SPECFROM,"<$SOURCE/build/deb/control.debianbin") || die "Error";
|
||||
open (SPECFROM,"<$SOURCE/build/debian/control.debianbin") || die "Error";
|
||||
open (SPECTO,">$BUILDROOT/$PROJECT.tmp/DEBIAN/control") || die "Error";
|
||||
while (<SPECFROM>) {
|
||||
$_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/;
|
||||
@ -705,13 +706,14 @@ if ($nboftargetok) {
|
||||
$ret=`chmod 644 $BUILDROOT/$PROJECT.tmp/DEBIAN/templates`;
|
||||
|
||||
# Creation of binary package (to build without sources)
|
||||
#print "Go to directory $BUILDROOT\n";
|
||||
# Enable this to build a binary package without building sources first
|
||||
#print "Go into directory $BUILDROOT\n";
|
||||
#chdir("$BUILDROOT");
|
||||
#$cmd="dpkg -b $BUILDROOT/$PROJECT.tmp $BUILDROOT/${FILENAMEDEB}_all.deb";
|
||||
#print "Launch DEB build ($cmd)\n";
|
||||
#$ret=`$cmd`;
|
||||
#print $ret."\n";
|
||||
#exit
|
||||
#exit;
|
||||
|
||||
$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/DEBIAN"`;
|
||||
$ret=`rm -fr "$BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/doc"`;
|
||||
@ -719,31 +721,31 @@ if ($nboftargetok) {
|
||||
# Prepare source package (init debian dir)
|
||||
print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n";
|
||||
$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian/source"`;
|
||||
print "Copy $SOURCE/build/deb/xxx to $BUILDROOT/$PROJECT.tmp/debian\n";
|
||||
print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n";
|
||||
# Add files for dpkg-source
|
||||
$ret=`cp -f "$SOURCE/ChangeLog" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/UserChangeLog"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/README.debian" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/README"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/changelog" "$BUILDROOT/$PROJECT.tmp/debian/changelog"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/control.debian" "$BUILDROOT/$PROJECT.tmp/debian/control"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian/dolibarr.lintian-overrides"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/install" "$BUILDROOT/$PROJECT.tmp/debian/install"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/rules" "$BUILDROOT/$PROJECT.tmp/debian/rules"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/copyright" "$BUILDROOT/$PROJECT.tmp/debian/copyright"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/compat" "$BUILDROOT/$PROJECT.tmp/debian/compat"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/format" "$BUILDROOT/$PROJECT.tmp/debian/source/format"`;
|
||||
$ret=`cp -fr "$SOURCE/build/deb/po" "$BUILDROOT/$PROJECT.tmp/debian/po"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/README.debian" "$BUILDROOT/$PROJECT.tmp/usr/share/doc/dolibarr/README"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/install" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -fr "$SOURCE/build/debian/source" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -fr "$SOURCE/build/debian/po" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
# Add files also required to build binary package with dpkg-buildpackages
|
||||
$ret=`cp -f "$SOURCE/build/deb/config" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/postinst" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/deb/templates" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/config" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/postinst" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/postrm" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/templates" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
|
||||
print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
|
||||
$cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
|
||||
$ret=`$cmd`;
|
||||
|
||||
# Creation of source package
|
||||
print "Go to directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
|
||||
print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
|
||||
chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build");
|
||||
#$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
|
||||
$cmd="dpkg-buildpackage -us -uc";
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
|
||||
* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
@ -42,7 +42,7 @@ class DoliDBMysql
|
||||
//! Collate used to force collate when creating database
|
||||
static $forcecollate='utf8_general_ci'; // latin1_swedish_ci, utf8_general_ci
|
||||
//! Version min database
|
||||
static $versionmin=array(3,1,0);
|
||||
static $versionmin=array(4,1,0);
|
||||
//! Resultset of last request
|
||||
private $results;
|
||||
//! 1 if connected, 0 else
|
||||
@ -566,7 +566,7 @@ class DoliDBMysql
|
||||
* @param test chaine test
|
||||
* @param resok resultat si test egal
|
||||
* @param resko resultat si test non egal
|
||||
* @return string chaine formate SQL
|
||||
* @return string SQL string
|
||||
*/
|
||||
function ifsql($test,$resok,$resko)
|
||||
{
|
||||
@ -647,6 +647,7 @@ class DoliDBMysql
|
||||
1146 => 'DB_ERROR_NOSUCHTABLE',
|
||||
1216 => 'DB_ERROR_NO_PARENT',
|
||||
1217 => 'DB_ERROR_CHILD_EXISTS',
|
||||
1396 => 'DB_ERROR_USER_ALREADY_EXISTS', // When creating user already existing
|
||||
1451 => 'DB_ERROR_CHILD_EXISTS'
|
||||
);
|
||||
|
||||
@ -694,9 +695,10 @@ class DoliDBMysql
|
||||
/**
|
||||
* Encrypt sensitive data in database
|
||||
* Warning: This function includes the escape, so it must use direct value
|
||||
* @param fieldorvalue Field name or value to encrypt
|
||||
* @param withQuotes Return string with quotes
|
||||
* @return return XXX(field) or XXX('value') or field or 'value'
|
||||
*
|
||||
* @param string $fieldorvalue Field name or value to encrypt
|
||||
* @param int $withQuotes Return string with quotes
|
||||
* @return string XXX(field) or XXX('value') or field or 'value'
|
||||
*/
|
||||
function encrypt($fieldorvalue, $withQuotes=0)
|
||||
{
|
||||
@ -759,8 +761,9 @@ class DoliDBMysql
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie l'id de la connexion
|
||||
* \return string Id connexion
|
||||
* Renvoie l'id de la connexion
|
||||
*
|
||||
* @return string Id connexion
|
||||
*/
|
||||
function DDLGetConnectId()
|
||||
{
|
||||
@ -1036,36 +1039,27 @@ class DoliDBMysql
|
||||
*/
|
||||
function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name)
|
||||
{
|
||||
$sql = "INSERT INTO user ";
|
||||
$sql.= "(Host,User,password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv,Lock_tables_priv)";
|
||||
$sql.= " VALUES ('".addslashes($dolibarr_main_db_host)."','".addslashes($dolibarr_main_db_user)."',password('".addslashes($dolibarr_main_db_pass)."')";
|
||||
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')";
|
||||
$sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'";
|
||||
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
|
||||
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$sql="FLUSH Privileges";
|
||||
|
||||
$sql = "INSERT INTO db ";
|
||||
$sql.= "(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv,Lock_tables_priv)";
|
||||
$sql.= " VALUES ('".addslashes($dolibarr_main_db_host)."','".addslashes($dolibarr_main_db_name)."','".addslashes($dolibarr_main_db_user)."'";
|
||||
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')";
|
||||
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql,LOG_DEBUG);
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql="FLUSH Privileges";
|
||||
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql,LOG_DEBUG);
|
||||
$resql=$this->query($sql);
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql);
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
|
||||
@ -249,9 +249,6 @@ class DoliDBMysqli
|
||||
*/
|
||||
function getVersion()
|
||||
{
|
||||
// $resql=$this->query('SELECT VERSION()');
|
||||
// $row=$this->fetch_row($resql);
|
||||
// return $row[0];
|
||||
return mysqli_get_server_info($this->db);
|
||||
}
|
||||
|
||||
@ -546,7 +543,7 @@ class DoliDBMysqli
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert (by PHP) a GM Timestamp date into a PHP server TZ to insert into a date field.
|
||||
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
|
||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||
*
|
||||
* @param string $param Date TMS to convert
|
||||
@ -578,7 +575,7 @@ class DoliDBMysqli
|
||||
* @param test chaine test
|
||||
* @param resok resultat si test egal
|
||||
* @param resko resultat si test non egal
|
||||
* @return string chaine formatee SQL
|
||||
* @return string SQL string
|
||||
*/
|
||||
function ifsql($test,$resok,$resko)
|
||||
{
|
||||
@ -659,6 +656,7 @@ class DoliDBMysqli
|
||||
1146 => 'DB_ERROR_NOSUCHTABLE',
|
||||
1216 => 'DB_ERROR_NO_PARENT',
|
||||
1217 => 'DB_ERROR_CHILD_EXISTS',
|
||||
1396 => 'DB_ERROR_USER_ALREADY_EXISTS', // When creating user already existing
|
||||
1451 => 'DB_ERROR_CHILD_EXISTS'
|
||||
);
|
||||
|
||||
@ -702,9 +700,9 @@ class DoliDBMysqli
|
||||
* Encrypt sensitive data in database
|
||||
* Warning: This function includes the escape, so it must use direct value
|
||||
*
|
||||
* @param fieldorvalue Field name or value to encrypt
|
||||
* @param withQuotes Return string with quotes
|
||||
* @return return XXX(field) or XXX('value') or field or 'value'
|
||||
* @param string $fieldorvalue Field name or value to encrypt
|
||||
* @param int $withQuotes Return string with quotes
|
||||
* @return string XXX(field) or XXX('value') or field or 'value'
|
||||
*
|
||||
*/
|
||||
function encrypt($fieldorvalue, $withQuotes=0)
|
||||
@ -767,12 +765,10 @@ class DoliDBMysqli
|
||||
}
|
||||
|
||||
|
||||
// Next functions are not required. Only minor features use them.
|
||||
//---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* \brief Renvoie l'id de la connexion
|
||||
* \return string Id connexion
|
||||
* Renvoie l'id de la connexion
|
||||
*
|
||||
* @return string Id connexion
|
||||
*/
|
||||
function DDLGetConnectId()
|
||||
{
|
||||
@ -1047,11 +1043,7 @@ class DoliDBMysqli
|
||||
*/
|
||||
function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name)
|
||||
{
|
||||
$sql = "INSERT INTO user ";
|
||||
$sql.= "(Host,User,password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv,Lock_tables_priv)";
|
||||
$sql.= " VALUES ('".addslashes($dolibarr_main_db_host)."','".addslashes($dolibarr_main_db_user)."',password('".addslashes($dolibarr_main_db_pass)."')";
|
||||
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')";
|
||||
|
||||
$sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'";
|
||||
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
@ -1059,13 +1051,8 @@ class DoliDBMysqli
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO db ";
|
||||
$sql.= "(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv,Lock_tables_priv)";
|
||||
$sql.= " VALUES ('".addslashes($dolibarr_main_db_host)."','".addslashes($dolibarr_main_db_name)."','".addslashes($dolibarr_main_db_user)."'";
|
||||
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')";
|
||||
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql);
|
||||
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
|
||||
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
|
||||
@ -167,7 +167,7 @@ if (! $error)
|
||||
$db=getDoliDBInstance($_POST["db_type"],$_POST["db_host"],$userroot,$passroot,$databasefortest,$_POST["db_port"]);
|
||||
|
||||
dol_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG);
|
||||
print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected;
|
||||
//print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected;
|
||||
|
||||
if (empty($_POST["db_create_database"]) && $db->connected && ! $db->database_selected)
|
||||
{
|
||||
@ -467,7 +467,8 @@ if (! $error && $db->connected && $action == "set")
|
||||
else
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS'
|
||||
|| $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS')
|
||||
|| $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
|
||||
|| $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS')
|
||||
{
|
||||
dolibarr_install_syslog("etape1: User already exists");
|
||||
print '<tr><td>';
|
||||
@ -483,7 +484,7 @@ if (! $error && $db->connected && $action == "set")
|
||||
print $langs->trans("UserCreation").' : ';
|
||||
print $dolibarr_main_db_user;
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("Error").' '.$db->error()."</td></tr>";
|
||||
print '<td>'.$langs->trans("Error").': '.$db->errno().' '.$db->error()."</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -277,7 +277,7 @@ if (! empty($force_install_message))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php/i',$file,$reg))
|
||||
if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i',$file,$reg))
|
||||
{
|
||||
$type=$reg[1];
|
||||
$class='DoliDB'.ucfirst($type);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user