How can I retrieve more than 1000 pages with PermissionablePagination object?
Permalink
"This means that the entire result set (up to 1000) will be loaded and then segmented, with the permissions checker run against it."
http://www.concrete5.org/documentation/developers/5.7/working-with-...
I think this limit is needed for performance issue, but some times we have more than 1000 pages (or files). Can we change this number?
http://www.concrete5.org/documentation/developers/5.7/working-with-...
I think this limit is needed for performance issue, but some times we have more than 1000 pages (or files). Can we change this number?
Making that configurable though a method or public would be a fair pull request.
So, is this limit a design? or a bug? I'd like to here from core team about this.
Yep, it's by design, for performance reasons.
Thanks much for your reply. So it means we can't view more than 1000 files in the file manager by design. OK...
Well, technically it means you can't have a query with a result set greater than 1000 if you're not the admin user. But if you filter the query by any criteria you get a new 1000 results to play with.
The logic behind this is for permissions performance: we can't do permissions calls in MySQL, we have to do them on the objects that come out of the database. The permissionable pagination is really meant to only let you page further back or ahead in the result set, rather than jump to a specific page. Much like you can't just view the full index of Google, you have to search for something first. And even then you have a finite number of pages you can jump back to into the past.
That's the idea, anyway – having pagination functionality (next/previous) while having all permissions being checked in PHP, rather than in the SQL query itself.
The logic behind this is for permissions performance: we can't do permissions calls in MySQL, we have to do them on the objects that come out of the database. The permissionable pagination is really meant to only let you page further back or ahead in the result set, rather than jump to a specific page. Much like you can't just view the full index of Google, you have to search for something first. And even then you have a finite number of pages you can jump back to into the past.
That's the idea, anyway – having pagination functionality (next/previous) while having all permissions being checked in PHP, rather than in the SQL query itself.
> Much like you can't just view the full index of Google, you have to search for something first.
I'm going to tell to my client like this. Thanks very much.
I'm going to tell to my client like this. Thanks very much.
However if you want to do it then follow as bellow :
register "/tools/required/dashboard/sitemap_data" in your-web-site/application/bootstrap/app.php
1) Create one custome class in "your-web-site/application/src" with extend "Concrete\Core\Page\PageList" and add your customer public function in that class which call in your registered route and return it.
2) Copy code from "your-web-site/concrete/tools/dashboard/sitemap_data.php" and put it in your above created function.
3) Set all use/includes according to your function required.
4) Copy "your-web-site/concrete/src/Search/PermissionableListItemInterface.php" file and put it in "your-web-site/application/src"
5) In PermissionableListItemInterface you have able to set your customer data listing limit in place of "$this->maxResultsToProcessAtOnce".
6) Override "createPaginationObject" function in which you create your customer class (point 1).
7) And use PermissionableListItemInterface which you have just copy it from "your-web-site/concrete/src/Search/PermissionableListItemInterface.php" and past it in "your-web-site/application/src".
register "/tools/required/dashboard/sitemap_data" in your-web-site/application/bootstrap/app.php
1) Create one custome class in "your-web-site/application/src" with extend "Concrete\Core\Page\PageList" and add your customer public function in that class which call in your registered route and return it.
2) Copy code from "your-web-site/concrete/tools/dashboard/sitemap_data.php" and put it in your above created function.
3) Set all use/includes according to your function required.
4) Copy "your-web-site/concrete/src/Search/PermissionableListItemInterface.php" file and put it in "your-web-site/application/src"
5) In PermissionableListItemInterface you have able to set your customer data listing limit in place of "$this->maxResultsToProcessAtOnce".
6) Override "createPaginationObject" function in which you create your customer class (point 1).
7) And use PermissionableListItemInterface which you have just copy it from "your-web-site/concrete/src/Search/PermissionableListItemInterface.php" and past it in "your-web-site/application/src".
protected $maxResultsToProcessAtOnce = 1000;
As it's a protected class variable and there doesn't look like there is a function to change it, I think you may need to override the class to add a function to change it.
I've not overridden any core classes in 5.7 yet, but this appears to be the way to do it:
https://www.concrete5.org/documentation/how-tos/developers/override-...