[Flow] TYPO3\Flow\Monitor\FileMonitor and how to use it?

Aljoscha Weber aweber at w-commerce.de
Fri May 30 15:09:06 CEST 2014


Hello,

Found how Flow creates FileMonitors in "TYPO3\Flow\Core\Booting\Scripts.php":
use TYPO3\Flow\Monitor\FileMonitor;

static public function initializeSystemFileMonitor(Bootstrap $bootstrap) {
        $fileMonitors = array(
            'Flow_ClassFiles' => FileMonitor::createFileMonitorAtBoot('Flow_ClassFiles', $bootstrap),
           ..
        );

        $context = $bootstrap->getContext();
        $packageManager = $bootstrap->getEarlyInstance('TYPO3\Flow\Package\PackageManagerInterface');
        foreach ($packageManager->getActivePackages() as $packageKey => $package) {
            self::monitorDirectoryIfItExists($fileMonitors['Flow_ClassFiles'], $package->getClassesPath());
            ...
        }

        foreach ($fileMonitors as $fileMonitor) {
            $fileMonitor->detectChanges();
        }
        foreach ($fileMonitors as $fileMonitor) {
            $fileMonitor->shutdownObject();
        }
    }

And found how to connect it in "TYPO3\Flow\Package.php":

public function boot(Core\Bootstrap $bootstrap) {
  ...
  $dispatcher->connect('TYPO3\Flow\Monitor\FileMonitor', 'filesHaveChanged', 'TYPO3\Flow\Cache\CacheManager', 'flushSystemCachesByChangedFiles');
  ...
}

But I don't have a clue how to create my own FileMonitor in my Package.
It has to happen somewhere in the flow booting sequence (“createFileMonitorAtBoot”)?
Is someone familiar with the FileMonitor and can enlighten me?

Best regards,
Aljoscha


More information about the Flow mailing list