Xaraya Integration Failure

pdugas

Joined: 2004-01-07
Posts: 16
Posted: Sat, 2005-01-08 22:17

Building a new test server hoping things are read for me to update production to Xaraya and G2. Installed G2 from CVS and most seems okay (fails to load some of my images but I'll get to that later). Installed Xaraya-0.9.11 and that too is running okay. Installed Andy's gallery2 module for Xaraya and ran into two things; one I can deal with, the other is fatal.

First, the tolerable one... It seems the g2 installation must be somewhere within the Xaraya installation. Tried to track down the reason with no luck. Found another posting suggesting moving g2 and tied it. Worked. Figured I'd repost here in case someone is listening and interested in a fix. I'd like to be able to store g2 independant of xaraya.

The fatal problem is that after setting up the g2 module in xaraya, the xaraya admin menu is no longer accessable. I redid everything a couple times and get the same thing every time. No errors in the apache logs, no errors in the generated pages.

Hmmm.... Suggestions?

----

Gallery URL (optional): dugas.homeip.net
Gallery version: g2-cvs-20050107
Webserver (with version): apache 2.0.52
Datatabase (with version): mysql 3.23.58
PHP version (eg 4.2.1): 4.3.10
phpinfo URL (optional):
Graphics Toolkit(s): gd-2.0.28, ImageMagick-6.0.7.1, netpbm-10.25
Operating system: Linux, Fedora Core 3
Web browser/version: Firefox-1.0

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-01-09 01:22

pdugas, thanks for the feedback. I'll allocate some time to work on the xaraya integration again.

@1. G2 doesn't have to be within the xaraya directory tree. In my personal test server setup, xaraya is in a dir called "xaraya-0-9-11" and G2 in "gallery2", both being directly in the webroot.
What post suggests moving G2 into the xaraya dir tree?

@2. Wow, that's a bad one. The whole xaraya admin menu or just the gallery2 module part of it? I've not much feedback ATM, two people tried the gallery2 xaraya module, 1 had an error during the initial user synchronization, but noone had this admin menu error.

I'll try to finish the search hook tomorrow and release an updated version of the module. With a little luck your errors will be fixed with that release, but I don't think so.
What's special in your configuration? What could be non standard? It's definitely hard to find the error without complete access to your server but lets wait wait for the next vesion of the module.

What really sucks is the css incompatibily. We'll have to solve this somehow.

 
pdugas

Joined: 2004-01-07
Posts: 16
Posted: Sun, 2005-01-09 03:16

@1. Long time retentive system admin here. Don't like things installed all on top of the others without apackage manager so... I have a /usr/local/www/gallery2 and a /use/local/www/xaraya and I use apache to set the "root" of a virtual to xaraya an an "alias" support /gallery requests. Gallery is certainly accessable, just not in the document root. Any thoughts on whan in your module prevents this from working?

@2. I've been poking around again and it looks like xaraya thinks I shouldn't get access to the admin menu. I'm going to start over and see if I can get a look at the xar roles (read: users) table before and after installing the module. I suspect the added "myself" user is screwing with something. I wonder if you might explain to this non-gallery, non-xaraya guy what the deal is with the user sync stuff?

I should add that the integration worked for me a while back but I decided to reinstall Xaraya to start over. At the moment, the only thing I remember being different with the installs was that I select "Public Site" now. I think this just adjusts the default permissions but someone more femilliar with Xaraya will have to verify this.

I will open up the system to you to poke around if it comes to that but I agree. Let's redo it with your updated module in a caouple days.

 
pdugas

Joined: 2004-01-07
Posts: 16
Posted: Sun, 2005-01-09 05:45

More poking around. Definitely a permission (aka Roles and Privileges in Xaraya) issue. Commented out te call to xarSecuritCheck() in Xarayas adminpannels_adminblock_display() routine and I get the menu. Who is this "Myself " entry? Was it created as part of the g2 module sync-users step?

Will reinstall and get the user info prior to the module setup tomorrow.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-01-09 13:23

@2. good point. I only tested it with "Community Site", not with "Public Site". Once I tried a different site style and something with the permissions didn't work with my module.
The myself user is from xaraya, not G2. But after the first gallery2 module configuration (=initial user/group synchronization (import/export)), this myself user will exist in G2 too.
My code shouldn't remove/add any permissions in xaraya. The whole integration works simplex, from xaraya to G2, not the other way around.
The one exception is the initial user/group synchronization. All users/groups of G2 that don't exist in xaraya, will be created in xaraya.
I'll look into this "Public Site" today.

@1. Ok, didn't think of that. What the xar gallery2 module does: take the relative path you specify and expects realpath(dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $relativeG2Path) . '/'; to be the directory of G2. I don't accept absolute paths (starting with '/').
dirname($_SERVER['SCRIPT_FILENAME']) returns the absolute path to your xaraya directory. I don't know if it returns the alias or the location in the webroot.
Maybe you know more about this now knowing what I do with the relative path you specify, do you?

 
pdugas

Joined: 2004-01-07
Posts: 16
Posted: Sun, 2005-01-09 14:06

@1. I understand what you've written. Will look at the module code and see if I can figure out why my setup isn't working.

@2. I'm going to try it with a "Community Site" in a few minutes. Will let you know.

PS. Thanks for the work on this. I expect there are many others using your work. Thanks again.

 
pdugas

Joined: 2004-01-07
Posts: 16
Posted: Sun, 2005-01-09 14:24

@2. Reinstalled Xaraya-0.9.11 from scratch and selected "Community Site". Installed your 12/18 module and it seems to be working. Interesting.

@1. First my details. Gallery2 is installed in /usr/local/www/gallery2. Its data is in /usr/loca/www/g2data. Xaraya is installed in /usr/local/www/xaraya-0.9.11. The DocumentRoot for Apache is set to /usr/local/xaraya-0.9.11/html and there is an Alias mapping "/gallery" to /usr/local/www/gallery2. I entered "../../gallery2/" into the module config as the path to gallery. The module init was accepted.

When I it the gallery module within xaraya, I get the page contents as expected but the images are missing. Looking into the generates source, the URLs are "http://gallery2/maim.php...". I think the "../.." in the path-to-gallery that I entered is resulting in the host portion of the URL being removed.

Would is be wise to consider having users enter two paths? One relative path for PHP to use when looking for the gallery embed.php and others. Another for the URL path to gallery? Seems like for most installs, they'd be the same but for people like me who like to be difficult, ... ;)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-01-09 15:01

@2. Ok, gonna work on it.
@1. I too experience problems now, testing with some softlinks.
I didn't think that alias and symlinks would be a problem.
Perhaps I'll do what you suggest, add a 2nd, optional relative path for the filesystem. If not specified, it defaults to the first relative path which is for urls.
I'm not sure if this really solves all problems, perhaps I should just use different code than "realpath(dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $relativeG2Path) . '/';"
Stay tuned...

 
pdugas

Joined: 2004-01-07
Posts: 16
Posted: Sun, 2005-01-09 18:45
valiant wrote:
Perhaps I'll do what you suggest, add a 2nd, optional relative path for the filesystem.

Now that I think some more about it (after more coffee and some food), The filesystem path to my g2 install ends in gallery2 but URL ends in just gallery (no "2"). There's no way you can know what the correct URLs should be without an additional config option if there are others with tricky webserver configs like me. If I read this correctly, in the modules current state, g2 must be installed in the same DocumentRoot as Xaraya.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-01-09 18:52

I added a 2nd path as you suggested, looking at point 1. now and i'll upload the new version in a few hours.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-01-09 23:11

@1. fixed, or i guess so. please download the new xaraya module version and let me know how it works. and if you have better help texts for the new paths, post them please :)

@2. quite big problem. in xaraya, admins must not be in the all users group and in G2, they must be members of the users group.
I'll have to change / add some code in a few places to make this exception.
it was only luck that this problem didn't show up with xaraya community sites.
expect a fix within 2 weeks, i have a lot of other things to do.

 
pdugas

Joined: 2004-01-07
Posts: 16
Posted: Mon, 2005-01-10 02:25

@1. Fixed for my setup. Thanks.

@2. Don't know the deltas between "Community" and "Public" Xaraya sites so I guess I'm happy with the Community option that works. If you post on this topic when you want me to test, I'll give it a whirl.

 
robban1976

Joined: 2004-12-07
Posts: 3
Posted: Fri, 2005-01-14 15:58

Hi, gets this error when trying to integrate gallery2 into xaraya.

Function failed

Could not create a xar role for a G2 user 'admin'.
Explanation:

The function executed correctly, but the result was a failure.
Stack:

at g2xarusergroupimportexport(xargallery2helper.php:1459)
at gallery2_admin_updateconfig(updateconfig.php:87)

Array
(
[0] => Array
(
)

)

at xarmodfunc(xarMod.php:880)

Array
(
[0] => gallery2
[1] => admin
[2] => updateconfig
)

at xarmain(index.php:85)

Any idea on how to fix this?

My system:
Gallery version 2.0-alpha-4+
PHP version 4.3.10-1.dotdeb.0 apache
Webserver Apache/1.3.26 (Unix) Debian GNU/Linux PHP/4.3.10-1.dotdeb.0
Database mysql 4.1.7-log
Toolkits ImageMagick, NetPBM
Operating system Linux torungen 2.4.28 #1 SMP Thu Dec 2 08:25:21 CET 2004 i686
Browser Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20041013 Firefox/0.9.3 (Ubuntu

 
fcd

Joined: 2002-09-25
Posts: 20
Posted: Tue, 2005-02-01 01:55

My setup is php5, apache2, postgres. See attached for error.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-02-01 04:12

fcd, can you retry with debug output enabled in config.php and find the database error near the bottom of the output?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-02-01 06:39

robban1976, what's special about your installation?
What's the uname / name of the admin user of your xaraya site?

 
fcd

Joined: 2002-09-25
Posts: 20
Posted: Tue, 2005-02-01 23:27

Well there seems to be a whole bunch of errors so I guess I'll start at the top as it where.

http://216.235.149.51//gallery/gallery.log

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-02-02 07:39

fcd,
1. what G2 / xaraya / integration version are you using?
2. group with id 7 has the name 'Contributors'. is this a new group or did you rename another user/group to this group?

 
fcd

Joined: 2002-09-25
Posts: 20
Posted: Wed, 2005-02-02 22:59
valiant wrote:
fcd,
1. what G2 / xaraya / integration version are you using?
2. group with id 7 has the name 'Contributors'. is this a new group or did you rename another user/group to this group?

1. cvs / bk /cvs
2. This is a new group.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-02-03 00:07

mindless, I have not much time these days, but I guess I found the error in fcd's case. He's using postgresql and there's an error which has to do with adodb / gen next sequence on the first try to insert a new group. Probably the same error that was solved for mysql. Could you take a look into that and if this is also a bug in oracle, ...?

Thanks!

from the error log from above:

(postgres7): 
        SELECT
          g2_Group.g_id
        FROM
          g2_Group
        WHERE
          g2_Group.g_groupName = 'Contributors'
         LIMIT 1 &amp; <code></code>
<hr />

2005-02-01 18:32:19 [3c34972a5638a31ce0bee78bdb60d96a] <hr />
(postgres7): SELECT NEXTVAL('seqg2_SequenceId') &amp; <code></code>
<hr />
<br />
<b>Warning</b>:  pg_exec() [<a href='function.pg-exec'>function.pg-exec</a>]: Query failed: ERROR:  relation &amp;seqg2_sequenceid&amp; does not exist in <b>/web/xarclone/core/html/xaradodb/drivers/adodb-postgres64.inc.php</b> on line <b>698</b><br />
ERROR:  relation "seqg2_sequenceid" does not exist: ERROR:  relation "seqg2_sequenceid" does not exist<br>
 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2005-02-03 07:01

Does he have any tables that end with "sequenceid" in his database? We create those when we configure the database .. but I see he's using a different prefix so maybe something went wrong there.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-02-03 15:11

I believe the error is in a adodb incompatibility between xaraya adodb and G2 adodb.
There's a hint in the error "Query failed: ERROR: relation &seqg2_sequenceid& does not exist in /web/xarclone/core/html/xaradodb/drivers/adodb-postgres64.inc.php".
It's using the xaraya adodb for a G2 query, same thing as we had for mysql, isn't it?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-02-05 15:00

mindless / bharat, yes it is this bug.
/modules/core/classes/GalleryStorage/DatabaseStorage/
MySqlDatabaseStorage.class

the bug is fixed in the mysql file (function newEntity) but not in
PostgreSqlDatabaseStorage.class and
OracleDatabaseStorage.class as function newEntity is not redefined in these files.

Could you fix it? (Either fix it in DatabaseStorage.class function newEntity or in all implementations of DatabaseStorage.class)
Thanks!

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sat, 2005-02-05 17:08

committed to cvs (I moved the check into the common parent class instead of being just for mysql)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-02-05 17:39

:) thanks!

fcd, that means for you that G2 is fixed. You should get the next nightly snapshot and try again.

 
fcd

Joined: 2002-09-25
Posts: 20
Posted: Fri, 2005-02-11 01:54

Ok after updates and reinstalls I now have a different error when I try to configure the xaraya module.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-02-11 07:25

fcd, does G2 work in standalone mode? First, G2 has to be installed (run through the install wizard) in standalone mode, if it is working, run through the xaraya gallery2 config.
this error should show up, if something's wrong with G2...

 
fcd

Joined: 2002-09-25
Posts: 20
Posted: Sun, 2005-02-13 15:11

Ok, I think now that I got g2 working, I'm back to the original error. http://hf1beta.vtec.net/gallery/gallery.log

The sequence name in my db is: g2_sequenceid

Thanks, Frank

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-02-13 16:22

fcd, how old is your G2? is it a very recent nightly snapshot?
the issue with the sequenceId should have been solved with our fix.
I'll install G2/xaraya today again to see if i have the same problems.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-02-13 17:18

It's working for me. Using xaraya 0.9.11, G2 cvs from today, mysql.
But obviously, it isn't working for postgres.

mindless, only mysql overrides function GenId in the adodb drivers. Postgres, oracle, ... all use the implementation in adodb.inc.php. But I forgot why hasGenId = true; fixed the mysql issue. I mean, even if it is set to true, it's still using the xaraya adodb connection, right?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2005-02-13 19:35

<sigh/>
if xaraya wants to hack adodb i'm not sure what we can do...

// XARAYA MODIFICATION - START
        //var $_genIDSQL = "SELECT NEXTVAL('%s')";
        //var $_genSeqSQL = "CREATE SEQUENCE %s START %s";
        //var $_dropSeqSQL = "DROP SEQUENCE %s";
    // Prefix the sequence number to make it unique
    var $_genIDSQL = "SELECT NEXTVAL('seq%s')";
    var $_genSeqSQL = "CREATE SEQUENCE seq%s START %s";
        var $_dropSeqSQL = "DROP SEQUENCE seq%s";
    // XARAYA MODIFICATION - END

xaraya's postgres adodb sticks "seq" on the front of the name you pass to GenID. i suppose you can create a sequenced called seqg2_SequenceId.. but then make very sure not to use G2 standalone to avoid duplicate ids (or modify G2 standalone to also use seqg2_SequenceId)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-02-13 19:59

ah fark, these changes were only made for postgres64 and oracle drivers. not sure if i can convince the xaraya devs to change this. and i don't know why we don't run into the same errors as they did with postgres and oracle. probably, because we use different names for the sequence and the tables.

if it can't be resolved, we have a serious problem with all embedding apps that have a customized adodb layer.

edit:
i filed this as a xaraya bug, but i'm quite sure this won't be changed, as it's not something that impaires xaraya itself.
http://bugs.xaraya.com/show_bug.cgi?id=4071

 
fcd

Joined: 2002-09-25
Posts: 20
Posted: Mon, 2005-02-14 00:56

It is latest CVS. (Or as of yesterday). I don't know if this http://bugs.xaraya.com/show_bug.cgi?id=3905 bug has anything to do with it. This line "SELECT NEXTVAL('seqg2_SequenceId')" is definitely wrong. The sequence name is g2_SequenceId. When I look at my xaraya sequences (which adodb auto-gens for non-mysql I think, there is also a sequence for every table) they begin with 'seq'.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-02-14 13:24

fcd, we know now what the problem is, but if there will be a fix, it will take weeks or months. it's a systematic incompatibility between xaraya and G2 for postgresql and oracle because xaraya hacked something together. it works for pretty all other DBMS.
first i'd like to wait for a definitive "no" from the xaraya guys (=that they won't change it), then we'll have to figure out if there's a easy fix to it or a not so hard-manual fix and if not, as a final resort, we have to declare the combination of xaraya + G2 + postgresql/oracle as not supported.

for now, I'm sorry but you can't run xaraya + G2 + postgresql.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-02-14 16:49

here's a workaround for this...
1) get the latest G2 code
2) make this patch to modules/core/classes/GalleryStorage/DatabaseStorage.class

change: $id = $this->_db->GenId($this->_tablePrefix . DATABASE_SEQUENCE_ID); to: $id = $this->_db->GenId('seq' . $this->_tablePrefix . DATABASE_SEQUENCE_ID);
change: $recordSet = $this->_db->CreateSequence($this->_tablePrefix . $sequenceId); to $recordSet = $this->_db->CreateSequence('seq' . $this->_tablePrefix . $sequenceId);
change: $recordSet = $this->_db->DropSequence($this->_tablePrefix . $sequenceId); to: $recordSet = $this->_db->DropSequence('seq' . $this->_tablePrefix . $sequenceId);
change: $lockId = $db->GenId($this->_tablePrefix . DATABASE_SEQUENCE_LOCK); to: $lockId = $db->GenId('seq' . $this->_tablePrefix . DATABASE_SEQUENCE_LOCK);

3) now do a clean G2 install
4) after successful install now undo the first and last changes shown above
5) set embed-only mode in config.php --- G2 will not work in standalone mode now!
6) access G2 via xaraya

This will install G2 using the 'seq' prefix for sequences.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-02-15 19:10

Things are getting interesting. Maybe there will be a change in xaraya!
http://bugs.xaraya.com/show_bug.cgi?id=4071

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-03-01 21:51

fcd, I worked closely together with the xaraya devs and there's now a development tree of xaraya that is compatible with G2 AND postgres (mysql worked also before). The development tree is called xaraya core/adodbupdate and chances are very good that it will be merged into the release tree in a few days/weeks.