Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add install:extensionsetupifpossible command #488

Merged
merged 1 commit into from
May 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ before_install:
export TYPO3_PATH_ROOT="$CONSOLE_ROOT/.Build/Web"
export PATH="$PATH:./Scripts"
- if php -i | grep -q xdebug; then phpenv config-rm xdebug.ini; fi
- wget https://raw.github.com/lehmannro/assert.sh/v1.1/assert.sh && source assert.sh -v -x && rm assert.sh

before_script:
- >
if [ -n "$TRAVIS_TAG" ]; then
composer set-version $TRAVIS_TAG
# If this fails, we forgot to update version numbers before tagging the release
assert "git diff --shortstat 2> /dev/null | tail -n1" "";
test -z "$(git diff --shortstat 2> /dev/null | tail -n1)";
fi
- composer extension-create-libs && ls -la Libraries/*.phar | grep -v ^-rwx
- git clean -dffx
Expand All @@ -72,7 +71,7 @@ script:
- >
echo "Checking command reference completeness…"
typo3cms commandreference:render;
assert "git diff 2> /dev/null" "";
test -z "$(git diff --shortstat 2> /dev/null | tail -n1)";

after_script:
- >
Expand Down
26 changes: 26 additions & 0 deletions Classes/Command/InstallCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

use Helhum\Typo3Console\Install\FolderStructure\ExtensionFactory;
use Helhum\Typo3Console\Install\PackageStatesGenerator;
use Helhum\Typo3Console\Mvc\Cli\CommandDispatcher;
use Helhum\Typo3Console\Mvc\Cli\FailedSubProcessCommandException;
use Helhum\Typo3Console\Mvc\Controller\CommandController;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Package\PackageInterface;
Expand Down Expand Up @@ -182,6 +184,30 @@ public function fixFolderStructureCommand()
}
}

/**
* Setup TYPO3 with extensions if possible
*
* This command tries up all TYPO3 extensions, but quits gracefully if this is not possible.
* This can be used in <code>composer.json</code> scripts to ensure that extensions
* are always set up correctly after a composer run on development systems,
* but does not fail on packaging for deployment where no database connection is available.
*
* Besides that, it can be used for a first deploy of a TYPO3 instance in a new environment,
* but also works for subsequent deployments.
*
* @see typo3_console:extension:setupactive
*/
public function extensionSetupIfPossibleCommand()
{
$commandDispatcher = CommandDispatcher::createFromCommandRun();
try {
$commandDispatcher->executeCommand('database:updateschema');
$this->outputLine($commandDispatcher->executeCommand('extension:setupactive'));
} catch (FailedSubProcessCommandException $e) {
$this->outputLine('<warning>Extension setup skipped.</warning>');
}
}

/**
* Check environment / create folders
*
Expand Down