/** * @return array */ public function DoAdminPackageInstall() { $this->IsAdminLoggined(); $sType = $this->GetActionParam('Type', ''); $sId = $this->GetActionParam('Id', ''); $sFile = $this->GetActionParam('File', ''); $this->Logger()->Write('Start package install: ' . $sFile . ' (' . $sType . ')', \MailSo\Log\Enumerations\Type::INFO, 'INSTALLER'); $sRealFile = ''; $bReal = false; $bRainLoopUpdatable = false; $aList = $this->getRepositoryData($bReal, $bRainLoopUpdatable); if ('plugin' === $sType) { foreach ($aList as $oItem) { if ($oItem && $sFile === $oItem['file'] && $sId === $oItem['id']) { $sRealFile = $sFile; break; } } } $sTmp = ''; $bResult = false; if ('' !== $sRealFile) { $sUrl = $this->rainLoopRepo() . $sRealFile; $sTmp = $this->downloadRemotePackageByUrl($sUrl); } if ('' !== $sTmp) { include_once APP_VERSION_ROOT_PATH . 'app/libraries/pclzip/pclzip.lib.php'; $oArchive = new \PclZip($sTmp); if ('plugin' === $sType) { $bResult = true; if (\is_dir(APP_PLUGINS_PATH . $sId)) { $bResult = \MailSo\Base\Utils::RecRmDir(APP_PLUGINS_PATH . $sId); if (!$bResult) { $this->Logger()->Write('Cannot remove previous plugin folder: ' . $sId, \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER'); } } if ($bResult) { $bResult = 0 !== $oArchive->extract(PCLZIP_OPT_PATH, APP_PLUGINS_PATH); if (!$bResult) { $this->Logger()->Write('Cannot extract package files: ' . $oArchive->errorInfo(), \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER'); } } } @\unlink($sTmp); } return $this->DefaultResponse(__FUNCTION__, $bResult ? 'plugin' !== $sType ? array('Reload' => true) : true : false); }
/** * @param \RainLoop\Model\Account|string $oAccount * * @return bool */ public function DeleteStorage($oAccount) { $sPath = $this->generateFileName($oAccount, \RainLoop\Providers\Storage\Enumerations\StorageType::USER, 'xxx', false, true); if (!empty($sPath) && \is_dir($sPath)) { \MailSo\Base\Utils::RecRmDir($sPath); } $sPath = $this->generateFileName($oAccount, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, 'xxx', false, true); if (!empty($sPath) && \is_dir($sPath)) { \MailSo\Base\Utils::RecRmDir($sPath); } return true; }