1. JDev
  2. General
  3. Wednesday, April 26 2017, 03:42 AM
I'm writing a CLI script to parse a CSV and update member profiles now that I have this extension installed. I load the helper, follow the docs, but in your helper function the code just dies when trying to get the user profile model and calling model->getData()....

Has this been tested running via CLI? I have a lot of data to parse/update the database with and this is the only way, I can't do it manually via the Joomla admin or get users to do it.

Please advise. Not sure why it's crashing.
Accepted Answer
admin Accepted Answer
Admin
Hi,
here a CLI script.

we have added load user data and store user data examples ;)
Attachments (1)
  1. more than a month ago
  2. General
  3. # Permalink
JDev Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 1
admin Accepted Answer
Admin
Hi,
Easy Profile's APIs are not designed to use via CLI, anyway in the coming days we will take a look to this problem. Thanks for report this.
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
after some test I found a way to works, this is my code:

class Test extends JApplicationCli
{
public function doExecute()
{
$this->out( '---- Start Easy Profile Test API ----' );

$app=JFactory::getApplication( 'site' );
$lang = JLanguage::getInstance( 'en-GB' );
$app->loadLanguage( $lang );

require_once( JPATH_SITE . '/components/com_jsn/helpers/helper.php' );
$user = JsnHelper::getUser( 159 ); // 159 is a example user ID to load

$this->out( 'Firstname: ' . $user->getField( 'firstname' ) );
$this->out( 'Lastname: ' . $user->getField( 'lastname' ) );

$this->out( '---- Finished Easy Profile Test API ----' );
}
}

JApplicationCli::getInstance('Test')->execute();


Joomla com_user frontend model require that you have loaded Language in your Application instance.

NOTE: Tested with Joomla 3.7 and PHP 7.1
  1. more than a month ago
  2. General
  3. # 3
JDev Accepted Answer
Pro
Can you send me the full working cli script? I can't get an example to compile and run.
  1. more than a month ago
  2. General
  3. # 4
JDev Accepted Answer
Pro
Thanks!

Everything works but the update, not sure what the issue is but it could be my end. I'll try debugging further before writing directly to the database.
  1. more than a month ago
  2. General
  3. # 5
JDev Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 6
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.