Commit Graph

136 Commits

Author SHA1 Message Date
Bernhard Posselt 95239ad21e AppFramework StreamResponse
First stab at the StreamResponse, see #12988

The idea is to use an interface ICallbackResponse (I'm not 100% happy with the name yet, suggestions?) that allow the response to output things in its own way, for instance stream the file using readfile

Unittests are atm lacking, plan is to

check if a mock of ICallbackResponse will be used by calling its callback (also unhappy with this name) method
Usage is:

$response = new StreamResponse('path/to/file');

rename io to output, add additional methods and handle error and not modified cases when using StreamResponse

fix indention and uppercasing, also handle forbidden cases

fix indention

fix indention

no forbidden, figuring out if a file is really readable is too complicated to get to work across OSes and streams

remove useless import

remove useless import

fix intendation
2015-02-27 15:42:33 +01:00
Morris Jobke 06aef4e8b1 Revert "Updating license headers"
This reverts commit 6a1a4880f0.
2015-02-26 11:37:37 +01:00
Thomas Müller c62eb9d652 owncloud -> ownCloud 2015-02-25 22:21:24 +01:00
Bernhard Posselt fb84e7d282 migrate to IDBConnection 2015-02-25 22:21:24 +01:00
Thomas Müller bcf3704645 Merge pull request #14458 from owncloud/revive/11157
Get the real protocol behind several proxies
2015-02-25 02:51:46 -08:00
Thomas Müller 799e144b04 Merge pull request #14151 from owncloud/update-sabre2.1
Sabre Update to 2.1
2015-02-25 02:21:55 -08:00
Lukas Reschke 9adcd15cb3 Use [0] instead of current as HHVM might have problems with that 2015-02-24 13:37:34 +01:00
Lukas Reschke 1c6eae9017 Get the real protocol behind several proxies
X-Forwarded-Proto contains a list of protocols if ownCloud is behind multiple reverse proxies.

This is a revival of https://github.com/owncloud/core/pull/11157 using the new IRequest public API.
2015-02-24 12:24:55 +01:00
Vincent Petry 9f6dcb9d3e Sabre Update to 2.1
- VObject fixes for Sabre\VObject 3.3
- Remove VObject property workarounds
- Added prefetching for tags in sabre tags plugin
- Moved oc_properties logic to separate PropertyStorage backend (WIP)
- Fixed Sabre connector namespaces
- Improved files plugin to handle props on-demand
- Moved allowed props from server class to files plugin
- Fixed tags caching for files that are known to have no tags
  (less queries)
- Added/fixed unit tests for Sabre FilesPlugin, TagsPlugin
- Replace OC\Connector\Sabre\Request with direct call to
  httpRequest->setUrl()
- Fix exception detection in DAV client when using Sabre\DAV\Client
- Added setETag() on Node instead of using the static FileSystem
- Also preload tags/props when depth is infinity
2015-02-23 22:27:23 +01:00
Thomas Müller 0a9b8242ee properly initialize OC::$WEBROOT and host name 2015-02-23 21:49:35 +01:00
Bernhard Posselt 8176032176 Merge pull request #14427 from owncloud/fix-some-php-docs
Fix some PHPDocs
2015-02-23 14:04:35 +01:00
Lukas Reschke c06a94ecc2 Fix some PHPDocs 2015-02-23 12:19:52 +01:00
Jenkins for ownCloud 6a1a4880f0 Updating license headers 2015-02-23 12:13:59 +01:00
Lukas Reschke cebf9f6a5a Incorporate review changes 2015-02-16 22:13:03 +01:00
Lukas Reschke 992164446c Add blackmagic due to cyclic dependency 🙈 2015-02-16 22:13:01 +01:00
Lukas Reschke 9f91d64918 Make scrutinizer happy 2015-02-16 22:13:00 +01:00
Lukas Reschke 886bda5f81 Refactor OC_Request into TrustedDomainHelper and IRequest
This changeset removes the static class `OC_Request` and moves the functions either into `IRequest` which is accessible via `\OC::$server::->getRequest()` or into a separated `TrustedDomainHelper` class for some helper methods which should not be publicly exposed.

This changes only internal methods and nothing on the public API. Some public functions in `util.php` have been deprecated though in favour of the new non-static functions.

Unfortunately some part of this code uses things like `__DIR__` and thus is not completely unit-testable. Where tests where possible they ahve been added though.

Fixes https://github.com/owncloud/core/issues/13976 which was requested in https://github.com/owncloud/core/pull/13973#issuecomment-73492969
2015-02-16 22:13:00 +01:00
Morris Jobke 1bb6de7c1b Merge pull request #13425 from owncloud/phpdoc_cleanup
Cleanup of PHPDoc return types
2015-02-10 01:14:00 +01:00
Lukas Reschke 770fa761b8 Respect `mod_unique_id` and refactor `OC_Request::getRequestId`
When `mod_unique_id` is enabled the ID generated by it will be used for logging. This allows for correlation of the Apache logs and the ownCloud logs.

Testplan:

- [ ] When `mod_unique_id` is enabled the request ID equals the one generated by `mod_unique_id`.
- [ ] When `mod_unique_id` is not available the request ID is a 20 character long random string
- [ ] The generated Id is stable over the lifespan of one request

Changeset looks a little bit larger since I had to adjust every unit test using the HTTP\Request class for proper DI.

Fixes https://github.com/owncloud/core/issues/13366
2015-02-09 11:53:11 +01:00
Lukas Reschke bedf358b40 Use proper namespace
IAppManager lives in OCP\App and not in OCP.

Fixes https://github.com/owncloud/core/issues/13710
2015-01-27 17:34:25 +01:00
Bernhard Posselt 9df297324f get rid of log warning when using servercontainer 2015-01-22 15:33:09 +01:00
Robin McCorkell 2b99fc76ec Cleanup of PHPDoc return types 2015-01-16 20:30:43 +00:00
Bernhard Posselt bb0c88a577 always set url parameters when they are available in the app dispatch
prefer url parameters passed into the main method. If they are not present, use the containers urlParameters

add space
2015-01-15 15:22:52 +01:00
Morris Jobke 4ffe7ddb75 degraded logging policy for server container in AppFramework 2015-01-06 13:43:40 +01:00
Lukas Reschke 8689605999 Use info instead of warning log level
Otherwise the log is flooded as can be seen at https://github.com/owncloud/core/issues/13106

Fixes https://github.com/owncloud/core/issues/13106
2015-01-05 11:18:54 +01:00
Bernhard Posselt f195123765 Intelligent container
* resolves dependencies by type hint or variable name
* simpler route.php
* implementation of https://github.com/owncloud/core/issues/12829

Generates and injects parameters automatically. You can now build full classes like

    $c->query('MyClassName')

without having to register it as a service. The resolved object's instance will be saved by using registerService. If a constructor parameter is not type hinted, the parameter name will be taken.

Therefore the following two implementations are identical:

    class Class1 { function __construct(MyClassName $class)
    class Class1 { function __construct($MyClassName)

This makes it possible to also inject primitive values such as strings, arrays etc.

In addition if the query could not be resolved, a `QueryException` is now thrown

Routes can now be returned as an array from `routes.php` and an `appinfo/application.php` is optional

Old commit messages:

make it possible to return the routes instead of having to intialize the application
try to get the controller by convention
add first implementation of automatic resolve
add another test just to be sure
store the resolved object
more tests
add phpdoc to public app.php method
use the same variable for the public app.php method
deprecate old methods and add services for public interfaces
deprecated getServer method
disallow private api injection for apps other than core or settings (settings should be an app goddamnit :D)
register userid because its such an often used variable
fix indention and leading slash
use test namespace
add deprecation reasons, remove private api usage checks and remove deprecation from getServer()
add additional public interfaces
add public interface for rootfolder
fix syntax error
remove deprecation from methods where no alternative is there yet
remove deprecated from method which has no alternative
add timezone public service for #12881
add another deprecation hint
move deprecation into separate branch
remove dead comment
first try to get the namespace from the info.xml, if it does not exist, just uppercase the first letter
also trim the namespace name
add an interface for timefactory
move timefactory to public and add icontrollermethodreflector
keep core interface
fix copyright date in headers
2014-12-23 09:50:42 +01:00
Thomas Müller c3544bd27e Merge pull request #12982 from owncloud/timefac-iface
Add an interface for the timefactory class
2014-12-21 20:27:53 +01:00
Bernhard Posselt ba03b0b843 add an interface for the timefactory class
fix indention
2014-12-20 15:53:31 +01:00
Bernhard Posselt 6779bf113d add isAdmin and isInGroup methods for the group manager 2014-12-17 17:41:57 +01:00
Bernhard Posselt 236632702c add a isLoggedIn method to the usersession and deprecate the isLoggedIn method on the api 2014-12-17 17:40:52 +01:00
Bernhard Posselt d59c4e832f first round of deprecation 2014-12-16 19:50:31 +01:00
Olivier Paroz 469fd3b3a3 Olivier Paroz \OCP\AppFramework\Utility\IControllerMethodReflector 2014-12-14 23:54:31 +01:00
Philipp Knechtges 768aea57d3 make regex in controllermethodreflector.php compatible with PCRE 6.x
The syntax ?<...> seems to be only supported from PCRE 7.0 on. For
backwards-compability ?P<...> is used.
2014-12-14 10:52:21 +01:00
Lukas Reschke d197f43475 Use server container 2014-11-27 14:36:11 +01:00
Lukas Reschke 048139074d Add functions to modify cookies to response class
Currently there is no AppFramework way to modify cookies, which makes it unusable for quite some use-cases or results in untestable code.

This PR adds some basic functionalities to add and invalidate cookies.

Usage:
```php
$response = new TemplateResponse(...);
$response->addCookie('foo', 'bar');
$response->invalidateCookie('foo');
$response->addCookie('bar', 'foo', new \DateTime('2015-01-01 00:00'));
```

Existing cookies can be accessed with the AppFramework using `$this->request->getCookie($name)`.
2014-11-27 14:19:00 +01:00
Thomas Müller ddacd7f900 Merge pull request #12294 from owncloud/route-postfix
Add route postfix to allow url versioning when only the http method changed
2014-11-24 16:32:54 +01:00
Morris Jobke 1b17429c1d Merge pull request #12142 from owncloud/DeprecateOldIAPICalls
Deprecate older API wrappers and calls
2014-11-24 14:01:49 +01:00
Bernhard Posselt 4e90c44301 add postfix
add postfix
2014-11-19 12:01:42 +01:00
Lukas Reschke 07f0d76fc6 Move CSRF check
Because we're closing the session now before controllers are executed there are cases where we cannot write the session.
2014-11-17 15:10:53 +01:00
Lukas Reschke cd5925036a Check if app is enabled for user
Fixes https://github.com/owncloud/core/issues/12188 for AppFramework apps
2014-11-15 11:13:55 +01:00
Lukas Reschke 4302a78b27 Deprecate older API wrappers and calls
Those old classes have now non-static pendants and can be deprecated IMHO.
2014-11-12 17:39:25 +01:00
Bernhard Posselt 6d5a239abf Fix Pimple unset 2014-11-11 22:04:46 +01:00
Thomas Müller 994768d99f Update Pimple to V3.0 2014-11-03 16:57:16 +01:00
Bernhard Posselt 0696099bad add dataresponse
fix docstrings

adjust copyright date

another copyright date update

another header update

implement third headers argument, fix indention, fix docstrings

fix docstrings
2014-10-29 09:43:47 +01:00
Lukas Reschke d060180140 Use function outside of loop
Otherwise the function is executed n times which is a lot of overhead
2014-10-24 12:27:53 +02:00
Thomas Müller 6c1871da06 Merge pull request #10985 from owncloud/db-cleanup
Cleanup database handling
2014-10-23 13:48:33 +02:00
Lukas Reschke be06937e65 Use mixed as type
Actually query() returns value of the type "mixed" (as is also stated in the interface) - this is purely there to make our IDEs and Scrutinizer happier.
2014-10-22 15:09:33 +02:00
Thomas Müller 02c5933af8 introduce SessionMiddleWare to control session handling via an annotation 2014-10-22 12:44:19 +02:00
Robin Appelman d83b11d34a Use statements wrapper in \OCP\IDB 2014-10-22 12:29:53 +02:00
Robin Appelman 2ae6a0d96d Move creating the database connection to the server container 2014-10-22 12:29:53 +02:00