mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 06:27:02 +03:00
ownCloud new package (with built-in RainLoop Webmail)
Remove VERSION file dependence. Small fixes
This commit is contained in:
parent
169bd45f31
commit
fb18e4e799
145 changed files with 500 additions and 5462 deletions
|
|
@ -1,14 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace RainLoop;
|
||||
|
||||
if (!\defined('RAINLOOP_APP_ROOT_PATH'))
|
||||
if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
|
||||
{
|
||||
\define('RAINLOOP_APP_LIBRARIES_PATH', \rtrim(\realpath(__DIR__), '\\/').'/libraries/');
|
||||
\define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper'));
|
||||
|
||||
\spl_autoload_register(function ($sClassName) {
|
||||
|
||||
|
||||
if (0 === \strpos($sClassName, 'RainLoop') && false !== \strpos($sClassName, '\\'))
|
||||
{
|
||||
return include RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
|
||||
|
|
@ -20,32 +18,39 @@ if (!\defined('RAINLOOP_APP_ROOT_PATH'))
|
|||
\define('RL_MB_FIXED', true);
|
||||
include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/MbStringFix.php';
|
||||
}
|
||||
|
||||
|
||||
return include RAINLOOP_APP_LIBRARIES_PATH.'Sabre/'.\str_replace('\\', '/', \substr($sClassName, 6)).'.php';
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (\class_exists('RainLoop\Service'))
|
||||
if (\class_exists('RainLoop\Service'))
|
||||
{
|
||||
$oException = null;
|
||||
if (!\class_exists('MailSo\Version'))
|
||||
{
|
||||
$oException = null;
|
||||
try
|
||||
{
|
||||
include APP_VERSION_ROOT_PATH.'app/libraries/MailSo/MailSo.php';
|
||||
}
|
||||
catch (\Exception $oException) {}
|
||||
}
|
||||
|
||||
if (!$oException)
|
||||
if (!$oException)
|
||||
{
|
||||
if (isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API'])
|
||||
{
|
||||
if (defined('RAINLOOP_INCLUDE_AS_API') && RAINLOOP_INCLUDE_AS_API)
|
||||
{
|
||||
\RainLoop\Api::Handle();
|
||||
}
|
||||
else
|
||||
{
|
||||
\RainLoop\Service::NewInstance()->Handle();
|
||||
}
|
||||
$_ENV['RAINLOOP_INCLUDE_AS_API'] = false;
|
||||
\RainLoop\Api::Handle();
|
||||
}
|
||||
else if (!\defined('APP_STARTED'))
|
||||
{
|
||||
\define('APP_STARTED', true);
|
||||
\RainLoop\Service::NewInstance()->Handle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
@ -986,6 +986,7 @@ class Actions
|
|||
$aResult = array(
|
||||
'Version' => APP_VERSION,
|
||||
'IndexFile' => APP_INDEX_FILE,
|
||||
'OwnCloud' => APP_OWNCLOUD,
|
||||
'Auth' => false,
|
||||
'AccountHash' => '',
|
||||
'AccountSignMe' => false,
|
||||
|
|
@ -2921,23 +2922,29 @@ class Actions
|
|||
|
||||
if ($bResult && \file_exists($sTmpFolder.'/index.php') &&
|
||||
\is_writable(APP_INDEX_ROOT_PATH.'rainloop/') &&
|
||||
\file_exists($sTmpFolder.'/data/VERSION') &&
|
||||
\is_writable(APP_INDEX_ROOT_PATH.'index.php') &&
|
||||
\is_dir($sTmpFolder.'/rainloop/'))
|
||||
{
|
||||
$sNewVersion = \file_get_contents($sTmpFolder.'/data/VERSION');
|
||||
if ($sNewVersion && !\is_dir(APP_INDEX_ROOT_PATH.'rainloop/v/'.$sNewVersion))
|
||||
$aMatch = array();
|
||||
$sNewVersion = '';
|
||||
$sIndexFile = \file_get_contents($sTmpFolder.'/index.php');
|
||||
if (\preg_match('/\'APP_VERSION\', \'([^\']+)\'/', $sIndexFile, $aMatch) && !empty($aMatch[1]))
|
||||
{
|
||||
$sNewVersion = \trim($aMatch[1]);
|
||||
}
|
||||
|
||||
if (empty($sNewVersion))
|
||||
{
|
||||
$this->Logger()->Write('Unknown version', \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER');
|
||||
}
|
||||
else if (!\is_dir(APP_INDEX_ROOT_PATH.'rainloop/v/'.$sNewVersion))
|
||||
{
|
||||
\MailSo\Base\Utils::CopyDir($sTmpFolder.'/rainloop/', APP_INDEX_ROOT_PATH.'rainloop/');
|
||||
|
||||
if (\is_dir(APP_INDEX_ROOT_PATH.'rainloop/v/'.$sNewVersion) &&
|
||||
\copy($sTmpFolder.'/data/VERSION', APP_DATA_FOLDER_PATH.'VERSION'))
|
||||
\is_file(APP_INDEX_ROOT_PATH.'rainloop/v/'.$sNewVersion.'/index.php'))
|
||||
{
|
||||
if (\md5_file($sTmpFolder.'/index.php') !== \md5_file(APP_INDEX_ROOT_PATH.'index.php'))
|
||||
{
|
||||
\copy($sTmpFolder.'/index.php', APP_INDEX_ROOT_PATH.'index.php');
|
||||
}
|
||||
|
||||
$bResult = true;
|
||||
$bResult = \copy($sTmpFolder.'/index.php', APP_INDEX_ROOT_PATH.'index.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2945,9 +2952,9 @@ class Actions
|
|||
$this->Logger()->Write($sTmpFolder.'/rainloop/ -> '.APP_INDEX_ROOT_PATH.'rainloop/', \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER');
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!empty($sNewVersion))
|
||||
{
|
||||
$this->Logger()->Write($sNewVersion.' version already installed', \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER');
|
||||
$this->Logger()->Write('"'.$sNewVersion.'" version already installed', \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER');
|
||||
}
|
||||
}
|
||||
else if ($bResult)
|
||||
|
|
|
|||
|
|
@ -59,6 +59,14 @@ class Api
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function Version()
|
||||
{
|
||||
return APP_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sEmail
|
||||
* @param string $sPassword
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue