Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 8.3.0 #49

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=7.1.0-php7.4
version=8.3.0
database=mysql:8.0.29
install=1
6 changes: 6 additions & 0 deletions 8.3.0/.symvol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.symvol
logs/
storage/
test/
user_privileges/
languages/
34 changes: 34 additions & 0 deletions 8.3.0/000-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<VirtualHost *:80>
ServerName localhost
ServerAdmin [email protected]
DocumentRoot /var/www/html/
ErrorLog /var/lib/vtiger/logs/apache.log
CustomLog /var/lib/vtiger/logs/access.log combined

<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:443>
ServerName localhost
ServerAdmin [email protected]
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"

<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
68 changes: 68 additions & 0 deletions 8.3.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
FROM php:8.2.24-apache
LABEL maintainer="Francesco Bianco <[email protected]>"

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 --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}
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="[email protected]" \
VT_CURRENCY_NAME="USA, Dollars" \
VT_SCHEDULER=1 \
VT_INSTALL=1 \
MYSQL_HOST="mysql" \
MYSQL_DATABASE="vtiger"

CMD ["vtiger-foreground.sh"]
238 changes: 238 additions & 0 deletions 8.3.0/LoggerManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
<?php
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*************************************************************************************/

/** Classes to avoid logging */
class LoggerManager
{
protected static $overrideinfo = null;

public static function getlogger($name = 'ROOT')
{
if (static::$overrideinfo === null) {
static::$overrideinfo = [];
foreach (preg_split('/\\s*,\\s*/', trim(getenv('VT_DEBUG'))) as $config) {
list($key, $value) = preg_split('/\\s*:\\s*/', $config);
if ($value !== null) {
static::$overrideinfo[strtoupper($key)] = strtoupper($value);
} else {
static::$overrideinfo['ROOT'] = strtoupper($key);
}
}
}

$configinfo = LoggerPropertyConfigurator::getInstance()->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);
}
}
}
Loading