mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Also support SnappyMail\TAR on core update
This commit is contained in:
parent
b1471c2bbd
commit
fa3d4727f9
2 changed files with 13 additions and 10 deletions
|
|
@ -263,18 +263,18 @@ abstract class Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sTmp) {
|
if ($sTmp) {
|
||||||
if (\class_exists('PharData')) {
|
|
||||||
$oArchive = new \PharData($sTmp, 0, $sRealFile);
|
|
||||||
} else {
|
|
||||||
// throw new \Exception('PHP Phar is disabled, you must enable it');
|
|
||||||
$oArchive = new \SnappyMail\TAR($sTmp);
|
|
||||||
}
|
|
||||||
if (!static::deletePackageDir($sId)) {
|
if (!static::deletePackageDir($sId)) {
|
||||||
throw new \Exception('Cannot remove previous plugin folder: '.$sId);
|
throw new \Exception('Cannot remove previous plugin folder: '.$sId);
|
||||||
}
|
}
|
||||||
if ('.phar' === \substr($sRealFile, -5)) {
|
if ('.phar' === \substr($sRealFile, -5)) {
|
||||||
$bResult = \copy($sTmp, APP_PLUGINS_PATH . \basename($sRealFile));
|
$bResult = \copy($sTmp, APP_PLUGINS_PATH . \basename($sRealFile));
|
||||||
} else {
|
} else {
|
||||||
|
if (\class_exists('PharData')) {
|
||||||
|
$oArchive = new \PharData($sTmp, 0, $sRealFile);
|
||||||
|
} else {
|
||||||
|
// throw new \Exception('PHP Phar is disabled, you must enable it');
|
||||||
|
$oArchive = new \SnappyMail\TAR($sTmp);
|
||||||
|
}
|
||||||
$bResult = $oArchive->extractTo(\rtrim(APP_PLUGINS_PATH, '\\/'));
|
$bResult = $oArchive->extractTo(\rtrim(APP_PLUGINS_PATH, '\\/'));
|
||||||
}
|
}
|
||||||
if (!$bResult) {
|
if (!$bResult) {
|
||||||
|
|
|
||||||
|
|
@ -197,16 +197,19 @@ abstract class Upgrade
|
||||||
throw new \Exception('Failed to download latest SnappyMail');
|
throw new \Exception('Failed to download latest SnappyMail');
|
||||||
}
|
}
|
||||||
$target = \rtrim(APP_INDEX_ROOT_PATH, '\\/');
|
$target = \rtrim(APP_INDEX_ROOT_PATH, '\\/');
|
||||||
$oArchive = new \PharData($sTmp, 0, null, \Phar::GZ);
|
if (\class_exists('PharData')) {
|
||||||
|
$oArchive = new \PharData($sTmp, 0, null, \Phar::GZ);
|
||||||
|
} else {
|
||||||
|
$oArchive = new \SnappyMail\TAR($sTmp);
|
||||||
|
}
|
||||||
\error_log('Extract to ' . $target);
|
\error_log('Extract to ' . $target);
|
||||||
// $bResult = $oArchive->extractTo($target, null, true);
|
// $bResult = $oArchive->extractTo($target, null, true);
|
||||||
$bResult = $oArchive->extractTo($target, 'snappymail/')
|
$bResult = $oArchive->extractTo($target, 'snappymail/')
|
||||||
&& $oArchive->extractTo($target, 'index.php', true);
|
&& $oArchive->extractTo($target, 'index.php', true);
|
||||||
if ($bResult) {
|
if (!$bResult) {
|
||||||
\error_log('Update success');
|
|
||||||
} else {
|
|
||||||
throw new \Exception('Extract core files failed');
|
throw new \Exception('Extract core files failed');
|
||||||
}
|
}
|
||||||
|
\error_log('Update success');
|
||||||
// opcache_reset is a terrible solution
|
// opcache_reset is a terrible solution
|
||||||
// \is_callable('opcache_reset') && \opcache_reset();
|
// \is_callable('opcache_reset') && \opcache_reset();
|
||||||
\is_callable('opcache_invalidate') && \opcache_invalidate($target.'/index.php', true);
|
\is_callable('opcache_invalidate') && \opcache_invalidate($target.'/index.php', true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue