mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
Some small code improvements
This commit is contained in:
parent
3676183b10
commit
7188ae753e
5 changed files with 44 additions and 43 deletions
64
release.php
64
release.php
|
|
@ -2,7 +2,7 @@
|
|||
<?php
|
||||
chdir(__DIR__);
|
||||
|
||||
$options = getopt('', ['aur','docker','plugins','set-version']);
|
||||
$options = getopt('', ['aur','docker','plugins','set-version','skip-gulp']);
|
||||
|
||||
if (isset($options['plugins'])) {
|
||||
$destPath = "build/dist/releases/plugins/";
|
||||
|
|
@ -128,38 +128,40 @@ $tar_destination = "{$destPath}snappymail-{$package->version}.tar";
|
|||
@unlink($tar_destination);
|
||||
@unlink("{$tar_destination}.gz");
|
||||
|
||||
echo "\x1b[33;1m === Gulp === \x1b[0m\n";
|
||||
passthru($gulp, $return_var);
|
||||
if ($return_var) {
|
||||
exit("gulp failed with error code {$return_var}\n");
|
||||
if (!isset($options['skip-gulp'])) {
|
||||
echo "\x1b[33;1m === Gulp === \x1b[0m\n";
|
||||
passthru($gulp, $return_var);
|
||||
if ($return_var) {
|
||||
exit("gulp failed with error code {$return_var}\n");
|
||||
}
|
||||
|
||||
$cmddir = escapeshellcmd(__DIR__) . '/snappymail/v/0.0.0/static';
|
||||
|
||||
if ($gzip = trim(`which gzip`)) {
|
||||
echo "\x1b[33;1m === Gzip *.js and *.css === \x1b[0m\n";
|
||||
passthru("{$gzip} -k --best {$cmddir}/js/*.js");
|
||||
passthru("{$gzip} -k --best {$cmddir}/js/min/*.js");
|
||||
passthru("{$gzip} -k --best {$cmddir}/css/admin*.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/min/boot.min.js.gz');
|
||||
}
|
||||
|
||||
if ($brotli = trim(`which brotli`)) {
|
||||
echo "\x1b[33;1m === Brotli *.js and *.css === \x1b[0m\n";
|
||||
passthru("{$brotli} -k --best {$cmddir}/js/*.js");
|
||||
passthru("{$brotli} -k --best {$cmddir}/js/min/*.js");
|
||||
passthru("{$brotli} -k --best {$cmddir}/css/admin*.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/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.br');
|
||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/openpgp.js.gz');
|
||||
}
|
||||
|
||||
$cmddir = escapeshellcmd(__DIR__) . '/snappymail/v/0.0.0/static';
|
||||
|
||||
if ($gzip = trim(`which gzip`)) {
|
||||
echo "\x1b[33;1m === Gzip *.js and *.css === \x1b[0m\n";
|
||||
passthru("{$gzip} -k --best {$cmddir}/js/*.js");
|
||||
passthru("{$gzip} -k --best {$cmddir}/js/min/*.js");
|
||||
passthru("{$gzip} -k --best {$cmddir}/css/admin*.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/min/boot.min.js.gz');
|
||||
}
|
||||
|
||||
if ($brotli = trim(`which brotli`)) {
|
||||
echo "\x1b[33;1m === Brotli *.js and *.css === \x1b[0m\n";
|
||||
passthru("{$brotli} -k --best {$cmddir}/js/*.js");
|
||||
passthru("{$brotli} -k --best {$cmddir}/js/min/*.js");
|
||||
passthru("{$brotli} -k --best {$cmddir}/css/admin*.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/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.br');
|
||||
unlink(__DIR__ . '/snappymail/v/0.0.0/static/js/openpgp.js.gz');
|
||||
|
||||
// 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
|
||||
{
|
||||
// if ($this->IsSupported('ACL')) {
|
||||
$this->SendRequestGetResponse('SETACL', array(
|
||||
$this->EscapeString($sFolderName),
|
||||
$this->EscapeString($sIdentifier),
|
||||
|
|
@ -28,6 +29,7 @@ trait ACL
|
|||
|
||||
public function FolderDeleteACL(string $sFolderName, string $sIdentifier) : void
|
||||
{
|
||||
// if ($this->IsSupported('ACL')) {
|
||||
$this->SendRequestGetResponse('DELETEACL', array(
|
||||
$this->EscapeString($sFolderName),
|
||||
$this->EscapeString($sIdentifier)
|
||||
|
|
@ -36,6 +38,7 @@ trait ACL
|
|||
|
||||
public function FolderGetACL(string $sFolderName) : array
|
||||
{
|
||||
// if ($this->IsSupported('ACL')) {
|
||||
$oResponses = $this->SendRequestGetResponse('GETACL', array($this->EscapeString($sFolderName)));
|
||||
$aResult = array();
|
||||
foreach ($oResponses as $oResponse) {
|
||||
|
|
@ -53,6 +56,7 @@ trait ACL
|
|||
|
||||
public function FolderListRights(string $sFolderName, string $sIdentifier) : ?array
|
||||
{
|
||||
// if ($this->IsSupported('ACL')) {
|
||||
$oResponses = $this->SendRequestGetResponse('LISTRIGHTS', array(
|
||||
$this->EscapeString($sFolderName),
|
||||
$this->EscapeString($sIdentifier)
|
||||
|
|
@ -73,6 +77,7 @@ trait ACL
|
|||
|
||||
public function FolderMyRights(string $sFolderName) : ?array
|
||||
{
|
||||
// if ($this->IsSupported('ACL')) {
|
||||
$oResponses = $this->SendRequestGetResponse('MYRIGHTS', array($this->EscapeString($sFolderName)));
|
||||
foreach ($oResponses as $oResponse) {
|
||||
if (MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oResponse->ResponseType
|
||||
|
|
|
|||
|
|
@ -53,12 +53,13 @@ class ResponseCollection extends \MailSo\Base\Collection
|
|||
{
|
||||
foreach ($this as $oResponse) {
|
||||
$aList = null;
|
||||
// ResponseList[2][0] => CAPABILITY
|
||||
if (isset($oResponse->ResponseList[1]) && \is_string($oResponse->ResponseList[1]) &&
|
||||
'CAPABILITY' === \strtoupper($oResponse->ResponseList[1]))
|
||||
{
|
||||
$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]) &&
|
||||
'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 ') .
|
||||
$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:' .
|
||||
(\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : 'unknown') . '][' .
|
||||
$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(
|
||||
'[' . $oHttp->GetMethod() . '] ' . $oHttp->GetScheme() . '://' . $oHttp->GetHost(false, false) . $oHttp->GetServer('REQUEST_URI', ''),
|
||||
\MailSo\Log\Enumerations\Type::NOTE, 'REQUEST');
|
||||
|
|
|
|||
|
|
@ -696,10 +696,10 @@ trait Admin
|
|||
public function DoAdminPHPExtensions() : array
|
||||
{
|
||||
$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[] = [
|
||||
'name' => $name,
|
||||
'loaded' => extension_loaded($name)
|
||||
'loaded' => \extension_loaded(\strtolower($name))
|
||||
];
|
||||
}
|
||||
return $this->DefaultResponse(__FUNCTION__, $aResult);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue