Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/OCPSinceChecker.php22
-rw-r--r--build/gen-coverage-badge.php2
-rw-r--r--build/htaccess-checker.php2
-rw-r--r--build/integration/features/bootstrap/Auth.php1
-rw-r--r--build/integration/features/bootstrap/BasicStructure.php5
-rw-r--r--build/integration/features/bootstrap/CalDavContext.php13
-rw-r--r--build/integration/features/bootstrap/CapabilitiesContext.php4
-rw-r--r--build/integration/features/bootstrap/CardDavContext.php21
-rw-r--r--build/integration/features/bootstrap/ChecksumsContext.php32
-rw-r--r--build/integration/features/bootstrap/CommandLineContext.php2
-rw-r--r--build/integration/features/bootstrap/CommentsContext.php2
-rw-r--r--build/integration/features/bootstrap/FederationContext.php5
-rw-r--r--build/integration/features/bootstrap/FilesDropContext.php4
-rw-r--r--build/integration/features/bootstrap/LDAPContext.php14
-rw-r--r--build/integration/features/bootstrap/Provisioning.php6
-rw-r--r--build/integration/features/bootstrap/Search.php1
-rw-r--r--build/integration/features/bootstrap/Sharing.php99
-rw-r--r--build/integration/features/bootstrap/SharingContext.php3
-rw-r--r--build/license.php15
-rw-r--r--build/signed-off-checker.php32
20 files changed, 125 insertions, 160 deletions
diff --git a/build/OCPSinceChecker.php b/build/OCPSinceChecker.php
index 13f58fe2550..ff314170149 100644
--- a/build/OCPSinceChecker.php
+++ b/build/OCPSinceChecker.php
@@ -40,51 +40,51 @@ class SinceTagCheckVisitor extends \PhpParser\NodeVisitorAbstract {
protected $errors = [];
public function enterNode(\PhpParser\Node $node) {
- if($this->deprecatedClass) {
+ if ($this->deprecatedClass) {
return;
}
- if($node instanceof \PhpParser\Node\Stmt\Namespace_) {
+ if ($node instanceof \PhpParser\Node\Stmt\Namespace_) {
$this->namespace = $node->name;
}
- if($node instanceof \PhpParser\Node\Stmt\Interface_ or
+ if ($node instanceof \PhpParser\Node\Stmt\Interface_ or
$node instanceof \PhpParser\Node\Stmt\Class_) {
$this->className = $node->name;
/** @var \PhpParser\Comment\Doc[] $comments */
$comments = $node->getAttribute('comments');
- if(count($comments) === 0) {
+ if (count($comments) === 0) {
$this->errors[] = 'PHPDoc is needed for ' . $this->namespace . '\\' . $this->className . '::' . $node->name;
return;
}
$comment = $comments[count($comments) - 1];
$text = $comment->getText();
- if(strpos($text, '@deprecated') !== false) {
+ if (strpos($text, '@deprecated') !== false) {
$this->deprecatedClass = true;
}
- if($this->deprecatedClass === false && strpos($text, '@since') === false && strpos($text, '@deprecated') === false) {
+ if ($this->deprecatedClass === false && strpos($text, '@since') === false && strpos($text, '@deprecated') === false) {
$type = $node instanceof \PhpParser\Node\Stmt\Interface_ ? 'interface' : 'class';
$this->errors[] = '@since or @deprecated tag is needed in PHPDoc for ' . $type . ' ' . $this->namespace . '\\' . $this->className;
return;
}
}
- if($node instanceof \PhpParser\Node\Stmt\ClassMethod) {
+ if ($node instanceof \PhpParser\Node\Stmt\ClassMethod) {
/** @var \PhpParser\Node\Stmt\ClassMethod $node */
/** @var \PhpParser\Comment\Doc[] $comments */
$comments = $node->getAttribute('comments');
- if(count($comments) === 0) {
+ if (count($comments) === 0) {
$this->errors[] = 'PHPDoc is needed for ' . $this->namespace . '\\' . $this->className . '::' . $node->name;
return;
}
$comment = $comments[count($comments) - 1];
$text = $comment->getText();
- if(strpos($text, '@since') === false && strpos($text, '@deprecated') === false) {
+ if (strpos($text, '@since') === false && strpos($text, '@deprecated') === false) {
$this->errors[] = '@since or @deprecated tag is needed in PHPDoc for ' . $this->namespace . '\\' . $this->className . '::' . $node->name;
return;
}
@@ -108,7 +108,7 @@ $Regex = new RegexIterator($Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GE
$errors = [];
-foreach($Regex as $file) {
+foreach ($Regex as $file) {
$stmts = $parser->parse(file_get_contents($file[0]));
$visitor = new SinceTagCheckVisitor();
@@ -119,7 +119,7 @@ foreach($Regex as $file) {
$errors = array_merge($errors, $visitor->getErrors());
}
-if(count($errors)) {
+if (count($errors)) {
echo join(PHP_EOL, $errors) . PHP_EOL . PHP_EOL;
exit(1);
}
diff --git a/build/gen-coverage-badge.php b/build/gen-coverage-badge.php
index b610b2748d6..0164951fc1c 100644
--- a/build/gen-coverage-badge.php
+++ b/build/gen-coverage-badge.php
@@ -52,7 +52,7 @@ try {
}
$content = file_get_contents("https://img.shields.io/badge/coverage-$percent%-$color.svg");
file_put_contents('coverage.svg', $content);
-} catch(Exception $ex) {
+} catch (Exception $ex) {
echo $ex->getMessage() . PHP_EOL;
$content = file_get_contents("https://img.shields.io/badge/coverage-ERROR-red.svg");
file_put_contents('coverage.svg', $content);
diff --git a/build/htaccess-checker.php b/build/htaccess-checker.php
index b6932d6543a..950735463c9 100644
--- a/build/htaccess-checker.php
+++ b/build/htaccess-checker.php
@@ -27,7 +27,7 @@
*/
$htaccess = file_get_contents(__DIR__ . '/../.htaccess');
-if(strpos($htaccess, 'DO NOT CHANGE ANYTHING') !== false) {
+if (strpos($htaccess, 'DO NOT CHANGE ANYTHING') !== false) {
echo(".htaccess file has invalid changes!\n");
exit(1);
} else {
diff --git a/build/integration/features/bootstrap/Auth.php b/build/integration/features/bootstrap/Auth.php
index e48c0967cee..c621ef3572d 100644
--- a/build/integration/features/bootstrap/Auth.php
+++ b/build/integration/features/bootstrap/Auth.php
@@ -270,5 +270,4 @@ trait Auth {
public function whenTheSessionCookieExpires() {
$this->cookieJar->clearSessionCookies();
}
-
}
diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php
index 6a42cc1915d..438a6418f07 100644
--- a/build/integration/features/bootstrap/BasicStructure.php
+++ b/build/integration/features/bootstrap/BasicStructure.php
@@ -43,7 +43,6 @@ use Psr\Http\Message\ResponseInterface;
require __DIR__ . '/../../vendor/autoload.php';
trait BasicStructure {
-
use Auth;
use Download;
use Trashbin;
@@ -516,11 +515,11 @@ trait BasicStructure {
* @throws \Exception
*/
public function theFollowingHeadersShouldBeSet(TableNode $table) {
- foreach($table->getTable() as $header) {
+ foreach ($table->getTable() as $header) {
$headerName = $header[0];
$expectedHeaderValue = $header[1];
$returnedHeader = $this->response->getHeader($headerName)[0];
- if($returnedHeader !== $expectedHeaderValue) {
+ if ($returnedHeader !== $expectedHeaderValue) {
throw new \Exception(
sprintf(
"Expected value '%s' for header '%s', got '%s'",
diff --git a/build/integration/features/bootstrap/CalDavContext.php b/build/integration/features/bootstrap/CalDavContext.php
index b7b099b9850..76fe0576704 100644
--- a/build/integration/features/bootstrap/CalDavContext.php
+++ b/build/integration/features/bootstrap/CalDavContext.php
@@ -71,7 +71,8 @@ class CalDavContext implements \Behat\Behat\Context\Context {
],
]
);
- } catch (\GuzzleHttp\Exception\ClientException $e) {}
+ } catch (\GuzzleHttp\Exception\ClientException $e) {
+ }
}
/**
@@ -106,7 +107,7 @@ class CalDavContext implements \Behat\Behat\Context\Context {
* @throws \Exception
*/
public function theCaldavHttpStatusCodeShouldBe($code) {
- if((int)$code !== $this->response->getStatusCode()) {
+ if ((int)$code !== $this->response->getStatusCode()) {
throw new \Exception(
sprintf(
'Expected %s got %s',
@@ -117,7 +118,7 @@ class CalDavContext implements \Behat\Behat\Context\Context {
}
$body = $this->response->getBody()->getContents();
- if($body && substr($body, 0, 1) === '<') {
+ if ($body && substr($body, 0, 1) === '<') {
$reader = new Sabre\Xml\Reader();
$reader->xml($body);
$this->responseXml = $reader->parse();
@@ -132,7 +133,7 @@ class CalDavContext implements \Behat\Behat\Context\Context {
public function theExceptionIs($message) {
$result = $this->responseXml['value'][0]['value'];
- if($message !== $result) {
+ if ($message !== $result) {
throw new \Exception(
sprintf(
'Expected %s got %s',
@@ -151,7 +152,7 @@ class CalDavContext implements \Behat\Behat\Context\Context {
public function theErrorMessageIs($message) {
$result = $this->responseXml['value'][1]['value'];
- if($message !== $result) {
+ if ($message !== $result) {
throw new \Exception(
sprintf(
'Expected %s got %s',
@@ -219,7 +220,7 @@ class CalDavContext implements \Behat\Behat\Context\Context {
$jsonEncoded = json_encode($this->responseXml);
$arrayElement = json_decode($jsonEncoded, true);
$actual = count($arrayElement['value']) - 1;
- if($actual !== (int)$amount) {
+ if ($actual !== (int)$amount) {
throw new InvalidArgumentException(
sprintf(
'Expected %s got %s',
diff --git a/build/integration/features/bootstrap/CapabilitiesContext.php b/build/integration/features/bootstrap/CapabilitiesContext.php
index 9f778ea5b5a..427e115605c 100644
--- a/build/integration/features/bootstrap/CapabilitiesContext.php
+++ b/build/integration/features/bootstrap/CapabilitiesContext.php
@@ -34,7 +34,6 @@ require __DIR__ . '/../../vendor/autoload.php';
* Capabilities context.
*/
class CapabilitiesContext implements Context, SnippetAcceptingContext {
-
use BasicStructure;
use AppConfiguration;
@@ -48,7 +47,7 @@ class CapabilitiesContext implements Context, SnippetAcceptingContext {
foreach ($formData->getHash() as $row) {
$path_to_element = explode('@@@', $row['path_to_element']);
$answeredValue = $capabilitiesXML->{$row['capability']};
- for ($i = 0; $i < count($path_to_element); $i++){
+ for ($i = 0; $i < count($path_to_element); $i++) {
$answeredValue = $answeredValue->{$path_to_element[$i]};
}
$answeredValue = (string)$answeredValue;
@@ -57,7 +56,6 @@ class CapabilitiesContext implements Context, SnippetAcceptingContext {
$answeredValue,
"Failed field " . $row['capability'] . " " . $row['path_to_element']
);
-
}
}
diff --git a/build/integration/features/bootstrap/CardDavContext.php b/build/integration/features/bootstrap/CardDavContext.php
index 3e79c41fd13..c6d12c0f980 100644
--- a/build/integration/features/bootstrap/CardDavContext.php
+++ b/build/integration/features/bootstrap/CardDavContext.php
@@ -71,7 +71,8 @@ class CardDavContext implements \Behat\Behat\Context\Context {
],
]
);
- } catch (\GuzzleHttp\Exception\ClientException $e) {}
+ } catch (\GuzzleHttp\Exception\ClientException $e) {
+ }
}
/**
@@ -101,7 +102,7 @@ class CardDavContext implements \Behat\Behat\Context\Context {
$this->response = $e->getResponse();
}
- if((int)$statusCode !== $this->response->getStatusCode()) {
+ if ((int)$statusCode !== $this->response->getStatusCode()) {
throw new \Exception(
sprintf(
'Expected %s got %s',
@@ -112,7 +113,7 @@ class CardDavContext implements \Behat\Behat\Context\Context {
}
$body = $this->response->getBody()->getContents();
- if(substr($body, 0, 1) === '<') {
+ if (substr($body, 0, 1) === '<') {
$reader = new Sabre\Xml\Reader();
$reader->xml($body);
$this->responseXml = $reader->parse();
@@ -154,7 +155,7 @@ class CardDavContext implements \Behat\Behat\Context\Context {
]
);
- if($this->response->getStatusCode() !== (int)$statusCode) {
+ if ($this->response->getStatusCode() !== (int)$statusCode) {
throw new \Exception(
sprintf(
'Expected %s got %s',
@@ -173,7 +174,7 @@ class CardDavContext implements \Behat\Behat\Context\Context {
public function theCarddavExceptionIs($message) {
$result = $this->responseXml['value'][0]['value'];
- if($message !== $result) {
+ if ($message !== $result) {
throw new \Exception(
sprintf(
'Expected %s got %s',
@@ -192,7 +193,7 @@ class CardDavContext implements \Behat\Behat\Context\Context {
public function theCarddavErrorMessageIs($message) {
$result = $this->responseXml['value'][1]['value'];
- if($message !== $result) {
+ if ($message !== $result) {
throw new \Exception(
sprintf(
'Expected %s got %s',
@@ -225,7 +226,7 @@ class CardDavContext implements \Behat\Behat\Context\Context {
]
);
- if($this->response->getStatusCode() !== 201) {
+ if ($this->response->getStatusCode() !== 201) {
throw new \Exception(
sprintf(
'Expected %s got %s',
@@ -284,7 +285,7 @@ class CardDavContext implements \Behat\Behat\Context\Context {
]
);
} catch (\GuzzleHttp\Exception\ClientException $e) {
- $this->response = $e->getResponse();
+ $this->response = $e->getResponse();
}
}
@@ -294,11 +295,11 @@ class CardDavContext implements \Behat\Behat\Context\Context {
* @throws \Exception
*/
public function theFollowingHttpHeadersShouldBeSet(\Behat\Gherkin\Node\TableNode $table) {
- foreach($table->getTable() as $header) {
+ foreach ($table->getTable() as $header) {
$headerName = $header[0];
$expectedHeaderValue = $header[1];
$returnedHeader = $this->response->getHeader($headerName)[0];
- if($returnedHeader !== $expectedHeaderValue) {
+ if ($returnedHeader !== $expectedHeaderValue) {
throw new \Exception(
sprintf(
"Expected value '%s' for header '%s', got '%s'",
diff --git a/build/integration/features/bootstrap/ChecksumsContext.php b/build/integration/features/bootstrap/ChecksumsContext.php
index f6587b53d41..be9059cb710 100644
--- a/build/integration/features/bootstrap/ChecksumsContext.php
+++ b/build/integration/features/bootstrap/ChecksumsContext.php
@@ -64,7 +64,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @return string
*/
private function getPasswordForUser($userName) {
- if($userName === 'admin') {
+ if ($userName === 'admin') {
return 'admin';
}
return '123456';
@@ -77,8 +77,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @param string $destination
* @param string $checksum
*/
- public function userUploadsFileToWithChecksum($user, $source, $destination, $checksum)
- {
+ public function userUploadsFileToWithChecksum($user, $source, $destination, $checksum) {
$file = \GuzzleHttp\Psr7\stream_for(fopen($source, 'r'));
try {
$this->response = $this->client->put(
@@ -106,7 +105,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @throws \Exception
*/
public function theWebdavResponseShouldHaveAStatusCode($statusCode) {
- if((int)$statusCode !== $this->response->getStatusCode()) {
+ if ((int)$statusCode !== $this->response->getStatusCode()) {
throw new \Exception("Expected $statusCode, got ".$this->response->getStatusCode());
}
}
@@ -116,8 +115,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @param string $user
* @param string $path
*/
- public function userRequestTheChecksumOfViaPropfind($user, $path)
- {
+ public function userRequestTheChecksumOfViaPropfind($user, $path) {
$this->response = $this->client->request(
'PROPFIND',
$this->baseUrl . '/remote.php/webdav' . $path,
@@ -141,8 +139,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @param string $checksum
* @throws \Exception
*/
- public function theWebdavChecksumShouldMatch($checksum)
- {
+ public function theWebdavChecksumShouldMatch($checksum) {
$service = new Sabre\Xml\Service();
$parsed = $service->parse($this->response->getBody()->getContents());
@@ -162,8 +159,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @param string $user
* @param string $path
*/
- public function userDownloadsTheFile($user, $path)
- {
+ public function userDownloadsTheFile($user, $path) {
$this->response = $this->client->get(
$this->baseUrl . '/remote.php/webdav' . $path,
[
@@ -180,8 +176,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @param string $checksum
* @throws \Exception
*/
- public function theHeaderChecksumShouldMatch($checksum)
- {
+ public function theHeaderChecksumShouldMatch($checksum) {
if ($this->response->getHeader('OC-Checksum')[0] !== $checksum) {
throw new \Exception("Expected $checksum, got ".$this->response->getHeader('OC-Checksum')[0]);
}
@@ -193,8 +188,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @param string $source
* @param string $destination
*/
- public function userCopiedFileTo($user, $source, $destination)
- {
+ public function userCopiedFileTo($user, $source, $destination) {
$this->response = $this->client->request(
'MOVE',
$this->baseUrl . '/remote.php/webdav' . $source,
@@ -213,8 +207,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
/**
* @Then The webdav checksum should be empty
*/
- public function theWebdavChecksumShouldBeEmpty()
- {
+ public function theWebdavChecksumShouldBeEmpty() {
$service = new Sabre\Xml\Service();
$parsed = $service->parse($this->response->getBody()->getContents());
@@ -232,8 +225,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
/**
* @Then The OC-Checksum header should not be there
*/
- public function theOcChecksumHeaderShouldNotBeThere()
- {
+ public function theOcChecksumHeaderShouldNotBeThere() {
if ($this->response->hasHeader('OC-Checksum')) {
throw new \Exception("Expected no checksum header but got ".$this->response->getHeader('OC-Checksum')[0]);
}
@@ -248,8 +240,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
* @param string $destination
* @param string $checksum
*/
- public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $data, $destination, $checksum)
- {
+ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $data, $destination, $checksum) {
$num -= 1;
$this->response = $this->client->put(
$this->baseUrl . '/remote.php/webdav' . $destination . '-chunking-42-'.$total.'-'.$num,
@@ -265,6 +256,5 @@ class ChecksumsContext implements \Behat\Behat\Context\Context {
]
]
);
-
}
}
diff --git a/build/integration/features/bootstrap/CommandLineContext.php b/build/integration/features/bootstrap/CommandLineContext.php
index 678cf40351f..d233353262d 100644
--- a/build/integration/features/bootstrap/CommandLineContext.php
+++ b/build/integration/features/bootstrap/CommandLineContext.php
@@ -110,7 +110,7 @@ class CommandLineContext implements \Behat\Behat\Context\Context {
*/
public function transferingOwnershipPath($path, $user1, $user2) {
$path = '--path=' . $path;
- if($this->runOcc(['files:transfer-ownership', $path, $user1, $user2]) === 0) {
+ if ($this->runOcc(['files:transfer-ownership', $path, $user1, $user2]) === 0) {
$this->lastTransferPath = $this->findLastTransferFolderForUser($user1, $user2);
} else {
// failure
diff --git a/build/integration/features/bootstrap/CommentsContext.php b/build/integration/features/bootstrap/CommentsContext.php
index c3577658f0c..ebd7d5697e5 100644
--- a/build/integration/features/bootstrap/CommentsContext.php
+++ b/build/integration/features/bootstrap/CommentsContext.php
@@ -297,6 +297,4 @@ class CommentsContext implements \Behat\Behat\Context\Context {
throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")");
}
}
-
-
}
diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php
index dce62b16c0d..ca1869c10ac 100644
--- a/build/integration/features/bootstrap/FederationContext.php
+++ b/build/integration/features/bootstrap/FederationContext.php
@@ -33,7 +33,6 @@ require __DIR__ . '/../../vendor/autoload.php';
* Federation context.
*/
class FederationContext implements Context, SnippetAcceptingContext {
-
use WebDav;
use AppConfiguration;
@@ -47,7 +46,7 @@ class FederationContext implements Context, SnippetAcceptingContext {
* @param string $shareeServer "LOCAL" or "REMOTE"
*/
public function federateSharing($sharerUser, $sharerServer, $sharerPath, $shareeUser, $shareeServer) {
- if ($shareeServer == "REMOTE"){
+ if ($shareeServer == "REMOTE") {
$shareWith = "$shareeUser@" . substr($this->remoteBaseUrl, 0, -4);
} else {
$shareWith = "$shareeUser@" . substr($this->localBaseUrl, 0, -4);
@@ -68,7 +67,7 @@ class FederationContext implements Context, SnippetAcceptingContext {
* @param string $shareeServer "LOCAL" or "REMOTE"
*/
public function federateGroupSharing($sharerUser, $sharerServer, $sharerPath, $shareeGroup, $shareeServer) {
- if ($shareeServer == "REMOTE"){
+ if ($shareeServer == "REMOTE") {
$shareWith = "$shareeGroup@" . substr($this->remoteBaseUrl, 0, -4);
} else {
$shareWith = "$shareeGroup@" . substr($this->localBaseUrl, 0, -4);
diff --git a/build/integration/features/bootstrap/FilesDropContext.php b/build/integration/features/bootstrap/FilesDropContext.php
index 8f522d6f2ce..d1fd2e8d0c9 100644
--- a/build/integration/features/bootstrap/FilesDropContext.php
+++ b/build/integration/features/bootstrap/FilesDropContext.php
@@ -37,7 +37,7 @@ class FilesDropContext implements Context, SnippetAcceptingContext {
public function droppingFileWith($path, $content) {
$client = new Client();
$options = [];
- if (count($this->lastShareData->data->element) > 0){
+ if (count($this->lastShareData->data->element) > 0) {
$token = $this->lastShareData->data[0]->token;
} else {
$token = $this->lastShareData->data[0]->token;
@@ -65,7 +65,7 @@ class FilesDropContext implements Context, SnippetAcceptingContext {
public function creatingFolderInDrop($folder) {
$client = new Client();
$options = [];
- if (count($this->lastShareData->data->element) > 0){
+ if (count($this->lastShareData->data->element) > 0) {
$token = $this->lastShareData->data[0]->token;
} else {
$token = $this->lastShareData->data[0]->token;
diff --git a/build/integration/features/bootstrap/LDAPContext.php b/build/integration/features/bootstrap/LDAPContext.php
index 306b1e3c517..4217bc640c9 100644
--- a/build/integration/features/bootstrap/LDAPContext.php
+++ b/build/integration/features/bootstrap/LDAPContext.php
@@ -38,7 +38,7 @@ class LDAPContext implements Context {
/** @AfterScenario */
public function teardown() {
- if($this->configID === null) {
+ if ($this->configID === null) {
return;
}
$this->disableLDAPConfiguration(); # via occ in case of big config issues
@@ -140,7 +140,7 @@ class LDAPContext implements Context {
$originalAsAn = $this->currentUser;
$this->asAn('admin');
$configData = $table->getRows();
- foreach($configData as &$row) {
+ foreach ($configData as &$row) {
$row[0] = 'configData[' . $row[0] . ']';
}
$this->settingTheLDAPConfigurationTo(new TableNode($configData));
@@ -153,8 +153,8 @@ class LDAPContext implements Context {
public function theGroupResultShouldMatch(string $type, TableNode $expectations) {
$listReturnedElements = simplexml_load_string($this->response->getBody())->data[0]->$type[0]->element;
$extractedIDsArray = json_decode(json_encode($listReturnedElements), 1);
- foreach($expectations->getRows() as $expectation) {
- if((int)$expectation[1] === 1) {
+ foreach ($expectations->getRows() as $expectation) {
+ if ((int)$expectation[1] === 1) {
Assert::assertContains($expectation[0], $extractedIDsArray);
} else {
Assert::assertNotContains($expectation[0], $extractedIDsArray);
@@ -182,8 +182,8 @@ class LDAPContext implements Context {
$listReturnedElements = simplexml_load_string($this->response->getBody())->data[0]->$type[0]->element;
$extractedIDsArray = json_decode(json_encode($listReturnedElements), 1);
$uidsFound = 0;
- foreach($expectations->getRows() as $expectation) {
- if(in_array($expectation[0], $extractedIDsArray)) {
+ foreach ($expectations->getRows() as $expectation) {
+ if (in_array($expectation[0], $extractedIDsArray)) {
$uidsFound++;
}
}
@@ -194,7 +194,7 @@ class LDAPContext implements Context {
* @Given /^the record's fields should match$/
*/
public function theRecordFieldsShouldMatch(TableNode $expectations) {
- foreach($expectations->getRowsHash() as $k => $v) {
+ foreach ($expectations->getRowsHash() as $k => $v) {
$value = (string)simplexml_load_string($this->response->getBody())->data[0]->$k;
Assert::assertEquals($v, $value, "got $value");
}
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php
index 1301d5551f6..c6cfa881fb5 100644
--- a/build/integration/features/bootstrap/Provisioning.php
+++ b/build/integration/features/bootstrap/Provisioning.php
@@ -380,7 +380,6 @@ trait Provisioning {
$this->userExists($user);
$this->groupExists($group);
$this->addingUserToGroup($user, $group);
-
}
/**
@@ -539,7 +538,6 @@ trait Provisioning {
$respondedArray = $this->getArrayOfUsersResponded($this->response);
Assert::assertEquals($usersSimplified, $respondedArray, "", 0.0, 10, true);
}
-
}
/**
@@ -553,7 +551,6 @@ trait Provisioning {
$respondedArray = $this->getArrayOfGroupsResponded($this->response);
Assert::assertEquals($groupsSimplified, $respondedArray, "", 0.0, 10, true);
}
-
}
/**
@@ -567,7 +564,6 @@ trait Provisioning {
$respondedArray = $this->getArrayOfSubadminsResponded($this->response);
Assert::assertEquals($groupsSimplified, $respondedArray, "", 0.0, 10, true);
}
-
}
/**
@@ -581,7 +577,6 @@ trait Provisioning {
$respondedArray = $this->getArrayOfAppsResponded($this->response);
Assert::assertEquals($appsSimplified, $respondedArray, "", 0.0, 10, true);
}
-
}
/**
@@ -817,5 +812,4 @@ trait Provisioning {
}
$this->usingServer($previousServer);
}
-
}
diff --git a/build/integration/features/bootstrap/Search.php b/build/integration/features/bootstrap/Search.php
index 6d6d9c3ecda..72a20a08ce8 100644
--- a/build/integration/features/bootstrap/Search.php
+++ b/build/integration/features/bootstrap/Search.php
@@ -86,5 +86,4 @@ trait Search {
Assert::assertEquals($expectedValue, $searchResult[$expectedField], "Field '$expectedField' does not match ({$searchResult[$expectedField]})");
}
}
-
}
diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php
index 854ce552e6e..22c9fef9f7f 100644
--- a/build/integration/features/bootstrap/Sharing.php
+++ b/build/integration/features/bootstrap/Sharing.php
@@ -79,7 +79,7 @@ trait Sharing {
if ($body instanceof TableNode) {
$fd = $body->getRowsHash();
- if (array_key_exists('expireDate', $fd)){
+ if (array_key_exists('expireDate', $fd)) {
$dateModification = $fd['expireDate'];
$fd['expireDate'] = date('Y-m-d', strtotime($dateModification));
}
@@ -106,7 +106,7 @@ trait Sharing {
* @When /^restore the last share data from "([^"]*)"$/
*/
public function restoreLastShareData($name) {
- $this->lastShareData = $this->storedShareData[$name];
+ $this->lastShareData = $this->storedShareData[$name];
}
/**
@@ -156,10 +156,9 @@ trait Sharing {
public function checkPublicSharedFile($filename) {
$client = new Client();
$options = [];
- if (count($this->lastShareData->data->element) > 0){
+ if (count($this->lastShareData->data->element) > 0) {
$url = $this->lastShareData->data[0]->url;
- }
- else{
+ } else {
$url = $this->lastShareData->data->url;
}
$fullUrl = $url . "/download";
@@ -171,10 +170,9 @@ trait Sharing {
*/
public function checkPublicSharedFileWithPassword($filename, $password) {
$options = [];
- if (count($this->lastShareData->data->element) > 0){
+ if (count($this->lastShareData->data->element) > 0) {
$token = $this->lastShareData->data[0]->token;
- }
- else{
+ } else {
$token = $this->lastShareData->data->token;
}
@@ -246,7 +244,7 @@ trait Sharing {
if ($body instanceof TableNode) {
$fd = $body->getRowsHash();
- if (array_key_exists('expireDate', $fd)){
+ if (array_key_exists('expireDate', $fd)) {
$dateModification = $fd['expireDate'];
$fd['expireDate'] = date('Y-m-d', strtotime($dateModification));
}
@@ -281,22 +279,22 @@ trait Sharing {
$options['auth'] = [$user, $this->regularUser];
}
$body = [];
- if (!is_null($path)){
+ if (!is_null($path)) {
$body['path'] = $path;
}
- if (!is_null($shareType)){
+ if (!is_null($shareType)) {
$body['shareType'] = $shareType;
}
- if (!is_null($shareWith)){
+ if (!is_null($shareWith)) {
$body['shareWith'] = $shareWith;
}
- if (!is_null($publicUpload)){
+ if (!is_null($publicUpload)) {
$body['publicUpload'] = $publicUpload;
}
- if (!is_null($password)){
+ if (!is_null($password)) {
$body['password'] = $password;
}
- if (!is_null($permissions)){
+ if (!is_null($permissions)) {
$body['permissions'] = $permissions;
}
@@ -313,41 +311,34 @@ trait Sharing {
public function isFieldInResponse($field, $contentExpected) {
$data = simplexml_load_string($this->response->getBody())->data[0];
- if ((string)$field == 'expiration'){
+ if ((string)$field == 'expiration') {
$contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00";
}
- if (count($data->element) > 0){
- foreach($data as $element) {
- if ($contentExpected == "A_TOKEN"){
+ if (count($data->element) > 0) {
+ foreach ($data as $element) {
+ if ($contentExpected == "A_TOKEN") {
return (strlen((string)$element->$field) == 15);
- }
- elseif ($contentExpected == "A_NUMBER"){
+ } elseif ($contentExpected == "A_NUMBER") {
return is_numeric((string)$element->$field);
- }
- elseif($contentExpected == "AN_URL"){
+ } elseif ($contentExpected == "AN_URL") {
return $this->isExpectedUrl((string)$element->$field, "index.php/s/");
- }
- elseif ((string)$element->$field == $contentExpected){
+ } elseif ((string)$element->$field == $contentExpected) {
return true;
- }
- else{
+ } else {
print($element->$field);
}
}
return false;
} else {
- if ($contentExpected == "A_TOKEN"){
- return (strlen((string)$data->$field) == 15);
- }
- elseif ($contentExpected == "A_NUMBER"){
- return is_numeric((string)$data->$field);
- }
- elseif($contentExpected == "AN_URL"){
- return $this->isExpectedUrl((string)$data->$field, "index.php/s/");
- }
- elseif ($data->$field == $contentExpected){
- return true;
+ if ($contentExpected == "A_TOKEN") {
+ return (strlen((string)$data->$field) == 15);
+ } elseif ($contentExpected == "A_NUMBER") {
+ return is_numeric((string)$data->$field);
+ } elseif ($contentExpected == "AN_URL") {
+ return $this->isExpectedUrl((string)$data->$field, "index.php/s/");
+ } elseif ($data->$field == $contentExpected) {
+ return true;
}
return false;
}
@@ -391,8 +382,8 @@ trait Sharing {
public function isUserOrGroupInSharedData($userOrGroup, $permissions = null) {
$data = simplexml_load_string($this->response->getBody())->data[0];
- foreach($data as $element) {
- if ($element->share_with == $userOrGroup && ($permissions === null || $permissions == $element->permissions)){
+ foreach ($data as $element) {
+ if ($element->share_with == $userOrGroup && ($permissions === null || $permissions == $element->permissions)) {
return true;
}
}
@@ -419,7 +410,7 @@ trait Sharing {
'OCS-APIREQUEST' => 'true',
];
$this->response = $client->get($fullUrl, $options);
- if ($this->isUserOrGroupInSharedData($user2, $permissions)){
+ if ($this->isUserOrGroupInSharedData($user2, $permissions)) {
return;
} else {
$this->createShare($user1, $filepath, 0, $user2, null, null, $permissions);
@@ -448,7 +439,7 @@ trait Sharing {
'OCS-APIREQUEST' => 'true',
];
$this->response = $client->get($fullUrl, $options);
- if ($this->isUserOrGroupInSharedData($group, $permissions)){
+ if ($this->isUserOrGroupInSharedData($group, $permissions)) {
return;
} else {
$this->createShare($user, $filepath, 1, $group, null, null, $permissions);
@@ -480,7 +471,7 @@ trait Sharing {
*/
public function checkingLastShareIDIsIncluded() {
$share_id = $this->lastShareData->data[0]->id;
- if (!$this->isFieldInResponse('id', $share_id)){
+ if (!$this->isFieldInResponse('id', $share_id)) {
Assert::fail("Share id $share_id not found in response");
}
}
@@ -490,7 +481,7 @@ trait Sharing {
*/
public function checkingLastShareIDIsNotIncluded() {
$share_id = $this->lastShareData->data[0]->id;
- if ($this->isFieldInResponse('id', $share_id)){
+ if ($this->isFieldInResponse('id', $share_id)) {
Assert::fail("Share id $share_id has been found in response");
}
}
@@ -503,16 +494,16 @@ trait Sharing {
if ($body instanceof TableNode) {
$fd = $body->getRowsHash();
- foreach($fd as $field => $value) {
- if (substr($field, 0, 10) === "share_with"){
+ foreach ($fd as $field => $value) {
+ if (substr($field, 0, 10) === "share_with") {
$value = str_replace("REMOTE", substr($this->remoteBaseUrl, 0, -5), $value);
$value = str_replace("LOCAL", substr($this->localBaseUrl, 0, -5), $value);
}
- if (substr($field, 0, 6) === "remote"){
+ if (substr($field, 0, 6) === "remote") {
$value = str_replace("REMOTE", substr($this->remoteBaseUrl, 0, -4), $value);
$value = str_replace("LOCAL", substr($this->localBaseUrl, 0, -4), $value);
}
- if (!$this->isFieldInResponse($field, $value)){
+ if (!$this->isFieldInResponse($field, $value)) {
Assert::fail("$field" . " doesn't have value " . "$value");
}
}
@@ -610,7 +601,7 @@ trait Sharing {
Assert::fail("$field was not found in response");
}
- if ($field === 'expiration' && !empty($contentExpected)){
+ if ($field === 'expiration' && !empty($contentExpected)) {
$contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00";
}
@@ -648,7 +639,7 @@ trait Sharing {
);
$json = json_decode($res->getBody()->getContents(), true);
$deleted = false;
- foreach($json['ocs']['data'] as $data) {
+ foreach ($json['ocs']['data'] as $data) {
if (stripslashes($data['path']) === $fileName) {
$id = $data['id'];
$client->delete(
@@ -668,7 +659,7 @@ trait Sharing {
}
}
- if($deleted === false) {
+ if ($deleted === false) {
throw new \Exception("Could not delete file $fileName");
}
}
@@ -676,16 +667,14 @@ trait Sharing {
/**
* @When save last share id
*/
- public function saveLastShareId()
- {
+ public function saveLastShareId() {
$this->savedShareId = $this->lastShareData['data']['id'];
}
/**
* @Then share ids should match
*/
- public function shareIdsShouldMatch()
- {
+ public function shareIdsShouldMatch() {
if ($this->savedShareId !== $this->lastShareData['data']['id']) {
throw new \Exception('Expected the same link share to be returned');
}
diff --git a/build/integration/features/bootstrap/SharingContext.php b/build/integration/features/bootstrap/SharingContext.php
index ec03283de5a..584defda603 100644
--- a/build/integration/features/bootstrap/SharingContext.php
+++ b/build/integration/features/bootstrap/SharingContext.php
@@ -33,5 +33,6 @@ class SharingContext implements Context, SnippetAcceptingContext {
use Sharing;
use AppConfiguration;
- protected function resetAppConfigs() {}
+ protected function resetAppConfigs() {
+ }
}
diff --git a/build/license.php b/build/license.php
index ecb7bbd5051..9e2b5f94df4 100644
--- a/build/license.php
+++ b/build/license.php
@@ -19,8 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-class Licenses
-{
+class Licenses {
protected $paths = [];
protected $mailMap = [];
protected $checkFiles = [];
@@ -80,9 +79,8 @@ EOD;
* @param string|bool $gitRoot
*/
function exec($folder, $gitRoot = false) {
-
if (is_array($folder)) {
- foreach($folder as $f) {
+ foreach ($folder as $f) {
$this->exec($f, $gitRoot);
}
return;
@@ -105,7 +103,7 @@ EOD;
$iterator = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new RecursiveCallbackFilterIterator($iterator, function ($item) use ($folder, $excludes) {
/** @var SplFileInfo $item */
- foreach($excludes as $exclude) {
+ foreach ($excludes as $exclude) {
if (substr($item->getPath(), 0, strlen($exclude)) === $exclude) {
return false;
}
@@ -178,7 +176,7 @@ With help from many libraries and frameworks including:
*/
private function isMITLicensed($source) {
$lines = explode(PHP_EOL, $source);
- while(!empty($lines)) {
+ while (!empty($lines)) {
$line = $lines[0];
array_shift($lines);
if (strpos($line, 'The MIT License') !== false) {
@@ -191,7 +189,7 @@ With help from many libraries and frameworks including:
private function isOwnCloudLicensed($source) {
$lines = explode(PHP_EOL, $source);
- while(!empty($lines)) {
+ while (!empty($lines)) {
$line = $lines[0];
array_shift($lines);
if (strpos($line, 'ownCloud, Inc') !== false || strpos($line, 'ownCloud GmbH') !== false) {
@@ -209,7 +207,7 @@ With help from many libraries and frameworks including:
private function eatOldLicense($source) {
$lines = explode(PHP_EOL, $source);
$isStrict = false;
- while(!empty($lines)) {
+ while (!empty($lines)) {
$line = $lines[0];
if (trim($line) === '<?php') {
array_shift($lines);
@@ -298,7 +296,6 @@ With help from many libraries and frameworks including:
//all changes after the deadline
$this->checkFiles[] = $path;
-
}
private function printFilesToCheck() {
diff --git a/build/signed-off-checker.php b/build/signed-off-checker.php
index 43cf4529476..9620309932a 100644
--- a/build/signed-off-checker.php
+++ b/build/signed-off-checker.php
@@ -33,27 +33,27 @@ $repoName = getenv('DRONE_REPO_NAME');
$droneEvent = getenv('DRONE_BUILD_EVENT');
$githubToken = getenv('GITHUB_TOKEN');
-if(is_string($droneEvent) && $droneEvent === 'push') {
+if (is_string($droneEvent) && $droneEvent === 'push') {
echo("Push event - no signed-off check required.\n");
exit(0);
}
-if(!is_string($pullRequestNumber) || $pullRequestNumber === '') {
+if (!is_string($pullRequestNumber) || $pullRequestNumber === '') {
echo("The environment variable DRONE_PULL_REQUEST has no proper value.\n");
exit(1);
}
-if(!is_string($repoOwner) || $repoOwner === '') {
+if (!is_string($repoOwner) || $repoOwner === '') {
echo("The environment variable DRONE_REPO_OWNER has no proper value.\n");
exit(1);
}
-if(!is_string($repoName) || $repoName === '') {
+if (!is_string($repoName) || $repoName === '') {
echo("The environment variable DRONE_REPO_NAME has no proper value.\n");
exit(1);
}
-if(!is_string($githubToken) || $githubToken === '') {
+if (!is_string($githubToken) || $githubToken === '') {
echo("The environment variable GITHUB_TOKEN has no proper value.\n");
exit(1);
}
@@ -67,7 +67,7 @@ $response = curl_exec($ch);
curl_close($ch);
$decodedResponse = json_decode($response, true);
-if(!is_array($decodedResponse) || count($decodedResponse) === 0) {
+if (!is_array($decodedResponse) || count($decodedResponse) === 0) {
echo("Could not decode JSON response from GitHub API.\n");
exit(1);
}
@@ -75,47 +75,47 @@ if(!is_array($decodedResponse) || count($decodedResponse) === 0) {
// Get all commits SHAs
$commits = [];
-foreach($decodedResponse as $commit) {
- if(!isset($commit['sha'])) {
+foreach ($decodedResponse as $commit) {
+ if (!isset($commit['sha'])) {
echo("No SHA specified in $commit\n");
exit(1);
}
- if(!isset($commit['commit']['message'])) {
+ if (!isset($commit['commit']['message'])) {
echo("No commit message specified in $commit\n");
exit(1);
}
$commits[$commit['sha']] = $commit['commit']['message'];
}
-if(count($commits) < 1) {
+if (count($commits) < 1) {
echo("Could not read commits.\n");
exit(1);
}
$notSignedCommits = [];
-foreach($commits as $commit => $message) {
- if($commit === '') {
+foreach ($commits as $commit => $message) {
+ if ($commit === '') {
continue;
}
$signOffMessage = false;
$commitMessageLines = explode("\n", $message);
- foreach($commitMessageLines as $line) {
- if(preg_match('/^Signed-off-by: .* <.*@.*>$/', $line)) {
+ foreach ($commitMessageLines as $line) {
+ if (preg_match('/^Signed-off-by: .* <.*@.*>$/', $line)) {
echo "$commit is signed-off with \"$line\"\n";
$signOffMessage = true;
continue;
}
}
- if($signOffMessage === true) {
+ if ($signOffMessage === true) {
continue;
}
$notSignedCommits[] = $commit;
}
-if($notSignedCommits !== []) {
+if ($notSignedCommits !== []) {
echo("\n");
echo("Some commits were not signed off!\n");
echo("Missing signatures on:\n");