Merge pull request #18316 from owncloud/event-dispatcher

Event dispatcher
This commit is contained in:
Thomas Müller 2015-08-14 19:51:23 +02:00
commit 72f829eb06
3 changed files with 27 additions and 2 deletions

View File

@ -143,6 +143,9 @@ OCP\Util::addscript('files', 'fileactionsmenu');
OCP\Util::addscript('files', 'files');
OCP\Util::addscript('files', 'navigation');
OCP\Util::addscript('files', 'keyboardshortcuts');
\OC::$server->getEventDispatcher()->dispatch('OCA\Files::loadAdditionalScripts');
$tmpl = new OCP\Template('files', 'index', 'user');
$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
$tmpl->assign('owner', $storageInfo['owner']);

View File

@ -51,7 +51,6 @@ use OC\Http\Client\ClientService;
use OC\Lock\MemcacheLockingProvider;
use OC\Lock\NoopLockingProvider;
use OC\Mail\Mailer;
use OC\Memcache\NullCache;
use OC\Security\CertificateManager;
use OC\Security\Crypto;
use OC\Security\Hasher;
@ -59,6 +58,8 @@ use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper;
use OC\Tagging\TagMapper;
use OCP\IServerContainer;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Class Server
@ -457,7 +458,9 @@ class Server extends SimpleContainer implements IServerContainer {
});
return $manager;
});
$this->registerService('EventDispatcher', function() {
return new EventDispatcher();
});
}
/**
@ -963,4 +966,14 @@ class Server extends SimpleContainer implements IServerContainer {
public function getCapabilitiesManager() {
return $this->query('CapabilitiesManager');
}
/**
* Get the EventDispatcher
*
* @return EventDispatcherInterface
* @since 8.2.0
*/
public function getEventDispatcher() {
return $this->query('EventDispatcher');
}
}

View File

@ -39,6 +39,7 @@
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
@ -439,4 +440,12 @@ interface IServerContainer {
*/
public function getMimeTypeDetector();
/**
* Get the EventDispatcher
*
* @return EventDispatcherInterface
* @since 8.2.0
*/
public function getEventDispatcher();
}