Skip to content

Commit

Permalink
Resolving Issue #2712
Browse files Browse the repository at this point in the history
The hard code of set memory_limit need to be removed
  • Loading branch information
cigamit committed May 30, 2019
1 parent 7fe019a commit ba21617
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Cacti CHANGELOG
-issue#2699: Login Options: "Show the page that user pointed their browser to" Not Working
-issue#2702: sqltable_to_php.php should ignore '--plugin' when '--update'
-issue#2707: Some pages that have permission errors dont raise proper messages
-issue#2712: The hard code of set memory_limit need to be removed
-feature#2538: New global setting to change datasource behaviour when deleting graph
-feature#2539: New global setting to add permanent unlock of graphs
-feature#2540: New user setting to forget graph tree history on tab close
Expand Down
2 changes: 1 addition & 1 deletion cmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function debug($message) {
global $poller_id, $sessions, $downhosts, $remote_db_cnn_id;

ini_set('max_execution_time', '0');
ini_set('memory_limit', '512M');
ini_set('memory_limit', '-1');

$no_http_headers = true;

Expand Down
4 changes: 2 additions & 2 deletions include/vendor/phpsnmp/mib_parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MibParser extends MibCache {
*/
function __construct(){
set_time_limit(0);
ini_set('memory_limit', '256M');
ini_set('memory_limit', '-1');
error_reporting(E_ALL);
}

Expand Down Expand Up @@ -192,7 +192,7 @@ function get_tokens($text)
function parse_simple_token($tokens, &$index, $allowed=NULL)
{
$index++;

if(is_array($allowed))
{
if(in_array(strtolower($tokens[$index]), $allowed))
Expand Down
12 changes: 2 additions & 10 deletions install/cli_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,9 @@
+-------------------------------------------------------------------------+
*/

/* do NOT run this script through a web browser */
if (php_sapi_name() != 'cli') {
die('<br><strong>This script is only meant to run at the command line.</strong>');
}

global $original_memory_limit;
$original_memory_limit = ini_get('memory_limit');
ini_set('memory_limit','256M');
ini_set('memory_limit','-1');

$no_http_headers = true;
include(dirname(__FILE__) . '/../include/global.php');
include(dirname(__FILE__) . '/../include/cli_check.php');
include(dirname(__FILE__) . '/../lib/utility.php');

if ($argv !== false && $argc != false && $argc > 1) {
Expand Down
10 changes: 5 additions & 5 deletions lib/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function import_package($xmlfile, $profile_id = 1, $remove_orphans = false, $pre
/* set new timeout and memory settings */
if ($limitex) {
ini_set('max_execution_time', '50');
ini_set('memory_limit', '384M');
ini_set('memory_limit', '-1');
}

$public_key = get_public_key();
Expand Down Expand Up @@ -406,7 +406,7 @@ function xml_to_graph_template($hash, &$xml_array, &$hash_cache, $hash_version,
if (!empty($_graph_template_id)) {
$previous_data = db_fetch_row_prepared('SELECT *
FROM graph_templates
WHERE id = ?',
WHERE id = ?',
array($_graph_template_id));
} else {
$previous_data = array();
Expand Down Expand Up @@ -438,8 +438,8 @@ function xml_to_graph_template($hash, &$xml_array, &$hash_cache, $hash_version,
FROM graph_templates AS gt
INNER JOIN graph_templates_graph AS gtg
ON gt.id = gtg.graph_template_id
WHERE gt.id = ?
AND gtg.local_graph_id = 0',
WHERE gt.id = ?
AND gtg.local_graph_id = 0',
array($graph_template_id)));

if (!empty($_graph_template_id)) {
Expand Down Expand Up @@ -731,7 +731,7 @@ function xml_to_data_template($hash, &$xml_array, &$hash_cache, $import_as_new,
INNER JOIN data_template_data AS dtd
ON dt.id=dtd.data_template_id
WHERE dt.id = ?
AND dtd.local_data_id = 0',
AND dtd.local_data_id = 0',
array($data_template_id)));

if (!empty($save['id'])) {
Expand Down
2 changes: 1 addition & 1 deletion poller.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function sig_handler($signo) {
* plus the poller needs lot's of memory
*/
ini_set('max_execution_time', MAX_POLLER_RUNTIME + 1);
ini_set('memory_limit', '512M');
ini_set('memory_limit', '-1');

$poller_runs_completed = 0;
$poller_items_total = 0;
Expand Down
2 changes: 1 addition & 1 deletion poller_commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
define('MAX_RECACHE_RUNTIME', 1800);

ini_set('max_runtime', '-1');
ini_set('memory_limit', '800M');
ini_set('memory_limit', '-1');

require(__DIR__ . '/include/cli_check.php');
require_once($config['base_path'] . '/lib/api_device.php');
Expand Down
4 changes: 2 additions & 2 deletions poller_spikekill.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

require(__DIR__ . '/include/cli_check.php');

ini_set('memory_limit', '512M');
ini_set('memory_limit', '-1');

/* process calling arguments */
$parms = $_SERVER['argv'];
Expand Down Expand Up @@ -196,7 +196,7 @@ function purge_spike_backups() {
$earlytime = time() - $retention;

if ($directory != '' && s_dir($directory) && is_writable($directory)) {
$files = array_diff(scandir($directory), array('.', '..'));
$files = array_diff(scandir($directory), array('.', '..'));

if (cacti_sizeof($files)) {
foreach($files as $file) {
Expand Down

0 comments on commit ba21617

Please sign in to comment.