Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

API CHANGE Require ADMIN permissions for performance-heavy tasks in C…

…MSMain: getpagecount() and publishall(), and using increase_time_limit_to() which respects higher max_execution_time settings
  • Loading branch information...
commit 3809c1614f66aa3ed52b1ceb085830e2c182b863 1 parent f98bc84
@chillu chillu authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 code/controllers/CMSMain.php
View
14 code/controllers/CMSMain.php
@@ -1006,8 +1006,6 @@ function buildbrokenlinks($request) {
$page->HasBrokenLink = 0;
$page->HasBrokenFile = 0;
- $lastUsage = (memory_get_usage() - $lastPoint);
- $lastPoint = memory_get_usage();
$content->setValue($page->Content);
$content->saveInto($page);
@@ -1066,7 +1064,11 @@ function AddForm() {
* Helper function to get page count
*/
function getpagecount() {
- ini_set('max_execution_time', 0);
+ if(!Permission::check('ADMIN')) return Security::permissionFailure($this);
+
+ increase_time_limit_to();
+ increase_memory_limit_to();
+
$excludePages = split(" *, *", $_GET['exclude']);
$pages = DataObject::get("SiteTree", "\"ParentID\" = 0");
@@ -1093,8 +1095,10 @@ function getpagecount() {
}
function publishall($request) {
- ini_set("memory_limit", -1);
- ini_set('max_execution_time', 0);
+ if(!Permission::check('ADMIN')) return Security::permissionFailure($this);
+
+ increase_time_limit_to();
+ increase_memory_limit_to();
$response = "";
Please sign in to comment.
Something went wrong with that request. Please try again.