G2 import does not work, no error message

marc_p

Joined: 2006-03-27
Posts: 31
Posted: Sun, 2009-06-07 12:45

Hi !

I'm trying to use G3 beta (in fact, I'm using b9ee6f7d from git). The installation went nearly fine (strange error message when giving a db prefix name containing '-'). Now, I'm trying to import data from my previous g2 installation. I activated the module from the admin page. When I give the path to the embed.php (as asked by the module), I simply get an empty page (not a single character is sent by the server). I tried to check var/log, but it simply contains lines like:

2009-06-07 14:37:25 +02:00 --- debug: MySQLi Database Driver Initialized
2009-06-07 14:37:25 +02:00 --- debug: Database Library initialized
2009-06-07 14:37:26 +02:00 --- debug: Session Database Driver Initialized
2009-06-07 14:37:26 +02:00 --- debug: Session Library initialized

I tried to activate some debug display, but could not find out how... I set the IN_PRODUCTIOn to false in index.php, but result is the same. Then I tried to enable 'display_error':
ini_set('display_errors', true);
but still no trace of a single debug line. I stopped here before breaking anything.

Any help is welcome :)

Marc
PS: my g2 installation uses a "multisite" configuration. Maybe this is the source of my problem ?

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Sun, 2009-06-07 15:55

Looks like I have something not working correctly: I can't upload any image. The flash uploader fails with error 417. Nothing useful in the logs (always the same line as above).

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Mon, 2009-06-08 16:45

I'm having the same problem with the blank page after clicking Save on the import page. I am able to use the Flash uploader to add photos, though.

Ah, I've got a multi-site setup as well ... maybe that's the key?

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Mon, 2009-06-08 16:51

In fact, I tried from a different browser, and the flash uploader works. I don't know why it always fails on my laptop...

You still have a diff with me: i get a HTTP 200 (OK) and you get a HTTP 500 (internal server error).

 
mzibo

Joined: 2008-03-30
Posts: 12
Posted: Mon, 2009-06-08 21:19

having the same problem, described in this thread: http://gallery.menalto.com/node/88226 (only realized later that this was the same problem)

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Mon, 2009-06-08 23:26

I did try to trace the problem. In my case it looks like the multisite config causes problem. The import process copies some files around to change some names inside, and then require them. In the case of a multisite config, the embed.php is different than what is expected (in fact, it requires the "real" embed.php, the one that contains names to be changed). I'm not sure I can fix this as I don't have only knowledge of gallery2/3 internals... Maybe I'll have a look again later. Any helps from gallery devs is welcome. A fix would be great, but a clue/hint would be fine also... If I can come up with something, I know how to use git and provide a patch ;p

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2009-06-09 04:36

Ah yeah that totally makes sense. So the problem is that both Gallery2 and Gallery3 define a PHP class called "gallery" which the interpreter doesn't like. So we dupe the Gallery2 code files and hack on the code so that we can retroactively change the name of the class in G2. Can one of you file a bug against this? I can fix it when I get time to set up a multisite install and try importing it.
---
Problems? Check gallery3/var/logs before you post! and file bugs here!
Latest zip: http://github.com/gallery/gallery3/zipball/master
Latest git: http://codex.gallery2.org/Gallery:Using_Git

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 07:08
 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 10:06

I attach a patch that seems to do its job for multi site config. This is not a *good* patch, as it breaks regular import, does not check for valid args, ... But at least, it looks like it works (currently the progress bar indicates that it has imported 24 photos out of the 2000+ I have). You can have a try to see if it fixes your problem. Then I (or a g2 dev) will clean this patch (if what it does is the correct fix...)

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 11:43

http://github.com/dkm/gallery3/commit/e77ba1d7512b3d7f4c3cd12bb499e0e296c485ae

This is a better try. I'll let gallery hackers decide wether this is good or not. I have nearly 0 knowledge of php...

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 11:59

:(

After having imported 702 photos (out of 2000+), the process stopped. The progress bar was not making progress anymore :) I checked on the server, and there was no active apache process. So I "paused" it, and got a nice blank page (again). If I go the gallery main page, I can see that some albums have been imported correctly. But I can't go to the admin page anymore, I get a blank page now. Nothing in the log. Too bad, I really thought I add done something useful :)

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 12:35

In fact, I can go to the admin, but not in the "maintenance" tab.

Is there a way to enable *massive* debug output ? Because currently, I'm using "print" in the code to figure out what is going on, and that's not very friendly :(

I would really like to make g3 work, as it looks very nice and promising !

 
mikehay
mikehay's picture

Joined: 2003-11-14
Posts: 8
Posted: Tue, 2009-06-09 12:35

For what its worth I was seeing the same problem originally reported in this thread (not a multi-site config) and I saw something in http://gallery.menalto.com/node/88168 regarding a slightly different issue where a suggested workaround was to log into the G2 gallery and click on all user accounts so see if this generated any crashes etc. I clicked on each user and then click save and though there were no crashes after doing this I was able to configure the G2 Import module in G3.

Don't know if this would work for others too but worth a try if you have only a few users configured.

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 14:19

Problem solved, I simply did not check hard enough my patch, which was full of crap. Now, it works fine... I was able to resume the import. Maybe there is a timeout somewhere that stoped the first import...

I pushed the fix to my github clone.

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 14:28

https://apps.sourceforge.net/trac/gallery/ticket/377#comment:1 <= this is the ticket on track...

It's a bit misleading all these different location for tracking code... github, sf, svn, track, etc. Sorry for the mistake.

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Tue, 2009-06-09 15:03

I tried applying your new versions of the two php files but now I get a blank screen as soon as I click the "Gallery 2 Import" link on the Admin/Settings menu.

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 15:15

Strange. Did you try with my latest git version ? http://github.com/dkm/gallery3/tree/master
What you can do is going in index.php, and set the error reporting of php to E_ALL:

error_reporting(E_ALL);

(it is 0 by default)

It helped my *a lot* to trace errors !

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Tue, 2009-06-09 15:28

Even after setting error_reporting, just a blank page and nothing in the gallery logs. Just a 500 in my apache log.

xx.xx.xx.xx - - [09/Jun/2009:11:24:28 -0400] "GET /gallery3/index.php/admin/g2_import HTTP/1.1" 500 - "http://www.xxxxx.net/gallery3/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)"

I'll try messing around a bit more later.

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Tue, 2009-06-09 15:32

I think you have a different problem than mine, sorry :(
FYI, the "method" I used is quite simple. I added print statement along the execution path to see where something was going wrong.

I would have thought that having E_ALL set would always give something (syntax error, unhandled exception, ...) instead of the blank page, as it's something going wrong in the php code (the way I understood it...).

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Tue, 2009-06-09 21:14

Hmmm ... found this in my error log. Not sure how I missed it before:

[Tue Jun 09 11:24:28 2009] [error] [client xx.xx.xx.xx] PHP Parse error: syntax error, unexpected '{' in /usr/local/gallery3/modules/g2_import/helpers/g2_import.php on line 55, referer: http://www.xxxxx.net/gallery3/

It looks like a close paren is missing on the if line:

  static function init_embed($embed_path, $multi_path) {
    if (!is_file($embed_path) || (!empty($multi_path) && !is_dir($multi_path)) {
      return false;
    }

Not sure where it's supposed to go though.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2009-06-10 02:15

@marc_p: tip-- you can create "local.php" in your gallery3 dir and put those settings in it and it'll get loaded after index.php is done (so it won't get overwritten when you upgrade).

I'm watching this thread and will work on the multi-site import when I can (and I'll watch the forks to see how your code is progressing). Got a lot of irons in the fire right now so if you guys can help yourselves for a bit that'd let me focus on some other problems for a bit.

---
Problems? Check gallery3/var/logs before you post! and file bugs here!
Latest zip: http://github.com/gallery/gallery3/zipball/master
Latest git: http://codex.gallery2.org/Gallery:Using_Git

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Wed, 2009-06-10 05:56

this means you are not using the latest code I wrote. You should have a try with my git branch. If you use git, you can simply 'pull' my changes, or you can see this fix:
http://github.com/dkm/gallery3/commit/657e17361db19ac1878b2a6d93595a763aef8b15

@bharat : ok thanks for the tip :)

I finished the import process, it worked well. I see some things are not imported though. Like highlights or restricted albums.

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Wed, 2009-06-10 12:59
marc_p wrote:
this means you are not using the latest code I wrote. You should have a try with my git branch.

Ok, I'm still missing something (thanks for your patience).

The import page now loads, but when I put in the path for my master embed.php file, it tells me it's not a Gallery 2 installation. I assume the second path is supposed to be the path to the multisite's embed.php? Or some other file?

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Wed, 2009-06-10 13:10

Hmmm... Strange strange. I guess I've screwed something. The second path should be the directory that contains the multisite's embed.php, yes. First, you should clean the files previously copie by the import. They are located in var/modules/g2_import. You should empty this directory before starting the import process. Try again after removing stuff from there, and let me know if it works better or if you have the same problem

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Wed, 2009-06-10 13:48

I cleared out the two temp directories I found under var/modules/g2_import and tried again, but the same error (and nothing new was copied in). I'll check permissions, but those should be fine since this is my master site.

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Wed, 2009-06-10 14:03

Can you try to apply this patch ? I think I simply messed up with the test. I can't try on my side now.

diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 648f380..01e07eb 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -54,7 +54,7 @@ class g2_import_Core {
* Initialize the embedded Gallery2 instance. Call this before any other Gallery2 calls.
*/
static function init_embed($embed_path, $multi_path) {
- if (!is_file($embed_path) || (!empty($multi_path) && !is_dir($multi_path))) {
+ if (!is_file($embed_path) && (empty($multi_path) || is_dir($multi_path))) {
return false;
}

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Wed, 2009-06-10 14:46

Bingo! I'm able to start the import now ... here goes!

Thanks for your help!

edit: it's working ... 136 of 5219 photos imported.

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Wed, 2009-06-10 14:58

Glad to hear that !

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Wed, 2009-06-10 16:42

Well, it stalled after 3,712 images imported. I've tried resuming it, but the progress bar stays empty and goes no where.

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Wed, 2009-06-10 16:50

I think you are having a new problem. Some users raised problems when importing some users. Sorry, I won't be able to help with this :(

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Wed, 2009-06-10 16:53

Yeah, no problem ... thanks for all your help with at least getting something imported from multi-site! :)

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Thu, 2009-06-11 08:04
marc_p wrote:
I see some things are not imported though. Like highlights or restricted albums.

Looks like magically, the highlights have been imported (maybe because of a recent commit ?).

 
mzibo

Joined: 2008-03-30
Posts: 12
Posted: Thu, 2009-06-11 10:55
marc_p wrote:
this means you are not using the latest code I wrote. You should have a try with my git branch. If you use git, you can simply 'pull' my changes, or you can see this fix:
http://github.com/dkm/gallery3/commit/657e17361db19ac1878b2a6d93595a763aef8b15

your changes make importing from my multiste g2 install work! thanks!

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Thu, 2009-06-11 20:20
marc_p wrote:
Some users raised problems when importing some users.

Yeah, I checked all my users (only two: guest and my own) and they're fine. I deleted all the imported albums in G3 (which took a while) and then tried the import again. It froze in the same place so I'm guessing it's one of the photos. Not sure how to figure out which specific one though. I found this in the log:

2009-06-11 16:08:02 -04:00 --- error: Gallery2 call failed with: Error (ERROR_MISSING_OBJECT) : Missing object for 11458 in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 2054 (GalleryCoreApi::error)
in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 98 (GalleryStorageExtras::_identifyEntities)
in modules/core/classes/GalleryStorage.class at line 313 (GalleryStorageExtras::loadEntities)
in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 71 (GalleryStorage::loadEntities)
in modules/core/classes/GalleryCoreApi.class at line 2361 (GalleryEntityHelper_simple::loadEntitiesById)
in modules/core/classes/GalleryChildEntity.class at line 145 (GalleryCoreApi::loadEntitiesById)
in modules/core/classes/GalleryFileSystemEntity.class at line 283 (GalleryChildEntity::fetchParent)
in modules/core/classes/GalleryDataItem.class at line 377 (GalleryFileSystemEntity::fetchContainerPath)
in /usr/local/gallery3/modules/g2_import/helpers/g2_import.php at line 392 (GalleryDataItem::fetchPath)
in /usr/local/gallery3/modules/g2_import/helpers/g2_import_task.php at line 126 (g2_import_Core::import_item)
in ??? at line 0 (g2_import_task_Core::import)
in /usr/local/gallery3/modules/gallery/helpers/task.php at line 78
in /usr/local/gallery3/modules/gallery/controllers/admin_maintenance.php at line 140 (task_Core::run)
in ??? at line 0 (Admin_Maintenance_Controller::run)
in /usr/local/gallery3/modules/gallery/controllers/admin.php at line 50
in ??? at line 0 (Admin_Controller::__call)
in /usr/local/gallery3/system/core/Kohana.php at line 291 (ReflectionMethod::invokeArgs)
in ??? at line 0 (Kohana::instance)
in /usr/local/gallery3/system/core/Event.php at line 209
in /usr/local/gallery3/system/core/Bootstrap.php at line 55 (Event::run)
in /usr/local/gallery3/index.php at line 72

2009-06-11 16:08:02 -04:00 --- error: @todo G2_FUNCTION_FAILED in /usr/local/gallery3/modules/g2_import/helpers/g2_import.php at line 764:
#0 /usr/local/gallery3/modules/g2_import/helpers/g2_import.php(392): g2(Array)
#1 /usr/local/gallery3/modules/g2_import/helpers/g2_import_task.php(126): g2_import_Core::import_item(Array)
#2 [internal function]: g2_import_task_Core::import(Object(Task_Model))
#3 /usr/local/gallery3/modules/gallery/helpers/task.php(78): call_user_func_array('g2_import_task:...', Array)
#4 /usr/local/gallery3/modules/gallery/controllers/admin_maintenance.php(140): task_Core::run('3')
#5 [internal function]: Admin_Maintenance_Controller->run('3')
#6 /usr/local/gallery3/modules/gallery/controllers/admin.php(50): call_user_func_array(Array, Array)
#7 [internal function]: Admin_Controller->__call('maintenance', Array)
#8 /usr/local/gallery3/system/core/Kohana.php(291): ReflectionMethod->invokeArgs(Object(Admin_Controller), Array)
#9 [internal function]: Kohana::instance(NULL)
#10 /usr/local/gallery3/system/core/Event.php(209): call_user_func_array(Array, Array)
#11 /usr/local/gallery3/system/core/Bootstrap.php(55): Event::run('system.execute')
#12 /usr/local/gallery3/index.php(72): require('/usr/local/gall...')
#13 {main}
2009-06-11 16:08:02 -04:00 --- error: Uncaught Exception: @todo G2_FUNCTION_FAILED in file modules/g2_import/helpers/g2_import.php on line 764
 
UloPe

Joined: 2009-06-11
Posts: 9
Posted: Thu, 2009-06-11 23:15

I also have the blank page problem with gallery2 importing. I posted my take on the source here: http://gallery.menalto.com/node/88186#comment-310223

 
santm
santm's picture

Joined: 2005-08-08
Posts: 40
Posted: Fri, 2009-06-12 04:03

@marc_p Itried with your branch and it solved my problem what is trick here ? We need to have those changes in master copy of gallry3 before it goes public for sure.

-best regards

www.santm.com

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Fri, 2009-06-12 05:34

santm: when using regular install, embed.php is in the same directory as the config file (config.php I guess). In multisite, embed.php is in the 'master' directory and the config dir is with the instance. So instead of handling only one path ($embed_path), I add a second path ($multi_path) pointing to the instance. That's all. You can check the changes from my branch, you'll see there not much :)

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2009-06-12 08:20

I checked out the code in your fork superficially.. not sure if that's the approach I'd take but let me think on it a bit. I've got some stuff in the queue ahead of this but it's definitely on my list.
---
Problems? Check gallery3/var/logs before you post! and file bugs here!
Latest zip: http://github.com/gallery/gallery3/zipball/master
Latest git: http://codex.gallery2.org/Gallery:Using_Git

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Fri, 2009-06-12 08:26

I though of things more complicated but easier for the user (like findind master path from the instance's embed.php), but my php skills are too light.

Btw, I won't take it personnaly if you don't use a single line of my diff :)

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2009-06-13 01:12

Ok so the bad news is that I didn't use your approach, but the good news is that reading through your code helped me get it right. I've just submitted a change which allows us to detect the code source from reading the multisite wrapper code and then Do The Right Thing. I've successfully cleanly imported 1 multisite as a sanity check.. want to grab the latest code and try it out? You may need to revert your changes in your fork to get the latest code to apply cleanly, or you can just nuke your fork and start over if you don't have anything else in there that you care about.
---
Problems? Check gallery3/var/logs before you post! and file bugs here!
Latest zip: http://github.com/gallery/gallery3/zipball/master
Latest git: http://codex.gallery2.org/Gallery:Using_Git

 
UloPe

Joined: 2009-06-11
Posts: 9
Posted: Sat, 2009-06-13 01:31

Unfortunately this does not fix the problem for me. (No Multisite here)
I've also posted the var/modules/g2_import dir in this thread: http://gallery.menalto.com/node/88186

 
windracer

Joined: 2007-03-05
Posts: 113
Posted: Sat, 2009-06-13 04:03
bharat wrote:
want to grab the latest code and try it out?

It worked for me ... it allowed me to start importing one of my multi-sites. Unfortunately, the process still hangs after importing 3,721 photos out of 5,000 plus with the same error I posted earlier above. Any way to figure out what photo is causing the problem?

 
marc_p

Joined: 2006-03-27
Posts: 31
Posted: Sat, 2009-06-13 07:23
bharat wrote:
Ok so the bad news is that I didn't use your approach, but the good news is that reading through your code helped me get it right.

There is no bad news :) That's great I helped a (very little) bit with this issue ! I think I'll simply kill my branch, and maybe resurect it if I find something else to do on gallery 3 :)

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2009-06-13 07:28

Considering the high quality of your code, I hope you resurrect your branch and find something else to do soon :-D
---
Problems? Check gallery3/var/logs before you post! and file bugs here!
Latest zip: http://github.com/gallery/gallery3/zipball/master
Latest git: http://codex.gallery2.org/Gallery:Using_Git