There is only one paged result API now that PHP 7.2 is long dead. Starting by removing empty function calls. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>tags/v26.0.0beta1
@@ -1996,12 +1996,9 @@ class Access extends LDAPUtility { | |||
//since offset = 0, this is a new search. We abandon other searches that might be ongoing. | |||
$this->abandonPagedSearch(); | |||
} | |||
$pagedSearchOK = true === $this->invokeLDAPMethod( | |||
'controlPagedResult', $limit, false | |||
); | |||
if ($pagedSearchOK) { | |||
$this->logger->debug('Ready for a paged search', ['app' => 'user_ldap']); | |||
} | |||
$pagedSearchOK = true; | |||
$this->invokeLDAPMethod('controlPagedResult', $limit, false); | |||
$this->logger->debug('Ready for a paged search', ['app' => 'user_ldap']); | |||
/* ++ Fixing RHDS searches with pages with zero results ++ | |||
* We couldn't get paged searches working with our RHDS for login ($limit = 0), | |||
* due to pages with zero results. | |||
@@ -2016,8 +2013,8 @@ class Access extends LDAPUtility { | |||
// in case someone set it to 0 … use 500, otherwise no results will | |||
// be returned. | |||
$pageSize = (int)$this->connection->ldapPagingSize > 0 ? (int)$this->connection->ldapPagingSize : 500; | |||
$pagedSearchOK = $this->invokeLDAPMethod('controlPagedResult', | |||
$pageSize, false); | |||
$pagedSearchOK = true; | |||
$this->invokeLDAPMethod('controlPagedResult', $pageSize, false); | |||
} | |||
return $pagedSearchOK; |
@@ -58,9 +58,8 @@ interface ILDAPWrapper { | |||
* @param int $pageSize number of results per page | |||
* @param bool $isCritical Indicates whether the pagination is critical of not. | |||
* @param string $cookie structure sent by LDAP server | |||
* @return bool true on success, false otherwise | |||
*/ | |||
public function controlPagedResult($link, $pageSize, $isCritical); | |||
public function controlPagedResult($link, $pageSize, $isCritical): void; | |||
/** | |||
* Retrieve the LDAP pagination cookie |
@@ -105,21 +105,8 @@ class LDAP implements ILDAPWrapper { | |||
/** | |||
* {@inheritDoc} | |||
*/ | |||
public function controlPagedResult($link, $pageSize, $isCritical) { | |||
$fn = $this->pagedResultsAdapter->getRequestCallFunc(); | |||
public function controlPagedResult($link, $pageSize, $isCritical): void { | |||
$this->pagedResultsAdapter->setRequestParameters($link, $pageSize, $isCritical); | |||
if ($fn === null) { | |||
return true; | |||
} | |||
$this->preFunctionCall($fn, $this->pagedResultsAdapter->getRequestCallArgs($link)); | |||
$result = $this->pagedResultsAdapter->requestCall($link); | |||
if ($this->isResultFalse($result)) { | |||
$this->postFunctionCall(); | |||
} | |||
return $result; | |||
} | |||
/** |
@@ -37,32 +37,6 @@ interface IAdapter { | |||
*/ | |||
public function setRequestParameters($link, int $pageSize, bool $isCritical): void; | |||
/** | |||
* The adapter is asked for an function that is being explicitly called to | |||
* send the control parameters to LDAP. If not function has to be called, | |||
* null shall be returned. | |||
* | |||
* It will used by the callee for diagnosis and error handling. | |||
*/ | |||
public function getRequestCallFunc(): ?string; | |||
/** | |||
* The adapter is asked to provide the arguments it would pass to the | |||
* function returned by getRequestCallFunc(). If none shall be called, an | |||
* empty array should be returned. | |||
* | |||
* It will used by the callee for diagnosis and error handling. | |||
*/ | |||
public function getRequestCallArgs($link): array; | |||
/** | |||
* The adapter is asked to do the necessary calls to LDAP, if | |||
* getRequestCallFunc returned a function. If none, it will not be called | |||
* so the return value is best set to false. Otherwise it shall respond | |||
* whether setting the controls was successful. | |||
*/ | |||
public function requestCall($link): bool; | |||
/** | |||
* The adapter shall report which PHP function will be called to process | |||
* the paged results call |
@@ -87,10 +87,6 @@ class Php73 implements IAdapter { | |||
} | |||
} | |||
public function getRequestCallFunc(): ?string { | |||
return null; | |||
} | |||
public function setRequestParameters($link, int $pageSize, bool $isCritical): void { | |||
$linkId = $this->getLinkId($link); | |||
if (!isset($this->linkData[$linkId])) { | |||
@@ -105,16 +101,6 @@ class Php73 implements IAdapter { | |||
} | |||
} | |||
public function getRequestCallArgs($link): array { | |||
// no separate call | |||
return []; | |||
} | |||
public function requestCall($link): bool { | |||
// no separate call | |||
return false; | |||
} | |||
public function setSearchArgs( | |||
$link, | |||
string $baseDN, |