File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -243,29 +243,22 @@ protected function fetchDetails() {
243243 */
244244 protected function determineShares () {
245245 $ query = $ this ->db ->prepare ('
246- SELECT COUNT( `uid_owner`)
246+ SELECT `uid_owner`
247247 FROM `*PREFIX*share`
248248 WHERE `uid_owner` = ?
249249 ' , 1 );
250250 $ query ->execute ([$ this ->ocName ]);
251- $ sResult = $ query ->fetchColumn (0 );
252- if ((int )$ sResult === 1 ) {
251+ if ($ query ->rowCount () > 0 ) {
253252 $ this ->hasActiveShares = true ;
254253 return ;
255254 }
256255
257256 $ query = $ this ->db ->prepare ('
258- SELECT COUNT( `owner`)
257+ SELECT `owner`
259258 FROM `*PREFIX*share_external`
260259 WHERE `owner` = ?
261260 ' , 1 );
262261 $ query ->execute ([$ this ->ocName ]);
263- $ sResult = $ query ->fetchColumn (0 );
264- if ((int )$ sResult === 1 ) {
265- $ this ->hasActiveShares = true ;
266- return ;
267- }
268-
269- $ this ->hasActiveShares = false ;
262+ $ this ->hasActiveShares = $ query ->rowCount () > 0 ;
270263 }
271264}
Original file line number Diff line number Diff line change @@ -78,10 +78,12 @@ public function shareOwnerProvider(): array {
7878 public function testHasActiveShares (int $ internalOwnerships , int $ externalOwnerships , bool $ expected ) {
7979 $ queryMock = $ this ->createMock (Statement::class);
8080 $ queryMock ->expects ($ this ->atLeastOnce ())
81- ->method ('fetchColumn ' )
81+ ->method ('execute ' );
82+ $ queryMock ->expects ($ this ->atLeastOnce ())
83+ ->method ('rowCount ' )
8284 ->willReturnOnConsecutiveCalls (
83- ( string ) $ internalOwnerships ,
84- ( string ) $ externalOwnerships
85+ $ internalOwnerships > 0 ? 1 : 0 ,
86+ $ externalOwnerships > 0 ? 1 : 0
8587 );
8688
8789 $ this ->dbc ->expects ($ this ->atLeastOnce ())
You can’t perform that action at this time.
0 commit comments