English (United Kingdom)
Jms Multi Site, formerly joomla multisite.
Create, share multiple joomla sites in few clicks !
Message
  • EU e-Privacy Directive

    This website uses cookies to manage authentication, navigation, and other functions. By using our website, you agree that we can place these types of cookies on your device.

    View e-Privacy Directive Documents

Welcome, Guest
Please Login or Register.    Lost Password?
Go to bottomPage: 12
TOPIC: Gator Feed and Cron Jobs
#7462
Gator Feed and Cron Jobs 12 Years, 10 Months ago Karma: 0
Hi,

I have plenty of websites running now. The problem I face is my instalation of Gator Feed which accesses the Components folder and also the Includes folder as part of a CRON job.

I have had to move my Gator Feed folder into the root so that the CRON task can call the script, which is fine, however the script calls another file 'includes/defines.php'

I've tried moving this file elsewhere but to no avail. I get the error message:
Warning: require_once(/includes/defines.php): failed to open stream: No such file or directory in /var/www/vhosts/hydro2grow.co.uk/httpdocs/com_fg_cron/cron.feedgator.php on line 23

I've tried changing the location of the defines.php file but it won't work. I know this is more likely to be a question for GF but I was wondering if a similar issue had already come up somewhere/elsewhere?

The code within the GF file is:

#!/usr/bin/php
<?php

/**
* FeedGator - Aggregate RSS newsfeed content into a Joomla! database
* @version 2.3.3
* @package FeedGator
* @author Original author Stephen Simmons
* @now continued and modified by Matt Faulds, Remco Boom & Stephane Koenig and others
* @email mattfaulds@gmail.com
* @Joomla 1.5 Version by J. Kapusciarz (mrjozo)
* @copyright (C) 2005 by Stephen Simmons - All rights reserved
* @license GNU/GPL: www.gnu.org/copyleft/gpl.html
*
**/


define( '_JEXEC', 1 );

define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', substr(__FILE__,0,strrpos(__FILE__, DS.'administrator')));

require_once(JPATH_BASE.DS.'includes'.DS.'defines.php' );
require_once(JPATH_ADMINISTRATOR.DS.'includes'.DS.'framework.php' );
require_once(JPATH_ADMINISTRATOR.DS.'includes'.DS.'helper.php' );
require_once(JPATH_ADMINISTRATOR.DS.'includes'.DS.'toolbar.php' );

$mainframe = &JFactory::getApplication('site');
$mainframe->initialise();

$version = new JVersion();
define('J_VERSION', $version->getShortVersion());

require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_feedgator'.DS.'controller.php');
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_feedgator'.DS.'factory.feedgator.php');
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_feedgator'.DS.'helpers'.DS.'feedgator.helper.php');
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_feedgator'.DS.'helpers'.DS.'feedgator.utility.php');
if(file_exists(JPATH_ROOT.DS.'plugins'.DS.'system'.DS.'addkeywords.php')) {
require_once(JPATH_ROOT.DS.'plugins'.DS.'system'.DS.'addkeywords.php');
}
FeedgatorUtility::profiling('Start cron');

define('SPIE_CACHE_AGE', 60*10);

require_once(JPATH_ROOT.DS.'libraries'.DS.'simplepie'.DS.'simplepie.php');
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_feedgator'.DS.'inc'.DS.'simplepie'.DS.'overrides.php');
FeedgatorUtility::profiling('Loaded SimplePie');

JRequest::setVar('task','cron','get');
JRequest::setVar(JUtility::getToken(),'1','get');

$config = array('base_path'=>JPATH_ADMINISTRATOR.DS.'components'.DS.'com_feedgator');
$controller = new FeedgatorController($config);
$controller->import('all');

FeedgatorUtility::profiling('End');
echo 'Import finished';

Regards
Jamie
jamiegee
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7465
Re: Gator Feed and Cron Jobs 12 Years, 10 Months ago Karma: 54
The key element to make this script working is that it compute the correct JPATH_BASE.

If the define( 'JPATH_BASE' ...) has a wrong value, this may explain that you encouter problem.

If the computation of this value is wrong, perhaps you could replace the
define( 'JPATH_BASE', '<PUT HERE THE ROOT DIRECTORY OF JOOMLA>')

I hope this will help you
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7476
Re: Gator Feed and Cron Jobs 12 Years, 10 Months ago Karma: 0
I changed the file to read : define('JPATH_BASE', substr(__FILE__,0,strrpos(__FILE__, DS.'/var/www/vhosts/hydro2grow.co.uk/httpdocs')));

However I get the following error (original file located here 'includes/import.php' )

Fatal error: Class 'JRequest' not found in /var/www/vhosts/hydro2grow.co.uk/httpdocs/com_fg_script/import.php on line 33

I'm not sure where to go from here....

31 //Environment classes
32 JLoader::import( 'joomla.environment.request' );
33 JRequest::clean();
34
35 JLoader::import( 'joomla.environment.response' );
jamiegee
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7480
Re: Gator Feed and Cron Jobs 12 Years, 10 Months ago Karma: 54
The problem is not to change the file to read but assing the correct value to the define
In example:
define('JPATH_BASE', '/var/www/vhosts/hydro2grow.co.uk/httpdocs');

In the line that you writen, you can never find a value and the result is problem an empty string assign to the JPATH_BASE.
That you explain that you have an error to load the 'includes/import.php' as the JPATH_BASE would be empty.

So hardcode the value to the JPATH_BASE
This must be a constant.
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7483
Re: Gator Feed and Cron Jobs 12 Years, 10 Months ago Karma: 0
I changed my base path to look like this:
define('JPATH_BASE','');

However I'm still getting the same error message from the 'import.php' file.

//Environment classes
32 JLoader::import( 'joomla.environment.request' );
33 JRequest::clean();

34 JLoader::import( 'joomla.environment.response' );

Thanks for your help so far
jamiegee
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7484
Re: Gator Feed and Cron Jobs 12 Years, 10 Months ago Karma: 0
Great - I've got back to an error now in FG which is better:

Fatal error: Class 'JFactory' not found in /var/www/vhosts/hydro2grow.co.uk/httpdocs/com_fg_cron/cron.feedgator.php on line 28

This is the line 28:
$mainframe = &JFactory::getApplication('site');

Any ideas...?
jamiegee
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12
get the latest posts directly to your desktop
2Win, Multisite(s) are trademarks of Edwin2Win.
Joomla