mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 00:47:04 +03:00
Nextcloud added import RainLoop data helper for
https://github.com/pierre-alain-b/rainloop-nextcloud/issues/288
This commit is contained in:
parent
057bd9d15c
commit
ce4c6d1925
1 changed files with 39 additions and 0 deletions
|
|
@ -119,4 +119,43 @@ class SnappyMailHelper
|
||||||
static::loadApp();
|
static::loadApp();
|
||||||
return \SnappyMail\Crypt::DecryptUrlSafe($sPassword, $sSalt);
|
return \SnappyMail\Crypt::DecryptUrlSafe($sPassword, $sSalt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function importRainloop() : bool
|
||||||
|
{
|
||||||
|
$dir = \rtrim(\trim(\OC::$server->getSystemConfig()->getValue('datadirectory', '')), '\\/');
|
||||||
|
|
||||||
|
$dir_snappy = $dir . '/appdata_snappymail/';
|
||||||
|
\is_dir($dir_snappy) || \mkdir($dir);
|
||||||
|
|
||||||
|
$dir_rainloop = $dir . '/rainloop-storage';
|
||||||
|
if (\is_dir($dir_rainloop)) {
|
||||||
|
$plugins = [];
|
||||||
|
$iterator = new \RecursiveIteratorIterator(
|
||||||
|
new \RecursiveDirectoryIterator($dir_rainloop, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||||
|
\RecursiveIteratorIterator::SELF_FIRST
|
||||||
|
);
|
||||||
|
foreach ($iterator as $item) {
|
||||||
|
$target = $dir_snappy . DIRECTORY_SEPARATOR . $iterator->getSubPathname();
|
||||||
|
if (\preg_match('@/plugins/([^/])@', $target, $match)) {
|
||||||
|
$plugins[$match[1]] = $match[1];
|
||||||
|
} else if (!\strpos($target, '/cache/')) {
|
||||||
|
if ($item->isDir()) {
|
||||||
|
\mkdir($target);
|
||||||
|
} else {
|
||||||
|
\copy($item, $target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static::loadApp();
|
||||||
|
foreach (\SnappyMail\Repository::getPackagesList()['List'] as $plugin) {
|
||||||
|
if (\in_array($plugin['id'], $plugins)) {
|
||||||
|
\SnappyMail\Repository::installPackage('plugin', $plugin['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue