diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 3f0b8edb98c..5510f7e6214 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -297,29 +297,37 @@ echo "-------------------------------------------------------" echo -#---- postun (after uninstall) +#---- postun (after upgrade or uninstall) %postun -# Define vars -export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" - -# Remove apache link -if [ -L $apachelink ] ; +if [ "x$1" = "x0" ] ; then - echo "Delete apache config link for Dolibarr ($apachelink)" - %{__rm} -f $apachelink - status=purge -fi + # Remove + echo "Removed package" -# Restart web servers if required -if [ "x$status" = "xpurge" ] ; -then - # Restart web server - echo Restart web server - /sbin/service httpd restart + # Define vars + export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" + + # Remove apache link + if [ -L $apachelink ] ; + then + echo "Delete apache config link for Dolibarr ($apachelink)" + %{__rm} -f $apachelink + status=purge + fi + + # Restart web servers if required + if [ "x$status" = "xpurge" ] ; + then + # Restart web server + echo Restart web server + /sbin/service httpd restart + fi +else + # Upgrade + echo "No remove ation done (this is an upgrade)" fi - # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog * Sun Feb 17 2013 Laurent Destailleur 3.5.0-0.1.a diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index b8bcfe6876a..b67677b10cb 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -463,9 +463,16 @@ echo Restart mysql server %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} /sbin/service mysqld restart %else +%if 0%{?suse_version} + /sbin/service mysql restart +%else if [ -f /etc/init.d/mysqld ]; then /etc/init.d/mysqld restart fi +if [ -f /etc/init.d/mysql ]; then + /etc/init.d/mysql restart +fi +%endif %endif # Show result @@ -481,63 +488,71 @@ echo -#---- postun (after uninstall) +#---- postun (after upgrade or uninstall) %postun -# Define vars -os='unknown'; -%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} -export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" -%else -%if 0%{?suse_version} -export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" -%else -if [ -d %{_sysconfdir}/httpd/conf.d ]; then - export os='fedora-redhat'; - export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" -fi -if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then - export os='opensuse'; - export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" -fi -if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then - export os='mageia-mandriva'; - export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" -fi -if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then - export os='ubuntu-debian'; - export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" -fi -%endif -%endif - -# Remove apache link -if [ -L $apachelink ] ; +if [ "x$1" = "x0" ] ; then - echo "Delete apache config link for Dolibarr ($apachelink)" - %{__rm} -f $apachelink - status=purge -fi + # Remove + echo "Removed package" -# Restart web servers if required -if [ "x$status" = "xpurge" ] ; -then - # Restart web server - echo Restart web server + # Define vars + os='unknown'; %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} - /sbin/service httpd restart + export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" %else - if [ -f %{_sysconfdir}/init.d/httpd ]; then - %{_sysconfdir}/init.d/httpd restart - fi - if [ -f %{_sysconfdir}/init.d/apache2 ]; then - %{_sysconfdir}/init.d/apache2 restart - fi - %endif + %if 0%{?suse_version} + export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" + %else + if [ -d %{_sysconfdir}/httpd/conf.d ]; then + export os='fedora-redhat'; + export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" + fi + if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then + export os='opensuse'; + export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" + fi + if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then + export os='mageia-mandriva'; + export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" + fi + if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then + export os='ubuntu-debian'; + export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" + fi + %endif + %endif + + # Remove apache link + if [ -L $apachelink ] ; + then + echo "Delete apache config link for Dolibarr ($apachelink)" + %{__rm} -f $apachelink + status=purge + fi + + # Restart web servers if required + if [ "x$status" = "xpurge" ] ; + then + # Restart web server + echo Restart web server + %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} + /sbin/service httpd restart + %else + if [ -f %{_sysconfdir}/init.d/httpd ]; then + %{_sysconfdir}/init.d/httpd restart + fi + if [ -f %{_sysconfdir}/init.d/apache2 ]; then + %{_sysconfdir}/init.d/apache2 restart + fi + %endif + fi +else + # Upgrade + echo "No remove ation done (this is an upgrade)" fi - # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog * Sun Feb 17 2013 Laurent Destailleur 3.5.0-0.1.a diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 9140f353df6..ff4487b288f 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -280,6 +280,9 @@ echo Restart mysql if [ -f /etc/init.d/mysqld ]; then /etc/init.d/mysqld restart fi +if [ -f /etc/init.d/mysql ]; then + /etc/init.d/mysql restart +fi # Show result echo @@ -293,31 +296,40 @@ echo "-------------------------------------------------------" echo -#---- postun (after uninstall) +#---- postun (after upgrade or uninstall) %postun -# Define vars -export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" - -# Remove apache link -if [ -L $apachelink ] ; +if [ "x$1" = "x0" ] ; then - echo "Delete apache config link for Dolibarr ($apachelink)" - %{__rm} -f $apachelink - status=purge -fi + # Remove + echo "Removed package" -# Restart web servers if required -if [ "x$status" = "xpurge" ] ; -then - # Restart web server - echo Restart web server - if [ -f %{_sysconfdir}/init.d/httpd ]; then - %{_sysconfdir}/init.d/httpd restart - fi - if [ -f %{_sysconfdir}/init.d/apache2 ]; then - %{_sysconfdir}/init.d/apache2 restart - fi + # Define vars + export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf" + + # Remove apache link + if [ -L $apachelink ] ; + then + echo "Delete apache config link for Dolibarr ($apachelink)" + %{__rm} -f $apachelink + status=purge + fi + + # Restart web servers if required + if [ "x$status" = "xpurge" ] ; + then + # Restart web server + echo Restart web server + if [ -f %{_sysconfdir}/init.d/httpd ]; then + %{_sysconfdir}/init.d/httpd restart + fi + if [ -f %{_sysconfdir}/init.d/apache2 ]; then + %{_sysconfdir}/init.d/apache2 restart + fi + fi +else + # Upgrade + echo "No remove ation done (this is an upgrade)" fi diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 1ebdac399bb..bdfb0eab0af 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -288,9 +288,7 @@ fi # Restart mysql echo Restart mysql -if [ -f /etc/init.d/mysqld ]; then - /etc/init.d/mysqld restart -fi +/sbin/service mysql restart # Show result echo @@ -304,34 +302,42 @@ echo "-------------------------------------------------------" echo -#---- postun (after uninstall) +#---- postun (after upgrade or uninstall) %postun -# Define vars -export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" - -# Remove apache link -if [ -L $apachelink ] ; +if [ "x$1" = "x0" ] ; then - echo "Delete apache config link for Dolibarr ($apachelink)" - %{__rm} -f $apachelink - status=purge + # Remove + echo "Removed package" + + # Define vars + export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf" + + # Remove apache link + if [ -L $apachelink ] ; + then + echo "Delete apache config link for Dolibarr ($apachelink)" + %{__rm} -f $apachelink + status=purge + fi + + # Restart web servers if required + if [ "x$status" = "xpurge" ] ; + then + # Restart web server + echo Restart web server + if [ -f %{_sysconfdir}/init.d/httpd ]; then + %{_sysconfdir}/init.d/httpd restart + fi + if [ -f %{_sysconfdir}/init.d/apache2 ]; then + %{_sysconfdir}/init.d/apache2 restart + fi + fi +else + # Upgrade + echo "No remove ation done (this is an upgrade)" fi -# Restart web servers if required -if [ "x$status" = "xpurge" ] ; -then - # Restart web server - echo Restart web server - if [ -f %{_sysconfdir}/init.d/httpd ]; then - %{_sysconfdir}/init.d/httpd restart - fi - if [ -f %{_sysconfdir}/init.d/apache2 ]; then - %{_sysconfdir}/init.d/apache2 restart - fi -fi - - # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 3e726a67c60..564b39ff73a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -997,18 +997,20 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession= if (! empty($_FILES[$varfiles])) // For view $_FILES[$varfiles]['error'] { + dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession, LOG_DEBUG); if (dol_mkdir($upload_dir) >= 0) { $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $upload_dir . "/" . $_FILES[$varfiles]['name'], $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles); if (is_numeric($resupload) && $resupload > 0) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; if (empty($donotupdatesession)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->add_attached_files($upload_dir . "/" . $_FILES[$varfiles]['name'],$_FILES[$varfiles]['name'],$_FILES[$varfiles]['type']); } - else if (image_format_supported($upload_dir . "/" . $_FILES[$varfiles]['name']) == 1) + if (image_format_supported($upload_dir . "/" . $_FILES[$varfiles]['name']) == 1) { // Create small thumbs for image (Ratio is near 16/9) // Used on logon for example