diff --git a/config/global.ini.php b/config/global.ini.php index d53ad8b109bf1616d0229e4e2e2e9290ca0b7e84..e6ff05d97e269bf9da84b86c4a225a154dafb6de 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -140,6 +140,9 @@ minimum_pgsql_version = 8.3 ; Minimum adviced memory limit in php.ini file (see memory_limit value) minimum_memory_limit = 128 +; Minimum memory limit enforced when archived via misc/cron/archive.php +minimum_memory_limit_when_archiving = 768 + ; Piwik will check that usernames and password have a minimum length, and will check that characters are "allowed" ; This can be disabled, if for example you wish to import an existing User database in Piwik and your rules are less restrictive disable_checks_usernames_attributes = 0 diff --git a/core/Piwik.php b/core/Piwik.php index a27ec3b4b31c09fb68395b3fa219145f70f9bd07..287bb70bac68f9f280ab88293febba9d670b52d4 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -968,14 +968,26 @@ class Piwik */ static public function raiseMemoryLimitIfNecessary() { - $minimumMemoryLimit = Zend_Registry::get('config')->General->minimum_memory_limit; $memoryLimit = self::getMemoryLimitValue(); - if($memoryLimit !== false - && $memoryLimit < $minimumMemoryLimit) + if($memoryLimit === false) + { + return false; + } + $minimumMemoryLimit = Zend_Registry::get('config')->General->minimum_memory_limit; + + if(Piwik_Common::isArchivePhpTriggered()) + { + $minimumMemoryLimitWhenArchiving = Zend_Registry::get('config')->General->minimum_memory_limit_when_archiving; + if($memoryLimit < $minimumMemoryLimitWhenArchiving) + { + return self::setMemoryLimit($minimumMemoryLimitWhenArchiving); + } + return false; + } + if($memoryLimit < $minimumMemoryLimit) { return self::setMemoryLimit($minimumMemoryLimit); } - return false; }