Welcome Guest, Not a member yet? Register   Sign In
Site migration using site_migrate
#11

[eluser]manik005[/eluser]
ok i will check it out annd get back to you
#12

[eluser]manik005[/eluser]
hi i tried with a simple php file in site_migrate..
steps i followed:
1. installed CI v2.0.2
2. added site_migrte_base and site_migrate
3. Configured config.php as specified
4. changed the default controller to site_migrate
5. added $route['(:any)'] = 'site_migrate/$1'; in routes.php
6.created a file named index.php with simple php code inside views/site_migrate
i get the errors that i have attached in the reply
#13

[eluser]sophistry[/eluser]
hi manik005,

thank you for testing this. i am seeing the same errors. it looks like CI2 changed the error reporting a little bit and now the chdir() function in the site_migrate_base code is confusing it.

i was able to get it working again by commenting the lines with the chdir(). that lets the basic functionality of site_migrate work again, but it will not work on any more complex sites - specifically sites that make use of relative paths in any include or require calls.

i'll look into this issue later - i am not available to fix it right now.

but, if your site has no include() or require() calls or those calls are all absolute paths or can be changed to absolute paths, then simply commenting the chdir() lines will let you move forward. i hope to have a fix in a day or two.

cheers.
#14

[eluser]manik005[/eluser]
ok thanks for your assist and i too try to debug it Smile
#15

[eluser]manik005[/eluser]
upto which version it worked correctly???
#16

[eluser]sophistry[/eluser]
i just posted my fix for CI 2. site_migrate works again.

http://codeigniter.com/wiki/site_migrate/

at some point between v 1.5 and v2.0 the Loader.php was changed to use relative paths when looking for view files. If you change the "working directory" in your controller code using chdir(), the CI loader can not find the view. I am not sure if this is really a bug, but I believe that CI should be smart enough to find view files and should probably be looking for them using absolute paths.. (but, there is also a new file search cascade feature I was not aware of that might me used to solve that problem)..

anyway, I solved it by changing the site_migrate_base code.

now, if you dump an old site into the views/site_migrate directory it should just work. but, if it complains about paths and not being able to find files, you now have the variable available in your migrating site
Code:
$site_migrate_docroot

if you need to convince your old site pages to find files that are being included you can use this command:

Code:
chdir($site_migrate_docroot);

at the top of the index.php file or any page that does a relative include. that will tell the page exactly where it is in the directory structure and should let every file be found again.

let me know if this works for you!




Theme © iAndrew 2016 - Forum software by © MyBB