protected static function isRequestAuthorizedToArchive() { return !self::$forceDisableArchiving && (self::isBrowserTriggerArchivingEnabled() || Piwik_Common::isPhpCliMode() || Piwik::isUserIsSuperUser() && Piwik_Common::isArchivePhpTriggered()); }
/** * Raise PHP memory limit if below the minimum required * * @return bool true if set; false otherwise */ public static function raiseMemoryLimitIfNecessary() { $memoryLimit = self::getMemoryLimitValue(); if ($memoryLimit === false) { return false; } $minimumMemoryLimit = Zend_Registry::get('config')->General->minimum_memory_limit; if (Piwik_Common::isArchivePhpTriggered() && Piwik::isUserIsSuperUser()) { // archive.php: no time limit, high memory limit self::setMaxExecutionTime(0); $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; }
public static function shouldRethrowException() { // If we are in no dispatch mode, eg. a script reusing Piwik libs, // then we should return the exception directly, rather than trigger the event "bad config file" // which load the HTML page of the installer with the error. // This is at least required for misc/cron/archive.php and useful to all other scripts return defined('PIWIK_ENABLE_DISPATCH') && !PIWIK_ENABLE_DISPATCH || Piwik_Common::isPhpCliMode() || Piwik_Common::isArchivePhpTriggered(); }