I installed a clean joomla with kunena and jomsocial in order to try to fix a bug on another site.
The main problem is that i get an error message (Error displaying the error page: Application Instantiation Error: Application Instantiation Error) on a custom made API
girltalk.dk/app/api.php
(used to service a mobile app) that was working fine before upgrading jomsocial. So I assume it has to do with code changes.
The bug is related to CFactory::getModel(...). since removing the community part lets it run fine.
My mirror dev site
dev.girltalk.dk/app/api.php
(with jomsocial 4.1.6) it does not return the error
So, I made a blank site to test with
dev2.girltalk.dk
to continue testing. Latest joomla, knuena and jomsocial.
- same error on
dev2.girltalk.dk/app/api.php
Now trying to downgrade to 4.0.10 but getting an error when going to the administration of jomsocial
---
Warning: require_once(/usr/www/users/girltax/dev2.girltalk.dk/components/com_community/models/community.php): failed to open stream: No such file or directory in /usr/www/users/girltax/dev2.girltalk.dk/components/com_community/libraries/core.php on line 656
Fatal error: require_once(): Failed opening required '/usr/www/users/girltax/dev2.girltalk.dk/components/com_community/models/community.php' (include_path='.:/usr/local/lib/php/') in /usr/www/users/girltax/dev2.girltalk.dk/components/com_community/libraries/core.php on line 656
---
I need help to get it running on the clean site so I continue from there.
Any documentation relating to changes in CFactory::getModel(...) since 4.1.6 would also be welcome.
Here is the first part of my script api.php.
I'm wondering if you changed the model from getModel to getUser ?
The code seems to be breaking already at require_once JPATH_BASE . '/components/com_community/libraries/core.php';
---- code ----
<?php
define('_JEXEC', 1);
define('JPATH_BASE', realpath('../'));
define('KPATH_ADMIN', JPATH_BASE . 'administrator/components/com_kunena');
ini_set('display_errors', '1');
error_reporting(1);
define('JDEBUG', 0);
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';
require_once JPATH_BASE . '/libraries/joomla/factory.php';
require_once JPATH_BASE . '/components/com_community/defines.community.php';
require_once JPATH_BASE . '/components/com_community/libraries/core.php';
require_once JPATH_BASE . '/libraries/kunena/bootstrap.php';
require_once JPATH_BASE . '/components/com_kunena/models/category.php';
$app = JFactory::getApplication('site');
$app->initialise();
$db = JFactory::getDbo();
$session = JFactory::getSession();
$friendModel = CFactory::getModel( 'friends' );
$inboxModel = CFactory::getModel( 'inbox' );
$categoryModel = new KunenaModelCategory();
$language = JFactory::getLanguage();
$language->setLanguage('da-DK');
$language->load('lib_joomla');
$user = NULL;
$token = ($_POST) OR '';
$action = ($_POST) OR '';
$json = new stdClass;
$json->user = new stdClass;
$json->data = NULL;
$json->err = 1;
$json->msg = '';
HI, Tomas.
Thank you for contacting us.
Issue you experience:
Fatal error: require_once(): Failed opening required '/usr/www/users/girltax/dev2.girltalk.dk/components/com_community/models/community.php' (include_path='.:/usr/local/lib/php/') in /usr/www/users/girltax/dev2.girltalk.dk/components/com_community/libraries/core.php on line 656
Is related with incompatibility of JomSocial version you downgraded with latest version of Joomla!. That means you'll need to downgrade Joomla! as well.
I managed to debug the code and find the bug.
/components/com_community/libraries/core.php - line 42
#JFactory::getLanguage()->load('com_community');
I also reinstalled the danish language files via the administration.
My api script works fine with line 42 commented out. And Jomsocial also shows the labels in Danish.
what is the use of this line 42 of code then??
I would hope for a fix that would not require med to comment out code in the core files since they would be overwritten on upgrading.
Hi, Tomas.
Good find ;) I'll assign developer to help you with that.
Hi Tomas,
Why you dont install the latest version? because we have critical issue on old jomsocial version due newest Joomla version 3.6.x, if you want to use old Jomsocial version, please you use Joomla version < 3.6.x
thank you
Hi Tomas,
Ok, please provide me the steps to replicate this on your API code.. also guide me to edit your API and tell me how it works.
thank you!
Hi Dimas, let me sum it up here..
FTP access is in the top post. The script is on the actual live site now since it is working with the hack.
My API script for the mobile app is on
girltalk.dk/app/api.php
. The script outputs json and will give an error message in json when run from outside the app, that is ok since no request has been passed. You don't need to install the mobile app to test the API in this case.
The "bug" is in /components/com_community/libraries/core.php - line 42 (as stated earlier)
#JFactory::getLanguage()->load('com_community');
To replicate simply uncomment line 42 and the API will return a system error instead of json when you open it in the browser.
I also reinstalled the danish language files via the administration.
My api script works fine with line 42 commented out. And Jomsocial also shows the labels in Danish on the website so I'm wondering what getLanguage actually does then...
Let me know if you have any other questions :-)
Hi Tomas,
Your FTP access is not working for me, seems username and password invalid, would you mind check again, please?
thank you!