Created
April 12, 2014 13:47
-
-
Save pumatertion/10536642 to your computer and use it in GitHub Desktop.
Using your own splitable yaml configurations like Foo.Bar.yaml
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
<?php | |
/* * | |
* This script belongs to the TYPO3 Flow framework. * | |
* * | |
* It is free software; you can redistribute it and/or modify it under * | |
* the terms of the GNU Lesser General Public License, either version 3 * | |
* of the License, or (at your option) any later version. * | |
* * | |
* The TYPO3 project - inspiring people to share! * | |
* */ | |
namespace PIPEU\Site; | |
use TYPO3\Flow\Configuration\ConfigurationManager; | |
use TYPO3\Flow\Package\Package as BasePackage; | |
use TYPO3\Flow\Package\PackageManagerInterface; | |
use TYPO3\Flow\Package\PackageInterface; | |
use TYPO3\Flow\Monitor\FileMonitor; | |
use TYPO3\Flow\Core\Booting\Step; | |
use TYPO3\Flow\Core\Bootstrap; | |
/** | |
* Class Package | |
* | |
* @package PIPEU\Site | |
*/ | |
class Package extends BasePackage { | |
/** | |
* @param Bootstrap $bootstrap | |
* @return void | |
*/ | |
public function boot(Bootstrap $bootstrap) { | |
$dispatcher = $bootstrap->getSignalSlotDispatcher(); | |
$dispatcher->connect('TYPO3\Flow\Configuration\ConfigurationManager', 'configurationManagerReady', function (ConfigurationManager $configurationManager) { | |
$configurationManager->registerConfigurationType('DeliveryProvider', ConfigurationManager::CONFIGURATION_PROCESSING_TYPE_DEFAULT, TRUE); | |
}); | |
$context = $bootstrap->getContext(); | |
if (!$context->isProduction()) { | |
$dispatcher->connect('TYPO3\Flow\Core\Booting\Sequence', 'afterInvokeStep', function (Step $step) use ($bootstrap) { | |
if ($step->getIdentifier() === 'typo3.flow:systemfilemonitor') { | |
/** @var FileMonitor $deliveryProviderConfigurationFileMonitor */ | |
$deliveryProviderConfigurationFileMonitor = \TYPO3\Flow\Monitor\FileMonitor::createFileMonitorAtBoot('PIPEU_DeliveryProviderConfiguration', $bootstrap); | |
/** @var PackageManagerInterface $packageManager */ | |
$packageManager = $bootstrap->getEarlyInstance('TYPO3\Flow\Package\PackageManagerInterface'); | |
/** @var PackageInterface $package */ | |
foreach ($packageManager->getActivePackages() as $packageKey => $package) { | |
if ($packageManager->isPackageFrozen($packageKey)) { | |
continue; | |
} | |
if (file_exists($package->getConfigurationPath())) { | |
$deliveryProviderConfigurationFileMonitor->monitorDirectory($package->getConfigurationPath(), 'DeliveryProvider(\..+)\.yaml'); | |
} | |
} | |
$deliveryProviderConfigurationFileMonitor->monitorDirectory(FLOW_PATH_CONFIGURATION, 'DeliveryProvider(\..+)\.yaml'); | |
$deliveryProviderConfigurationFileMonitor->detectChanges(); | |
$deliveryProviderConfigurationFileMonitor->shutdownObject(); | |
} | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment