Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
329 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
|
||
demo_community_description = Beschreibung | ||
demo_community_description_install_heading = Installation | ||
demo_community_description_install_body = Gehe zu <a href="{0}">Backup > Import > Vom Server</a> und importiere die Datenbank und den Dateiexport <code>demo_community</code> | ||
demo_community_title = Demo | ||
|
||
demo_community_install = Installation | ||
demo_community_install_heading = Installation | ||
demo_community_install_description = Bitte beachten, dass bei der Installation alle Inhalte der Datenbank gelöscht werden! | ||
demo_community_install_button = Demo installieren | ||
|
||
demo_community_confirm_setup = Bestehende Daten gehen verloren. Fortfahren? | ||
|
||
demo_community_package_not_available = Benötigte Version des Pakets <strong>"{0}"</strong> ist nicht verfügbar! | ||
demo_community_package_not_exists = Paket <strong>"{0}"</strong> ist nicht vorhanden! | ||
demo_community_package_failed_to_download = Fehler beim Download von <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_validate = Fehler bei der Validierung von <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_extract = Fehler beim Entpacken von <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_install = Fehler beim Installieren von <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_activate = Fehler beim Aktivieren von <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_import = Fehler beim Importieren von <strong>"{0}"</strong>! | ||
|
||
demo_community_installation_error = Demo konnte nicht installiert werden: | ||
demo_community_installation_success = Demo wurde erfolgreich installiert! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
|
||
demo_community_description = Description | ||
demo_community_description_install_heading = Installation | ||
demo_community_description_install_body = Go to <a href="{0}">Backup > Import > From server</a> and import the database and the file export <code>demo_community</code> | ||
demo_community_title = Demo | ||
|
||
demo_community_install = Installation | ||
demo_community_install_heading = Installation | ||
demo_community_install_description = Please note that all contents of the database will be deleted during installation! | ||
demo_community_install_button = Install demo | ||
|
||
demo_community_confirm_setup = Current data will be deleted. Would you like to proceed? | ||
|
||
demo_community_package_not_available = Required version of package <strong>"{0}"</strong> not available for download! | ||
demo_community_package_not_exists = Package <strong>"{0}"</strong> does not exist! | ||
demo_community_package_failed_to_download = Failed to download package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_validate = Failed to validate package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_extract = Failed to extract package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_install = Failed to install package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_activate = Failed to activate package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_import = Failed to import <strong>"{0}"</strong>! | ||
|
||
demo_community_installation_error = Failed to install demo: | ||
demo_community_installation_success = Successfully installed demo! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
|
||
demo_community_description = Descrição | ||
demo_community_description_install_heading = Instalação | ||
demo_community_description_install_body = Vá para <a href="{0}">Backup > Importar > Do servidor</a> e importe o banco de dados e o arquivo de exportação <code>demo_community</code> | ||
demo_community_title = Demo | ||
|
||
demo_community_install = Instalação | ||
demo_community_install_heading = Instalação | ||
demo_community_install_description = Por favor, note que todos os conteúdos do banco de dados serão excluídos durante a instalação! | ||
demo_community_install_button = Instale o demo | ||
|
||
demo_community_confirm_setup = Os arquivos atuais serão deletados. Deseja continuar? | ||
|
||
demo_community_package_not_available = Required version of package <strong>"{0}"</strong> not available for download! | ||
demo_community_package_not_exists = Package <strong>"{0}"</strong> does not exist! | ||
demo_community_package_failed_to_download = Failed to download package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_validate = Failed to validate package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_extract = Failed to extract package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_install = Failed to install package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_activate = Failed to activate package <strong>"{0}"</strong>! | ||
demo_community_package_failed_to_import = Failed to import <strong>"{0}"</strong>! | ||
|
||
demo_community_installation_error = Failed to install demo: | ||
demo_community_installation_success = Successfully installed demo! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# additional requires (non-system packages) | ||
requires: | ||
packages: | ||
markitup: '>=3.0.0' | ||
phpmailer: '>=2.1.0' | ||
yform: '>=2.0' | ||
yform/geo: '>=2.0' | ||
ycom: '>=1.0' | ||
|
||
# setup config | ||
# hint: inspect link values inside of REDAXO installer to find out fileIds (numbers) for new packages! | ||
setup: | ||
packages: | ||
markitup: 1895 # 3.0.1 | ||
phpmailer: 1821 # 2.1.2 | ||
yform: 1986 # 2.2 | ||
ycom: 1987 # 2.0 | ||
installSequence: | ||
- backup | ||
- structure/content | ||
- phpmailer | ||
- markitup | ||
- yform | ||
- yform/geo | ||
- ycom | ||
dbimport: | ||
- demo_community.sql | ||
fileimport: | ||
- demo_community.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
|
||
echo rex_view::title($this->i18n('title')); | ||
$subpage = rex_be_controller::getCurrentPagePart(2); | ||
include rex_be_controller::getCurrentPageObject()->getSubPath(); | ||
include rex_be_controller::getCurrentPageObject()->getSubPath(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
<?php | ||
|
||
/** @var rex_addon $this */ | ||
|
||
/* setup process */ | ||
|
||
if (rex_post('install', 'boolean')) { | ||
|
||
$errors = array(); | ||
|
||
// step 1/5: select missing packages we need to download | ||
$missingPackages = array(); | ||
$packages = $this->getProperty('setup')['packages']; | ||
if (count($packages) > 0) { | ||
|
||
// fetch list of available packages from to redaxo webservice | ||
try { | ||
$packagesFromInstaller = rex_install_packages::getAddPackages(); | ||
} catch (rex_functional_exception $e) { | ||
$errors[] = $e->getMessage(); | ||
} | ||
|
||
foreach ($packages as $id => $fileId) { | ||
|
||
$localPackage = rex_package::get($id); | ||
if ($localPackage->isSystemPackage()) { | ||
continue; | ||
} | ||
|
||
$installerPackage = $packagesFromInstaller[$id]['files'][$fileId]; | ||
if (!$installerPackage) { | ||
$errors[] = $this->i18n('package_not_available', $id); | ||
} | ||
|
||
if ($localPackage->getVersion() !== $installerPackage['version']) { | ||
$missingPackages[$id] = $fileId; | ||
} | ||
} | ||
} | ||
|
||
// step 2/5: download required packages | ||
if (count($missingPackages) > 0 && count($errors) == 0) { | ||
foreach ($missingPackages as $id => $fileId) { | ||
|
||
$installerPackage = $packagesFromInstaller[$id]['files'][$fileId]; | ||
if ($installerPackage) { | ||
|
||
// fetch package | ||
try { | ||
$archivefile = rex_install_webservice::getArchive($installerPackage['path']); | ||
} catch (rex_functional_exception $e) { | ||
$errors[] = $this->i18n('package_failed_to_download', $id); | ||
break; | ||
} | ||
|
||
// validate checksum | ||
if ($installerPackage['checksum'] != md5_file($archivefile)) { | ||
$errors[] = $this->i18n('package_failed_to_validate', $id); | ||
break; | ||
} | ||
|
||
// extract package (overrides local package if existent) | ||
if (!rex_install_archive::extract($archivefile, rex_path::addon($id), $id)) { | ||
rex_dir::delete(rex_path::addon($id)); | ||
$errors[] = $this->i18n('package_failed_to_extract', $id); | ||
break; | ||
} | ||
|
||
rex_package_manager::synchronizeWithFileSystem(); | ||
} | ||
} | ||
} | ||
|
||
// step 3/5: install and activate packages based on install sequence from config | ||
if (count($this->getProperty('setup')['installSequence']) > 0 && count($errors) == 0) { | ||
foreach ($this->getProperty('setup')['installSequence'] as $id) { | ||
|
||
$package = rex_package::get($id); | ||
if ($package instanceof rex_null_package) { | ||
$errors[] = $this->i18n('package_not_exists', $id); | ||
break; | ||
} | ||
|
||
$manager = rex_package_manager::factory($package); | ||
|
||
try { | ||
$manager->install(); | ||
} catch (rex_functional_exception $e) { | ||
$errors[] = $this->i18n('package_failed_to_install', $id); | ||
break; | ||
} | ||
|
||
try { | ||
$manager->activate(); | ||
} catch (rex_functional_exception $e) { | ||
$errors[] = $this->i18n('package_failed_to_activate', $id); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
// step 4/5: import database | ||
if (count($this->getProperty('setup')['dbimport']) > 0 && count($errors) == 0) { | ||
foreach ($this->getProperty('setup')['dbimport'] as $import) { | ||
$file = rex_backup::getDir() . '/' . $import; | ||
$success = rex_backup::importDb($file); | ||
if (!$success['state']) { | ||
$errors[] = $this->i18n('package_failed_to_import', $import); | ||
} | ||
} | ||
} | ||
|
||
// step 5/5: import files | ||
if (count($this->getProperty('setup')['fileimport']) > 0 && count($errors) == 0) { | ||
foreach ($this->getProperty('setup')['fileimport'] as $import) { | ||
$file = rex_backup::getDir() . '/' . $import; | ||
$success = rex_backup::importFiles($file); | ||
if (!$success['state']) { | ||
$errors[] = $this->i18n('package_failed_to_import', $import); | ||
} | ||
} | ||
} | ||
|
||
// show result messages | ||
if (count($errors) > 0) { | ||
echo rex_view::error("<p>" . $this->i18n('installation_error') . "</p><ul><li>" . implode("</li><li>", $errors) . "</li></ul>"); | ||
} else { | ||
echo rex_view::success("<p>" . $this->i18n('installation_success') . "</p>"); | ||
} | ||
} | ||
|
||
|
||
/* setup info */ | ||
|
||
$content = '<p>' . $this->i18n('demo_community_install_description') . '</p>'; | ||
$content .= '<p><button class="btn btn-send" type="submit" name="install" value="1"><i class="rex-icon fa-download"></i> ' . $this->i18n('demo_community_install_button') . '</button></p>'; | ||
|
||
$fragment = new rex_fragment(); | ||
$fragment->setVar('title', $this->i18n('demo_community_install_heading'), false); | ||
$fragment->setVar('body', $content, false); | ||
$content = $fragment->parse('core/page/section.php'); | ||
|
||
$content = ' | ||
<form action="' . rex_url::currentBackendPage() . '" method="post" data-confirm="' . $this->i18n('demo_community_confirm_setup') . '"> | ||
' . $content . ' | ||
</form>'; | ||
|
||
echo $content; | ||
|
||
|
||
/* package info from README.md */ | ||
|
||
$content = ''; | ||
|
||
$package = rex_package::get('demo_community'); | ||
$name = $package->getPackageId(); | ||
$version = $package->getVersion(); | ||
$author = $package->getAuthor(); | ||
$supportPage = $package->getSupportPage(); | ||
|
||
if (is_readable($package->getPath('README.md'))) { | ||
$fragment = new rex_fragment(); | ||
$fragment->setVar('content', rex_markdown::factory()->parse(rex_file::get($package->getPath('README.md'))), false); | ||
$content .= $fragment->parse('core/page/docs.php'); | ||
} | ||
|
||
if (!empty($content)) { | ||
$fragment = new rex_fragment(); | ||
$fragment->setVar('title', rex_i18n::msg('package_help') . ' ' . $name, false); | ||
$fragment->setVar('body', $content, false); | ||
echo $fragment->parse('core/page/section.php'); | ||
} | ||
|
||
|
||
/* credits */ | ||
|
||
$credits = ''; | ||
$credits .= '<dl class="dl-horizontal">'; | ||
$credits .= '<dt>' . rex_i18n::msg('credits_name') . '</dt><dd>' . htmlspecialchars($name) . '</dd>'; | ||
|
||
if ($version) { | ||
$credits .= '<dt>' . rex_i18n::msg('credits_version') . '</dt><dd>' . $version . '</dd>'; | ||
} | ||
if ($author) { | ||
$credits .= '<dt>' . rex_i18n::msg('credits_author') . '</dt><dd>' . htmlspecialchars($author) . '</dd>'; | ||
} | ||
if ($supportPage) { | ||
$credits .= '<dt>' . rex_i18n::msg('credits_supportpage') . '</dt><dd><a href="' . $supportPage . '" onclick="window.open(this.href); return false;">' . $supportPage . '</a></dd>'; | ||
} | ||
|
||
$credits .= '</dl>'; | ||
|
||
$fragment = new rex_fragment(); | ||
$fragment->setVar('title', rex_i18n::msg('credits'), false); | ||
$fragment->setVar('body', $credits, false); | ||
echo $fragment->parse('core/page/section.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** @var rex_addon $this */ | ||
|
||
// read configs | ||
$config1 = rex_file::getConfig($this->getPath('package.yml')); | ||
$config2 = rex_file::getConfig($this->getPath('package.setup.yml')); | ||
|
||
// reduce packages to initial version | ||
$packages = array_diff( | ||
$config1['requires']['packages'], | ||
$config2['requires']['packages'] | ||
); | ||
|
||
// update config with initial packages | ||
$config1['requires']['packages'] = $packages; | ||
|
||
// remove setup data | ||
unset($config1['setup']); | ||
|
||
// save config | ||
rex_file::putConfig($this->getPath('package.yml'), $config1); |