From 36b4b5b0f423d886114b815cbb09916f955047cb Mon Sep 17 00:00:00 2001 From: Florian Schroen Date: Sun, 13 Oct 2024 18:29:49 +0200 Subject: [PATCH 1/4] add service start order - fix vtiger crash on initial db import --- docker-compose.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 9c71f3f6..ae52e15d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ version: '2' services: vtiger: + image: javanile/vtiger:${version:-latest} build: ${version} environment: - VT_DEBUG=false @@ -15,6 +16,9 @@ services: volumes: - ./:/app - ./vtiger:/var/lib/vtiger + depends_on: + mysql: + condition: service_healthy links: - mysql - adminer @@ -36,6 +40,10 @@ services: volumes: - mysql:/var/lib/mysql:rw - ./:/vtiger:rw + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] + timeout: 20s + retries: 10 script: image: debian From c98d2f6a0bba8aa352c77fe1177daafe16630574 Mon Sep 17 00:00:00 2001 From: Florian Schroen Date: Fri, 11 Oct 2024 00:42:20 +0200 Subject: [PATCH 2/4] add 8.3.0 --- .env | 2 +- 8.3.0/.symvol | 6 + 8.3.0/000-default.conf | 34 +++++ 8.3.0/Dockerfile | 68 ++++++++++ 8.3.0/LoggerManager.php | 238 ++++++++++++++++++++++++++++++++++ 8.3.0/config.inc.php | 242 +++++++++++++++++++++++++++++++++++ 8.3.0/config.performance.php | 41 ++++++ 8.3.0/crontab | 4 + 8.3.0/health.php | 47 +++++++ 8.3.0/loading.php | 29 +++++ 8.3.0/php.ini | 18 +++ 8.3.0/polyfill.php | 18 +++ 8.3.0/vtiger-autoload.php | 12 ++ 8.3.0/vtiger-cron.sh | 23 ++++ 8.3.0/vtiger-foreground.sh | 81 ++++++++++++ 8.3.0/vtiger-functions.php | 30 +++++ 8.3.0/vtiger-install.php | 234 +++++++++++++++++++++++++++++++++ 8.3.0/vtiger-install.sh | 121 ++++++++++++++++++ 8.3.0/vtiger-schedule.sh | 8 ++ 8.3.0/vtiger-ssl.crt | 24 ++++ 8.3.0/vtiger-ssl.pem | 28 ++++ 8.3.0/vtiger-startup.php | 44 +++++++ 8.3.0/vtiger.json | 3 + Makefile | 2 +- README.md | 1 + php.ini | 3 + versions.sh | 4 + vtiger-foreground.sh | 4 +- vtiger-install.php | 10 +- vtiger-install.sh | 1 + 30 files changed, 1374 insertions(+), 6 deletions(-) create mode 100644 8.3.0/.symvol create mode 100644 8.3.0/000-default.conf create mode 100644 8.3.0/Dockerfile create mode 100644 8.3.0/LoggerManager.php create mode 100644 8.3.0/config.inc.php create mode 100644 8.3.0/config.performance.php create mode 100644 8.3.0/crontab create mode 100644 8.3.0/health.php create mode 100644 8.3.0/loading.php create mode 100644 8.3.0/php.ini create mode 100644 8.3.0/polyfill.php create mode 100644 8.3.0/vtiger-autoload.php create mode 100755 8.3.0/vtiger-cron.sh create mode 100755 8.3.0/vtiger-foreground.sh create mode 100644 8.3.0/vtiger-functions.php create mode 100644 8.3.0/vtiger-install.php create mode 100755 8.3.0/vtiger-install.sh create mode 100755 8.3.0/vtiger-schedule.sh create mode 100644 8.3.0/vtiger-ssl.crt create mode 100644 8.3.0/vtiger-ssl.pem create mode 100644 8.3.0/vtiger-startup.php create mode 100644 8.3.0/vtiger.json diff --git a/.env b/.env index 076cff5c..bbc3c5a1 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -version=7.1.0-php7.4 +version=8.3.0 database=mysql:8.0.29 install=1 diff --git a/8.3.0/.symvol b/8.3.0/.symvol new file mode 100644 index 00000000..70f4f466 --- /dev/null +++ b/8.3.0/.symvol @@ -0,0 +1,6 @@ +.symvol +logs/ +storage/ +test/ +user_privileges/ +languages/ diff --git a/8.3.0/000-default.conf b/8.3.0/000-default.conf new file mode 100644 index 00000000..d36bd8ac --- /dev/null +++ b/8.3.0/000-default.conf @@ -0,0 +1,34 @@ + + ServerName localhost + ServerAdmin info@javanile.org + DocumentRoot /var/www/html/ + ErrorLog /var/lib/vtiger/logs/apache.log + CustomLog /var/lib/vtiger/logs/access.log combined + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all + Require all granted + + + + + ServerName localhost + ServerAdmin info@javanile.org + DocumentRoot /var/www/html/ + ErrorLog /var/lib/vtiger/logs/apache.log + CustomLog /var/lib/vtiger/logs/access.log combined + SSLEngine on + SSLCertificateFile "/etc/apache2/ssl/vtiger-ssl.crt" + SSLCertificateKeyFile "/etc/apache2/ssl/vtiger-ssl.pem" + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all + Require all granted + + diff --git a/8.3.0/Dockerfile b/8.3.0/Dockerfile new file mode 100644 index 00000000..8cd037c9 --- /dev/null +++ b/8.3.0/Dockerfile @@ -0,0 +1,68 @@ +FROM php:8.2.24-apache +LABEL maintainer="Francesco Bianco " + +ENV LAYER_BREAK=true +ENV VT_VERSION="8.3.0" \ + DATABASE_PACKAGE="mariadb-server-10.5" \ + COMPOSER_HOME=/usr/src/vtiger \ + PATH="/usr/src/vtiger/vendor/bin:$PATH" + +COPY php.ini /usr/local/etc/php/ +COPY vtiger.json .symvol /usr/src/vtiger/ +COPY vtiger-ssl.* /etc/apache2/ssl/ +COPY 000-default.conf /etc/apache2/sites-available/ + +RUN apt-get update && \ + apt-get install --no-install-recommends -y libzip-dev zlib1g-dev libc-client-dev libkrb5-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxml2-dev cron rsyslog zip unzip socat vim nano && \ + docker-php-ext-configure gd && ${LAYER_BREAK} +RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \ + docker-php-ext-install imap exif mysqli pdo pdo_mysql zip gd xml && \ + echo "cron.* /var/log/cron.log" >> /etc/rsyslog.conf && rm -fr /etc/cron.* && mkdir /etc/cron.d && ${LAYER_BREAK} +RUN curl -o composer -sL https://getcomposer.org/composer.phar && \ + php composer global require javanile/http-robot:0.0.2 javanile/mysql-import:0.0.15 javanile/vtiger-cli:0.0.4 && \ + php composer clearcache && rm composer && ${LAYER_BREAK} +RUN curl -sL https://javanile.github.io/symvol/setup.sh?v=0.0.2 | bash - && ${LAYER_BREAK} +RUN usermod -u 1000 www-data && groupmod -g 1000 www-data && \ + echo "ServerName localhost" >> /etc/apache2/apache2.conf && \ + a2enmod ssl && a2enmod rewrite && ${LAYER_BREAK} +RUN cd /usr/src/vtiger && \ + curl -o vtiger.tar.gz -L "http://sourceforge.net/projects/vtigercrm/files/vtiger%20CRM%208.3.0/Core%20Product/vtigercrm8.3.0.tar.gz" && \ + tar -xzf vtiger.tar.gz && \ + rm vtiger.tar.gz && \ + rm -fr /var/www/html && \ + mv "vtigercrm" /var/www/html && \ + vtiger permissions --fix && \ + mv .symvol /var/www/html && \ + mkdir -p volume /var/lib/vtiger && ${LAYER_BREAK} +RUN apt-get clean && rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* + +COPY develop-install.sh /usr/local/bin/ +RUN develop-install.sh +COPY health.php polyfill.php /var/www/html/ +COPY vtiger-*.sh /usr/local/bin/ +COPY vtiger-*.php /usr/src/vtiger/ + +RUN vtiger-install.sh --assert-mysql --dump --remove-mysql +RUN cd /var/www/html/vtlib/Vtiger/ && \ + sed -e 's!realpath(!__realpath__(!' -ri Utils.php Deprecated.php && \ + symvol move /var/www/html /usr/src/vtiger/volume + +COPY config.inc.php /usr/src/vtiger/ +COPY LoggerManager.php /var/www/html/libraries/log4php/ +COPY config.performance.php health.php loading.php /var/www/html/ +COPY crontab /etc/ + +VOLUME ["/var/lib/vtiger"] + +WORKDIR /app + +ENV VT_ADMIN_USER="admin" \ + VT_ADMIN_PASSWORD="admin" \ + VT_ADMIN_EMAIL="admin@localhost.lan" \ + VT_CURRENCY_NAME="USA, Dollars" \ + VT_SCHEDULER=1 \ + VT_INSTALL=1 \ + MYSQL_HOST="mysql" \ + MYSQL_DATABASE="vtiger" + +CMD ["vtiger-foreground.sh"] diff --git a/8.3.0/LoggerManager.php b/8.3.0/LoggerManager.php new file mode 100644 index 00000000..2efa6da0 --- /dev/null +++ b/8.3.0/LoggerManager.php @@ -0,0 +1,238 @@ +getConfigInfo($name); + + if ($configinfo && isset(static::$overrideinfo['ROOT'])) { + $configinfo['level'] = static::$overrideinfo['ROOT']; + } + + if ($configinfo && isset(static::$overrideinfo[$name])) { + $configinfo['level'] = static::$overrideinfo[$name]; + } + + return new Logger($name, $configinfo); + } +} + +/** + * Core logging class. + */ +class Logger +{ + private $name = false; + private $appender = false; + private $configinfo = false; + + /** + * Writing log file information could cost in-terms of performance. + * Enable logging based on the levels here explicitly. + */ + private $enableLogLevel = [ + 'FATAL' => false, + 'ERROR' => false, + 'WARN' => false, + 'INFO' => false, + 'DEBUG' => false, + ]; + + /** + * @var array + */ + private $logLevelWeight = [ + 'FATAL' => 0, + 'ERROR' => 1, + 'WARN' => 2, + 'INFO' => 3, + 'DEBUG' => 4, + ]; + + /** + * Logger constructor. + * + * @param $name + * @param bool $configinfo + */ + public function __construct($name, $configinfo = false) + { + $this->name = $name; + $this->configinfo = $configinfo; + $debug = getenv('VT_DEBUG') ?: null; + + if ($configinfo && isset($debug) && $debug && strtolower($debug) != 'false' && $debug != '0') { + foreach ($this->enableLogLevel as $level => $flag) { + $this->enableLogLevel[$level] = $this->isLevelRelevantThen($level, $configinfo['level']); + } + } + + /* For migration log-level we need debug turned-on */ + if (strtoupper($name) == 'MIGRATION') { + $this->enableLogLevel['DEBUG'] = true; + } + } + + /** + * @param $level + * @param $message + */ + public function emit($level, $message) + { + if (!$this->appender) { + $filename = 'logs/vtigercrm.log'; + if ($this->configinfo && isset($this->configinfo['appender']['File'])) { + $filename = $this->configinfo['appender']['File']; + } + $this->appender = new LoggerAppenderFile($filename, 0777); + } + + $mypid = @getmypid(); + + $this->appender->emit("$level [$mypid] $this->name - ", $message); + } + + /** + * @param $message + */ + public function info($message) + { + if ($this->isLevelEnabled('INFO')) { + $this->emit('INFO', $message); + } + } + + public function debug($message) + { + if ($this->isDebugEnabled()) { + $this->emit('DEBUG', $message); + } + } + + public function warn($message) + { + if ($this->isLevelEnabled('WARN')) { + $this->emit('WARN', $message); + } + } + + public function fatal($message) + { + if ($this->isLevelEnabled('FATAL')) { + $this->emit('FATAL', $message); + } + } + + /** + * @param $message + */ + public function error($message) + { + if ($this->isLevelEnabled('ERROR')) { + $this->emit('ERROR', $message); + } + } + + /** + * @param $level + * + * @return bool + */ + public function isLevelEnabled($level) + { + if ($this->enableLogLevel[$level] && $this->configinfo) { + return $this->isLevelRelevantThan($level, $this->configinfo['level']); + } + + return false; + } + + /** + * @param $level1 + * @param $level2 + */ + public function isLevelRelevantThen($level1, $level2) + { + return $this->logLevelWeight[$level1] <= $this->logLevelWeight[$level2]; + } + + /** + * @return bool + */ + public function isDebugEnabled() + { + return $this->isLevelEnabled('DEBUG'); + } +} + +/** + * Log message appender to file. + */ +class LoggerAppenderFile +{ + /** + * @var + */ + private $filename; + + /** + * @var int + */ + private $chmod; + + /** + * LoggerAppenderFile constructor. + * + * @param $filename + * @param int $chmod + */ + public function __construct($filename, $chmod = 0222) + { + $this->filename = $filename; + $this->chmod = $chmod; + } + + /** + * @param $prefix + * @param $message + */ + public function emit($prefix, $message) + { + if ($this->chmod != 0777 && file_exists($this->filename)) { + if (is_readable($this->filename)) { + chmod($this->filename, $this->chmod); + } + } + + $fh = fopen($this->filename, 'a'); + + if ($fh) { + $err = fwrite($fh, date('Y-m-d H:i:s')." $prefix $message\n"); + fclose($fh); + } + } +} diff --git a/8.3.0/config.inc.php b/8.3.0/config.inc.php new file mode 100644 index 00000000..55b18b96 --- /dev/null +++ b/8.3.0/config.inc.php @@ -0,0 +1,242 @@ +=') ? 'mysqli' : 'mysql'); +$dbconfig['db_status'] = 'true'; + +// TODO: test if port is empty +// TODO: set db_hostname dependending on db_type +$dbconfig['db_hostname'] = $dbconfig['db_server'].$dbconfig['db_port']; + +// log_sql default value = false +$dbconfig['log_sql'] = false; + +// persistent default value = true +$dbconfigoption['persistent'] = true; + +// autofree default value = false +$dbconfigoption['autofree'] = false; + +// debug default value = 0 +$dbconfigoption['debug'] = 0; + +// seqname_format default value = '%s_seq' +$dbconfigoption['seqname_format'] = '%s_seq'; + +// portability default value = 0 +$dbconfigoption['portability'] = 0; + +// ssl default value = false +$dbconfigoption['ssl'] = false; + +// TODO: looking for usage +$host_name = $dbconfig['db_hostname']; + +// Update $_SERVER for reverse proxy with public domain +if (trim(getenv('VT_SITE_URL'))) { + $_SERVER['HTTP_PORT'] = parse_url(trim(getenv('VT_SITE_URL')), PHP_URL_PORT); + $_SERVER['HTTP_HOST'] = parse_url(trim(getenv('VT_SITE_URL')), PHP_URL_HOST); + if (preg_match('/^https/i', trim(getenv('VT_SITE_URL')))) { + $_SERVER['HTTPS'] = 'on'; + $_SERVER['HTTP_HOST'] .= $_SERVER['HTTP_PORT'] && $_SERVER['HTTP_PORT'] != 443 ? ':'.$_SERVER['HTTP_PORT'] : ''; + } else { + $_SERVER['HTTP_HOST'] .= $_SERVER['HTTP_PORT'] && $_SERVER['HTTP_PORT'] != 80 ? ':'.$_SERVER['HTTP_PORT'] : ''; + } +} + +// Update $site_URL using VT_SITE_URL environment variable +$site_URL = 'http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].'/'; + +// Store $site_URL on /tmp for system services +if ($_SERVER['HTTP_HOST']) { + $site_URL_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'vtiger_site_URL'; + if (!file_exists($site_URL_file) || filemtime($site_URL_file) + 3600 < time()) { + file_put_contents($site_URL_file, $site_URL); + $port = parse_url('http://'.$_SERVER['HTTP_HOST'], PHP_URL_PORT); + if ($_SERVER['HTTPS'] === 'on' && $port != 443) { + file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'https_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:443'); + } elseif ($port != 80) { + file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'http_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:80'); + } + } +} + +// url for customer portal (Example: http://vtiger.com/portal) +$PORTAL_URL = $site_URL.'/customerportal'; + +// root directory path +$root_directory = __DIR__.'/'; + +// cache direcory path +$cache_dir = 'cache/'; + +// tmp_dir default value prepended by cache_dir = images/ +$tmp_dir = 'cache/images/'; + +// import_dir default value prepended by cache_dir = import/ +$import_dir = 'cache/import/'; + +// upload_dir default value prepended by cache_dir = upload/ +$upload_dir = 'cache/upload/'; + +// maximum file size for uploaded files in bytes also used when uploading import files +// upload_maxsize default value = 3000000 +$upload_maxsize = 3145728; //3MB + +// flag to allow export functionality +// 'all' to allow anyone to use exports +// 'admin' to only allow admins to export +// 'none' to block exports completely +// allow_exports default value = all +$allow_exports = 'all'; + +// files with one of these extensions will have '.txt' appended to their filename on upload +// upload_badext default value = php, php3, php4, php5, pl, cgi, py, asp, cfm, js, vbs, html, htm +$upload_badext = ['php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm', 'exe', 'bin', 'bat', 'sh', 'dll', 'phps', 'phtml', 'xhtml', 'rb', 'msi', 'jsp', 'shtml', 'sth', 'shtm']; + +// full path to include directory including the trailing slash +// includeDirectory default value = $root_directory..'include/ +$includeDirectory = $root_directory.'include/'; + +// list_max_entries_per_page default value = 20 +$list_max_entries_per_page = '20'; + +// limitpage_navigation default value = 5 +$limitpage_navigation = '5'; + +// history_max_viewed default value = 5 +$history_max_viewed = '5'; + +// default_module default value = Home +$default_module = getenv('VT_DEFAULT_MODULE') ?: 'Home'; + +// default_action default value = index +$default_action = getenv('VT_DEFAULT_ACTION') ?: 'index'; + +// set default theme +// default_theme default value = blue +$default_theme = 'softed'; + +// show or hide time to compose each page +// calculate_response_time default value = true +$calculate_response_time = true; + +// default text that is placed initially in the login form for user name +// no default_user_name default value +$default_user_name = ''; + +// default text that is placed initially in the login form for password +// no default_password default value +$default_password = ''; + +// create user with default username and password +// create_default_user default value = false +$create_default_user = false; +// default_user_is_admin default value = false +$default_user_is_admin = false; + +// if your MySQL/PHP configuration does not support persistent connections set this to true to avoid a large performance slowdown +// disable_persistent_connections default value = false +$disable_persistent_connections = false; + +//Master currency name +$currency_name = getenv('VT_CURRENCY_NAME') ?: 'USA, Dollars'; + +// default charset +// default charset default value = 'UTF-8' or 'ISO-8859-1' +$default_charset = 'UTF-8'; + +// default language +// default_language default value = en_us +$default_language = 'en_us'; + +// add the language pack name to every translation string in the display. +// translation_string_prefix default value = false +$translation_string_prefix = false; + +//Option to cache tabs permissions for speed. +$cache_tab_perms = true; + +//Option to hide empty home blocks if no entries. +$display_empty_home_blocks = false; + +//Disable Stat Tracking of vtiger CRM instance +$disable_stats_tracking = false; + +// Generating Unique Application Key +$application_unique_key = '4fb0ce8557702081d08b32ae0c4e9849'; + +// trim descriptions, titles in listviews to this value +$listview_max_textlength = 40; + +// Maximum time limit for PHP script execution (in seconds) +$php_max_execution_time = 0; + +// Set the default timezone as per your preference +$default_timezone = 'UTC'; + +/* If timezone is configured, try to set it */ +if (isset($default_timezone) && function_exists('date_default_timezone_set')) { + @date_default_timezone_set($default_timezone); +} + +//Set the default layout +$default_layout = 'v7'; + +include_once 'config.security.php'; +require_once '/usr/src/vtiger/vtiger-functions.php'; diff --git a/8.3.0/config.performance.php b/8.3.0/config.performance.php new file mode 100644 index 00000000..76c6aadd --- /dev/null +++ b/8.3.0/config.performance.php @@ -0,0 +1,41 @@ + getenv('LOG4PHP_DEBUG') && !in_array(strtolower(getenv('LOG4PHP_DEBUG')), ['false', '0']), + + // Should the caller information be captured in SQL Logging? + // It adds little overhead for performance but will be useful to debug + 'SQL_LOG_INCLUDE_CALLER' => false, + + // If database default charset is UTF-8, set this to true + // This avoids executing the SET NAMES SQL for each query! + 'DB_DEFAULT_CHARSET_UTF8' => true, + + // Turn-off default sorting in ListView, could eat up time as data grows + 'LISTVIEW_DEFAULT_SORTING' => false, + + // Compute list view record count while loading listview everytime. + // Recommended value false + 'LISTVIEW_COMPUTE_PAGE_COUNT' => false, + + // Control DetailView Record Navigation + 'DETAILVIEW_RECORD_NAVIGATION' => true, + + // To control the Email Notifications being sent to the Owner + 'NOTIFY_OWNER_EMAILS' => true, //By default it is set to true, if it is set to false, then notifications will not be sent + // reduce number of ajax requests on home page, reduce this value if home page widget dont + // show value. + 'HOME_PAGE_WIDGET_GROUP_SIZE' => 12, +]; diff --git a/8.3.0/crontab b/8.3.0/crontab new file mode 100644 index 00000000..1dff0b09 --- /dev/null +++ b/8.3.0/crontab @@ -0,0 +1,4 @@ +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +* * * * * root vtiger-cron.sh ts +* * * * * root vtiger-cron.sh vtiger +* * * * * root vtiger-cron.sh localhost_proxy diff --git a/8.3.0/health.php b/8.3.0/health.php new file mode 100644 index 00000000..f60de83f --- /dev/null +++ b/8.3.0/health.php @@ -0,0 +1,47 @@ +getMessage(); + } +} else { + $mysql = 'Extension not installed'; +} + +if (function_exists('mysqli_connect')) { + try { + mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT); + $mysqli = mysqli_connect_error(); + } catch (\Exception $error) { + $mysqli = $error->getMessage(); + } +} else { + $mysqli = 'Extension not installed'; +} + +$response = [ + 'status' => 'OK', + 'cookie' => $_COOKIE, + 'database' => [ + 'user' => DB_USER, + 'mysql' => $mysql ?: 'OK', + 'mysqli' => $mysqli ?: 'OK', + ] +]; + +echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."\n"; diff --git a/8.3.0/loading.php b/8.3.0/loading.php new file mode 100644 index 00000000..760ad95e --- /dev/null +++ b/8.3.0/loading.php @@ -0,0 +1,29 @@ + + + + +vtiger | loading... + + + + + +
+ vtiger +

+ loading... + %%MESSAGE%% +

+
+
+ Javanile +
+ + + diff --git a/8.3.0/php.ini b/8.3.0/php.ini new file mode 100644 index 00000000..47b04fde --- /dev/null +++ b/8.3.0/php.ini @@ -0,0 +1,18 @@ +display_startup_errors = On +display_errors = On +html_errors = On +docref_root = 0 +docref_ext = 0 +log_errors = On +short_open_tag = Off +error_log = /var/www/html/logs/php.log +# reporting: production +error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +# reporting: debug +;error_reporting = E_ALL +max_execution_time = 0 +memory_limit = 4G +post_max_size = 4G +upload_max_filesize = 4G +max_input_time = 0 +max_input_var = 10000 diff --git a/8.3.0/polyfill.php b/8.3.0/polyfill.php new file mode 100644 index 00000000..42fcbcf0 --- /dev/null +++ b/8.3.0/polyfill.php @@ -0,0 +1,18 @@ + $value, 'value' => $value, 0 => $key, 'key' => $key); + } +} diff --git a/8.3.0/vtiger-autoload.php b/8.3.0/vtiger-autoload.php new file mode 100644 index 00000000..f189378e --- /dev/null +++ b/8.3.0/vtiger-autoload.php @@ -0,0 +1,12 @@ + /run/crond.ts + ;; + vtiger) + echo "====[ vtiger cron ]====" + [[ -n "${VT_SCHEDULER}" ]] && /var/www/html/cron/vtigercron.sh >> ${log_dir}/${log_file} 2>&1 + find "${log_dir}/" -iname "${log_file}" -size +5M -exec mv {} {}.$(date +%s) \; + ;; + localhost_proxy) + echo "====[ localhost proxy ]====" + if [[ -f /tmp/http_localhost_proxy ]]; then socat $(cat /tmp/http_localhost_proxy) & fi + if [[ -f /tmp/https_localhost_proxy ]]; then socat $(cat /tmp/https_localhost_proxy) & fi + ;; +esac diff --git a/8.3.0/vtiger-foreground.sh b/8.3.0/vtiger-foreground.sh new file mode 100755 index 00000000..acc3bb0b --- /dev/null +++ b/8.3.0/vtiger-foreground.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +set -e +WORKDIR=$(echo $PWD) +touch .vtiger.lock + +loading() { + if [[ -f /var/www/html/index.php.0 ]]; then + sed -e 's!%%MESSAGE%%!'"$1"'!' /var/www/html/loading.php > /var/www/html/index.php + fi +} + +## Welcome message +echo " ________${VT_VERSION}_ " | sed 's/[^ ]/_/g' +echo "--| vtiger ${VT_VERSION} |--" | sed 's/[\.]/./g' +echo " --------${VT_VERSION}- " | sed 's/[^ ]/‾/g' + +## Init log files +echo "[vtiger] Init log files..." +mkdir -p /var/lib/vtiger/logs && cd /var/lib/vtiger/logs +touch access.log apache.log migration.log platform.log soap.log php.log +touch cron.log installation.log security.log sqltime.log vtigercrm.log + +## run apache for debugging +cd /var/www/html +echo "[vtiger] Start web loading..." +[[ ! -f index.php.0 ]] && cp -f index.php index.php.0 +service apache2 start >/dev/null 2>&1 + +## store environment variables +printenv | sed 's/^\(.*\)$/export \1/g' | grep -E '^export MYSQL_|^export VT_' > /run/crond.env + +## import database using environment variables +if [[ -n "${VT_INSTALL}" ]]; then + cd /usr/src/vtiger + loading "Waiting for database..." + echo "[vtiger] Waiting for available database..." + # no wait needed when using docker health check and depends_on + #echo "[vtiger] waiting for db server init to finish..." && sleep 30 + echo -n "[vtiger] importing initial database..." && mysql-import --do-while vtiger.sql + #php vtiger-startup.php + + ## Remove default config.inc.php if VT_INSTALL is false + if [[ ! -f /var/www/html/config.inc.php ]]; then + echo "[vtiger] Create configuration files..." + cp config.inc.php /var/www/html/config.inc.php + fi +fi + +## fill current mounted volume +loading "Waiting for volume preparation..." +echo "[vtiger] Waiting for preparation volume: /var/lib/vtiger" +symvol copy /usr/src/vtiger/volume /var/lib/vtiger && symvol mode /var/lib/vtiger www-data:www-data +symvol link /var/lib/vtiger /var/www/html && symvol mode /var/www/html www-data:www-data + +## update permissions +echo "[vtiger] Start cron daemon..." +loading "Waiting start background process..." +rsyslogd +cron + +## stop debugging +cd /var/www/html +service apache2 stop >/dev/null 2>&1 +[[ -f index.php.0 ]] && mv -f index.php.0 index.php + +## return to working directory +echo "[vtiger] Set working directory: ${WORKDIR}" +cd ${WORKDIR} + +## Apply database patches if exists +loading "Waiting for patch database..." +[[ -f vtiger.sql ]] && echo -n "[vtiger] Database patch: " && mysql-import --force vtiger.sql +[[ -f vtiger.override.sql ]] && echo -n "[vtiger] Database override: " && mysql-import --force vtiger.override.sql + +## copy vtiger.json file on working directory +[[ ! -f vtiger.json ]] && cp /usr/src/vtiger/vtiger.json . + +## run cron and apache +echo "[vtiger] Run main process..." +[[ -f .vtiger.lock ]] && rm .vtiger.lock +apache2-foreground diff --git a/8.3.0/vtiger-functions.php b/8.3.0/vtiger-functions.php new file mode 100644 index 00000000..a059831d --- /dev/null +++ b/8.3.0/vtiger-functions.php @@ -0,0 +1,30 @@ + + */ + +date_default_timezone_set('America/Los_Angeles'); + +define('VT_VERSION', getenv('VT_VERSION')); + +if (version_compare(VT_VERSION, '7.0.0', '>=')) { + define('DB_TYPE', 'mysqli'); + define('DB_HOST', '127.0.0.1'); + define('DB_PORT', '3306'); + define('DB_NAME', 'vtiger'); + define('DB_USER', 'vtiger'); + define('DB_PASS', 'vtiger'); + define('DB_ROOT', ''); +} elseif (version_compare(VT_VERSION, '6.0.0', '>=') && version_compare(VT_VERSION, '7.0.0', '<')) { + define('DB_TYPE', 'mysql'); + define('DB_HOST', '127.0.0.1'); + define('DB_PORT', '3306'); + define('DB_NAME', 'vtiger'); + define('DB_USER', 'root'); + define('DB_PASS', 'root'); + define('DB_ROOT', 'root'); +} else { + echo "[vtiger] Error unsupported version."; + exit(1); +} + +require_once '/usr/src/vtiger/vendor/autoload.php'; + +use Javanile\HttpRobot\HttpRobot; + +echo "[vtiger] Testing installation...\n"; + +echo '[vtiger] Database params: '.DB_TYPE.' '.DB_HOST.' '.DB_PORT.' '.DB_NAME.' '.DB_USER.' '.DB_PASS."\n"; +$link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT); +if (mysqli_connect_errno()) { + echo '[vtiger] Database error: '.mysqli_connect_errno().' - '.mysqli_connect_error()."\n"; + exit(1); +} + +$robot = new HttpRobot([ + 'base_uri' => 'http://localhost/', + 'cookies' => true, +]); + +// Check if cookie are working... +$data = $robot->get('health.php', ['@html']); +$data = $robot->post('health.php?setcookie=yes', ['cookie_name' => 'test', 'cookie_value' => '1234'], ['@html']); +$data = $robot->get('health.php', ['@html']); + +/** + * Get session token + */ +echo "[vtiger] (#1) Get session token"; +$values = $robot->get('index.php?module=Install&view=Index&mode=Step4', ['__vtrftk', '@text']); +echo " -> token: '{$values['__vtrftk']}'\n"; +if (version_compare(VT_VERSION, '7.0.0', '>=')) { + if (empty($values['__vtrftk'])) { + echo " -> [ERROR] Session token not found\n"; + echo $values['@text']; + exit(1); + } +} + +/** + * Submit installation params + */ +echo "[vtiger] (#2) Sending installation parameters"; +$values = $robot->post( + 'index.php', + [ + '__vtrftk' => $values['__vtrftk'], + 'module' => 'Install', + 'view' => 'Index', + 'mode' => 'Step5', + 'pwd_regex' => '', + 'db_type' => DB_TYPE, + 'db_hostname' => DB_HOST, + 'db_username' => DB_USER, + 'db_password' => DB_PASS, + 'db_name' => DB_NAME, + 'db_root_username' => DB_ROOT, + 'db_root_password' => DB_ROOT, + 'create_db' => 'on', + 'currency_name' => 'USA, Dollars', + 'admin' => 'admin', + 'password' => 'admin', + 'retype_password' => 'admin', + 'firstname' => '', + 'lastname' => 'Administrator', + 'admin_email' => 'vtiger@localhost.lan', + 'dateformat' => 'dd-mm-yyyy', + 'timezone' => 'America/Los_Angeles', + ], + ['__vtrftk', 'auth_key', '@text'] +); +echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; + +echo "[vtiger] (#3) Confirm installation parameters"; +$values = $robot->post( + 'index.php', + [ + '__vtrftk' => $values['__vtrftk'], + 'auth_key' => $values['auth_key'], + 'module' => 'Install', + 'view' => 'Index', + 'mode' => 'Step6', + ], + ['__vtrftk', 'auth_key', '@text'] +); +echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; + +/** + * Selecting industry + */ +echo "[vtiger] (#4) Selecting industry"; +$values = $robot->post( + 'index.php', + [ + '__vtrftk' => $values['__vtrftk'], + 'auth_key' => $values['auth_key'], + 'module' => 'Install', + 'view' => 'Index', + 'mode' => 'Step7', + 'myname' => 'Admin', + 'myemail' => 'vtiger@localhost.lan', + 'industry' => 'Accounting', + ], + ['__vtrftk', 'auth_key', '@text'] +); +echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; +if (version_compare(VT_VERSION, '7.0.0', '>=')) { + if (empty($values['__vtrftk'])) { + echo " -> [ERROR] install error on industry selector\n"; + $mysqli = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT); + $error = mysqli_connect_error(); + $result = mysqli_query($mysqli, "SHOW TABLES"); + while ($table = mysqli_fetch_row($result)) { + echo "Table: $table[0]\n"; + } + echo $values['@text']; + if (file_exists('/var/lib/vtiger/logs/php.log')) { + echo file_get_contents('/var/lib/vtiger/logs/php.log'); + } + #exit(1); + } +} + +/** + * First login seems required only for >7 + */ +echo "[vtiger] (#5) First login"; +$values = $robot->post( + 'index.php?module=Users&action=Login', + [ + '__vtrftk' => $values['__vtrftk'], + 'username' => 'admin', + 'password' => 'admin', + ] + , + ['__vtrftk', '@text'] +); +if (version_compare(VT_VERSION, '7.0.0', '>=')) { + if (empty($values['__vtrftk'])) { + echo " -> [ERROR] install error on first login.\n"; + #echo $values['@text']; + echo file_get_contents('/var/www/html/logs/php.log'); + exit(1); + } +} +echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; + +/** + * Select crm modules + */ +echo "[vtiger] (#6) Select modules and packages"; +$values = $robot->post( + 'index.php?module=Users&action=SystemSetupSave', + [ + '__vtrftk' => $values['__vtrftk'], + 'packages[Tools]' => 'on', + 'packages[Sales]' => 'on', + 'packages[Marketing]' => 'on', + 'packages[Support]' => 'on', + 'packages[Inventory]' => 'on', + 'packages[Project]' => 'on', + ], + ['__vtrftk', '@text'] +); +echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; + +// Save user settings +echo "[vtiger] (#7) Save user settings"; +$values = $robot->post( + 'index.php?module=Users&action=UserSetupSave', + [ + '__vtrftk' => $values['__vtrftk'], + 'currency_name' => 'Euro', + 'lang_name' => 'en_us', + 'time_zone' => 'Europe/Amsterdam', + 'date_format' => 'dd-mm-yyyy', + ], + ['__vtrftk', '@text'] +); +echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; + +// ================================================================= +// Select Modules +/* +$modules = [ + 'Documents' => false, +]; +foreach ($modules as $module => $status) { + echo "[vtiger] ".($status?'enable':'disable')." module '${module}': "; + $resp = $robot->post( + 'index.php', + [ + '__vtrftk' => $vtrftk, + 'module' => 'ModuleManager', + 'parent' => 'Settings', + 'action' => 'Basic', + 'mode' => 'updateModuleStatus', + 'forModule' => $module, + 'updateStatus' => $status, + ] + ); + echo trim($resp)."\n"; +} +*/ diff --git a/8.3.0/vtiger-install.sh b/8.3.0/vtiger-install.sh new file mode 100755 index 00000000..b85cd714 --- /dev/null +++ b/8.3.0/vtiger-install.sh @@ -0,0 +1,121 @@ +#!/usr/bin/env bash +set -e + +export DEBIAN_FRONTEND=noninteractive + +## Install MySQL +if [[ $@ == *'--install-mysql'* ]]; then + ## ============================================================ ## + ## IMPORTANT NOTICE! ## + ## This docker image use an external mysql database service. ## + ## During build process will be installed a database server ## + ## with the sole purpose of creating a database dump to allow ## + ## auto installation and files preparations for future uses. ## + ## The database will be immediately removed without affecting ## + ## image size, keeping all free from unnecessary dependencies. ## ## + ## ============================================================ ## + apt-get update + + echo "${DATABASE_PACKAGE} mysql-server/root_password password root" | debconf-set-selections + echo "${DATABASE_PACKAGE} mysql-server/root_password_again password root" | debconf-set-selections + + apt-get install -y --no-install-recommends ${DATABASE_PACKAGE} + + service mysql start && true + service mariadb start && true + + export MYSQL_PWD=root + mysql -uroot -e "CREATE DATABASE IF NOT EXISTS vtiger; \ + ALTER DATABASE vtiger CHARACTER SET utf8 COLLATE utf8_general_ci;" + + mysql -uroot -e "CREATE USER 'vtiger'@'%' IDENTIFIED BY 'vtiger';" && true + + mysql -uroot -e "UPDATE mysql.user SET password = PASSWORD('vtiger') WHERE user = 'vtiger';" && true + + mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'vtiger'@'%' WITH GRANT OPTION; \ + FLUSH PRIVILEGES;" + + service mysql stop >/dev/null 2>&1 && true + service mariadb stop >/dev/null 2>&1 && true + echo "[mysqld]" >> /etc/mysql/my.cnf + echo "sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" >> /etc/mysql/my.cnf + service mysql start && true + service mariadb start && true +fi + +## Assert MySQL +if [[ $@ == *'--assert-mysql'* ]]; then + service mysql start && true + service mariadb start && true + sleep 10 # wait until db is started + database=$(mysqlshow -uvtiger -pvtiger -hlocalhost vtiger | grep -v Wildcard | grep -o vtiger) + if [[ "${database}" != "vtiger" ]]; then + echo "[vtiger] install error '--install-mysql' database not found."; + exit 65; + fi +fi + +## Fix PHP problems on codebase +if [[ $@ == *'--fix-php'* ]]; then + sed -i "s#{'\([a-z]*\)'}#['\1']#g" /var/www/html/include/database/PearDatabase.php + sed -i "s#\$\([a-z][a-z]*\){\$\([a-z][a-z]*\)}#$\1[$\2]#g" /var/www/html/include/database/PearDatabase.php /var/www/html/libraries/htmlpurifier/library/HTMLPurifier/Encoder.php + sed -i "s#matchAny(\$input)#matchAny(\$input=null)#g" /var/www/html/libraries/antlr/BaseRecognizer.php + sed -i "s#matchAny()#matchAny(\$input=null)#g" /var/www/html/libraries/antlr/AntlrLexer.php + sed -i "s#function recover(\$re)#function recover(\$input,\$re=null)#g" /var/www/html/libraries/antlr/AntlrLexer.php + sed -i "s#traceIn(\$ruleName, \$ruleIndex)#traceIn(\$ruleName, \$ruleIndex, \$inputSymbol=null)#g" /var/www/html/libraries/antlr/AntlrLexer.php /var/www/html/libraries/antlr/AntlrParser.php + sed -i "s#traceOut(\$ruleName, \$ruleIndex)#traceOut(\$ruleName, \$ruleIndex, \$inputSymbol=null)#g" /var/www/html/libraries/antlr/AntlrLexer.php /var/www/html/libraries/antlr/AntlrParser.php + sed -i "s#get_magic_quotes_gpc()#true#g" /var/www/html/includes/http/Request.php + sed -i "s#function __autoload(\$class)#function __autoload2(\$class)#g" /var/www/html/libraries/htmlpurifier/library/HTMLPurifier.autoload.php + sed -i "s#{0}#[0]#g" /var/www/html/libraries/htmlpurifier/library/HTMLPurifier/TagTransform/Font.php /var/www/html/vtlib/thirdparty/network/Request.php /var/www/html/vtlib/thirdparty/network/Net/URL.php + sed -i "s#include_once 'config.php';#error_reporting(E_ALL\&~E_WARNING\&~E_DEPRECATED); include_once 'polyfill.php'; include_once 'config.php';#g" /var/www/html/index.php + sed -i "s#function Install_ConfigFileUtils_Model#function __construct#g" /var/www/html/modules/Install/models/ConfigFileUtils.php + sed -i "s#function DefaultDataPopulator#function __construct#g" /var/www/html/modules/Users/DefaultDataPopulator.php + sed -i "s#function Vtiger_PackageUpdate#function __construct#g" /var/www/html/vtlib/Vtiger/PackageUpdate.php + sed -i "s#function Vtiger_PackageImport#function __construct#g" /var/www/html/vtlib/Vtiger/PackageImport.php + sed -i "s#function Vtiger_PackageExport#function __construct#g" /var/www/html/vtlib/Vtiger/PackageExport.php + sed -i "s#csrf_check_token(\$token) {#csrf_check_token(\$token) { return true;#g" /var/www/html/libraries/csrf-magic/csrf-magic.php + sed -i "s#count(\$params) > 0#is_array(\$params) \&\& count(\$params) > 0#g" /var/www/html/include/database/PearDatabase.php + sed -i "s#+ rand(1,9999999) +#. rand(1,9999999) .#g" /var/www/html/modules/Install/models/ConfigFileUtils.php + #sed -n 100p /var/www/html/modules/Install/models/ConfigFileUtils.php + #sed -n 614p /var/www/html/include/database/PearDatabase.php + #sed -n 71p /var/www/html/libraries/antlr/BaseRecognizer.php + #sed -n 283p /var/www/html/libraries/antlr/AntlrLexer.php + #exit 1 +fi + +## Execute Wizard +mkdir -p /var/lib/vtiger/logs +service apache2 start +response=$(curl -Is "http://localhost/index.php?module=Install&view=Index" | head -n 1 | tr -d "\r\n") +if [[ "${response}" != "HTTP/1.1 200 OK" ]]; then exit 64; fi +php /usr/src/vtiger/vtiger-install.php +rm -f /var/www/html/config.inc.php +if [[ $? -ne 0 ]]; then exit 66; fi + +## Export fresh database +if [[ $@ == *'--dump'* ]]; then + sql_file=/usr/src/vtiger/vtiger.sql + mysqldump -uvtiger -pvtiger -h127.0.0.1 vtiger > "${sql_file}" + if [[ ! $(find "${sql_file}" -type f -size +200k 2>/dev/null) ]]; then + echo "[vtiger] dump error database sql too small" + echo "---(vtiger.sql START)----" + cat "${sql_file}" + echo "---(vtiger.sql END)----" + exit 67; + fi +fi + +## Uninstall MySQL +if [[ $@ == *'--remove-mysql'* ]]; then + service mysql stop && true + service mariadb stop && true + killall -KILL mysql mysqld mysqld_safe && true + apt-get --yes purge ^mysql.* ^mariadb.* && true + apt-get --yes autoremove --purge && apt-get autoclean + deluser --remove-home mysql && true + delgroup mysql && true + rm -rf \ + /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql \ + /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld \ + /tmp/* /var/tmp/* /var/lib/apt/lists/* +fi diff --git a/8.3.0/vtiger-schedule.sh b/8.3.0/vtiger-schedule.sh new file mode 100755 index 00000000..d4daa4d6 --- /dev/null +++ b/8.3.0/vtiger-schedule.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e + +log_file=cron.log +log_dir=/var/www/html/logs + +/var/www/html/cron/vtigercron.sh 2>&1 | tee -a "${log_dir}/${log_file}" +find "${log_dir}/" -iname "${log_file}" -size +5M -exec mv {} {}.$(date +%s) \; diff --git a/8.3.0/vtiger-ssl.crt b/8.3.0/vtiger-ssl.crt new file mode 100644 index 00000000..0e13b08d --- /dev/null +++ b/8.3.0/vtiger-ssl.crt @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIID/zCCAuegAwIBAgIJAOTDf4xw8akaMA0GCSqGSIb3DQEBCwUAMIGVMQswCQYD +VQQGEwJVSzEPMA0GA1UECAwGTG9uZG9uMQ8wDQYDVQQHDAZMb25kb24xHDAaBgNV +BAoME0NvVmkgQW5hbHl0aWNzIGx0ZC4xDjAMBgNVBAsMBUNNSUxFMQ4wDAYDVQQD +DAVDTUlMRTEmMCQGCSqGSIb3DQEJARYXaGVsbG9AY292aWFuYWx5dGljcy5jb20w +HhcNMTcwNzAzMjEwNjI2WhcNMjcwNzAzMjEwNjI2WjCBlTELMAkGA1UEBhMCVUsx +DzANBgNVBAgMBkxvbmRvbjEPMA0GA1UEBwwGTG9uZG9uMRwwGgYDVQQKDBNDb1Zp +IEFuYWx5dGljcyBsdGQuMQ4wDAYDVQQLDAVDTUlMRTEOMAwGA1UEAwwFQ01JTEUx +JjAkBgkqhkiG9w0BCQEWF2hlbGxvQGNvdmlhbmFseXRpY3MuY29tMIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl3wWNH5J3wYeMO8wwNAOx7jh/MlR3tG2 +1aFEU3d698gVpxmhBVNW0vYlk7QbrRkyvbupgm8enFEMi4qhd63gu0Nb+idky/wN +BHBwJ5TZTuj4cj1Kz8q+M3CaYWyYTpZMUShsC6RFLtH0qxLYqALk3dW9BHOPlP9x +h5Tq7wBVJizlINWjKJFITHHMG4443d5n6+Ve9cT3Nvz0GfYaR4IixvJJrL46A9hz +R0W1XS73ItGHO6D90m7qVN8feKYUj+T6WH4gBq3zs/o2dmE/B2PQyja6YePJrojg +U/vRuMA43tO+sehgiwGnGDIjj58TqKzBDOsSewVvmsLSKQQ3ojFdbQIDAQABo1Aw +TjAdBgNVHQ4EFgQU2tuyeV+QS9EKDEgVqWUIG92UwHEwHwYDVR0jBBgwFoAU2tuy +eV+QS9EKDEgVqWUIG92UwHEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AQEAdoO2l2O0KAAA8IJ95OeM98RPuu9r3eFSBESW+wV/Lr7qy05wOv1I7W9BTYLS +EKA3rQzlpS1pip3IdFosKNOY/8e2SNe/zuuzkeRc8WOhs/b04kNepKY0O2yPAXic +gMj8I5l9jnhLkhGmHWQJ+vjvNw7Tyeq23lfhdUSnjNZG6W5kGNwv7mYn+VPlt1iT +8JvliDsrw1M9kepZvhqf2oap0glPx2f047hJwiFYwNEsePZHszI3tit78JiYNLFY +JnRZvMtQ3nAp8cM7KvPnUxphMPV1Zn1IF03J60rW7o1da3EWUQ6p9A/TPosHEaP+ +IoCOWpQqMLKkchNkRmTXv0CHRw== +-----END CERTIFICATE----- diff --git a/8.3.0/vtiger-ssl.pem b/8.3.0/vtiger-ssl.pem new file mode 100644 index 00000000..bb57cc26 --- /dev/null +++ b/8.3.0/vtiger-ssl.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXfBY0fknfBh4w +7zDA0A7HuOH8yVHe0bbVoURTd3r3yBWnGaEFU1bS9iWTtButGTK9u6mCbx6cUQyL +iqF3reC7Q1v6J2TL/A0EcHAnlNlO6PhyPUrPyr4zcJphbJhOlkxRKGwLpEUu0fSr +EtioAuTd1b0Ec4+U/3GHlOrvAFUmLOUg1aMokUhMccwbjjjd3mfr5V71xPc2/PQZ +9hpHgiLG8kmsvjoD2HNHRbVdLvci0Yc7oP3SbupU3x94phSP5PpYfiAGrfOz+jZ2 +YT8HY9DKNrph48muiOBT+9G4wDje076x6GCLAacYMiOPnxOorMEM6xJ7BW+awtIp +BDeiMV1tAgMBAAECggEAOvZkmjgRvspd1AQ2AMa7CggvhjpCMK2GMe7cbnSSG4H4 +05rJLw56PBDtHWm8YArv0iQKXaeszYFKlcH3CWNXluwoD91ngXJxCqpNLUrlrq5F +jgnHZcvvboxEuukO+3/K4sgODhX5i7jTOAdU50iBFsuMEAB/AarP4MsZCsAhZIL5 +tbMN7kMkI1Y4uwg0suz0jl1ajWBWKThgPSK1mxpjs3Xel1+ZEdvG8rjhCyi/bhQr +aouOh1mHFklhqJ3Okl6aZC1AhocUxFCz6tIAHbdqk1D451ZP9+3noAMhDeNajSCC +AQlctyahscmb+AJ5mkAOgqW8A1vohYhD9LEYBxz/AQKBgQDIN0+gAek2MGut05Y7 +lcolq0w0ih2Q82zjV3dtcagxOIDZrgwh/ZU+Wo8JecUYlHwvNOfN4+nzmo0tyyO1 +l1+YvpIiRwaGiFXhalVkAJqr4UjVkN0dTu5ST6LtVe/HuF3M2smS1n6JpGlBiMde +xSFP7hF3QTfXQ+7lnjXQURK0LQKBgQDBsPHZbfWSfbUhNYDy7GWNjovZZSwGib8y +y62QfIitOZsYVLMSqSxTzKa8tS5pgGr8X5HJU/MKa29b8g7rL/yG9Mxm4nOejVMP +nXGoeDk/8Eo61tWlYEwmh6qfOuDQ2HkQgP2RYCOG3OAOx5VTEuqfY0+ZY2lrkMvH +uMTnEaTWQQKBgDpbVMwQgocW6evKhjlr2XXNTfLqZt++8/f3oIm33QwrqfLItiSa +Iwv/nT1nzrjxXpjr1LzAN4qXe5rjYM8nBeghc7ql9RL1XgLL2YPCYVLD4VTOWoSW +YwR+zcBbkf4mkMCK7MHt3wgDceJ2GZZX4vPHMjQOQFZwKIuo54qGduspAoGABxBC +4aEG8Z6v+lQPLcy9L1phcz4jSuG/HUUcQUapXVfadhqwpR+SREQUWJFq7eIHBMkf +ce4j0N92Ii5DqQQI+4r14VKk0MVqoAkn2fL4c4J50od/JxbJ8CXGbSQiirs6PwXV +OXX+Fa78ZM2Wfn8UG1ft0TQ05f1T0SbF139nOYECgYEAv9gWIw3Zcsxiv+lgE6MH +I2xvmB9zfkhiRIGwdK9KiV79qvFUQv+RJVd+VzkSUXf46yT6lp97ohdWbpb90Izr +XoVXhPfMfVZ46JYkQt+jCMqak6p3nU3JJOsvWYCfJyW+jyuU/ESWSWcTMwavt8y+ +W/Vgi8aWk1+q87ANi4TOXUs= +-----END PRIVATE KEY----- diff --git a/8.3.0/vtiger-startup.php b/8.3.0/vtiger-startup.php new file mode 100644 index 00000000..8472c05b --- /dev/null +++ b/8.3.0/vtiger-startup.php @@ -0,0 +1,44 @@ + true])); + */ +} diff --git a/8.3.0/vtiger.json b/8.3.0/vtiger.json new file mode 100644 index 00000000..3eabc402 --- /dev/null +++ b/8.3.0/vtiger.json @@ -0,0 +1,3 @@ +{ + "vtiger_dir": "/var/www/html" +} diff --git a/Makefile b/Makefile index f181fbda..cc649a61 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ develop: build: update @cp develop-install.sh $${version} - @docker build -t javanile/vtiger:$${version} ./$${version} + @docker build --progress=plain -t javanile/vtiger:$${version} ./$${version} push: build @git add . diff --git a/README.md b/README.md index 5756333a..bfaaeecf 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ improve marketing reach, and deliver great customer service. Try it free with Do [![StyleCI](https://github.styleci.io/repos/118489407/shield?branch=master)](https://github.styleci.io/repos/118489407) ## Supported tags and respective `Dockerfile` links +* [`8.3.0`, `8.3`, `8`, `latest` (8.3.0/Dockerfile)](https://github.com/javanile/vtiger/blob/master/8.3.0/Dockerfile) * [`7.2.0`, `7.2`, `7`, `latest` (7.2.0/Dockerfile)](https://github.com/javanile/vtiger/blob/master/7.2.0/Dockerfile) * [`7.1.0`, `7.1` (7.1.0/Dockerfile)](https://github.com/javanile/vtiger/blob/master/7.1.0/Dockerfile) * [`7.1.0-RC` (7.1.0-RC/Dockerfile)](https://github.com/javanile/vtiger/blob/master/7.1.0-RC/Dockerfile) diff --git a/php.ini b/php.ini index ed888ca1..47b04fde 100644 --- a/php.ini +++ b/php.ini @@ -6,7 +6,10 @@ docref_ext = 0 log_errors = On short_open_tag = Off error_log = /var/www/html/logs/php.log +# reporting: production error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +# reporting: debug +;error_reporting = E_ALL max_execution_time = 0 memory_limit = 4G post_max_size = 4G diff --git a/versions.sh b/versions.sh index 6a97fc78..dc83a588 100644 --- a/versions.sh +++ b/versions.sh @@ -7,8 +7,12 @@ source_code_hosting=( ["github_javanile"]=https://github.com/javanile/vtiger-core/archive/ ) +## dependency notes: +# 8.2.0 - PHP Version 7.0+,8.0+; Composer dependencies require a PHP version ">= 8.1.0" + declare -A versions versions=( + ["8.3.0"]=next,8.2.24,mariadb-server-10.5,sourceforge_vtiger,vtigercrm,vtiger%20CRM%208.3.0/Core%20Product/vtigercrm8.3.0.tar.gz ["7.2.0"]=main,7.3.12,mariadb-server-10.3,sourceforge_vtiger,vtigercrm,vtiger%20CRM%207.2.0/Core%20Product/vtigercrm7.2.0.tar.gz ["7.1.0-php8.0"]=next,8.0.19,mariadb-server-10.5,github_javanile,vtiger-core-7.1.0,7.1.0.tar.gz ["7.1.0-php7.4"]=next,7.4.29,mariadb-server-10.5,github_javanile,vtiger-core-7.1.0,7.1.0.tar.gz diff --git a/vtiger-foreground.sh b/vtiger-foreground.sh index a0c0691f..acc3bb0b 100755 --- a/vtiger-foreground.sh +++ b/vtiger-foreground.sh @@ -34,7 +34,9 @@ if [[ -n "${VT_INSTALL}" ]]; then cd /usr/src/vtiger loading "Waiting for database..." echo "[vtiger] Waiting for available database..." - echo -n "[vtiger] " && mysql-import --do-while vtiger.sql + # no wait needed when using docker health check and depends_on + #echo "[vtiger] waiting for db server init to finish..." && sleep 30 + echo -n "[vtiger] importing initial database..." && mysql-import --do-while vtiger.sql #php vtiger-startup.php ## Remove default config.inc.php if VT_INSTALL is false diff --git a/vtiger-install.php b/vtiger-install.php index 61ee4130..1cf896d0 100644 --- a/vtiger-install.php +++ b/vtiger-install.php @@ -78,6 +78,7 @@ 'module' => 'Install', 'view' => 'Index', 'mode' => 'Step5', + 'pwd_regex' => '', 'db_type' => DB_TYPE, 'db_hostname' => DB_HOST, 'db_username' => DB_USER, @@ -85,6 +86,7 @@ 'db_name' => DB_NAME, 'db_root_username' => DB_ROOT, 'db_root_password' => DB_ROOT, + 'create_db' => 'on', 'currency_name' => 'USA, Dollars', 'admin' => 'admin', 'password' => 'admin', @@ -125,6 +127,8 @@ 'module' => 'Install', 'view' => 'Index', 'mode' => 'Step7', + 'myname' => 'Admin', + 'myemail' => 'vtiger@localhost.lan', 'industry' => 'Accounting', ], ['__vtrftk', 'auth_key', '@text'] @@ -158,15 +162,15 @@ 'username' => 'admin', 'password' => 'admin', ] - //, - //['__vtrftk', '@text'] + , + ['__vtrftk', '@text'] ); if (version_compare(VT_VERSION, '7.0.0', '>=')) { if (empty($values['__vtrftk'])) { echo " -> [ERROR] install error on first login.\n"; #echo $values['@text']; echo file_get_contents('/var/www/html/logs/php.log'); - #exit(1); + exit(1); } } echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; diff --git a/vtiger-install.sh b/vtiger-install.sh index 9c98a3d2..b85cd714 100755 --- a/vtiger-install.sh +++ b/vtiger-install.sh @@ -47,6 +47,7 @@ fi if [[ $@ == *'--assert-mysql'* ]]; then service mysql start && true service mariadb start && true + sleep 10 # wait until db is started database=$(mysqlshow -uvtiger -pvtiger -hlocalhost vtiger | grep -v Wildcard | grep -o vtiger) if [[ "${database}" != "vtiger" ]]; then echo "[vtiger] install error '--install-mysql' database not found."; From 6302a1e4416295f6638078eed1865b7c9ead9734 Mon Sep 17 00:00:00 2001 From: Florian Schroen Date: Mon, 14 Oct 2024 13:06:20 +0200 Subject: [PATCH 3/4] make styleci happy --- 8.3.0/LoggerManager.php | 4 ++-- 8.3.0/config.inc.php | 6 +++--- 8.3.0/health.php | 10 +++++----- 8.3.0/polyfill.php | 2 +- 8.3.0/vtiger-functions.php | 2 +- 8.3.0/vtiger-install.php | 38 ++++++++++++++++++-------------------- LoggerManager.php | 4 ++-- config.inc.php | 6 +++--- health.php | 10 +++++----- polyfill.php | 2 +- vtiger-functions.php | 2 +- vtiger-install.php | 38 ++++++++++++++++++-------------------- 12 files changed, 60 insertions(+), 64 deletions(-) diff --git a/8.3.0/LoggerManager.php b/8.3.0/LoggerManager.php index 2efa6da0..a1b29770 100644 --- a/8.3.0/LoggerManager.php +++ b/8.3.0/LoggerManager.php @@ -76,7 +76,7 @@ class Logger /** * Logger constructor. * - * @param $name + * @param $name * @param bool $configinfo */ public function __construct($name, $configinfo = false) @@ -207,7 +207,7 @@ class LoggerAppenderFile /** * LoggerAppenderFile constructor. * - * @param $filename + * @param $filename * @param int $chmod */ public function __construct($filename, $chmod = 0222) diff --git a/8.3.0/config.inc.php b/8.3.0/config.inc.php index 55b18b96..67eeed1c 100644 --- a/8.3.0/config.inc.php +++ b/8.3.0/config.inc.php @@ -104,14 +104,14 @@ // Store $site_URL on /tmp for system services if ($_SERVER['HTTP_HOST']) { - $site_URL_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'vtiger_site_URL'; + $site_URL_file = sys_get_temp_dir().DIRECTORY_SEPARATOR.'vtiger_site_URL'; if (!file_exists($site_URL_file) || filemtime($site_URL_file) + 3600 < time()) { file_put_contents($site_URL_file, $site_URL); $port = parse_url('http://'.$_SERVER['HTTP_HOST'], PHP_URL_PORT); if ($_SERVER['HTTPS'] === 'on' && $port != 443) { - file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'https_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:443'); + file_put_contents(sys_get_temp_dir().DIRECTORY_SEPARATOR.'https_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:443'); } elseif ($port != 80) { - file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'http_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:80'); + file_put_contents(sys_get_temp_dir().DIRECTORY_SEPARATOR.'http_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:80'); } } } diff --git a/8.3.0/health.php b/8.3.0/health.php index f60de83f..dab3c65f 100644 --- a/8.3.0/health.php +++ b/8.3.0/health.php @@ -35,13 +35,13 @@ } $response = [ - 'status' => 'OK', - 'cookie' => $_COOKIE, + 'status' => 'OK', + 'cookie' => $_COOKIE, 'database' => [ - 'user' => DB_USER, - 'mysql' => $mysql ?: 'OK', + 'user' => DB_USER, + 'mysql' => $mysql ?: 'OK', 'mysqli' => $mysqli ?: 'OK', - ] + ], ]; echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."\n"; diff --git a/8.3.0/polyfill.php b/8.3.0/polyfill.php index 42fcbcf0..6d759aea 100644 --- a/8.3.0/polyfill.php +++ b/8.3.0/polyfill.php @@ -13,6 +13,6 @@ function each(array &$array) // Move pointer. next($array); - return array(1 => $value, 'value' => $value, 0 => $key, 'key' => $key); + return [1 => $value, 'value' => $value, 0 => $key, 'key' => $key]; } } diff --git a/8.3.0/vtiger-functions.php b/8.3.0/vtiger-functions.php index a059831d..798666da 100644 --- a/8.3.0/vtiger-functions.php +++ b/8.3.0/vtiger-functions.php @@ -2,7 +2,7 @@ /** * Retrieve realpath without resolve symbolic link. * - * @param $path + * @param $path * @param null $link * * @return false|string diff --git a/8.3.0/vtiger-install.php b/8.3.0/vtiger-install.php index 1cf896d0..941391ea 100644 --- a/8.3.0/vtiger-install.php +++ b/8.3.0/vtiger-install.php @@ -4,7 +4,6 @@ * * @author Francesco Bianco */ - date_default_timezone_set('America/Los_Angeles'); define('VT_VERSION', getenv('VT_VERSION')); @@ -26,7 +25,7 @@ define('DB_PASS', 'root'); define('DB_ROOT', 'root'); } else { - echo "[vtiger] Error unsupported version."; + echo '[vtiger] Error unsupported version.'; exit(1); } @@ -54,9 +53,9 @@ $data = $robot->get('health.php', ['@html']); /** - * Get session token + * Get session token. */ -echo "[vtiger] (#1) Get session token"; +echo '[vtiger] (#1) Get session token'; $values = $robot->get('index.php?module=Install&view=Index&mode=Step4', ['__vtrftk', '@text']); echo " -> token: '{$values['__vtrftk']}'\n"; if (version_compare(VT_VERSION, '7.0.0', '>=')) { @@ -68,9 +67,9 @@ } /** - * Submit installation params + * Submit installation params. */ -echo "[vtiger] (#2) Sending installation parameters"; +echo '[vtiger] (#2) Sending installation parameters'; $values = $robot->post( 'index.php', [ @@ -101,7 +100,7 @@ ); echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; -echo "[vtiger] (#3) Confirm installation parameters"; +echo '[vtiger] (#3) Confirm installation parameters'; $values = $robot->post( 'index.php', [ @@ -116,9 +115,9 @@ echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; /** - * Selecting industry + * Selecting industry. */ -echo "[vtiger] (#4) Selecting industry"; +echo '[vtiger] (#4) Selecting industry'; $values = $robot->post( 'index.php', [ @@ -139,36 +138,35 @@ echo " -> [ERROR] install error on industry selector\n"; $mysqli = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT); $error = mysqli_connect_error(); - $result = mysqli_query($mysqli, "SHOW TABLES"); - while ($table = mysqli_fetch_row($result)) { + $result = mysqli_query($mysqli, 'SHOW TABLES'); + while ($table = mysqli_fetch_row($result)) { echo "Table: $table[0]\n"; } echo $values['@text']; if (file_exists('/var/lib/vtiger/logs/php.log')) { echo file_get_contents('/var/lib/vtiger/logs/php.log'); } - #exit(1); + //exit(1); } } /** - * First login seems required only for >7 + * First login seems required only for >7. */ -echo "[vtiger] (#5) First login"; +echo '[vtiger] (#5) First login'; $values = $robot->post( 'index.php?module=Users&action=Login', [ '__vtrftk' => $values['__vtrftk'], 'username' => 'admin', 'password' => 'admin', - ] - , + ], ['__vtrftk', '@text'] ); if (version_compare(VT_VERSION, '7.0.0', '>=')) { if (empty($values['__vtrftk'])) { echo " -> [ERROR] install error on first login.\n"; - #echo $values['@text']; + //echo $values['@text']; echo file_get_contents('/var/www/html/logs/php.log'); exit(1); } @@ -176,9 +174,9 @@ echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; /** - * Select crm modules + * Select crm modules. */ -echo "[vtiger] (#6) Select modules and packages"; +echo '[vtiger] (#6) Select modules and packages'; $values = $robot->post( 'index.php?module=Users&action=SystemSetupSave', [ @@ -195,7 +193,7 @@ echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; // Save user settings -echo "[vtiger] (#7) Save user settings"; +echo '[vtiger] (#7) Save user settings'; $values = $robot->post( 'index.php?module=Users&action=UserSetupSave', [ diff --git a/LoggerManager.php b/LoggerManager.php index 2efa6da0..a1b29770 100644 --- a/LoggerManager.php +++ b/LoggerManager.php @@ -76,7 +76,7 @@ class Logger /** * Logger constructor. * - * @param $name + * @param $name * @param bool $configinfo */ public function __construct($name, $configinfo = false) @@ -207,7 +207,7 @@ class LoggerAppenderFile /** * LoggerAppenderFile constructor. * - * @param $filename + * @param $filename * @param int $chmod */ public function __construct($filename, $chmod = 0222) diff --git a/config.inc.php b/config.inc.php index 55b18b96..67eeed1c 100755 --- a/config.inc.php +++ b/config.inc.php @@ -104,14 +104,14 @@ // Store $site_URL on /tmp for system services if ($_SERVER['HTTP_HOST']) { - $site_URL_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'vtiger_site_URL'; + $site_URL_file = sys_get_temp_dir().DIRECTORY_SEPARATOR.'vtiger_site_URL'; if (!file_exists($site_URL_file) || filemtime($site_URL_file) + 3600 < time()) { file_put_contents($site_URL_file, $site_URL); $port = parse_url('http://'.$_SERVER['HTTP_HOST'], PHP_URL_PORT); if ($_SERVER['HTTPS'] === 'on' && $port != 443) { - file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'https_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:443'); + file_put_contents(sys_get_temp_dir().DIRECTORY_SEPARATOR.'https_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:443'); } elseif ($port != 80) { - file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'http_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:80'); + file_put_contents(sys_get_temp_dir().DIRECTORY_SEPARATOR.'http_localhost_proxy', 'tcp-listen:'.$port.',reuseaddr,fork tcp:localhost:80'); } } } diff --git a/health.php b/health.php index f60de83f..dab3c65f 100644 --- a/health.php +++ b/health.php @@ -35,13 +35,13 @@ } $response = [ - 'status' => 'OK', - 'cookie' => $_COOKIE, + 'status' => 'OK', + 'cookie' => $_COOKIE, 'database' => [ - 'user' => DB_USER, - 'mysql' => $mysql ?: 'OK', + 'user' => DB_USER, + 'mysql' => $mysql ?: 'OK', 'mysqli' => $mysqli ?: 'OK', - ] + ], ]; echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."\n"; diff --git a/polyfill.php b/polyfill.php index 42fcbcf0..6d759aea 100644 --- a/polyfill.php +++ b/polyfill.php @@ -13,6 +13,6 @@ function each(array &$array) // Move pointer. next($array); - return array(1 => $value, 'value' => $value, 0 => $key, 'key' => $key); + return [1 => $value, 'value' => $value, 0 => $key, 'key' => $key]; } } diff --git a/vtiger-functions.php b/vtiger-functions.php index a059831d..798666da 100644 --- a/vtiger-functions.php +++ b/vtiger-functions.php @@ -2,7 +2,7 @@ /** * Retrieve realpath without resolve symbolic link. * - * @param $path + * @param $path * @param null $link * * @return false|string diff --git a/vtiger-install.php b/vtiger-install.php index 1cf896d0..941391ea 100644 --- a/vtiger-install.php +++ b/vtiger-install.php @@ -4,7 +4,6 @@ * * @author Francesco Bianco */ - date_default_timezone_set('America/Los_Angeles'); define('VT_VERSION', getenv('VT_VERSION')); @@ -26,7 +25,7 @@ define('DB_PASS', 'root'); define('DB_ROOT', 'root'); } else { - echo "[vtiger] Error unsupported version."; + echo '[vtiger] Error unsupported version.'; exit(1); } @@ -54,9 +53,9 @@ $data = $robot->get('health.php', ['@html']); /** - * Get session token + * Get session token. */ -echo "[vtiger] (#1) Get session token"; +echo '[vtiger] (#1) Get session token'; $values = $robot->get('index.php?module=Install&view=Index&mode=Step4', ['__vtrftk', '@text']); echo " -> token: '{$values['__vtrftk']}'\n"; if (version_compare(VT_VERSION, '7.0.0', '>=')) { @@ -68,9 +67,9 @@ } /** - * Submit installation params + * Submit installation params. */ -echo "[vtiger] (#2) Sending installation parameters"; +echo '[vtiger] (#2) Sending installation parameters'; $values = $robot->post( 'index.php', [ @@ -101,7 +100,7 @@ ); echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; -echo "[vtiger] (#3) Confirm installation parameters"; +echo '[vtiger] (#3) Confirm installation parameters'; $values = $robot->post( 'index.php', [ @@ -116,9 +115,9 @@ echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; /** - * Selecting industry + * Selecting industry. */ -echo "[vtiger] (#4) Selecting industry"; +echo '[vtiger] (#4) Selecting industry'; $values = $robot->post( 'index.php', [ @@ -139,36 +138,35 @@ echo " -> [ERROR] install error on industry selector\n"; $mysqli = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT); $error = mysqli_connect_error(); - $result = mysqli_query($mysqli, "SHOW TABLES"); - while ($table = mysqli_fetch_row($result)) { + $result = mysqli_query($mysqli, 'SHOW TABLES'); + while ($table = mysqli_fetch_row($result)) { echo "Table: $table[0]\n"; } echo $values['@text']; if (file_exists('/var/lib/vtiger/logs/php.log')) { echo file_get_contents('/var/lib/vtiger/logs/php.log'); } - #exit(1); + //exit(1); } } /** - * First login seems required only for >7 + * First login seems required only for >7. */ -echo "[vtiger] (#5) First login"; +echo '[vtiger] (#5) First login'; $values = $robot->post( 'index.php?module=Users&action=Login', [ '__vtrftk' => $values['__vtrftk'], 'username' => 'admin', 'password' => 'admin', - ] - , + ], ['__vtrftk', '@text'] ); if (version_compare(VT_VERSION, '7.0.0', '>=')) { if (empty($values['__vtrftk'])) { echo " -> [ERROR] install error on first login.\n"; - #echo $values['@text']; + //echo $values['@text']; echo file_get_contents('/var/www/html/logs/php.log'); exit(1); } @@ -176,9 +174,9 @@ echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; /** - * Select crm modules + * Select crm modules. */ -echo "[vtiger] (#6) Select modules and packages"; +echo '[vtiger] (#6) Select modules and packages'; $values = $robot->post( 'index.php?module=Users&action=SystemSetupSave', [ @@ -195,7 +193,7 @@ echo " -> form-token: '{$values['__vtrftk']}' auth-key: '{$values['auth_key']}'\n"; // Save user settings -echo "[vtiger] (#7) Save user settings"; +echo '[vtiger] (#7) Save user settings'; $values = $robot->post( 'index.php?module=Users&action=UserSetupSave', [ From cfb35647c485759c0b4f15f02ea6d4d9b89bfbdb Mon Sep 17 00:00:00 2001 From: Florian Schroen Date: Mon, 14 Oct 2024 16:52:23 +0200 Subject: [PATCH 4/4] add jpeg support for gd (used for jpeg image upload) --- 8.3.0/Dockerfile | 2 +- Dockerfile.next.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/8.3.0/Dockerfile b/8.3.0/Dockerfile index 8cd037c9..56eda23b 100644 --- a/8.3.0/Dockerfile +++ b/8.3.0/Dockerfile @@ -14,7 +14,7 @@ COPY 000-default.conf /etc/apache2/sites-available/ RUN apt-get update && \ apt-get install --no-install-recommends -y libzip-dev zlib1g-dev libc-client-dev libkrb5-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxml2-dev cron rsyslog zip unzip socat vim nano && \ - docker-php-ext-configure gd && ${LAYER_BREAK} + docker-php-ext-configure gd --with-jpeg && ${LAYER_BREAK} RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \ docker-php-ext-install imap exif mysqli pdo pdo_mysql zip gd xml && \ echo "cron.* /var/log/cron.log" >> /etc/rsyslog.conf && rm -fr /etc/cron.* && mkdir /etc/cron.d && ${LAYER_BREAK} diff --git a/Dockerfile.next.template b/Dockerfile.next.template index df08ab33..ae7d01ae 100644 --- a/Dockerfile.next.template +++ b/Dockerfile.next.template @@ -14,7 +14,7 @@ COPY 000-default.conf /etc/apache2/sites-available/ RUN apt-get update && \ apt-get install --no-install-recommends -y libzip-dev zlib1g-dev libc-client-dev libkrb5-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxml2-dev cron rsyslog zip unzip socat vim nano && \ - docker-php-ext-configure gd && ${LAYER_BREAK} + docker-php-ext-configure gd --with-jpeg && ${LAYER_BREAK} RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \ docker-php-ext-install imap exif mysqli pdo pdo_mysql zip gd xml && \ echo "cron.* /var/log/cron.log" >> /etc/rsyslog.conf && rm -fr /etc/cron.* && mkdir /etc/cron.d && ${LAYER_BREAK}