]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix language level incompatibilties
authorLukas Reschke <lukas@owncloud.com>
Wed, 8 Apr 2015 11:55:10 +0000 (13:55 +0200)
committerLukas Reschke <lukas@owncloud.com>
Wed, 8 Apr 2015 11:55:10 +0000 (13:55 +0200)
Arbitrary expressions in empty are allowed in PHP 5.5 ands upwards. Seems to only affect master.

Fixed https://github.com/owncloud/core/issues/15463

apps/files_external/lib/sftp_key.php
apps/files_external/service/globalstoragesservice.php
apps/files_external/service/storagesservice.php

index c460d81b8f049cecb67a405acf876e339bd90bdd..d9bcadb9eb7c7d56966e4330346f64e2837ca67d 100644 (file)
@@ -135,11 +135,16 @@ class SFTP_Key extends \OC\Files\Storage\SFTP {
        }
 
        public function test() {
-               if (empty($this->getHost())) {
+
+               // FIXME: Use as expression in empty once PHP 5.4 support is dropped
+               $host = $this->getHost();
+               if (empty($host)) {
                        \OC::$server->getLogger()->warning('Hostname has not been specified');
                        return false;
                }
-               if (empty($this->getUser())) {
+               // FIXME: Use as expression in empty once PHP 5.4 support is dropped
+               $user = $this->getUser();
+               if (empty($user)) {
                        \OC::$server->getLogger()->warning('Username has not been specified');
                        return false;
                }
index 011730390b0afb5097a59f8a9a3fb0d43083fd87..7df0f73f6525589d6ba6a0ac4376fb9b994952da 100644 (file)
@@ -101,6 +101,7 @@ class GlobalStoragesService extends StoragesService {
         * @param string $signal signal to trigger
         */
        protected function triggerHooks(StorageConfig $storage, $signal) {
+               // FIXME: Use as expression in empty once PHP 5.4 support is dropped
                $applicableUsers = $storage->getApplicableUsers();
                $applicableGroups = $storage->getApplicableGroups();
                if (empty($applicableUsers) && empty($applicableGroups)) {
@@ -149,8 +150,11 @@ class GlobalStoragesService extends StoragesService {
                $groupAdditions = array_diff($newStorage->getApplicableGroups(), $oldStorage->getApplicableGroups());
                $groupDeletions = array_diff($oldStorage->getApplicableGroups(), $newStorage->getApplicableGroups());
 
+               // FIXME: Use as expression in empty once PHP 5.4 support is dropped
                // if no applicable were set, raise a signal for "all"
-               if (empty($oldStorage->getApplicableUsers()) && empty($oldStorage->getApplicableGroups())) {
+               $oldApplicableUsers = $oldStorage->getApplicableUsers();
+               $oldApplicableGroups = $oldStorage->getApplicableGroups();
+               if (empty($oldApplicableUsers) && empty($oldApplicableGroups)) {
                        $this->triggerApplicableHooks(
                                Filesystem::signal_delete_mount,
                                $oldStorage->getMountPoint(),
@@ -191,8 +195,11 @@ class GlobalStoragesService extends StoragesService {
                        $groupAdditions
                );
 
+               // FIXME: Use as expression in empty once PHP 5.4 support is dropped
                // if no applicable, raise a signal for "all"
-               if (empty($newStorage->getApplicableUsers()) && empty($newStorage->getApplicableGroups())) {
+               $newApplicableUsers = $newStorage->getApplicableUsers();
+               $newApplicableGroups = $newStorage->getApplicableGroups();
+               if (empty($newApplicableUsers) && empty($newApplicableGroups)) {
                        $this->triggerApplicableHooks(
                                Filesystem::signal_create_mount,
                                $newStorage->getMountPoint(),
index 399a56677bf71f9a5bb44d8d365fd3196092d58f..51eb4abcc00e8c2e637ed035109505b00dd8ffc6 100644 (file)
@@ -227,8 +227,10 @@ abstract class StoragesService {
                if (!is_null($storageConfig->getPriority())) {
                        $options['priority'] = $storageConfig->getPriority();
                }
-               if (!empty($storageConfig->getMountOptions())) {
-                       $options['mountOptions'] = $storageConfig->getMountOptions();
+
+               $mountOptions = $storageConfig->getMountOptions();
+               if (!empty($mountOptions)) {
+                       $options['mountOptions'] = $mountOptions;
                }
 
                $mountPoints[$mountType][$applicable][$rootMountPoint] = $options;