Bugfix on confluence API
This commit is contained in:
parent
f64758aeec
commit
a5afc23cda
@ -121,9 +121,12 @@ class Api
|
|||||||
*/
|
*/
|
||||||
public function getHierarchy($rootPage)
|
public function getHierarchy($rootPage)
|
||||||
{
|
{
|
||||||
|
$increment = 15;
|
||||||
|
|
||||||
//We do a limit of 15 as it appears that confluence has
|
//We do a limit of 15 as it appears that confluence has
|
||||||
//a bug when retrieving more than 20 entries with "body.storage"
|
//a bug when retrieving more than 20 entries with "body.storage"
|
||||||
$url = "content/$rootPage/child/page?expand=version,body.storage&limit=15";
|
$base_url = $url = "content/$rootPage/child/page?expand=version,body.storage&limit=$increment";
|
||||||
|
$start = 0;
|
||||||
|
|
||||||
$children = [];
|
$children = [];
|
||||||
|
|
||||||
@ -143,12 +146,12 @@ class Api
|
|||||||
"children" => $this->getHierarchy($result['id'])
|
"children" => $this->getHierarchy($result['id'])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//We don't use _links->next as after ~30 elements it doesn't show any new elements
|
||||||
|
$start += $increment;
|
||||||
|
$url = "$base_url&start=$start";
|
||||||
|
|
||||||
if (array_key_exists('next', $hierarchy['_links'])) {
|
} while (!empty($hierarchy['results']));
|
||||||
$url = $hierarchy['_links']['next'];
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (array_key_exists('next', $hierarchy['_links']));
|
|
||||||
|
|
||||||
return $children;
|
return $children;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user