Skip to content

Commit

Permalink
Update to v19.0.0beta1
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Apr 10, 2020
1 parent 182a582 commit 0e3304c
Show file tree
Hide file tree
Showing 98 changed files with 202 additions and 168 deletions.
2 changes: 1 addition & 1 deletion OCP/Accounts/PropertyDoesNotExistException.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PropertyDoesNotExistException extends \Exception {
* @param string $msg the error message
* @since 15.0.0
*/
public function __construct($property) {
public function __construct($property){
parent::__construct('Property ' . $property . ' does not exist.');
}

Expand Down
1 change: 1 addition & 0 deletions OCP/Activity/IEventMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace OCP\Activity;


/**
* Interface EventMerger
*
Expand Down
22 changes: 11 additions & 11 deletions OCP/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class App {
* @return void
* @since 4.0.0
* @deprecated 14.0.0 Use settings section in appinfo.xml to register personal admin sections
*/
public static function registerPersonal($app, $page) {
\OC_App::registerPersonal($app, $page);
*/
public static function registerPersonal( $app, $page ) {
\OC_App::registerPersonal( $app, $page );
}

/**
Expand All @@ -68,8 +68,8 @@ public static function registerPersonal($app, $page) {
* @since 4.0.0
* @deprecated 14.0.0 Use settings section in appinfo.xml to register admin sections
*/
public static function registerAdmin($app, $page) {
\OC_App::registerAdmin($app, $page);
public static function registerAdmin( $app, $page ) {
\OC_App::registerAdmin( $app, $page );
}

/**
Expand All @@ -79,9 +79,9 @@ public static function registerAdmin($app, $page) {
* @return array|null
* @deprecated 14.0.0 ise \OC::$server->getAppManager()->getAppInfo($appId)
* @since 4.0.0
*/
public static function getAppInfo($app, $path=false) {
return \OC_App::getAppInfo($app, $path);
*/
public static function getAppInfo( $app, $path=false ) {
return \OC_App::getAppInfo( $app, $path);
}

/**
Expand All @@ -93,8 +93,8 @@ public static function getAppInfo($app, $path=false) {
* @since 4.0.0
* @deprecated 13.0.0 use \OC::$server->getAppManager()->isEnabledForUser($appId)
*/
public static function isEnabled($app) {
return \OC::$server->getAppManager()->isEnabledForUser($app);
public static function isEnabled( $app ) {
return \OC::$server->getAppManager()->isEnabledForUser( $app );
}

/**
Expand All @@ -104,7 +104,7 @@ public static function isEnabled($app) {
* @since 4.0.0
* @deprecated 14.0.0 use \OC::$server->getAppManager()->getAppVersion($appId)
*/
public static function getAppVersion($app) {
public static function getAppVersion( $app ) {
return \OC::$server->getAppManager()->getAppVersion($app);
}
}
96 changes: 48 additions & 48 deletions OCP/AppFramework/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,60 +39,60 @@
*/
abstract class ApiController extends Controller {

private $corsMethods;
private $corsAllowedHeaders;
private $corsMaxAge;
private $corsMethods;
private $corsAllowedHeaders;
private $corsMaxAge;

/**
* constructor of the controller
* @param string $appName the name of the app
* @param IRequest $request an instance of the request
* @param string $corsMethods comma separated string of HTTP verbs which
* should be allowed for websites or webapps when calling your API, defaults to
* 'PUT, POST, GET, DELETE, PATCH'
* @param string $corsAllowedHeaders comma separated string of HTTP headers
* which should be allowed for websites or webapps when calling your API,
* defaults to 'Authorization, Content-Type, Accept'
* @param int $corsMaxAge number in seconds how long a preflighted OPTIONS
* request should be cached, defaults to 1728000 seconds
/**
* constructor of the controller
* @param string $appName the name of the app
* @param IRequest $request an instance of the request
* @param string $corsMethods comma separated string of HTTP verbs which
* should be allowed for websites or webapps when calling your API, defaults to
* 'PUT, POST, GET, DELETE, PATCH'
* @param string $corsAllowedHeaders comma separated string of HTTP headers
* which should be allowed for websites or webapps when calling your API,
* defaults to 'Authorization, Content-Type, Accept'
* @param int $corsMaxAge number in seconds how long a preflighted OPTIONS
* request should be cached, defaults to 1728000 seconds
* @since 7.0.0
*/
public function __construct($appName,
IRequest $request,
$corsMethods='PUT, POST, GET, DELETE, PATCH',
$corsAllowedHeaders='Authorization, Content-Type, Accept',
$corsMaxAge=1728000) {
parent::__construct($appName, $request);
$this->corsMethods = $corsMethods;
$this->corsAllowedHeaders = $corsAllowedHeaders;
$this->corsMaxAge = $corsMaxAge;
}
*/
public function __construct($appName,
IRequest $request,
$corsMethods='PUT, POST, GET, DELETE, PATCH',
$corsAllowedHeaders='Authorization, Content-Type, Accept',
$corsMaxAge=1728000){
parent::__construct($appName, $request);
$this->corsMethods = $corsMethods;
$this->corsAllowedHeaders = $corsAllowedHeaders;
$this->corsMaxAge = $corsMaxAge;
}


/**
* This method implements a preflighted cors response for you that you can
* link to for the options request
*
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
/**
* This method implements a preflighted cors response for you that you can
* link to for the options request
*
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
* @since 7.0.0
*/
public function preflightedCors() {
if(isset($this->request->server['HTTP_ORIGIN'])) {
$origin = $this->request->server['HTTP_ORIGIN'];
} else {
$origin = '*';
}
*/
public function preflightedCors() {
if(isset($this->request->server['HTTP_ORIGIN'])) {
$origin = $this->request->server['HTTP_ORIGIN'];
} else {
$origin = '*';
}

$response = new Response();
$response->addHeader('Access-Control-Allow-Origin', $origin);
$response->addHeader('Access-Control-Allow-Methods', $this->corsMethods);
$response->addHeader('Access-Control-Max-Age', (string)$this->corsMaxAge);
$response->addHeader('Access-Control-Allow-Headers', $this->corsAllowedHeaders);
$response->addHeader('Access-Control-Allow-Credentials', 'false');
return $response;
}
$response = new Response();
$response->addHeader('Access-Control-Allow-Origin', $origin);
$response->addHeader('Access-Control-Allow-Methods', $this->corsMethods);
$response->addHeader('Access-Control-Max-Age', (string)$this->corsMaxAge);
$response->addHeader('Access-Control-Allow-Headers', $this->corsAllowedHeaders);
$response->addHeader('Access-Control-Allow-Credentials', 'false');
return $response;
}


}
1 change: 0 additions & 1 deletion OCP/AppFramework/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
*/

namespace OCP\AppFramework;

use OC\AppFramework\Routing\RouteConfig;
use OC\ServerContainer;
use OCP\Route\IRouter;
Expand Down
2 changes: 1 addition & 1 deletion OCP/AppFramework/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ abstract class Controller {
* @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0
*/
public function __construct($appName,
IRequest $request) {
IRequest $request) {
$this->appName = $appName;
$this->request = $request;

Expand Down
3 changes: 2 additions & 1 deletion OCP/AppFramework/Db/DoesNotExistException.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace OCP\AppFramework\Db;


/**
* This is returned or should be returned when a find request does not find an
* entry in the database
Expand All @@ -39,7 +40,7 @@ class DoesNotExistException extends \Exception implements IMapperException {
* @param string $msg the error message
* @since 7.0.0
*/
public function __construct($msg) {
public function __construct($msg){
parent::__construct($msg);
}

Expand Down
17 changes: 9 additions & 8 deletions OCP/AppFramework/Db/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

namespace OCP\AppFramework\Db;


use function lcfirst;
use function substr;

Expand Down Expand Up @@ -65,7 +66,7 @@ public static function fromParams(array $params) {
* @param array $row the row to map onto the entity
* @since 7.0.0
*/
public static function fromRow(array $row) {
public static function fromRow(array $row){
$instance = new static();

foreach($row as $key => $value){
Expand Down Expand Up @@ -93,7 +94,7 @@ public function getFieldTypes() {
* Marks the entity as clean needed for setting the id after the insertion
* @since 7.0.0
*/
public function resetUpdatedFields() {
public function resetUpdatedFields(){
$this->_updatedFields = [];
}

Expand Down Expand Up @@ -175,7 +176,7 @@ protected function isGetterForBoolProperty(string $methodName): bool {
* @param string $attribute the name of the attribute
* @since 7.0.0
*/
protected function markFieldUpdated($attribute) {
protected function markFieldUpdated($attribute){
$this->_updatedFields[$attribute] = true;
}

Expand All @@ -186,7 +187,7 @@ protected function markFieldUpdated($attribute) {
* @return string the property name
* @since 7.0.0
*/
public function columnToProperty($columnName) {
public function columnToProperty($columnName){
$parts = explode('_', $columnName);
$property = null;

Expand All @@ -208,7 +209,7 @@ public function columnToProperty($columnName) {
* @return string the column name
* @since 7.0.0
*/
public function propertyToColumn($property) {
public function propertyToColumn($property){
$parts = preg_split('/(?=[A-Z])/', $property);
$column = null;

Expand All @@ -228,7 +229,7 @@ public function propertyToColumn($property) {
* @return array array of updated fields for update query
* @since 7.0.0
*/
public function getUpdatedFields() {
public function getUpdatedFields(){
return $this->_updatedFields;
}

Expand All @@ -240,7 +241,7 @@ public function getUpdatedFields() {
* @param string $type the type which will be used to call settype()
* @since 7.0.0
*/
protected function addType($fieldName, $type) {
protected function addType($fieldName, $type){
$this->_fieldTypes[$fieldName] = $type;
}

Expand All @@ -252,7 +253,7 @@ protected function addType($fieldName, $type) {
* @return string slugified value
* @since 7.0.0
*/
public function slugify($attributeName) {
public function slugify($attributeName){
// toSlug should only work for existing attributes
if(property_exists($this, $attributeName)){
$value = $this->$attributeName;
Expand Down
18 changes: 9 additions & 9 deletions OCP/AppFramework/Db/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ abstract class Mapper {
* @since 7.0.0
* @deprecated 14.0.0 Move over to QBMapper
*/
public function __construct(IDBConnection $db, $tableName, $entityClass=null) {
public function __construct(IDBConnection $db, $tableName, $entityClass=null){
$this->db = $db;
$this->tableName = '*PREFIX*' . $tableName;

Expand All @@ -68,7 +68,7 @@ public function __construct(IDBConnection $db, $tableName, $entityClass=null) {
* @since 7.0.0
* @deprecated 14.0.0 Move over to QBMapper
*/
public function getTableName() {
public function getTableName(){
return $this->tableName;
}

Expand All @@ -80,7 +80,7 @@ public function getTableName() {
* @since 7.0.0 - return value added in 8.1.0
* @deprecated 14.0.0 Move over to QBMapper
*/
public function delete(Entity $entity) {
public function delete(Entity $entity){
$sql = 'DELETE FROM `' . $this->tableName . '` WHERE `id` = ?';
$stmt = $this->execute($sql, [$entity->getId()]);
$stmt->closeCursor();
Expand All @@ -95,7 +95,7 @@ public function delete(Entity $entity) {
* @since 7.0.0
* @deprecated 14.0.0 Move over to QBMapper
*/
public function insert(Entity $entity) {
public function insert(Entity $entity){
// get updated fields to save, fields have to be set using a setter to
// be saved
$properties = $entity->getUpdatedFields();
Expand Down Expand Up @@ -145,7 +145,7 @@ public function insert(Entity $entity) {
* @since 7.0.0 - return value was added in 8.0.0
* @deprecated 14.0.0 Move over to QBMapper
*/
public function update(Entity $entity) {
public function update(Entity $entity){
// if entity wasn't changed it makes no sense to run a db query
$properties = $entity->getUpdatedFields();
if(count($properties) === 0) {
Expand Down Expand Up @@ -235,7 +235,7 @@ private function getPDOType($value) {
* @since 7.0.0
* @deprecated 14.0.0 Move over to QBMapper
*/
protected function execute($sql, array $params=[], $limit=null, $offset=null) {
protected function execute($sql, array $params=[], $limit=null, $offset=null){
$query = $this->db->prepare($sql, $limit, $offset);

if ($this->isAssocArray($params)) {
Expand Down Expand Up @@ -271,7 +271,7 @@ protected function execute($sql, array $params=[], $limit=null, $offset=null) {
* @since 7.0.0
* @deprecated 14.0.0 Move over to QBMapper
*/
protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null) {
protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null){
$stmt = $this->execute($sql, $params, $limit, $offset);
$row = $stmt->fetch();

Expand All @@ -285,7 +285,7 @@ protected function findOneQuery($sql, array $params=[], $limit=null, $offset=nul
$row2 = $stmt->fetch();
$stmt->closeCursor();
//MDB2 returns null, PDO and doctrine false when no row is available
if(! ($row2 === false || $row2 === null)) {
if( ! ($row2 === false || $row2 === null )) {
$msg = $this->buildDebugMessage(
'Did not expect more than one result when executing', $sql, $params, $limit, $offset
);
Expand Down Expand Up @@ -367,7 +367,7 @@ protected function findEntities($sql, array $params=[], $limit=null, $offset=nul
* @since 7.0.0
* @deprecated 14.0.0 Move over to QBMapper
*/
protected function findEntity($sql, array $params=[], $limit=null, $offset=null) {
protected function findEntity($sql, array $params=[], $limit=null, $offset=null){
return $this->mapRowToEntity($this->findOneQuery($sql, $params, $limit, $offset));
}

Expand Down
3 changes: 2 additions & 1 deletion OCP/AppFramework/Db/MultipleObjectsReturnedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace OCP\AppFramework\Db;


/**
* This is returned or should be returned when a find request finds more than one
* row
Expand All @@ -39,7 +40,7 @@ class MultipleObjectsReturnedException extends \Exception implements IMapperExce
* @param string $msg the error message
* @since 7.0.0
*/
public function __construct($msg) {
public function __construct($msg){
parent::__construct($msg);
}

Expand Down
Loading

0 comments on commit 0e3304c

Please sign in to comment.