Closed (works as designed)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2013 at 13:22 UTC
Updated:
23 May 2013 at 16:28 UTC
I've implemented my classs who extends migrate, it imports all the rows correctly from a MySql database, but i must repeat this cycle every day and i must delete all data before import.
I've tried to implement Migration::replace() in the beforeImport() istance, but seems it doesn't work. How can I implement it?
thanks
Comments
Comment #1
mikeryanSorry I missed this post - "support request" is a better category for questions like this.
You can run
To automatically rollback before importing. If you're doing this on a daily basis, scheduling that command in crontab would be a good idea.
Comment #2
csedax90 commentedi've write this function to run cron every night... is it correct?
the process is running but it seems very slow... i've written some wrong code?
thanks for your support!
Comment #3
mikeryanBe sure when adding information to an issue marked "postponed (maintainer needs more info)", that you reset the status to "active" - issues with the postponed status get bottom priority when reviewing the queue, the assumption being that there is nothing new there.
Migration processes are a bit heavy to be run in a cron hook - Drupal cron is intended to run for a limited time (like, a minute or two) on each invocation, and a big process like this will block other cron functions. You're really better off running migrations directly from the server's crontab.
As for your performance issue, the best way to diagnose this is to try running the rollback and import operations through drush with the --instrument=timer flag - this will report where most of the time is being spent so you can find your bottlenecks.
Comment #4
csedax90 commentedthanks, your support is very usefull! But... how can i set up to run the module with the crontab? I should write a command to execute drush + migrate?
thanks for your time!
Comment #5
ziobudda commentedHi CRY_X2, create a file "mio _script_migrate.php" in the "scripts" directory and write this code:
In the crontab write something like:
0 * * * * cd /MY/DRUPAL/ROOT/FULL/PATH && php scripts/mio _script_migrate.phpThis run you function every hour at 00 minute.
If you want to run this script more time in 1 hour write */EVERY_HOW_MANY_MINUTES_IN_NUMBER in place of 0
M.
PS: Spero di esseri stato d'aiuto.
Comment #6
mikeryanYou don't even need to wrap a script around it:
Comment #7
mikeryanComment #8
csedax90 commentedthanks all, after a couple of testing and days my process works correctly!
PS: grazie ziobudda funziona tutto alla grande