Passed
Push — master ( b306a8...3e64be )
by Roeland
09:52 queued 10s
created
apps/files/ajax/download.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 $files_list = json_decode($files);
38 38
 // in case we get only a single file
39 39
 if (!is_array($files_list)) {
40
-	$files_list = array($files);
40
+    $files_list = array($files);
41 41
 }
42 42
 
43 43
 /**
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
  * alphanumeric characters
47 47
  */
48 48
 if(isset($_GET['downloadStartSecret'])
49
-	&& !isset($_GET['downloadStartSecret'][32])
50
-	&& preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) {
51
-	setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
49
+    && !isset($_GET['downloadStartSecret'][32])
50
+    && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) {
51
+    setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
52 52
 }
53 53
 
54 54
 $server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' );
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  * Http range requests support
58 58
  */
59 59
 if (isset($_SERVER['HTTP_RANGE'])) {
60
-	$server_params['range'] = \OC::$server->getRequest()->getHeader('Range');
60
+    $server_params['range'] = \OC::$server->getRequest()->getHeader('Range');
61 61
 }
62 62
 
63 63
 OC_Files::get($dir, $files_list, $server_params);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 OCP\User::checkLoggedIn();
32 32
 \OC::$server->getSession()->close();
33 33
 
34
-$files = isset($_GET['files']) ? (string)$_GET['files'] : '';
35
-$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
34
+$files = isset($_GET['files']) ? (string) $_GET['files'] : '';
35
+$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : '';
36 36
 
37 37
 $files_list = json_decode($files);
38 38
 // in case we get only a single file
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
  * the content must not be longer than 32 characters and must only contain
46 46
  * alphanumeric characters
47 47
  */
48
-if(isset($_GET['downloadStartSecret'])
48
+if (isset($_GET['downloadStartSecret'])
49 49
 	&& !isset($_GET['downloadStartSecret'][32])
50 50
 	&& preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) {
51 51
 	setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
52 52
 }
53 53
 
54
-$server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' );
54
+$server_params = array('head' => \OC::$server->getRequest()->getMethod() === 'HEAD');
55 55
 
56 56
 /**
57 57
  * Http range requests support
Please login to merge, or discard this patch.
apps/files_sharing/lib/Migration/OwncloudGuestShareType.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 
69 69
 		$query = $this->connection->getQueryBuilder();
70 70
 		$query->update('share')
71
-			->set('share_type',  $query->createNamedParameter(Share::SHARE_TYPE_GUEST))
71
+			->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST))
72 72
 			->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL)));
73 73
 		$query->execute();
74 74
 	}
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -36,47 +36,47 @@
 block discarded – undo
36 36
  */
37 37
 class OwncloudGuestShareType implements IRepairStep {
38 38
 
39
-	/** @var IDBConnection */
40
-	private $connection;
39
+    /** @var IDBConnection */
40
+    private $connection;
41 41
 
42
-	/** @var  IConfig */
43
-	private $config;
42
+    /** @var  IConfig */
43
+    private $config;
44 44
 
45 45
 
46
-	public function __construct(IDBConnection $connection, IConfig $config) {
47
-		$this->connection = $connection;
48
-		$this->config = $config;
49
-	}
46
+    public function __construct(IDBConnection $connection, IConfig $config) {
47
+        $this->connection = $connection;
48
+        $this->config = $config;
49
+    }
50 50
 
51
-	/**
52
-	 * Returns the step's name
53
-	 *
54
-	 * @return string
55
-	 * @since 9.1.0
56
-	 */
57
-	public function getName() {
58
-		return 'Fix the share type of guest shares when migrating from ownCloud';
59
-	}
51
+    /**
52
+     * Returns the step's name
53
+     *
54
+     * @return string
55
+     * @since 9.1.0
56
+     */
57
+    public function getName() {
58
+        return 'Fix the share type of guest shares when migrating from ownCloud';
59
+    }
60 60
 
61
-	/**
62
-	 * @param IOutput $output
63
-	 */
64
-	public function run(IOutput $output) {
65
-		if (!$this->shouldRun()) {
66
-			return;
67
-		}
61
+    /**
62
+     * @param IOutput $output
63
+     */
64
+    public function run(IOutput $output) {
65
+        if (!$this->shouldRun()) {
66
+            return;
67
+        }
68 68
 
69
-		$query = $this->connection->getQueryBuilder();
70
-		$query->update('share')
71
-			->set('share_type',  $query->createNamedParameter(Share::SHARE_TYPE_GUEST))
72
-			->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL)));
73
-		$query->execute();
74
-	}
69
+        $query = $this->connection->getQueryBuilder();
70
+        $query->update('share')
71
+            ->set('share_type',  $query->createNamedParameter(Share::SHARE_TYPE_GUEST))
72
+            ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL)));
73
+        $query->execute();
74
+    }
75 75
 
76
-	protected function shouldRun() {
77
-		$appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
78
-		return $appVersion === '0.10.0' ||
79
-			$this->config->getAppValue('core', 'vendor', '') === 'owncloud';
80
-	}
76
+    protected function shouldRun() {
77
+        $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
78
+        return $appVersion === '0.10.0' ||
79
+            $this->config->getAppValue('core', 'vendor', '') === 'owncloud';
80
+    }
81 81
 
82 82
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Migration/SetPasswordColumn.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -36,62 +36,62 @@
 block discarded – undo
36 36
  */
37 37
 class SetPasswordColumn implements IRepairStep {
38 38
 
39
-	/** @var IDBConnection */
40
-	private $connection;
41
-
42
-	/** @var  IConfig */
43
-	private $config;
44
-
45
-
46
-	public function __construct(IDBConnection $connection, IConfig $config) {
47
-		$this->connection = $connection;
48
-		$this->config = $config;
49
-	}
50
-
51
-	/**
52
-	 * Returns the step's name
53
-	 *
54
-	 * @return string
55
-	 * @since 9.1.0
56
-	 */
57
-	public function getName() {
58
-		return 'Copy the share password into the dedicated column';
59
-	}
60
-
61
-	/**
62
-	 * @param IOutput $output
63
-	 */
64
-	public function run(IOutput $output) {
65
-		if (!$this->shouldRun()) {
66
-			return;
67
-		}
68
-
69
-		$query = $this->connection->getQueryBuilder();
70
-		$query
71
-			->update('share')
72
-			->set('password', 'share_with')
73
-			->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK)))
74
-			->andWhere($query->expr()->isNotNull('share_with'));
75
-		$result = $query->execute();
76
-
77
-		if ($result === 0) {
78
-			// No link updated, no need to run the second query
79
-			return;
80
-		}
81
-
82
-		$clearQuery = $this->connection->getQueryBuilder();
83
-		$clearQuery
84
-			->update('share')
85
-			->set('share_with', $clearQuery->createNamedParameter(null))
86
-			->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK)));
87
-
88
-		$clearQuery->execute();
89
-
90
-	}
91
-
92
-	protected function shouldRun() {
93
-		$appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
94
-		return version_compare($appVersion, '1.4.0', '<');
95
-	}
39
+    /** @var IDBConnection */
40
+    private $connection;
41
+
42
+    /** @var  IConfig */
43
+    private $config;
44
+
45
+
46
+    public function __construct(IDBConnection $connection, IConfig $config) {
47
+        $this->connection = $connection;
48
+        $this->config = $config;
49
+    }
50
+
51
+    /**
52
+     * Returns the step's name
53
+     *
54
+     * @return string
55
+     * @since 9.1.0
56
+     */
57
+    public function getName() {
58
+        return 'Copy the share password into the dedicated column';
59
+    }
60
+
61
+    /**
62
+     * @param IOutput $output
63
+     */
64
+    public function run(IOutput $output) {
65
+        if (!$this->shouldRun()) {
66
+            return;
67
+        }
68
+
69
+        $query = $this->connection->getQueryBuilder();
70
+        $query
71
+            ->update('share')
72
+            ->set('password', 'share_with')
73
+            ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK)))
74
+            ->andWhere($query->expr()->isNotNull('share_with'));
75
+        $result = $query->execute();
76
+
77
+        if ($result === 0) {
78
+            // No link updated, no need to run the second query
79
+            return;
80
+        }
81
+
82
+        $clearQuery = $this->connection->getQueryBuilder();
83
+        $clearQuery
84
+            ->update('share')
85
+            ->set('share_with', $clearQuery->createNamedParameter(null))
86
+            ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK)));
87
+
88
+        $clearQuery->execute();
89
+
90
+    }
91
+
92
+    protected function shouldRun() {
93
+        $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0');
94
+        return version_compare($appVersion, '1.4.0', '<');
95
+    }
96 96
 
97 97
 }
Please login to merge, or discard this patch.
apps/oauth2/lib/Db/Client.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@
 block discarded – undo
34 34
  * @method void setName(string $name)
35 35
  */
36 36
 class Client extends Entity {
37
-	/** @var string */
38
-	protected $name;
39
-	/** @var string */
40
-	protected $redirectUri;
41
-	/** @var string */
42
-	protected $clientIdentifier;
43
-	/** @var string */
44
-	protected $secret;
37
+    /** @var string */
38
+    protected $name;
39
+    /** @var string */
40
+    protected $redirectUri;
41
+    /** @var string */
42
+    protected $clientIdentifier;
43
+    /** @var string */
44
+    protected $secret;
45 45
 
46
-	public function __construct() {
47
-		$this->addType('id', 'int');
48
-		$this->addType('name', 'string');
49
-		$this->addType('redirect_uri', 'string');
50
-		$this->addType('client_identifier', 'string');
51
-		$this->addType('secret', 'string');
52
-	}
46
+    public function __construct() {
47
+        $this->addType('id', 'int');
48
+        $this->addType('name', 'string');
49
+        $this->addType('redirect_uri', 'string');
50
+        $this->addType('client_identifier', 'string');
51
+        $this->addType('secret', 'string');
52
+    }
53 53
 }
Please login to merge, or discard this patch.
lib/public/Authentication/LoginCredentials/ICredentials.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -31,31 +31,31 @@
 block discarded – undo
31 31
  */
32 32
 interface ICredentials {
33 33
 
34
-	/**
35
-	 * Get the user UID
36
-	 *
37
-	 * @since 12
38
-	 *
39
-	 * @return string
40
-	 */
41
-	public function getUID();
34
+    /**
35
+     * Get the user UID
36
+     *
37
+     * @since 12
38
+     *
39
+     * @return string
40
+     */
41
+    public function getUID();
42 42
 
43
-	/**
44
-	 * Get the login name the users used to login
45
-	 *
46
-	 * @since 12
47
-	 *
48
-	 * @return string
49
-	 */
50
-	public function getLoginName();
43
+    /**
44
+     * Get the login name the users used to login
45
+     *
46
+     * @since 12
47
+     *
48
+     * @return string
49
+     */
50
+    public function getLoginName();
51 51
 
52
-	/**
53
-	 * Get the password
54
-	 *
55
-	 * @since 12
56
-	 *
57
-	 * @return string
58
-	 * @throws PasswordUnavailableException
59
-	 */
60
-	public function getPassword();
52
+    /**
53
+     * Get the password
54
+     *
55
+     * @since 12
56
+     *
57
+     * @return string
58
+     * @throws PasswordUnavailableException
59
+     */
60
+    public function getPassword();
61 61
 }
Please login to merge, or discard this patch.
lib/private/Files/Cache/Wrapper/CachePermissionsMask.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@
 block discarded – undo
24 24
 namespace OC\Files\Cache\Wrapper;
25 25
 
26 26
 class CachePermissionsMask extends CacheWrapper {
27
-	/**
28
-	 * @var int
29
-	 */
30
-	protected $mask;
27
+    /**
28
+     * @var int
29
+     */
30
+    protected $mask;
31 31
 
32
-	/**
33
-	 * @param \OCP\Files\Cache\ICache $cache
34
-	 * @param int $mask
35
-	 */
36
-	public function __construct($cache, $mask) {
37
-		parent::__construct($cache);
38
-		$this->mask = $mask;
39
-	}
32
+    /**
33
+     * @param \OCP\Files\Cache\ICache $cache
34
+     * @param int $mask
35
+     */
36
+    public function __construct($cache, $mask) {
37
+        parent::__construct($cache);
38
+        $this->mask = $mask;
39
+    }
40 40
 
41
-	protected function formatCacheEntry($entry) {
42
-		if (isset($entry['permissions'])) {
43
-			$entry['scan_permissions'] = $entry['permissions'];
44
-			$entry['permissions'] &= $this->mask;
45
-		}
46
-		return $entry;
47
-	}
41
+    protected function formatCacheEntry($entry) {
42
+        if (isset($entry['permissions'])) {
43
+            $entry['scan_permissions'] = $entry['permissions'];
44
+            $entry['permissions'] &= $this->mask;
45
+        }
46
+        return $entry;
47
+    }
48 48
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/BearerAuth.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	private function setupUserFs($userId) {
56 56
 		\OC_Util::setupFS($userId);
57 57
 		$this->session->close();
58
-		return $this->principalPrefix . $userId;
58
+		return $this->principalPrefix.$userId;
59 59
 	}
60 60
 
61 61
 	/**
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	public function validateBearerToken($bearerToken) {
65 65
 		\OC_Util::setupFS();
66 66
 
67
-		if(!$this->userSession->isLoggedIn()) {
67
+		if (!$this->userSession->isLoggedIn()) {
68 68
 			$this->userSession->tryTokenLogin($this->request);
69 69
 		}
70
-		if($this->userSession->isLoggedIn()) {
70
+		if ($this->userSession->isLoggedIn()) {
71 71
 			return $this->setupUserFs($this->userSession->getUser()->getUID());
72 72
 		}
73 73
 
Please login to merge, or discard this patch.
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -29,66 +29,66 @@
 block discarded – undo
29 29
 use Sabre\HTTP\ResponseInterface;
30 30
 
31 31
 class BearerAuth extends AbstractBearer {
32
-	/** @var IUserSession */
33
-	private $userSession;
34
-	/** @var ISession */
35
-	private $session;
36
-	/** @var IRequest */
37
-	private $request;
38
-	/** @var string */
39
-	private $principalPrefix;
32
+    /** @var IUserSession */
33
+    private $userSession;
34
+    /** @var ISession */
35
+    private $session;
36
+    /** @var IRequest */
37
+    private $request;
38
+    /** @var string */
39
+    private $principalPrefix;
40 40
 
41
-	/**
42
-	 * @param IUserSession $userSession
43
-	 * @param ISession $session
44
-	 * @param string $principalPrefix
45
-	 * @param IRequest $request
46
-	 */
47
-	public function __construct(IUserSession $userSession,
48
-								ISession $session,
49
-								IRequest $request,
50
-								$principalPrefix = 'principals/users/') {
51
-		$this->userSession = $userSession;
52
-		$this->session = $session;
53
-		$this->request = $request;
54
-		$this->principalPrefix = $principalPrefix;
41
+    /**
42
+     * @param IUserSession $userSession
43
+     * @param ISession $session
44
+     * @param string $principalPrefix
45
+     * @param IRequest $request
46
+     */
47
+    public function __construct(IUserSession $userSession,
48
+                                ISession $session,
49
+                                IRequest $request,
50
+                                $principalPrefix = 'principals/users/') {
51
+        $this->userSession = $userSession;
52
+        $this->session = $session;
53
+        $this->request = $request;
54
+        $this->principalPrefix = $principalPrefix;
55 55
 
56
-		// setup realm
57
-		$defaults = new \OCP\Defaults();
58
-		$this->realm = $defaults->getName();
59
-	}
56
+        // setup realm
57
+        $defaults = new \OCP\Defaults();
58
+        $this->realm = $defaults->getName();
59
+    }
60 60
 
61
-	private function setupUserFs($userId) {
62
-		\OC_Util::setupFS($userId);
63
-		$this->session->close();
64
-		return $this->principalPrefix . $userId;
65
-	}
61
+    private function setupUserFs($userId) {
62
+        \OC_Util::setupFS($userId);
63
+        $this->session->close();
64
+        return $this->principalPrefix . $userId;
65
+    }
66 66
 
67
-	/**
68
-	 * {@inheritdoc}
69
-	 */
70
-	public function validateBearerToken($bearerToken) {
71
-		\OC_Util::setupFS();
67
+    /**
68
+     * {@inheritdoc}
69
+     */
70
+    public function validateBearerToken($bearerToken) {
71
+        \OC_Util::setupFS();
72 72
 
73
-		if(!$this->userSession->isLoggedIn()) {
74
-			$this->userSession->tryTokenLogin($this->request);
75
-		}
76
-		if($this->userSession->isLoggedIn()) {
77
-			return $this->setupUserFs($this->userSession->getUser()->getUID());
78
-		}
73
+        if(!$this->userSession->isLoggedIn()) {
74
+            $this->userSession->tryTokenLogin($this->request);
75
+        }
76
+        if($this->userSession->isLoggedIn()) {
77
+            return $this->setupUserFs($this->userSession->getUser()->getUID());
78
+        }
79 79
 
80
-		return false;
81
-	}
80
+        return false;
81
+    }
82 82
 
83
-	/**
84
-	 * \Sabre\DAV\Auth\Backend\AbstractBearer::challenge sets an WWW-Authenticate
85
-	 * header which some DAV clients can't handle. Thus we override this function
86
-	 * and make it simply return a 401.
87
-	 *
88
-	 * @param RequestInterface $request
89
-	 * @param ResponseInterface $response
90
-	 */
91
-	public function challenge(RequestInterface $request, ResponseInterface $response) {
92
-		$response->setStatus(401);
93
-	}
83
+    /**
84
+     * \Sabre\DAV\Auth\Backend\AbstractBearer::challenge sets an WWW-Authenticate
85
+     * header which some DAV clients can't handle. Thus we override this function
86
+     * and make it simply return a 401.
87
+     *
88
+     * @param RequestInterface $request
89
+     * @param ResponseInterface $response
90
+     */
91
+    public function challenge(RequestInterface $request, ResponseInterface $response) {
92
+        $response->setStatus(401);
93
+    }
94 94
 }
Please login to merge, or discard this patch.
lib/private/Template/JSResourceLocator.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,26 +71,26 @@
 block discarded – undo
71 71
 		}
72 72
 
73 73
 		$app = substr($script, 0, strpos($script, '/'));
74
-		$script = substr($script, strpos($script, '/')+1);
74
+		$script = substr($script, strpos($script, '/') + 1);
75 75
 		$app_path = \OC_App::getAppPath($app);
76 76
 		$app_url = \OC_App::getAppWebPath($app);
77 77
 
78 78
 		// missing translations files fill be ignored
79 79
 		if (strpos($script, 'l10n/') === 0) {
80
-			$this->appendIfExist($app_path, $script . '.js', $app_url);
80
+			$this->appendIfExist($app_path, $script.'.js', $app_url);
81 81
 			return;
82 82
 		}
83 83
 
84 84
 		if ($app_path === false && $app_url === false) {
85 85
 			$this->logger->error('Could not find resource {resource} to load', [
86
-				'resource' => $app . '/' . $script . '.js',
86
+				'resource' => $app.'/'.$script.'.js',
87 87
 				'app' => 'jsresourceloader',
88 88
 			]);
89 89
 			return;
90 90
 		}
91 91
 
92 92
 		if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) {
93
-			$this->append($app_path, $script . '.js', $app_url);
93
+			$this->append($app_path, $script.'.js', $app_url);
94 94
 		}
95 95
 	}
96 96
 
Please login to merge, or discard this patch.
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -28,103 +28,103 @@
 block discarded – undo
28 28
 
29 29
 class JSResourceLocator extends ResourceLocator {
30 30
 
31
-	/** @var JSCombiner */
32
-	protected $jsCombiner;
33
-
34
-	public function __construct(\OCP\ILogger $logger, $theme, array $core_map, array $party_map, JSCombiner $JSCombiner) {
35
-		parent::__construct($logger, $theme, $core_map, $party_map);
36
-
37
-		$this->jsCombiner = $JSCombiner;
38
-	}
39
-
40
-	/**
41
-	 * @param string $script
42
-	 */
43
-	public function doFind($script) {
44
-		$theme_dir = 'themes/'.$this->theme.'/';
45
-		if (strpos($script, '3rdparty') === 0
46
-			&& $this->appendIfExist($this->thirdpartyroot, $script.'.js')) {
47
-			return;
48
-		}
49
-
50
-		if (strpos($script, '/l10n/') !== false) {
51
-			// For language files we try to load them all, so themes can overwrite
52
-			// single l10n strings without having to translate all of them.
53
-			$found = 0;
54
-			$found += $this->appendIfExist($this->serverroot, 'core/'.$script.'.js');
55
-			$found += $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js');
56
-			$found += $this->appendIfExist($this->serverroot, $script.'.js');
57
-			$found += $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js');
58
-			$found += $this->appendIfExist($this->serverroot, 'apps/'.$script.'.js');
59
-			$found += $this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js');
60
-
61
-			if ($found) {
62
-				return;
63
-			}
64
-		} else if ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js')
65
-			|| $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js')
66
-			|| $this->appendIfExist($this->serverroot, $script.'.js')
67
-			|| $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script.'.json')
68
-			|| $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js')
69
-			|| $this->appendIfExist($this->serverroot, 'core/'.$script.'.js')
70
-			|| $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/'.$script.'.json')
71
-		) {
72
-			return;
73
-		}
74
-
75
-		$app = substr($script, 0, strpos($script, '/'));
76
-		$script = substr($script, strpos($script, '/')+1);
77
-		$app_path = \OC_App::getAppPath($app);
78
-		$app_url = \OC_App::getAppWebPath($app);
79
-
80
-		if ($app_path !== false) {
81
-			// Account for the possibility of having symlinks in app path. Only
82
-			// do this if $app_path is set, because an empty argument to realpath
83
-			// gets turned into cwd.
84
-			$app_path = realpath($app_path);
85
-		}
86
-
87
-		// missing translations files fill be ignored
88
-		if (strpos($script, 'l10n/') === 0) {
89
-			$this->appendIfExist($app_path, $script . '.js', $app_url);
90
-			return;
91
-		}
92
-
93
-		if ($app_path === false && $app_url === false) {
94
-			$this->logger->error('Could not find resource {resource} to load', [
95
-				'resource' => $app . '/' . $script . '.js',
96
-				'app' => 'jsresourceloader',
97
-			]);
98
-			return;
99
-		}
100
-
101
-		if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) {
102
-			$this->append($app_path, $script . '.js', $app_url);
103
-		}
104
-	}
105
-
106
-	/**
107
-	 * @param string $script
108
-	 */
109
-	public function doFindTheme($script) {
110
-	}
111
-
112
-	protected function cacheAndAppendCombineJsonIfExist($root, $file, $app = 'core') {
113
-		if (is_file($root.'/'.$file)) {
114
-			if ($this->jsCombiner->process($root, $file, $app)) {
115
-				$this->append($this->serverroot, $this->jsCombiner->getCachedJS($app, $file), false, false);
116
-			} else {
117
-				// Add all the files from the json
118
-				$files = $this->jsCombiner->getContent($root, $file);
119
-				$app_url = \OC_App::getAppWebPath($app);
120
-
121
-				foreach ($files as $jsFile) {
122
-					$this->append($root, $jsFile, $app_url);
123
-				}
124
-			}
125
-			return true;
126
-		}
127
-
128
-		return false;
129
-	}
31
+    /** @var JSCombiner */
32
+    protected $jsCombiner;
33
+
34
+    public function __construct(\OCP\ILogger $logger, $theme, array $core_map, array $party_map, JSCombiner $JSCombiner) {
35
+        parent::__construct($logger, $theme, $core_map, $party_map);
36
+
37
+        $this->jsCombiner = $JSCombiner;
38
+    }
39
+
40
+    /**
41
+     * @param string $script
42
+     */
43
+    public function doFind($script) {
44
+        $theme_dir = 'themes/'.$this->theme.'/';
45
+        if (strpos($script, '3rdparty') === 0
46
+            && $this->appendIfExist($this->thirdpartyroot, $script.'.js')) {
47
+            return;
48
+        }
49
+
50
+        if (strpos($script, '/l10n/') !== false) {
51
+            // For language files we try to load them all, so themes can overwrite
52
+            // single l10n strings without having to translate all of them.
53
+            $found = 0;
54
+            $found += $this->appendIfExist($this->serverroot, 'core/'.$script.'.js');
55
+            $found += $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js');
56
+            $found += $this->appendIfExist($this->serverroot, $script.'.js');
57
+            $found += $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js');
58
+            $found += $this->appendIfExist($this->serverroot, 'apps/'.$script.'.js');
59
+            $found += $this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js');
60
+
61
+            if ($found) {
62
+                return;
63
+            }
64
+        } else if ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js')
65
+            || $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js')
66
+            || $this->appendIfExist($this->serverroot, $script.'.js')
67
+            || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script.'.json')
68
+            || $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$script.'.js')
69
+            || $this->appendIfExist($this->serverroot, 'core/'.$script.'.js')
70
+            || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/'.$script.'.json')
71
+        ) {
72
+            return;
73
+        }
74
+
75
+        $app = substr($script, 0, strpos($script, '/'));
76
+        $script = substr($script, strpos($script, '/')+1);
77
+        $app_path = \OC_App::getAppPath($app);
78
+        $app_url = \OC_App::getAppWebPath($app);
79
+
80
+        if ($app_path !== false) {
81
+            // Account for the possibility of having symlinks in app path. Only
82
+            // do this if $app_path is set, because an empty argument to realpath
83
+            // gets turned into cwd.
84
+            $app_path = realpath($app_path);
85
+        }
86
+
87
+        // missing translations files fill be ignored
88
+        if (strpos($script, 'l10n/') === 0) {
89
+            $this->appendIfExist($app_path, $script . '.js', $app_url);
90
+            return;
91
+        }
92
+
93
+        if ($app_path === false && $app_url === false) {
94
+            $this->logger->error('Could not find resource {resource} to load', [
95
+                'resource' => $app . '/' . $script . '.js',
96
+                'app' => 'jsresourceloader',
97
+            ]);
98
+            return;
99
+        }
100
+
101
+        if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) {
102
+            $this->append($app_path, $script . '.js', $app_url);
103
+        }
104
+    }
105
+
106
+    /**
107
+     * @param string $script
108
+     */
109
+    public function doFindTheme($script) {
110
+    }
111
+
112
+    protected function cacheAndAppendCombineJsonIfExist($root, $file, $app = 'core') {
113
+        if (is_file($root.'/'.$file)) {
114
+            if ($this->jsCombiner->process($root, $file, $app)) {
115
+                $this->append($this->serverroot, $this->jsCombiner->getCachedJS($app, $file), false, false);
116
+            } else {
117
+                // Add all the files from the json
118
+                $files = $this->jsCombiner->getContent($root, $file);
119
+                $app_url = \OC_App::getAppWebPath($app);
120
+
121
+                foreach ($files as $jsFile) {
122
+                    $this->append($root, $jsFile, $app_url);
123
+                }
124
+            }
125
+            return true;
126
+        }
127
+
128
+        return false;
129
+    }
130 130
 }
Please login to merge, or discard this patch.
lib/private/GlobalScale/Config.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -27,45 +27,45 @@
 block discarded – undo
27 27
 
28 28
 class Config implements \OCP\GlobalScale\IConfig {
29 29
 
30
-	/** @var IConfig */
31
-	private $config;
30
+    /** @var IConfig */
31
+    private $config;
32 32
 
33
-	/**
34
-	 * Config constructor.
35
-	 *
36
-	 * @param IConfig $config
37
-	 */
38
-	public function __construct(IConfig $config) {
39
-		$this->config = $config;
40
-	}
33
+    /**
34
+     * Config constructor.
35
+     *
36
+     * @param IConfig $config
37
+     */
38
+    public function __construct(IConfig $config) {
39
+        $this->config = $config;
40
+    }
41 41
 
42
-	/**
43
-	 * check if global scale is enabled
44
-	 *
45
-	 * @since 12.0.1
46
-	 * @return bool
47
-	 */
48
-	public function isGlobalScaleEnabled() {
49
-		$enabled = $this->config->getSystemValue('gs.enabled', false);
50
-		return $enabled !== false;
51
-	}
42
+    /**
43
+     * check if global scale is enabled
44
+     *
45
+     * @since 12.0.1
46
+     * @return bool
47
+     */
48
+    public function isGlobalScaleEnabled() {
49
+        $enabled = $this->config->getSystemValue('gs.enabled', false);
50
+        return $enabled !== false;
51
+    }
52 52
 
53
-	/**
54
-	 * check if federation should only be used internally in a global scale setup
55
-	 *
56
-	 * @since 12.0.1
57
-	 * @return bool
58
-	 */
59
-	public function onlyInternalFederation() {
60
-		// if global scale is disabled federation works always globally
61
-		$gsEnabled = $this->isGlobalScaleEnabled();
62
-		if ($gsEnabled === false) {
63
-			return false;
64
-		}
53
+    /**
54
+     * check if federation should only be used internally in a global scale setup
55
+     *
56
+     * @since 12.0.1
57
+     * @return bool
58
+     */
59
+    public function onlyInternalFederation() {
60
+        // if global scale is disabled federation works always globally
61
+        $gsEnabled = $this->isGlobalScaleEnabled();
62
+        if ($gsEnabled === false) {
63
+            return false;
64
+        }
65 65
 
66
-		$enabled = $this->config->getSystemValue('gs.federation', 'internal');
66
+        $enabled = $this->config->getSystemValue('gs.federation', 'internal');
67 67
 
68
-		return $enabled === 'internal';
69
-	}
68
+        return $enabled === 'internal';
69
+    }
70 70
 
71 71
 }
Please login to merge, or discard this patch.