mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 08:57:03 +03:00
Some small code improvements
This commit is contained in:
parent
3676183b10
commit
7188ae753e
5 changed files with 44 additions and 43 deletions
28
release.php
28
release.php
|
|
@ -2,7 +2,7 @@
|
||||||
<?php
|
<?php
|
||||||
chdir(__DIR__);
|
chdir(__DIR__);
|
||||||
|
|
||||||
$options = getopt('', ['aur','docker','plugins','set-version']);
|
$options = getopt('', ['aur','docker','plugins','set-version','skip-gulp']);
|
||||||
|
|
||||||
if (isset($options['plugins'])) {
|
if (isset($options['plugins'])) {
|
||||||
$destPath = "build/dist/releases/plugins/";
|
$destPath = "build/dist/releases/plugins/";
|
||||||
|
|
@ -128,15 +128,16 @@ $tar_destination = "{$destPath}snappymail-{$package->version}.tar";
|
||||||
@unlink($tar_destination);
|
@unlink($tar_destination);
|
||||||
@unlink("{$tar_destination}.gz");
|
@unlink("{$tar_destination}.gz");
|
||||||
|
|
||||||
echo "\x1b[33;1m === Gulp === \x1b[0m\n";
|
if (!isset($options['skip-gulp'])) {
|
||||||
passthru($gulp, $return_var);
|
echo "\x1b[33;1m === Gulp === \x1b[0m\n";
|
||||||
if ($return_var) {
|
passthru($gulp, $return_var);
|
||||||
|
if ($return_var) {
|
||||||
exit("gulp failed with error code {$return_var}\n");
|
exit("gulp failed with error code {$return_var}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmddir = escapeshellcmd(__DIR__) . '/snappymail/v/0.0.0/static';
|
$cmddir = escapeshellcmd(__DIR__) . '/snappymail/v/0.0.0/static';
|
||||||
|
|
||||||
if ($gzip = trim(`which gzip`)) {
|
if ($gzip = trim(`which gzip`)) {
|
||||||
echo "\x1b[33;1m === Gzip *.js and *.css === \x1b[0m\n";
|
echo "\x1b[33;1m === Gzip *.js and *.css === \x1b[0m\n";
|
||||||
passthru("{$gzip} -k --best {$cmddir}/js/*.js");
|
passthru("{$gzip} -k --best {$cmddir}/js/*.js");
|
||||||
passthru("{$gzip} -k --best {$cmddir}/js/min/*.js");
|
passthru("{$gzip} -k --best {$cmddir}/js/min/*.js");
|
||||||
|
|
@ -144,9 +145,9 @@ if ($gzip = trim(`which gzip`)) {
|
||||||
passthru("{$gzip} -k --best {$cmddir}/css/app*.css");
|
passthru("{$gzip} -k --best {$cmddir}/css/app*.css");
|
||||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/boot.js.gz');
|
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/boot.js.gz');
|
||||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/min/boot.min.js.gz');
|
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/min/boot.min.js.gz');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($brotli = trim(`which brotli`)) {
|
if ($brotli = trim(`which brotli`)) {
|
||||||
echo "\x1b[33;1m === Brotli *.js and *.css === \x1b[0m\n";
|
echo "\x1b[33;1m === Brotli *.js and *.css === \x1b[0m\n";
|
||||||
passthru("{$brotli} -k --best {$cmddir}/js/*.js");
|
passthru("{$brotli} -k --best {$cmddir}/js/*.js");
|
||||||
passthru("{$brotli} -k --best {$cmddir}/js/min/*.js");
|
passthru("{$brotli} -k --best {$cmddir}/js/min/*.js");
|
||||||
|
|
@ -154,11 +155,12 @@ if ($brotli = trim(`which brotli`)) {
|
||||||
passthru("{$brotli} -k --best {$cmddir}/css/app*.css");
|
passthru("{$brotli} -k --best {$cmddir}/css/app*.css");
|
||||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/boot.js.br');
|
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/boot.js.br');
|
||||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/min/boot.min.js.br');
|
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/min/boot.min.js.br');
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/openpgp.js');
|
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/openpgp.js');
|
||||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/openpgp.js.br');
|
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/openpgp.js.br');
|
||||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/openpgp.js.gz');
|
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/openpgp.js.gz');
|
||||||
|
}
|
||||||
|
|
||||||
// Temporary rename folder to speed up PharData
|
// Temporary rename folder to speed up PharData
|
||||||
//if (!rename('snappymail/v/0.0.0', "snappymail/v/{$package->version}")){
|
//if (!rename('snappymail/v/0.0.0', "snappymail/v/{$package->version}")){
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ trait ACL
|
||||||
{
|
{
|
||||||
public function FolderSetACL(string $sFolderName, string $sIdentifier, string $sAccessRights) : void
|
public function FolderSetACL(string $sFolderName, string $sIdentifier, string $sAccessRights) : void
|
||||||
{
|
{
|
||||||
|
// if ($this->IsSupported('ACL')) {
|
||||||
$this->SendRequestGetResponse('SETACL', array(
|
$this->SendRequestGetResponse('SETACL', array(
|
||||||
$this->EscapeString($sFolderName),
|
$this->EscapeString($sFolderName),
|
||||||
$this->EscapeString($sIdentifier),
|
$this->EscapeString($sIdentifier),
|
||||||
|
|
@ -28,6 +29,7 @@ trait ACL
|
||||||
|
|
||||||
public function FolderDeleteACL(string $sFolderName, string $sIdentifier) : void
|
public function FolderDeleteACL(string $sFolderName, string $sIdentifier) : void
|
||||||
{
|
{
|
||||||
|
// if ($this->IsSupported('ACL')) {
|
||||||
$this->SendRequestGetResponse('DELETEACL', array(
|
$this->SendRequestGetResponse('DELETEACL', array(
|
||||||
$this->EscapeString($sFolderName),
|
$this->EscapeString($sFolderName),
|
||||||
$this->EscapeString($sIdentifier)
|
$this->EscapeString($sIdentifier)
|
||||||
|
|
@ -36,6 +38,7 @@ trait ACL
|
||||||
|
|
||||||
public function FolderGetACL(string $sFolderName) : array
|
public function FolderGetACL(string $sFolderName) : array
|
||||||
{
|
{
|
||||||
|
// if ($this->IsSupported('ACL')) {
|
||||||
$oResponses = $this->SendRequestGetResponse('GETACL', array($this->EscapeString($sFolderName)));
|
$oResponses = $this->SendRequestGetResponse('GETACL', array($this->EscapeString($sFolderName)));
|
||||||
$aResult = array();
|
$aResult = array();
|
||||||
foreach ($oResponses as $oResponse) {
|
foreach ($oResponses as $oResponse) {
|
||||||
|
|
@ -53,6 +56,7 @@ trait ACL
|
||||||
|
|
||||||
public function FolderListRights(string $sFolderName, string $sIdentifier) : ?array
|
public function FolderListRights(string $sFolderName, string $sIdentifier) : ?array
|
||||||
{
|
{
|
||||||
|
// if ($this->IsSupported('ACL')) {
|
||||||
$oResponses = $this->SendRequestGetResponse('LISTRIGHTS', array(
|
$oResponses = $this->SendRequestGetResponse('LISTRIGHTS', array(
|
||||||
$this->EscapeString($sFolderName),
|
$this->EscapeString($sFolderName),
|
||||||
$this->EscapeString($sIdentifier)
|
$this->EscapeString($sIdentifier)
|
||||||
|
|
@ -73,6 +77,7 @@ trait ACL
|
||||||
|
|
||||||
public function FolderMyRights(string $sFolderName) : ?array
|
public function FolderMyRights(string $sFolderName) : ?array
|
||||||
{
|
{
|
||||||
|
// if ($this->IsSupported('ACL')) {
|
||||||
$oResponses = $this->SendRequestGetResponse('MYRIGHTS', array($this->EscapeString($sFolderName)));
|
$oResponses = $this->SendRequestGetResponse('MYRIGHTS', array($this->EscapeString($sFolderName)));
|
||||||
foreach ($oResponses as $oResponse) {
|
foreach ($oResponses as $oResponse) {
|
||||||
if (MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oResponse->ResponseType
|
if (MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oResponse->ResponseType
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,13 @@ class ResponseCollection extends \MailSo\Base\Collection
|
||||||
{
|
{
|
||||||
foreach ($this as $oResponse) {
|
foreach ($this as $oResponse) {
|
||||||
$aList = null;
|
$aList = null;
|
||||||
|
// ResponseList[2][0] => CAPABILITY
|
||||||
if (isset($oResponse->ResponseList[1]) && \is_string($oResponse->ResponseList[1]) &&
|
if (isset($oResponse->ResponseList[1]) && \is_string($oResponse->ResponseList[1]) &&
|
||||||
'CAPABILITY' === \strtoupper($oResponse->ResponseList[1]))
|
'CAPABILITY' === \strtoupper($oResponse->ResponseList[1]))
|
||||||
{
|
{
|
||||||
$aList = \array_slice($oResponse->ResponseList, 2);
|
$aList = \array_slice($oResponse->ResponseList, 2);
|
||||||
}
|
}
|
||||||
else if ($oResponse->OptionalResponse && \is_array($oResponse->OptionalResponse) &&
|
else if (\is_array($oResponse->OptionalResponse) &&
|
||||||
1 < \count($oResponse->OptionalResponse) && \is_string($oResponse->OptionalResponse[0]) &&
|
1 < \count($oResponse->OptionalResponse) && \is_string($oResponse->OptionalResponse[0]) &&
|
||||||
'CAPABILITY' === \strtoupper($oResponse->OptionalResponse[0]))
|
'CAPABILITY' === \strtoupper($oResponse->OptionalResponse[0]))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -786,20 +786,13 @@ class Actions
|
||||||
|
|
||||||
$this->oLogger->Write('[DATE:' . (new \DateTime('now', new \DateTimeZone($sTimeZone)))->format('Y-m-d ') .
|
$this->oLogger->Write('[DATE:' . (new \DateTime('now', new \DateTimeZone($sTimeZone)))->format('Y-m-d ') .
|
||||||
$sTimeZone .
|
$sTimeZone .
|
||||||
'][RL:' . APP_VERSION . '][PHP:' . PHP_VERSION . '][IP:' .
|
'][SM:' . APP_VERSION . '][IP:' .
|
||||||
$oHttp->GetClientIp($this->Config()->Get('labs', 'http_client_ip_check_proxy', false)) . '][PID:' .
|
$oHttp->GetClientIp($this->Config()->Get('labs', 'http_client_ip_check_proxy', false)) . '][PID:' .
|
||||||
(\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : 'unknown') . '][' .
|
(\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : 'unknown') . '][' .
|
||||||
$oHttp->GetServer('SERVER_SOFTWARE', '~') . '][' .
|
$oHttp->GetServer('SERVER_SOFTWARE', '~') . '][' .
|
||||||
(\MailSo\Base\Utils::FunctionExistsAndEnabled('php_sapi_name') ? \php_sapi_name() : '~') . ']'
|
(\MailSo\Base\Utils::FunctionExistsAndEnabled('php_sapi_name') ? \php_sapi_name() : '~') . '][Streams:' . \implode(',', \stream_get_transports()) . ']'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->oLogger->Write(
|
|
||||||
'[APCU:' . (\MailSo\Base\Utils::FunctionExistsAndEnabled('apcu_fetch') ? 'on' : 'off') .
|
|
||||||
'][MB:' . (\MailSo\Base\Utils::FunctionExistsAndEnabled('mb_convert_encoding') ? 'on' : 'off') .
|
|
||||||
'][PDO:' . (\class_exists('PDO') ? (\implode(',', \Pdo::getAvailableDrivers()) ?: '~') : 'off') .
|
|
||||||
'][Streams:' . \implode(',', \stream_get_transports()) .
|
|
||||||
']');
|
|
||||||
|
|
||||||
$this->oLogger->Write(
|
$this->oLogger->Write(
|
||||||
'[' . $oHttp->GetMethod() . '] ' . $oHttp->GetScheme() . '://' . $oHttp->GetHost(false, false) . $oHttp->GetServer('REQUEST_URI', ''),
|
'[' . $oHttp->GetMethod() . '] ' . $oHttp->GetScheme() . '://' . $oHttp->GetHost(false, false) . $oHttp->GetServer('REQUEST_URI', ''),
|
||||||
\MailSo\Log\Enumerations\Type::NOTE, 'REQUEST');
|
\MailSo\Log\Enumerations\Type::NOTE, 'REQUEST');
|
||||||
|
|
|
||||||
|
|
@ -696,10 +696,10 @@ trait Admin
|
||||||
public function DoAdminPHPExtensions() : array
|
public function DoAdminPHPExtensions() : array
|
||||||
{
|
{
|
||||||
$aResult = [];
|
$aResult = [];
|
||||||
foreach (['curl','gd','gmagick','imagick','intl','ldap','pdo_mysql','pdo_pgsql','pdo_sqlite','xxtea','zip'] as $name) {
|
foreach (['APCu', 'cURL','GD','Gmagick','Imagick','intl','LDAP','pdo_mysql','pdo_pgsql','pdo_sqlite','XXTEA','Zip'] as $name) {
|
||||||
$aResult[] = [
|
$aResult[] = [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'loaded' => extension_loaded($name)
|
'loaded' => \extension_loaded(\strtolower($name))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return $this->DefaultResponse(__FUNCTION__, $aResult);
|
return $this->DefaultResponse(__FUNCTION__, $aResult);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue