Closed (fixed)
Project:
Auto locale import
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
2 May 2007 at 18:47 UTC
Updated:
20 May 2007 at 20:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
meba commentedThis patch is adding support for latest batch operations (batch_7.patch) (apply to HEAD version of autolocale).
It works smoothly when importing through "import interface translations".
TODO
- TEST IT
- Figure out how $results work and implement it for displaying count of operations made
- Implement importing when enabling modules. (Do anybody know how we stand with the new hook after enabling and disabling a module?)
- Test it when installing Drupal.
Comment #2
yched commentedAbout $return :
actually you can put your stuff in the $result array whichever way you see fit - it's yours.
But I changed the syntax of batched operations since the earlier versions of the batch patch.
They now receive a 'batch context' array as a last param, that gathers results along with other info (mainly used for multi-pass operations)
The last batch patch contains more detailed phpdoc about that.
Comment #3
yched commentedPS : i tested batching stuff inside _enable / _disable hooks, it works perfectly - when triggered by admin/build/modules form submit.
install script being (AFAICT) out of the regular FAPI form processing, having this work at install time probably requires some work on install.php to make it batch-aware (as I did on update.php). Being absolutely unfamiliar with this area, I did not venture there...
Comment #4
meba commentedHow did you implement the enable/disable stuff? I have a patch doing batch_set() in form_alter for modules but it doesn't work for me, i don't know why yet.
Comment #5
meba commentedAttaching a new patch, doing the same as before, but now with support for enable/disable modules - which DOESN'T work right now. My batch_set() is triggered, but doesn't run operations. I think i need some parameter to the batch...Yched, can you help?
Comment #6
yched commentedBatches can't be added or processed in form_alter : that's still form building time.
Batches come into play at form _submitting_ time : the natural place for a batch_set() is during a form_submit callback.
Your form_alter should add a new _submit callback to the form - then declare the batches in this _submit callback.
Comment #7
dries commentedLot's of TODOs in the code ...
Small detail: incorrect use of t(). You'll want to turn that $file into a %file.
Comment #8
meba commentedFixed most of the TODOs, batch after enabling modules still in the works.
Fixed drupal_set_message. Added &$context.
A question:
is $form['#skip_duplicate_check'] = TRUE; required? If i remove it, importing does not work after one import...
Comment #9
yched commentedDuplicate submission check works this way :
if the form you submit is the same, with same form values, than the last form the same user submitted, then it's considered a 'duplicate' submission, and the form is not processed.
$form['#skip_duplicate_check'] = TRUE; is therefore recommended for 'little' forms that are likely to be submitted with the same values multiple times, and / or when you develop / debug your forms...
That being said, I _think_ this area might change a little / a lot when the FAPI3 patch lands.
Comment #10
meba commentedRerolling against HEAD - fixed new paths for locale patch that had been committed yesterday
Comment #11
meba commentedThis patch adds needed support for importing locales during installation. Just some moved code and added function
Comment #12
gábor hojtsyComitted your patch to autolocale module with the following modifications:
- removed @ before include_once in .install file
- removed function_exists() call before include_once, because include_once itself ensures that
- added a TODO note to language addition
- added a proper path prefix value to language addition
- fixed some comments
Comment #13
(not verified) commented