Internal Server Error

  • Robert
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 7 months ago #11 by Robert
Replied by Robert on topic Internal Server Error
Thanks Antonio,
I have initiated a server change within my hosting provider to have all a bit larger and hopefully faster, definitely will be looking at execution time ...

BTW, do you know how I can add a 500 or other larger figure for import on the Joomdle import page ? right now there is only a choice for 50, 100 or all .. but not e.g. 500 - could that be done manually from my side in the script ?
I guess temporary code hacking ...

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #12 by Antonio Durán
Replied by Antonio Durán on topic Internal Server Error
While that could be done with a script, I doubt that you get such high values to do it all in one transfer.

I have migrated large installations, using custom scripts, that do only a few users per call, and reloads itself to continue.
I don't have the code with me here, but I will check to see if I have something you can use.

BTW, are you syncing users from Joomla to Moodle, or the other way?

Please Log in or Create an account to join the conversation.

  • Robert
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 7 months ago #13 by Robert
Replied by Robert on topic Internal Server Error
That would be very helpful Antonio!

First, I need to add about 10'000 Moodle users to Joomla, then add them to Joomdle and sync if necessary.

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #14 by Rafael
Replied by Rafael on topic Internal Server Error
In php.ini in your server:

max_execution_time

change to 60

and

max_input_time

change to 60

;)

Please Log in or Create an account to join the conversation.

  • Robert
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 7 months ago #15 by Robert
Replied by Robert on topic Internal Server Error
Thanks Rafael,
It appears you have done something like this before. How many Moodle users have you been able to add to Joomla via Joomdle in one batch with your suggested settings ?
Robert

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago - 12 years 7 months ago #16 by Rafael
Replied by Rafael on topic Internal Server Error

Robert wrote: Thanks Rafael,
It appears you have done something like this before. How many Moodle users have you been able to add to Joomla via Joomdle in one batch with your suggested settings ?
Robert


I'm sorry. My english is not good.

Actually the error "internal server error" displays when a script runs out of resources or it hasn't time to execute.

Knowing that the default php.ini file has "short" set params, I know that the solution is this.

With other Joomla! components happens too.

I could not tell how many Moodle users have been able to add, because I haven't done, but you should be able to greatly increase the current number of migrated users.

Certainly, you should not increase much more the max_execution_time and max_input_time (60).

Regards
Last edit: 12 years 7 months ago by Rafael.

Please Log in or Create an account to join the conversation.

  • Robert
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 7 months ago #17 by Robert
Replied by Robert on topic Internal Server Error
Dear Antonio,

You mentioned something about a script you might have for me... did you find any?

Thanks for all these tips.. great community, just made a contribution via PayPal :)

Gracias,
Robert

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #18 by Antonio Durán
Replied by Antonio Durán on topic Internal Server Error
Hi Robert.

Thank you very much for your donation, it is really appreciated.

Sorry for the late reply, but this week has been crazy. I have the test scripts in my other laptop, so I will try to get them when I get home later today.

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #19 by Antonio Durán
Replied by Antonio Durán on topic Internal Server Error
Hi Robert.

I found the code I told you about, but I think it is not good for you, as you have Joomla and Moodle on different servers right?

What I have is a php function to migrate all moodle users to Joomla, using only database calls, to gain speed (most of the time spent in migration process is communication between joomla and moodle)

Just in case, I include the function. It has some exit calls for testing first:
Code:
function add_users_to_joomla () { $db =& JFactory::getDBO(); $option = array(); //prevent problems $option['driver'] = 'mysql'; // Database driver name $option['host'] = 'localhost'; // Database host name $option['user'] = 'moodle'; // User for database authentication $option['password'] = 'RuZXJ4y69Me8Zd5X'; // Password for database authentication $option['database'] = 'moodle'; // Database name $option['prefix'] = 'mdl_'; // Database prefix (may be empty) $db_moodle = & JDatabase::getInstance( $option ); $skip_array = array ('admin', 'joomdle', 'thewinekey', 'jcamus', 'guest'); $query = 'SELECT *' . ' FROM #__user' . " WHERE email!='joomdle'"; $db_moodle->setQuery($query); $moodle_users = $db_moodle->loadObjectList(); foreach ($moodle_users as $user) { if (in_array ($user->username, $skip_array)) continue; if ($user->username != 'antoniotest') continue; JoomdleHelperContent::create_joomla_user ($user->username); $query = 'UPDATE #__user' . " SET auth='joomdle'" . ' WHERE username='.$db_moodle->Quote ($user->username); $db_moodle->setQuery($query); $db_moodle->Query(); echo $user->username; exit (); echo $user->username; echo "<br>"; } exit (); }


If you have Jooma and Moodle on different servers, I am thinking of a trick: export moodle database (I think you only need users table) and import it into a temp database in joomla server.
Then modify above script to use that new database to fetch the users.
Warning: before running the script, you should disable joomdlehooks plugin, so no sync calls are made to Moodle. This will make the process much faster, as it will happen only on Joomla.

There is still a problem, though: the above script also modifies Moodle user table, to set auth method of the migrated users to "joomdle". This you cannot do with the trick, unless you later export the table again and import it into the real moodle database.
Another option, if you are going to migrate all users, is to just set the auth method directly in the moodle database after you run above script, with something like:
Code:
UPDATE #__user' . " SET auth='joomdle'" . ' WHERE username!='admin';


This is the faster method.
A more conventional method would be to create a script in Joomla that fetches some Moodle users each time, migrates them, and reloads itself to keep on working.
But this method is much slower: I did it once in a Moodle server where we could not have database access, and it took over a weekend running non-stop to migrate all users: around 22.000

Please let me know if you need any more info.
I will put this in my TODO list, to try to come up with a good solution that can be included by default in Joomdle next release.

Please Log in or Create an account to join the conversation.

  • Robert
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 7 months ago #20 by Robert
Replied by Robert on topic Internal Server Error
wow ..great thanks Antonio,
actually now all is moved on the same server, I will study it and hopefully manage to execute it .. one initial question, does this script only adds Moodle users to Joomla, or does it also Migrate users to Joomdle or would that be an extra script to do ?

Please Log in or Create an account to join the conversation.