Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Error Cron : Invalid argument supplied for foreach()

9 years 5 months ago
Licenses:
JomSocial Expired

Hello,

I'm getting an error when running the ?option=community&task=cron from the browser...

<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/XXXXXXXXXX/public_html/components/com_community/libraries/cron.php</b> on line <b>853</b><br />
^

I did see one other thread like this where the user created his own missing folder to take care of the problem. I have also done that with no success. However, I'm not sure if he was using Amazon S3, and I am.

I did do some testing and was able to successfully create a new Group and upload the Cover image, run cron, and the system stored the image in S3. But, if I tried any other upload that should go to S3, like changing/uploading a Group Avatar, it is stored locally on the Server and S3 is bypassed, and the Cron Error occurs.

I would appreciate your help in resolving.

Thanks,
Brian

9 years 5 months ago
Licenses:

Hi, Brian.

You need to post a domain change request first.
Please post a request here: www.jomsocial.com/forum/billing-issues
And provide reason for change.

When your request will be accepted, please, update this thread that it's done.
Then I'll proceed with support.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
9 years 5 months ago
Licenses:
JomSocial Expired

Billing has updated my Domain accordingly.

9 years 5 months ago
Licenses:

Hi, Brian.

Make sure that you have latest FFMPEG version installed (ask you hosting provider about it).
Then try this solution: www.jomsocial.com/forum/profile-universa...ed-for-foreach#85613


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
9 years 5 months ago
Licenses:
JomSocial Expired

I have already tried the solution posted, and mentioned the results in the first thread.

I do have root server access and checked the ffmpeg version = 0.6.5 running on Centos = 6.6

Something appears to be out of sync with JomSocial trying to create/copy/delete either Group Avatars or Cover images, to AWS S3.

I will test again by using a New User (so we get new ID's), then will create new Group, and modify Avatar image - then fire off cron.

9 years 5 months ago
Licenses:
JomSocial Expired

Okay, I implemented the following code change to /home/XXXXXXXXXX/public_html/components/com_community/libraries/cron.php

$pCover = JFolder::folders($path . '/' . $folder . '/profile');
if($pCover) {
foreach ($pCover as $_pCoverId) {
...}}

...and this gets me passed the cron error. Still doesn't solve the issue of why JomSocial was out of Sync and/or missing folders, to cause the problem in the first place. But, I can successfully see Users Avatars and Covers being created, the cron job fire, and images are created on AWS S3 correctly.

However, after testing this multiple times, I noticed a strange behavior ...JomSocial is creating the User/Group/Event "Avatars and Covers" on (both) local server and in S3. Isn't JomSocial supposed to only use S3 once configured?

I have duplicate images in both locations, please advise.

I'm on JomSocial 3.2.1.5, Joomla 3.3.6.

9 years 5 months ago
Licenses:

Hi, Brian.

Then you have REALLY old version of FFMPEG. Latest version is 2.5.1.
Please, try to upgrade it.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
9 years 5 months ago
Licenses:
JomSocial Expired

Hey Michael,

I see the same 2.5.1 on the home page. But, if you look a bit deeper you will find the latest ffmpeg version, for RHEL/Centos 6.X 64-bit = 0.10.15 ...so I'm not that far off.

http://download1.rpmfusion.org/free/el/updates/6/x86_64/repoview/index.html

Anyway, upgrading ffmpeg doesn't seem to be the issue at the moment. The cron fails at 2 points...

1) Something was out of Sync upon creating either a User or Group Avatar and/or Cover image...this threw
...Error Cron : Invalid argument supplied for foreach() at line
...modified cron.php to include the test for : if($pCover)

2) When I deleted the User or Group from JomSocial backend, then ran the cron, it threw:
....Warning: S3::deleteObject(): [BucketNotEmpty] The bucket you tried to delete is not empty in /home/XXXXXXX/public_html/components/com_community/libraries/storage/s3_lib.php on line 337

...which is strange, because the error is correct the bucket is not empty...I deleted the User/Group and expected the cron to Delete the files from S3 - not warn me otherwise.

Can we find a new starting point for testing and walk through this to eliminate the cron errors and the fact that JomSocial is creating duplicate images on both the local server and S3 - and apparently has an issue with deleting from S3.

Let's clear the slate and start new. What would you like me to do first?

Thanks,

9 years 5 months ago
Licenses:
JomSocial Expired

So, I took everything back to default / clean-state, meaning...

Users:
- Users only have default JomSocial Avatar image - local server
- Users only have default JomSocial Cover image - local server
- Deleted User Avatars from S3 - left the /folder structure
- Deleted User Covers from S3 - left the /folder structure

Groups & Events:
- Deleted the Groups / Events, so there are no images on local server
- Deleted the Groups / Events Avatars from S3, left the /folder structure
- Deleted the Groups / Events Covers from S3, left the /folder structure

Cron.php
- Set the cron.php file back to default, and removed the if($pCover) test

FFMPEG
I will triple check the ffmpeg version, but pretty sure its = 0.10.15 for RHEL/Centos 6.X 64-bit

Now we can test...

9 years 5 months ago
Licenses:

Hi, Brian.

I assign developer to this thread.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
9 years 5 months ago
Licenses:
JomSocial Expired

Thanks for sending it on Michael. I want to get this resolved before the site goes live if possible.

I have tested from my version of a clean-slate, mentioned in above thread and found the following:

User Avatar:
- User uploads a new avatar image, JS does the following:
JS creates (2) files on local server in /images/avatar/
- profile-1234.jpg
- stream_1234.jpg
- Both files are left on local server (I assume these should be removed if successfully transferred to S3)
Server fires off cron
- transfers/copies (2) files to S3 in bucket/images/avatar/
- thumb_1234.jpg
- 1234.jpg
- Both files are compressed smaller than the files found on local server

User Cover:
- User uploads a new cover image, JS does the following:
JS creates (1) folder on local server in /images/cover/profile/UserID/ ...no file
Server fires off cron
- transfers/copies (2) files to S3 in bucket/images/cover/profile/UserID/
- thumb_1234.jpg
- 1234.jpg

Originally, the cron threw error on line 853, because a folder was missing.
Warning: Invalid argument supplied for foreach() in
/home/XXXXXXXXXX/public_html/components/com_community/libraries/cron.php on line 853

After I delete the user/avatar and cover, the cron throws:
Warning: S3::deleteObject(): [BucketNotEmpty] The bucket you tried to delete is not empty in /home/XXXXXXX/public_html/components/com_community/libraries/storage/s3_lib.php on line 337

So, I have several questions like, why is the folder structure not consistent between server and S3? But, the overall issues feels like this is more JS S3-related and the Cron just happens to catch/see the problem and warn us of what's going on. But, I leave that too you to help explain.

Let me know what I can do to help.
Regards,
Brian

9 years 4 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Brian,

I think this is valid bug, I will add this to our bug list.

thank you

9 years 4 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

I give you the temp fix to hide warning error ..

Open this file /components/com_community/libraries/cron.php, find this code :

foreach ($pCover as $_pCoverId) {
                        $pUser = CFactory::getUser($_pCoverId);

                        if (is_null($pUser->username)) {
                            JFolder::delete($path . '/' . $folder . '/profile/' . $_pCoverId);
                        }
                    }

replace to :
if(is_dir($pCover)){
                        foreach ($pCover as $_pCoverId) {
                            $pUser = CFactory::getUser($_pCoverId);

                            if (is_null($pUser->username)) {
                                JFolder::delete($path . '/' . $folder . '/profile/' . $_pCoverId);
                            }
                        }
                    }

thank you

9 years 4 months ago
Licenses:
JomSocial Expired

Hi Dimas,

I swapped out the code like you asked, but received the following error:

Warning: is_dir() expects parameter 1 to be a valid path, array given in /home/XXXXXX/public_html/components/com_community/libraries/cron.php on line 854

...so switched the code back to default.

BTW - Were you able to confirm and/or make any progress on the bug with leaving duplicate folders/images on the server, when they should be moved to S3?

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW