From http://groups.drupal.org/node/25420:
I have been trying to get Drupal 6.x to work with FeedAPI. I go through the installation process, create a feed, etc and once I try to refresh the feed to add the feed items I keep getting the following message:
error message: undefined function memory_get_usage()
The message refers to the feedapi.info file I think.
I managed to get this working on an installation of 5.x on my hosting service, HostingMatters.
Any thoughts? I searched around and can't find anything that specifically addresses this issue.
Thanks.
Comments
Comment #1
aron novakhttp://hu2.php.net/manual/en/function.memory-get-peak-usage.php
Before a given PHP version, it was possible to compile such a binary without these memory-related functions.
Comment #2
aron novakShould be fixed in 1.9
Comment #3
fioritto commentedI applied the patch above but I am still getting the same error message:
Fatal error: Call to undefined function: memory_get_usage() in xxxxxxxxxxxxxxxxxx/sites/all/modules/feedapi/feedapi.module on line 1273
Comment #4
aron novakYep, the patch is broken, thanks!
Comment #5
aron novakfioritto: it would be great if you would be able to test the new patch as well. It should work now :)
Comment #6
fioritto commentedI appreciate your help.
The patch process failed:
patching file feedapi.module
Hunk #1 FAILED at 1180.
Hunk #2 FAILED at 1275.
2 out of 2 hunks FAILED -- saving rejects to file feedapi.module.rej
Here is the contents of the feedapi.module.rej file:
***************
*** 1171,1177 ****
$counter = array();
timer_start('feedapi_'. $feed->nid);
- $memory_usage = memory_get_usage();
$cron = $param;
// Step 0: Check processors and grab settings
--- 1180,1186 ----
$counter = array();
timer_start('feedapi_'. $feed->nid);
+ $memory_usage_before = function_exists('memory_get_usage') ? memory_get_usage() : 0;
$cron = $param;
// Step 0: Check processors and grab settings
***************
*** 1266,1276 ****
db_query("UPDATE {feedapi} SET next_refresh_time = %d, half_done = %d, hash = '%s' WHERE nid = %d", $next_refresh_time, $half_done, $feed->hash, $feed->nid);
// Log statistics.
_feedapi_store_stat($nid, 'update_times', time(), $timestamp);
_feedapi_store_stat($nid, 'new', $new, $timestamp);
_feedapi_store_stat($nid, 'download_num', count($items), $timestamp);
_feedapi_store_stat($nid, 'process_time', timer_read('feedapi_'. $feed->nid), $timestamp);
- _feedapi_store_stat($nid, 'memory_increase', memory_get_usage() - $memory_usage, $timestamp);
_feedapi_store_stat($nid, 'next_refresh_time', $next_refresh_time, $timestamp);
if (!$cron) {
--- 1275,1286 ----
db_query("UPDATE {feedapi} SET next_refresh_time = %d, half_done = %d, hash = '%s' WHERE nid = %d", $next_refresh_time, $half_done, $feed->hash, $feed->nid);
// Log statistics.
+ $memory_usage_after = function_exists('memory_get_usage') ? memory_get_usage() : 0;
_feedapi_store_stat($nid, 'update_times', time(), $timestamp);
_feedapi_store_stat($nid, 'new', $new, $timestamp);
_feedapi_store_stat($nid, 'download_num', count($items), $timestamp);
_feedapi_store_stat($nid, 'process_time', timer_read('feedapi_'. $feed->nid), $timestamp);
+ _feedapi_store_stat($nid, 'memory_increase', $memory_usage_after - $memory_usage_before, $timestamp);
_feedapi_store_stat($nid, 'next_refresh_time', $next_refresh_time, $timestamp);
if (!$cron) {
Comment #7
aron novakfioritto: well, it's something wrong with your working copy. Are you sure that no other patches were applied?
I did a clean checkout and applied the patch without any issues.
Comment #8
fioritto commentedMy bad - this patch worked. Newbie mistake, I patched the already patched file instead of the original.
Thanks much.
Comment #9
alex_b commentedRTBC.
Comment #10
aron novakCommitted, thank you all for cooperating.