summaryrefslogtreecommitdiffstats
path: root/lib/setup.php
Commit message (Expand)AuthorAgeFilesLines
* cleanup codestyleJörn Friedrich Dreyer2013-05-221-1/+1
* add debug outputJörn Friedrich Dreyer2013-05-221-2/+10
* disable mbstring.func_overload in setupThomas Tanghus2013-05-121-0/+1
* sync parameters in setup.php with the ones in the actual .htaccessDaniel Molkentin2013-04-241-0/+4
* Improve error message if user creation fails during setupRobin Appelman2013-04-221-1/+2
* Handle empty datafolder better.kondou2013-04-131-1/+1
* Use random bytes instead of timeLukas Reschke2013-04-041-3/+3
* Use a more random source...Lukas Reschke2013-04-041-1/+1
* using rtrimThomas Mueller2013-03-191-4/+1
* fixes #2081Thomas Mueller2013-03-121-0/+7
* [core] From echo to pLukas Reschke2013-02-271-1/+1
* Merge pull request #1961 from owncloud/trans_fixBart Visscher2013-02-271-1/+1
|\
| * fixed bug that would cause a failure because of undefined variable instead o...Bernhard Posselt2013-02-271-1/+1
* | Fix using wrong quotes for breaking long linesBart Visscher2013-02-261-4/+4
|/
* Merge branch 'master' into master-sqlserverThomas Mueller2013-02-221-2/+1
|\
| * Join split translated stringsBart Visscher2013-02-211-2/+1
* | Merge branch 'master' into master-sqlserverThomas Mueller2013-02-141-6/+13
|\|
| * Style-fix: Breakup long linesBart Visscher2013-02-141-7/+14
* | fixing sql server syntax for database creationThomas Mueller2013-02-121-1/+1
* | write any database messages / non critical errors to the log - don't pollute ...Thomas Mueller2013-02-121-32/+33
* | fixing indentThomas Mueller2013-02-121-35/+35
* | fixing undefined variablesThomas Mueller2013-02-121-5/+7
* | Merge branch 'master' into master-sqlserverThomas Mueller2013-02-121-51/+91
|\|
| * fixing indentThomas Mueller2013-02-111-3/+3
| * fixed argument for translationBernhard Posselt2013-02-111-4/+4
| * added l10n for db error messagesBernhard Posselt2013-02-091-52/+72
| * Execute the post setup check after finishing the setupBart Visscher2013-02-061-0/+20
* | Bugfixes and cleanup MS SQL Server installationAdministrator2013-02-101-67/+124
* | Added MS SQL Server supportTobias Ramforth2013-02-081-4/+144
|/
* Merge pull request #1113 from owncloud/fix-issue-1085Michael Gapczynski2013-01-221-1/+3
|\
| * Move template parameters around so database error page is properly renderedMichael Gapczynski2013-01-071-1/+3
* | Merge pull request #1148 from seancomeau/topic/setupFrank Karlitschek2013-01-161-5/+35
|\ \
| * | Rename TestException to DatabaseSetupExceptionSean Comeau2013-01-141-5/+5
| * | Use a custom exception instead of adding a delimiter to the error messageSean Comeau2013-01-141-8/+31
| * | Throw an exception when creating a MySQL user fails and display exception err...Sean Comeau2013-01-101-3/+10
| |/
* / Whitespace cleanupBart Visscher2013-01-161-1/+1
|/
* Revoke DB rights on install only if the db is newly createdBrice Maron2012-12-031-2/+4
* Merge pull request #157 from owncloud/setupBart Visscher2012-11-121-40/+4
|\
| * DRY for creating htaccess to protect data-directoryBart Visscher2012-10-301-0/+4
| * Separate control code from class definitionBart Visscher2012-10-301-40/+0
* | Fix WebDAV (and Android Client) not being able to authorize on Debian Squeeze...Stefan Seidel2012-11-091-1/+9
* | Checkstyle fixes: NoSpaceAfterCommaFelix Moeller2012-11-041-1/+1
* | Checkstyle fixes for SpaceBeforeOpenBraceFelix Moeller2012-11-041-1/+1
* | Checkstyle: many fixesFelix Moeller2012-11-021-4/+4
|/
* Fix MySQL install, bug fix for issue 132Michael Gapczynski2012-10-281-2/+2
* add svg mimetype to default htaccessRobin Appelman2012-10-281-0/+4
* deny the usage of dots in database nameGeorg Ehrke2012-10-281-0/+3
* Split database setup code to functionsBart Visscher2012-10-261-223/+238
* Checkstyle: NoSpaceAfterCommaFelix Moeller2012-10-231-3/+3
* Don't add the enhanced auth time to the configurationLukas Reschke2012-10-161-4/+1
n class="p">; use OC; use OC\AppFramework\Http; use OC\AppFramework\Http\Request; use OC\AppFramework\Http\Dispatcher; use OC\AppFramework\Http\Output; use OC\AppFramework\Core\API; use OC\AppFramework\Middleware\MiddlewareDispatcher; use OC\AppFramework\Middleware\Security\SecurityMiddleware; use OC\AppFramework\Middleware\Security\CORSMiddleware; use OC\AppFramework\Middleware\SessionMiddleware; use OC\AppFramework\Utility\SimpleContainer; use OCP\AppFramework\IApi; use OCP\AppFramework\IAppContainer; use OCP\AppFramework\Middleware; use OCP\IServerContainer; class DIContainer extends SimpleContainer implements IAppContainer { /** * @var array */ private $middleWares = array(); /** * Put your class dependencies in here * @param string $appName the name of the app */ public function __construct($appName, $urlParams = array()){ parent::__construct(); $this['AppName'] = $appName; $this['urlParams'] = $urlParams; // aliases $this->registerAlias('appName', 'AppName'); $this->registerAlias('webRoot', 'WebRoot'); $this->registerAlias('userId', 'UserId'); /** * Core services */ $this->registerService('OCP\\IAppConfig', function($c) { return $this->getServer()->getAppConfig(); }); $this->registerService('OCP\\App\\IAppManager', function($c) { return $this->getServer()->getAppManager(); }); $this->registerService('OCP\\AppFramework\\Http\\IOutput', function($c){ return new Output($this->getServer()->getWebRoot()); }); $this->registerService('OCP\\IAvatarManager', function($c) { return $this->getServer()->getAvatarManager(); }); $this->registerService('OCP\\Activity\\IManager', function($c) { return $this->getServer()->getActivityManager(); }); $this->registerService('OCP\\ICache', function($c) { return $this->getServer()->getCache(); }); $this->registerService('OCP\\ICacheFactory', function($c) { return $this->getServer()->getMemCacheFactory(); }); $this->registerService('OC\\CapabilitiesManager', function($c) { return $this->getServer()->getCapabilitiesManager(); }); $this->registerService('OCP\\IConfig', function($c) { return $this->getServer()->getConfig(); }); $this->registerService('OCP\\Contacts\\IManager', function($c) { return $this->getServer()->getContactsManager(); }); $this->registerService('OCP\\IDateTimeZone', function($c) { return $this->getServer()->getDateTimeZone(); }); $this->registerService('OCP\\IDb', function($c) { return $this->getServer()->getDb(); }); $this->registerService('OCP\\IDBConnection', function($c) { return $this->getServer()->getDatabaseConnection(); }); $this->registerService('OCP\\Diagnostics\\IEventLogger', function($c) { return $this->getServer()->getEventLogger(); }); $this->registerService('OCP\\Diagnostics\\IQueryLogger', function($c) { return $this->getServer()->getQueryLogger(); }); $this->registerService('OCP\\Files\\IMimeTypeDetector', function($c) { return $this->getServer()->getMimeTypeDetector(); }); $this->registerService('OCP\\Files\\Config\\IMountProviderCollection', function($c) { return $this->getServer()->getMountProviderCollection(); }); $this->registerService('OCP\\Files\\IRootFolder', function($c) { return $this->getServer()->getRootFolder(); }); $this->registerService('OCP\\IGroupManager', function($c) { return $this->getServer()->getGroupManager(); }); $this->registerService('OCP\\IL10N', function($c) { return $this->getServer()->getL10N($c->query('AppName')); }); $this->registerService('OCP\\ILogger', function($c) { return $this->getServer()->getLogger(); }); $this->registerService('OCP\\BackgroundJob\\IJobList', function($c) { return $this->getServer()->getJobList(); }); $this->registerAlias('OCP\\AppFramework\\Utility\\IControllerMethodReflector', 'OC\AppFramework\Utility\ControllerMethodReflector'); $this->registerAlias('ControllerMethodReflector', 'OCP\\AppFramework\\Utility\\IControllerMethodReflector'); $this->registerService('OCP\\INavigationManager', function($c) { return $this->getServer()->getNavigationManager(); }); $this->registerService('OCP\\IPreview', function($c) { return $this->getServer()->getPreviewManager(); }); $this->registerService('OCP\\IRequest', function () { return $this->getServer()->getRequest(); }); $this->registerAlias('Request', 'OCP\\IRequest'); $this->registerService('OCP\\ITagManager', function($c) { return $this->getServer()->getTagManager(); }); $this->registerService('OCP\\ITempManager', function($c) { return $this->getServer()->getTempManager(); }); $this->registerAlias('OCP\\AppFramework\\Utility\\ITimeFactory', 'OC\AppFramework\Utility\TimeFactory'); $this->registerAlias('TimeFactory', 'OCP\\AppFramework\\Utility\\ITimeFactory'); $this->registerService('OCP\\Route\\IRouter', function($c) { return $this->getServer()->getRouter(); }); $this->registerService('OCP\\ISearch', function($c) { return $this->getServer()->getSearch(); }); $this->registerService('OCP\\ISearch', function($c) { return $this->getServer()->getSearch(); }); $this->registerService('OCP\\Security\\ICrypto', function($c) { return $this->getServer()->getCrypto(); }); $this->registerService('OCP\\Security\\IHasher', function($c) { return $this->getServer()->getHasher(); }); $this->registerService('OCP\\Security\\ISecureRandom', function($c) { return $this->getServer()->getSecureRandom(); }); $this->registerService('OCP\\SystemTag\\ISystemTagManager', function() { return $this->getServer()->getSystemTagManager(); }); $this->registerService('OCP\\SystemTag\\ISystemTagObjectMapper', function() { return $this->getServer()->getSystemTagObjectMapper(); }); $this->registerService('OCP\\IURLGenerator', function($c) { return $this->getServer()->getURLGenerator(); }); $this->registerService('OCP\\IUserManager', function($c) { return $this->getServer()->getUserManager(); }); $this->registerService('OCP\\IUserSession', function($c) { return $this->getServer()->getUserSession(); }); $this->registerService('OCP\\ISession', function($c) { return $this->getServer()->getSession(); }); $this->registerService('ServerContainer', function ($c) { return $this->getServer(); }); $this->registerAlias('OCP\\IServerContainer', 'ServerContainer'); $this->registerService('Symfony\Component\EventDispatcher\EventDispatcherInterface', function ($c) { return $this->getServer()->getEventDispatcher(); }); $this->registerService('OCP\\AppFramework\\IAppContainer', function ($c) { return $c; }); // commonly used attributes $this->registerService('UserId', function ($c) { return $c->query('OCP\\IUserSession')->getSession()->get('user_id'); }); $this->registerService('WebRoot', function ($c) { return $c->query('ServerContainer')->getWebRoot(); }); /** * App Framework APIs */ $this->registerService('API', function($c){ $c->query('OCP\\ILogger')->debug( 'Accessing the API class is deprecated! Use the appropriate ' . 'services instead!' ); return new API($c['AppName']); }); $this->registerService('Protocol', function($c){ /** @var \OC\Server $server */ $server = $c->query('ServerContainer'); $protocol = $server->getRequest()->getHttpProtocol(); return new Http($_SERVER, $protocol); }); $this->registerService('Dispatcher', function($c) { return new Dispatcher( $c['Protocol'], $c['MiddlewareDispatcher'], $c['ControllerMethodReflector'], $c['Request'] ); }); /** * Middleware */ $app = $this; $this->registerService('SecurityMiddleware', function($c) use ($app){ return new SecurityMiddleware( $c['Request'], $c['ControllerMethodReflector'], $app->getServer()->getNavigationManager(), $app->getServer()->getURLGenerator(), $app->getServer()->getLogger(), $c['AppName'], $app->isLoggedIn(), $app->isAdminUser() ); }); $this->registerService('CORSMiddleware', function($c) { return new CORSMiddleware( $c['Request'], $c['ControllerMethodReflector'], $c['OCP\IUserSession'] ); }); $this->registerService('SessionMiddleware', function($c) use ($app) { return new SessionMiddleware( $c['Request'], $c['ControllerMethodReflector'], $app->getServer()->getSession() ); }); $middleWares = &$this->middleWares; $this->registerService('MiddlewareDispatcher', function($c) use (&$middleWares) { $dispatcher = new MiddlewareDispatcher(); $dispatcher->registerMiddleware($c['CORSMiddleware']); $dispatcher->registerMiddleware($c['SecurityMiddleware']); foreach($middleWares as $middleWare) { $dispatcher->registerMiddleware($c[$middleWare]); } $dispatcher->registerMiddleware($c['SessionMiddleware']); return $dispatcher; }); } /** * @deprecated implements only deprecated methods * @return IApi */ function getCoreApi() { return $this->query('API'); } /** * @return \OCP\IServerContainer */ function getServer() { return OC::$server; } /** * @param string $middleWare * @return boolean|null */ function registerMiddleWare($middleWare) { array_push($this->middleWares, $middleWare); } /** * used to return the appname of the set application * @return string the name of your application */ function getAppName() { return $this->query('AppName'); } /** * @deprecated use IUserSession->isLoggedIn() * @return boolean */ function isLoggedIn() { return \OC_User::isLoggedIn(); } /** * @deprecated use IGroupManager->isAdmin($userId) * @return boolean */ function isAdminUser() { $uid = $this->getUserId(); return \OC_User::isAdminUser($uid); } private function getUserId() { return $this->getServer()->getSession()->get('user_id'); } /** * @deprecated use the ILogger instead * @param string $message * @param string $level * @return mixed */ function log($message, $level) { switch($level){ case 'debug': $level = \OCP\Util::DEBUG; break; case 'info': $level = \OCP\Util::INFO; break; case 'warn': $level = \OCP\Util::WARN; break; case 'fatal': $level = \OCP\Util::FATAL; break; default: $level = \OCP\Util::ERROR; break; } \OCP\Util::writeLog($this->getAppName(), $message, $level); } /** * Register a capability * * @param string $serviceName e.g. 'OCA\Files\Capabilities' */ public function registerCapability($serviceName) { $this->query('OC\CapabilitiesManager')->registerCapability(function() use ($serviceName) { return $this->query($serviceName); }); } }