Passed
Push — master ( b6c034...979f40 )
by John
40:53 queued 23:59
created
apps/dav/lib/Events/CardDeletedEvent.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -34,67 +34,67 @@
 block discarded – undo
34 34
  */
35 35
 class CardDeletedEvent extends Event {
36 36
 
37
-	/** @var int */
38
-	private $addressBookId;
37
+    /** @var int */
38
+    private $addressBookId;
39 39
 
40
-	/** @var array */
41
-	private $addressBookData;
40
+    /** @var array */
41
+    private $addressBookData;
42 42
 
43
-	/** @var array */
44
-	private $shares;
43
+    /** @var array */
44
+    private $shares;
45 45
 
46
-	/** @var array */
47
-	private $cardData;
46
+    /** @var array */
47
+    private $cardData;
48 48
 
49
-	/**
50
-	 * CardDeletedEvent constructor.
51
-	 *
52
-	 * @param int $addressBookId
53
-	 * @param array $addressBookData
54
-	 * @param array $shares
55
-	 * @param array $cardData
56
-	 * @since 20.0.0
57
-	 */
58
-	public function __construct(int $addressBookId,
59
-								array $addressBookData,
60
-								array $shares,
61
-								array $cardData) {
62
-		parent::__construct();
63
-		$this->addressBookId = $addressBookId;
64
-		$this->addressBookData = $addressBookData;
65
-		$this->shares = $shares;
66
-		$this->cardData = $cardData;
67
-	}
49
+    /**
50
+     * CardDeletedEvent constructor.
51
+     *
52
+     * @param int $addressBookId
53
+     * @param array $addressBookData
54
+     * @param array $shares
55
+     * @param array $cardData
56
+     * @since 20.0.0
57
+     */
58
+    public function __construct(int $addressBookId,
59
+                                array $addressBookData,
60
+                                array $shares,
61
+                                array $cardData) {
62
+        parent::__construct();
63
+        $this->addressBookId = $addressBookId;
64
+        $this->addressBookData = $addressBookData;
65
+        $this->shares = $shares;
66
+        $this->cardData = $cardData;
67
+    }
68 68
 
69
-	/**
70
-	 * @return int
71
-	 * @since 20.0.0
72
-	 */
73
-	public function getAddressBookId(): int {
74
-		return $this->addressBookId;
75
-	}
69
+    /**
70
+     * @return int
71
+     * @since 20.0.0
72
+     */
73
+    public function getAddressBookId(): int {
74
+        return $this->addressBookId;
75
+    }
76 76
 
77
-	/**
78
-	 * @return array
79
-	 * @since 20.0.0
80
-	 */
81
-	public function getAddressBookData(): array {
82
-		return $this->addressBookData;
83
-	}
77
+    /**
78
+     * @return array
79
+     * @since 20.0.0
80
+     */
81
+    public function getAddressBookData(): array {
82
+        return $this->addressBookData;
83
+    }
84 84
 
85
-	/**
86
-	 * @return array
87
-	 * @since 20.0.0
88
-	 */
89
-	public function getShares(): array {
90
-		return $this->shares;
91
-	}
85
+    /**
86
+     * @return array
87
+     * @since 20.0.0
88
+     */
89
+    public function getShares(): array {
90
+        return $this->shares;
91
+    }
92 92
 
93
-	/**
94
-	 * @return array
95
-	 * @since 20.0.0
96
-	 */
97
-	public function getCardData(): array {
98
-		return $this->cardData;
99
-	}
93
+    /**
94
+     * @return array
95
+     * @since 20.0.0
96
+     */
97
+    public function getCardData(): array {
98
+        return $this->cardData;
99
+    }
100 100
 }
Please login to merge, or discard this patch.
apps/dav/lib/Events/AddressBookShareUpdatedEvent.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -34,81 +34,81 @@
 block discarded – undo
34 34
  */
35 35
 class AddressBookShareUpdatedEvent extends Event {
36 36
 
37
-	/** @var int */
38
-	private $addressBookId;
37
+    /** @var int */
38
+    private $addressBookId;
39 39
 
40
-	/** @var array */
41
-	private $addressBookData;
40
+    /** @var array */
41
+    private $addressBookData;
42 42
 
43
-	/** @var array */
44
-	private $oldShares;
43
+    /** @var array */
44
+    private $oldShares;
45 45
 
46
-	/** @var array */
47
-	private $added;
46
+    /** @var array */
47
+    private $added;
48 48
 
49
-	/** @var array */
50
-	private $removed;
49
+    /** @var array */
50
+    private $removed;
51 51
 
52
-	/**
53
-	 * AddressBookShareUpdatedEvent constructor.
54
-	 *
55
-	 * @param int $addressBookId
56
-	 * @param array $addressBookData
57
-	 * @param array $oldShares
58
-	 * @param array $added
59
-	 * @param array $removed
60
-	 * @since 20.0.0
61
-	 */
62
-	public function __construct(int $addressBookId,
63
-								array $addressBookData,
64
-								array $oldShares,
65
-								array $added,
66
-								array $removed) {
67
-		parent::__construct();
68
-		$this->addressBookId = $addressBookId;
69
-		$this->addressBookData = $addressBookData;
70
-		$this->oldShares = $oldShares;
71
-		$this->added = $added;
72
-		$this->removed = $removed;
73
-	}
52
+    /**
53
+     * AddressBookShareUpdatedEvent constructor.
54
+     *
55
+     * @param int $addressBookId
56
+     * @param array $addressBookData
57
+     * @param array $oldShares
58
+     * @param array $added
59
+     * @param array $removed
60
+     * @since 20.0.0
61
+     */
62
+    public function __construct(int $addressBookId,
63
+                                array $addressBookData,
64
+                                array $oldShares,
65
+                                array $added,
66
+                                array $removed) {
67
+        parent::__construct();
68
+        $this->addressBookId = $addressBookId;
69
+        $this->addressBookData = $addressBookData;
70
+        $this->oldShares = $oldShares;
71
+        $this->added = $added;
72
+        $this->removed = $removed;
73
+    }
74 74
 
75
-	/**
76
-	 * @return int
77
-	 * @since 20.0.0
78
-	 */
79
-	public function getAddressBookId(): int {
80
-		return $this->addressBookId;
81
-	}
75
+    /**
76
+     * @return int
77
+     * @since 20.0.0
78
+     */
79
+    public function getAddressBookId(): int {
80
+        return $this->addressBookId;
81
+    }
82 82
 
83
-	/**
84
-	 * @return array
85
-	 * @since 20.0.0
86
-	 */
87
-	public function getAddressBookData(): array {
88
-		return $this->addressBookData;
89
-	}
83
+    /**
84
+     * @return array
85
+     * @since 20.0.0
86
+     */
87
+    public function getAddressBookData(): array {
88
+        return $this->addressBookData;
89
+    }
90 90
 
91
-	/**
92
-	 * @return array
93
-	 * @since 20.0.0
94
-	 */
95
-	public function getOldShares(): array {
96
-		return $this->oldShares;
97
-	}
91
+    /**
92
+     * @return array
93
+     * @since 20.0.0
94
+     */
95
+    public function getOldShares(): array {
96
+        return $this->oldShares;
97
+    }
98 98
 
99
-	/**
100
-	 * @return array
101
-	 * @since 20.0.0
102
-	 */
103
-	public function getAdded(): array {
104
-		return $this->added;
105
-	}
99
+    /**
100
+     * @return array
101
+     * @since 20.0.0
102
+     */
103
+    public function getAdded(): array {
104
+        return $this->added;
105
+    }
106 106
 
107
-	/**
108
-	 * @return array
109
-	 * @since 20.0.0
110
-	 */
111
-	public function getRemoved(): array {
112
-		return $this->removed;
113
-	}
107
+    /**
108
+     * @return array
109
+     * @since 20.0.0
110
+     */
111
+    public function getRemoved(): array {
112
+        return $this->removed;
113
+    }
114 114
 }
Please login to merge, or discard this patch.
apps/dav/lib/Events/AddressBookCreatedEvent.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -34,39 +34,39 @@
 block discarded – undo
34 34
  */
35 35
 class AddressBookCreatedEvent extends Event {
36 36
 
37
-	/** @var int */
38
-	private $addressBookId;
37
+    /** @var int */
38
+    private $addressBookId;
39 39
 
40
-	/** @var array */
41
-	private $addressBookData;
40
+    /** @var array */
41
+    private $addressBookData;
42 42
 
43
-	/**
44
-	 * AddressBookCreatedEvent constructor.
45
-	 *
46
-	 * @param int $addressBookId
47
-	 * @param array $addressBookData
48
-	 * @since 20.0.0
49
-	 */
50
-	public function __construct(int $addressBookId,
51
-								array $addressBookData) {
52
-		parent::__construct();
53
-		$this->addressBookId = $addressBookId;
54
-		$this->addressBookData = $addressBookData;
55
-	}
43
+    /**
44
+     * AddressBookCreatedEvent constructor.
45
+     *
46
+     * @param int $addressBookId
47
+     * @param array $addressBookData
48
+     * @since 20.0.0
49
+     */
50
+    public function __construct(int $addressBookId,
51
+                                array $addressBookData) {
52
+        parent::__construct();
53
+        $this->addressBookId = $addressBookId;
54
+        $this->addressBookData = $addressBookData;
55
+    }
56 56
 
57
-	/**
58
-	 * @return int
59
-	 * @since 20.0.0
60
-	 */
61
-	public function getAddressBookId(): int {
62
-		return $this->addressBookId;
63
-	}
57
+    /**
58
+     * @return int
59
+     * @since 20.0.0
60
+     */
61
+    public function getAddressBookId(): int {
62
+        return $this->addressBookId;
63
+    }
64 64
 
65
-	/**
66
-	 * @return array
67
-	 * @since 20.0.0
68
-	 */
69
-	public function getAddressBookData(): array {
70
-		return $this->addressBookData;
71
-	}
65
+    /**
66
+     * @return array
67
+     * @since 20.0.0
68
+     */
69
+    public function getAddressBookData(): array {
70
+        return $this->addressBookData;
71
+    }
72 72
 }
Please login to merge, or discard this patch.
apps/dav/lib/Events/CalendarDeletedEvent.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -34,53 +34,53 @@
 block discarded – undo
34 34
  */
35 35
 class CalendarDeletedEvent extends Event {
36 36
 
37
-	/** @var int */
38
-	private $calendarId;
37
+    /** @var int */
38
+    private $calendarId;
39 39
 
40
-	/** @var array */
41
-	private $calendarData;
40
+    /** @var array */
41
+    private $calendarData;
42 42
 
43
-	/** @var array  */
44
-	private $shares;
43
+    /** @var array  */
44
+    private $shares;
45 45
 
46
-	/**
47
-	 * CalendarDeletedEvent constructor.
48
-	 *
49
-	 * @param int $calendarId
50
-	 * @param array $calendarData
51
-	 * @param array $shares
52
-	 * @since 20.0.0
53
-	 */
54
-	public function __construct(int $calendarId,
55
-								array $calendarData,
56
-								array $shares) {
57
-		parent::__construct();
58
-		$this->calendarId = $calendarId;
59
-		$this->calendarData = $calendarData;
60
-		$this->shares = $shares;
61
-	}
46
+    /**
47
+     * CalendarDeletedEvent constructor.
48
+     *
49
+     * @param int $calendarId
50
+     * @param array $calendarData
51
+     * @param array $shares
52
+     * @since 20.0.0
53
+     */
54
+    public function __construct(int $calendarId,
55
+                                array $calendarData,
56
+                                array $shares) {
57
+        parent::__construct();
58
+        $this->calendarId = $calendarId;
59
+        $this->calendarData = $calendarData;
60
+        $this->shares = $shares;
61
+    }
62 62
 
63
-	/**
64
-	 * @return int
65
-	 * @since 20.0.0
66
-	 */
67
-	public function getCalendarId(): int {
68
-		return $this->calendarId;
69
-	}
63
+    /**
64
+     * @return int
65
+     * @since 20.0.0
66
+     */
67
+    public function getCalendarId(): int {
68
+        return $this->calendarId;
69
+    }
70 70
 
71
-	/**
72
-	 * @return array
73
-	 * @since 20.0.0
74
-	 */
75
-	public function getCalendarData(): array {
76
-		return $this->calendarData;
77
-	}
71
+    /**
72
+     * @return array
73
+     * @since 20.0.0
74
+     */
75
+    public function getCalendarData(): array {
76
+        return $this->calendarData;
77
+    }
78 78
 
79
-	/**
80
-	 * @return array
81
-	 * @since 20.0.0
82
-	 */
83
-	public function getShares(): array {
84
-		return $this->shares;
85
-	}
79
+    /**
80
+     * @return array
81
+     * @since 20.0.0
82
+     */
83
+    public function getShares(): array {
84
+        return $this->shares;
85
+    }
86 86
 }
Please login to merge, or discard this patch.
apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -32,32 +32,32 @@
 block discarded – undo
32 32
 use OCP\IURLGenerator;
33 33
 
34 34
 class LegacySSEKeyFormat {
35
-	/** @var IL10N */
36
-	private $l10n;
37
-	/** @var IConfig */
38
-	private $config;
39
-	/** @var IURLGenerator */
40
-	private $urlGenerator;
41
-
42
-	public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) {
43
-		$this->l10n = $l10n;
44
-		$this->config = $config;
45
-		$this->urlGenerator = $urlGenerator;
46
-	}
47
-
48
-	public function description(): string {
49
-		return $this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.');
50
-	}
51
-
52
-	public function severity(): string {
53
-		return 'warning';
54
-	}
55
-
56
-	public function run(): bool {
57
-		return $this->config->getSystemValueBool('encryption.legacy_format_support', false) === false;
58
-	}
59
-
60
-	public function linkToDocumentation(): string {
61
-		return $this->urlGenerator->linkToDocs('admin-sse-legacy-format');
62
-	}
35
+    /** @var IL10N */
36
+    private $l10n;
37
+    /** @var IConfig */
38
+    private $config;
39
+    /** @var IURLGenerator */
40
+    private $urlGenerator;
41
+
42
+    public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) {
43
+        $this->l10n = $l10n;
44
+        $this->config = $config;
45
+        $this->urlGenerator = $urlGenerator;
46
+    }
47
+
48
+    public function description(): string {
49
+        return $this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.');
50
+    }
51
+
52
+    public function severity(): string {
53
+        return 'warning';
54
+    }
55
+
56
+    public function run(): bool {
57
+        return $this->config->getSystemValueBool('encryption.legacy_format_support', false) === false;
58
+    }
59
+
60
+    public function linkToDocumentation(): string {
61
+        return $this->urlGenerator->linkToDocs('admin-sse-legacy-format');
62
+    }
63 63
 }
Please login to merge, or discard this patch.
apps/weather_status/lib/AppInfo/Application.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,31 +42,31 @@
 block discarded – undo
42 42
  */
43 43
 class Application extends App implements IBootstrap {
44 44
 
45
-	/** @var string */
46
-	public const APP_ID = 'weather_status';
45
+    /** @var string */
46
+    public const APP_ID = 'weather_status';
47 47
 
48
-	/**
49
-	 * Application constructor.
50
-	 *
51
-	 * @param array $urlParams
52
-	 */
53
-	public function __construct(array $urlParams = []) {
54
-		parent::__construct(self::APP_ID, $urlParams);
48
+    /**
49
+     * Application constructor.
50
+     *
51
+     * @param array $urlParams
52
+     */
53
+    public function __construct(array $urlParams = []) {
54
+        parent::__construct(self::APP_ID, $urlParams);
55 55
 
56
-		$dispatcher = $this->getContainer()->query(IEventDispatcher::class);
57
-		$dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) {
58
-			Util::addScript(self::APP_ID, 'weather-status');
59
-		});
60
-	}
56
+        $dispatcher = $this->getContainer()->query(IEventDispatcher::class);
57
+        $dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) {
58
+            Util::addScript(self::APP_ID, 'weather-status');
59
+        });
60
+    }
61 61
 
62
-	/**
63
-	 * @inheritDoc
64
-	 */
65
-	public function register(IRegistrationContext $context): void {
66
-		// Register OCS Capabilities
67
-		$context->registerCapability(Capabilities::class);
68
-	}
62
+    /**
63
+     * @inheritDoc
64
+     */
65
+    public function register(IRegistrationContext $context): void {
66
+        // Register OCS Capabilities
67
+        $context->registerCapability(Capabilities::class);
68
+    }
69 69
 
70
-	public function boot(IBootContext $context): void {
71
-	}
70
+    public function boot(IBootContext $context): void {
71
+    }
72 72
 }
Please login to merge, or discard this patch.
apps/weather_status/lib/Capabilities.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,21 +35,21 @@
 block discarded – undo
35 35
  */
36 36
 class Capabilities implements ICapability {
37 37
 
38
-	/**
39
-	 * Capabilities constructor.
40
-	 *
41
-	 */
42
-	public function __construct() {
43
-	}
38
+    /**
39
+     * Capabilities constructor.
40
+     *
41
+     */
42
+    public function __construct() {
43
+    }
44 44
 
45
-	/**
46
-	 * @inheritDoc
47
-	 */
48
-	public function getCapabilities() {
49
-		return [
50
-			Application::APP_ID => [
51
-				'enabled' => true,
52
-			],
53
-		];
54
-	}
45
+    /**
46
+     * @inheritDoc
47
+     */
48
+    public function getCapabilities() {
49
+        return [
50
+            Application::APP_ID => [
51
+                'enabled' => true,
52
+            ],
53
+        ];
54
+    }
55 55
 }
Please login to merge, or discard this patch.
apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -34,91 +34,91 @@
 block discarded – undo
34 34
 
35 35
 class BuildCalendarSearchIndexBackgroundJob extends QueuedJob {
36 36
 
37
-	/** @var IDBConnection */
38
-	private $db;
39
-
40
-	/** @var CalDavBackend */
41
-	private $calDavBackend;
42
-
43
-	/** @var ILogger */
44
-	private $logger;
45
-
46
-	/** @var IJobList */
47
-	private $jobList;
48
-
49
-	/** @var ITimeFactory */
50
-	private $timeFactory;
51
-
52
-	/**
53
-	 * @param IDBConnection $db
54
-	 * @param CalDavBackend $calDavBackend
55
-	 * @param ILogger $logger
56
-	 * @param IJobList $jobList
57
-	 * @param ITimeFactory $timeFactory
58
-	 */
59
-	public function __construct(IDBConnection $db,
60
-								CalDavBackend $calDavBackend,
61
-								ILogger $logger,
62
-								IJobList $jobList,
63
-								ITimeFactory $timeFactory) {
64
-		$this->db = $db;
65
-		$this->calDavBackend = $calDavBackend;
66
-		$this->logger = $logger;
67
-		$this->jobList = $jobList;
68
-		$this->timeFactory = $timeFactory;
69
-	}
70
-
71
-	public function run($arguments) {
72
-		$offset = (int) $arguments['offset'];
73
-		$stopAt = (int) $arguments['stopAt'];
74
-
75
-		$this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')');
76
-
77
-		$startTime = $this->timeFactory->getTime();
78
-		while (($this->timeFactory->getTime() - $startTime) < 15) {
79
-			$offset = $this->buildIndex($offset, $stopAt);
80
-			if ($offset >= $stopAt) {
81
-				break;
82
-			}
83
-		}
84
-
85
-		if ($offset >= $stopAt) {
86
-			$this->logger->info('Building calendar index done');
87
-		} else {
88
-			$this->jobList->add(self::class, [
89
-				'offset' => $offset,
90
-				'stopAt' => $stopAt
91
-			]);
92
-			$this->logger->info('New building calendar index job scheduled with offset ' . $offset);
93
-		}
94
-	}
95
-
96
-	/**
97
-	 * @param int $offset
98
-	 * @param int $stopAt
99
-	 * @return int
100
-	 */
101
-	private function buildIndex(int $offset, int $stopAt): int {
102
-		$query = $this->db->getQueryBuilder();
103
-		$query->select(['id', 'calendarid', 'uri', 'calendardata'])
104
-			->from('calendarobjects')
105
-			->where($query->expr()->lte('id', $query->createNamedParameter($stopAt)))
106
-			->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset)))
107
-			->orderBy('id', 'ASC')
108
-			->setMaxResults(500);
109
-
110
-		$result = $query->execute();
111
-		while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
112
-			$offset = $row['id'];
113
-
114
-			$calendarData = $row['calendardata'];
115
-			if (is_resource($calendarData)) {
116
-				$calendarData = stream_get_contents($calendarData);
117
-			}
118
-
119
-			$this->calDavBackend->updateProperties($row['calendarid'], $row['uri'], $calendarData);
120
-		}
121
-
122
-		return $offset;
123
-	}
37
+    /** @var IDBConnection */
38
+    private $db;
39
+
40
+    /** @var CalDavBackend */
41
+    private $calDavBackend;
42
+
43
+    /** @var ILogger */
44
+    private $logger;
45
+
46
+    /** @var IJobList */
47
+    private $jobList;
48
+
49
+    /** @var ITimeFactory */
50
+    private $timeFactory;
51
+
52
+    /**
53
+     * @param IDBConnection $db
54
+     * @param CalDavBackend $calDavBackend
55
+     * @param ILogger $logger
56
+     * @param IJobList $jobList
57
+     * @param ITimeFactory $timeFactory
58
+     */
59
+    public function __construct(IDBConnection $db,
60
+                                CalDavBackend $calDavBackend,
61
+                                ILogger $logger,
62
+                                IJobList $jobList,
63
+                                ITimeFactory $timeFactory) {
64
+        $this->db = $db;
65
+        $this->calDavBackend = $calDavBackend;
66
+        $this->logger = $logger;
67
+        $this->jobList = $jobList;
68
+        $this->timeFactory = $timeFactory;
69
+    }
70
+
71
+    public function run($arguments) {
72
+        $offset = (int) $arguments['offset'];
73
+        $stopAt = (int) $arguments['stopAt'];
74
+
75
+        $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')');
76
+
77
+        $startTime = $this->timeFactory->getTime();
78
+        while (($this->timeFactory->getTime() - $startTime) < 15) {
79
+            $offset = $this->buildIndex($offset, $stopAt);
80
+            if ($offset >= $stopAt) {
81
+                break;
82
+            }
83
+        }
84
+
85
+        if ($offset >= $stopAt) {
86
+            $this->logger->info('Building calendar index done');
87
+        } else {
88
+            $this->jobList->add(self::class, [
89
+                'offset' => $offset,
90
+                'stopAt' => $stopAt
91
+            ]);
92
+            $this->logger->info('New building calendar index job scheduled with offset ' . $offset);
93
+        }
94
+    }
95
+
96
+    /**
97
+     * @param int $offset
98
+     * @param int $stopAt
99
+     * @return int
100
+     */
101
+    private function buildIndex(int $offset, int $stopAt): int {
102
+        $query = $this->db->getQueryBuilder();
103
+        $query->select(['id', 'calendarid', 'uri', 'calendardata'])
104
+            ->from('calendarobjects')
105
+            ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt)))
106
+            ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset)))
107
+            ->orderBy('id', 'ASC')
108
+            ->setMaxResults(500);
109
+
110
+        $result = $query->execute();
111
+        while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
112
+            $offset = $row['id'];
113
+
114
+            $calendarData = $row['calendardata'];
115
+            if (is_resource($calendarData)) {
116
+                $calendarData = stream_get_contents($calendarData);
117
+            }
118
+
119
+            $this->calDavBackend->updateProperties($row['calendarid'], $row['uri'], $calendarData);
120
+        }
121
+
122
+        return $offset;
123
+    }
124 124
 }
Please login to merge, or discard this patch.
lib/private/TempManager.php 1 patch
Indentation   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -37,244 +37,244 @@
 block discarded – undo
37 37
 use Psr\Log\LoggerInterface;
38 38
 
39 39
 class TempManager implements ITempManager {
40
-	/** @var string[] Current temporary files and folders, used for cleanup */
41
-	protected $current = [];
42
-	/** @var string i.e. /tmp on linux systems */
43
-	protected $tmpBaseDir;
44
-	/** @var LoggerInterface */
45
-	protected $log;
46
-	/** @var IConfig */
47
-	protected $config;
48
-	/** @var IniGetWrapper */
49
-	protected $iniGetWrapper;
40
+    /** @var string[] Current temporary files and folders, used for cleanup */
41
+    protected $current = [];
42
+    /** @var string i.e. /tmp on linux systems */
43
+    protected $tmpBaseDir;
44
+    /** @var LoggerInterface */
45
+    protected $log;
46
+    /** @var IConfig */
47
+    protected $config;
48
+    /** @var IniGetWrapper */
49
+    protected $iniGetWrapper;
50 50
 
51
-	/** Prefix */
52
-	public const TMP_PREFIX = 'oc_tmp_';
51
+    /** Prefix */
52
+    public const TMP_PREFIX = 'oc_tmp_';
53 53
 
54
-	public function __construct(LoggerInterface $logger, IConfig $config, IniGetWrapper $iniGetWrapper) {
55
-		$this->log = $logger;
56
-		$this->config = $config;
57
-		$this->iniGetWrapper = $iniGetWrapper;
58
-		$this->tmpBaseDir = $this->getTempBaseDir();
59
-	}
54
+    public function __construct(LoggerInterface $logger, IConfig $config, IniGetWrapper $iniGetWrapper) {
55
+        $this->log = $logger;
56
+        $this->config = $config;
57
+        $this->iniGetWrapper = $iniGetWrapper;
58
+        $this->tmpBaseDir = $this->getTempBaseDir();
59
+    }
60 60
 
61
-	/**
62
-	 * Builds the filename with suffix and removes potential dangerous characters
63
-	 * such as directory separators.
64
-	 *
65
-	 * @param string $absolutePath Absolute path to the file / folder
66
-	 * @param string $postFix Postfix appended to the temporary file name, may be user controlled
67
-	 * @return string
68
-	 */
69
-	private function buildFileNameWithSuffix($absolutePath, $postFix = '') {
70
-		if ($postFix !== '') {
71
-			$postFix = '.' . ltrim($postFix, '.');
72
-			$postFix = str_replace(['\\', '/'], '', $postFix);
73
-			$absolutePath .= '-';
74
-		}
61
+    /**
62
+     * Builds the filename with suffix and removes potential dangerous characters
63
+     * such as directory separators.
64
+     *
65
+     * @param string $absolutePath Absolute path to the file / folder
66
+     * @param string $postFix Postfix appended to the temporary file name, may be user controlled
67
+     * @return string
68
+     */
69
+    private function buildFileNameWithSuffix($absolutePath, $postFix = '') {
70
+        if ($postFix !== '') {
71
+            $postFix = '.' . ltrim($postFix, '.');
72
+            $postFix = str_replace(['\\', '/'], '', $postFix);
73
+            $absolutePath .= '-';
74
+        }
75 75
 
76
-		return $absolutePath . $postFix;
77
-	}
76
+        return $absolutePath . $postFix;
77
+    }
78 78
 
79
-	/**
80
-	 * Create a temporary file and return the path
81
-	 *
82
-	 * @param string $postFix Postfix appended to the temporary file name
83
-	 * @return string
84
-	 */
85
-	public function getTemporaryFile($postFix = '') {
86
-		if (is_writable($this->tmpBaseDir)) {
87
-			// To create an unique file and prevent the risk of race conditions
88
-			// or duplicated temporary files by other means such as collisions
89
-			// we need to create the file using `tempnam` and append a possible
90
-			// postfix to it later
91
-			$file = tempnam($this->tmpBaseDir, self::TMP_PREFIX);
92
-			$this->current[] = $file;
79
+    /**
80
+     * Create a temporary file and return the path
81
+     *
82
+     * @param string $postFix Postfix appended to the temporary file name
83
+     * @return string
84
+     */
85
+    public function getTemporaryFile($postFix = '') {
86
+        if (is_writable($this->tmpBaseDir)) {
87
+            // To create an unique file and prevent the risk of race conditions
88
+            // or duplicated temporary files by other means such as collisions
89
+            // we need to create the file using `tempnam` and append a possible
90
+            // postfix to it later
91
+            $file = tempnam($this->tmpBaseDir, self::TMP_PREFIX);
92
+            $this->current[] = $file;
93 93
 
94
-			// If a postfix got specified sanitize it and create a postfixed
95
-			// temporary file
96
-			if ($postFix !== '') {
97
-				$fileNameWithPostfix = $this->buildFileNameWithSuffix($file, $postFix);
98
-				touch($fileNameWithPostfix);
99
-				chmod($fileNameWithPostfix, 0600);
100
-				$this->current[] = $fileNameWithPostfix;
101
-				return $fileNameWithPostfix;
102
-			}
94
+            // If a postfix got specified sanitize it and create a postfixed
95
+            // temporary file
96
+            if ($postFix !== '') {
97
+                $fileNameWithPostfix = $this->buildFileNameWithSuffix($file, $postFix);
98
+                touch($fileNameWithPostfix);
99
+                chmod($fileNameWithPostfix, 0600);
100
+                $this->current[] = $fileNameWithPostfix;
101
+                return $fileNameWithPostfix;
102
+            }
103 103
 
104
-			return $file;
105
-		} else {
106
-			$this->log->warning(
107
-				'Can not create a temporary file in directory {dir}. Check it exists and has correct permissions',
108
-				[
109
-					'dir' => $this->tmpBaseDir,
110
-				]
111
-			);
112
-			return false;
113
-		}
114
-	}
104
+            return $file;
105
+        } else {
106
+            $this->log->warning(
107
+                'Can not create a temporary file in directory {dir}. Check it exists and has correct permissions',
108
+                [
109
+                    'dir' => $this->tmpBaseDir,
110
+                ]
111
+            );
112
+            return false;
113
+        }
114
+    }
115 115
 
116
-	/**
117
-	 * Create a temporary folder and return the path
118
-	 *
119
-	 * @param string $postFix Postfix appended to the temporary folder name
120
-	 * @return string
121
-	 */
122
-	public function getTemporaryFolder($postFix = '') {
123
-		if (is_writable($this->tmpBaseDir)) {
124
-			// To create an unique directory and prevent the risk of race conditions
125
-			// or duplicated temporary files by other means such as collisions
126
-			// we need to create the file using `tempnam` and append a possible
127
-			// postfix to it later
128
-			$uniqueFileName = tempnam($this->tmpBaseDir, self::TMP_PREFIX);
129
-			$this->current[] = $uniqueFileName;
116
+    /**
117
+     * Create a temporary folder and return the path
118
+     *
119
+     * @param string $postFix Postfix appended to the temporary folder name
120
+     * @return string
121
+     */
122
+    public function getTemporaryFolder($postFix = '') {
123
+        if (is_writable($this->tmpBaseDir)) {
124
+            // To create an unique directory and prevent the risk of race conditions
125
+            // or duplicated temporary files by other means such as collisions
126
+            // we need to create the file using `tempnam` and append a possible
127
+            // postfix to it later
128
+            $uniqueFileName = tempnam($this->tmpBaseDir, self::TMP_PREFIX);
129
+            $this->current[] = $uniqueFileName;
130 130
 
131
-			// Build a name without postfix
132
-			$path = $this->buildFileNameWithSuffix($uniqueFileName . '-folder', $postFix);
133
-			mkdir($path, 0700);
134
-			$this->current[] = $path;
131
+            // Build a name without postfix
132
+            $path = $this->buildFileNameWithSuffix($uniqueFileName . '-folder', $postFix);
133
+            mkdir($path, 0700);
134
+            $this->current[] = $path;
135 135
 
136
-			return $path . '/';
137
-		} else {
138
-			$this->log->warning(
139
-				'Can not create a temporary folder in directory {dir}. Check it exists and has correct permissions',
140
-				[
141
-					'dir' => $this->tmpBaseDir,
142
-				]
143
-			);
144
-			return false;
145
-		}
146
-	}
136
+            return $path . '/';
137
+        } else {
138
+            $this->log->warning(
139
+                'Can not create a temporary folder in directory {dir}. Check it exists and has correct permissions',
140
+                [
141
+                    'dir' => $this->tmpBaseDir,
142
+                ]
143
+            );
144
+            return false;
145
+        }
146
+    }
147 147
 
148
-	/**
149
-	 * Remove the temporary files and folders generated during this request
150
-	 */
151
-	public function clean() {
152
-		$this->cleanFiles($this->current);
153
-	}
148
+    /**
149
+     * Remove the temporary files and folders generated during this request
150
+     */
151
+    public function clean() {
152
+        $this->cleanFiles($this->current);
153
+    }
154 154
 
155
-	/**
156
-	 * @param string[] $files
157
-	 */
158
-	protected function cleanFiles($files) {
159
-		foreach ($files as $file) {
160
-			if (file_exists($file)) {
161
-				try {
162
-					\OC_Helper::rmdirr($file);
163
-				} catch (\UnexpectedValueException $ex) {
164
-					$this->log->warning(
165
-						"Error deleting temporary file/folder: {file} - Reason: {error}",
166
-						[
167
-							'file' => $file,
168
-							'error' => $ex->getMessage(),
169
-						]
170
-					);
171
-				}
172
-			}
173
-		}
174
-	}
155
+    /**
156
+     * @param string[] $files
157
+     */
158
+    protected function cleanFiles($files) {
159
+        foreach ($files as $file) {
160
+            if (file_exists($file)) {
161
+                try {
162
+                    \OC_Helper::rmdirr($file);
163
+                } catch (\UnexpectedValueException $ex) {
164
+                    $this->log->warning(
165
+                        "Error deleting temporary file/folder: {file} - Reason: {error}",
166
+                        [
167
+                            'file' => $file,
168
+                            'error' => $ex->getMessage(),
169
+                        ]
170
+                    );
171
+                }
172
+            }
173
+        }
174
+    }
175 175
 
176
-	/**
177
-	 * Remove old temporary files and folders that were failed to be cleaned
178
-	 */
179
-	public function cleanOld() {
180
-		$this->cleanFiles($this->getOldFiles());
181
-	}
176
+    /**
177
+     * Remove old temporary files and folders that were failed to be cleaned
178
+     */
179
+    public function cleanOld() {
180
+        $this->cleanFiles($this->getOldFiles());
181
+    }
182 182
 
183
-	/**
184
-	 * Get all temporary files and folders generated by oc older than an hour
185
-	 *
186
-	 * @return string[]
187
-	 */
188
-	protected function getOldFiles() {
189
-		$cutOfTime = time() - 3600;
190
-		$files = [];
191
-		$dh = opendir($this->tmpBaseDir);
192
-		if ($dh) {
193
-			while (($file = readdir($dh)) !== false) {
194
-				if (substr($file, 0, 7) === self::TMP_PREFIX) {
195
-					$path = $this->tmpBaseDir . '/' . $file;
196
-					$mtime = filemtime($path);
197
-					if ($mtime < $cutOfTime) {
198
-						$files[] = $path;
199
-					}
200
-				}
201
-			}
202
-		}
203
-		return $files;
204
-	}
183
+    /**
184
+     * Get all temporary files and folders generated by oc older than an hour
185
+     *
186
+     * @return string[]
187
+     */
188
+    protected function getOldFiles() {
189
+        $cutOfTime = time() - 3600;
190
+        $files = [];
191
+        $dh = opendir($this->tmpBaseDir);
192
+        if ($dh) {
193
+            while (($file = readdir($dh)) !== false) {
194
+                if (substr($file, 0, 7) === self::TMP_PREFIX) {
195
+                    $path = $this->tmpBaseDir . '/' . $file;
196
+                    $mtime = filemtime($path);
197
+                    if ($mtime < $cutOfTime) {
198
+                        $files[] = $path;
199
+                    }
200
+                }
201
+            }
202
+        }
203
+        return $files;
204
+    }
205 205
 
206
-	/**
207
-	 * Get the temporary base directory configured on the server
208
-	 *
209
-	 * @return string Path to the temporary directory or null
210
-	 * @throws \UnexpectedValueException
211
-	 */
212
-	public function getTempBaseDir() {
213
-		if ($this->tmpBaseDir) {
214
-			return $this->tmpBaseDir;
215
-		}
206
+    /**
207
+     * Get the temporary base directory configured on the server
208
+     *
209
+     * @return string Path to the temporary directory or null
210
+     * @throws \UnexpectedValueException
211
+     */
212
+    public function getTempBaseDir() {
213
+        if ($this->tmpBaseDir) {
214
+            return $this->tmpBaseDir;
215
+        }
216 216
 
217
-		$directories = [];
218
-		if ($temp = $this->config->getSystemValue('tempdirectory', null)) {
219
-			$directories[] = $temp;
220
-		}
221
-		if ($temp = $this->iniGetWrapper->get('upload_tmp_dir')) {
222
-			$directories[] = $temp;
223
-		}
224
-		if ($temp = getenv('TMP')) {
225
-			$directories[] = $temp;
226
-		}
227
-		if ($temp = getenv('TEMP')) {
228
-			$directories[] = $temp;
229
-		}
230
-		if ($temp = getenv('TMPDIR')) {
231
-			$directories[] = $temp;
232
-		}
233
-		if ($temp = sys_get_temp_dir()) {
234
-			$directories[] = $temp;
235
-		}
217
+        $directories = [];
218
+        if ($temp = $this->config->getSystemValue('tempdirectory', null)) {
219
+            $directories[] = $temp;
220
+        }
221
+        if ($temp = $this->iniGetWrapper->get('upload_tmp_dir')) {
222
+            $directories[] = $temp;
223
+        }
224
+        if ($temp = getenv('TMP')) {
225
+            $directories[] = $temp;
226
+        }
227
+        if ($temp = getenv('TEMP')) {
228
+            $directories[] = $temp;
229
+        }
230
+        if ($temp = getenv('TMPDIR')) {
231
+            $directories[] = $temp;
232
+        }
233
+        if ($temp = sys_get_temp_dir()) {
234
+            $directories[] = $temp;
235
+        }
236 236
 
237
-		foreach ($directories as $dir) {
238
-			if ($this->checkTemporaryDirectory($dir)) {
239
-				return $dir;
240
-			}
241
-		}
237
+        foreach ($directories as $dir) {
238
+            if ($this->checkTemporaryDirectory($dir)) {
239
+                return $dir;
240
+            }
241
+        }
242 242
 
243
-		$temp = tempnam(dirname(__FILE__), '');
244
-		if (file_exists($temp)) {
245
-			unlink($temp);
246
-			return dirname($temp);
247
-		}
248
-		throw new \UnexpectedValueException('Unable to detect system temporary directory');
249
-	}
243
+        $temp = tempnam(dirname(__FILE__), '');
244
+        if (file_exists($temp)) {
245
+            unlink($temp);
246
+            return dirname($temp);
247
+        }
248
+        throw new \UnexpectedValueException('Unable to detect system temporary directory');
249
+    }
250 250
 
251
-	/**
252
-	 * Check if a temporary directory is ready for use
253
-	 *
254
-	 * @param mixed $directory
255
-	 * @return bool
256
-	 */
257
-	private function checkTemporaryDirectory($directory) {
258
-		// suppress any possible errors caused by is_writable
259
-		// checks missing or invalid path or characters, wrong permissions etc
260
-		try {
261
-			if (is_writable($directory)) {
262
-				return true;
263
-			}
264
-		} catch (\Exception $e) {
265
-		}
266
-		$this->log->warning('Temporary directory {dir} is not present or writable',
267
-			['dir' => $directory]
268
-		);
269
-		return false;
270
-	}
251
+    /**
252
+     * Check if a temporary directory is ready for use
253
+     *
254
+     * @param mixed $directory
255
+     * @return bool
256
+     */
257
+    private function checkTemporaryDirectory($directory) {
258
+        // suppress any possible errors caused by is_writable
259
+        // checks missing or invalid path or characters, wrong permissions etc
260
+        try {
261
+            if (is_writable($directory)) {
262
+                return true;
263
+            }
264
+        } catch (\Exception $e) {
265
+        }
266
+        $this->log->warning('Temporary directory {dir} is not present or writable',
267
+            ['dir' => $directory]
268
+        );
269
+        return false;
270
+    }
271 271
 
272
-	/**
273
-	 * Override the temporary base directory
274
-	 *
275
-	 * @param string $directory
276
-	 */
277
-	public function overrideTempBaseDir($directory) {
278
-		$this->tmpBaseDir = $directory;
279
-	}
272
+    /**
273
+     * Override the temporary base directory
274
+     *
275
+     * @param string $directory
276
+     */
277
+    public function overrideTempBaseDir($directory) {
278
+        $this->tmpBaseDir = $directory;
279
+    }
280 280
 }
Please login to merge, or discard this patch.