OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Individual Name for Each Journal within MULTIPLE OJS inst.

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Individual Name for Each Journal within MULTIPLE OJS inst.

Postby mbria » Wed May 25, 2011 4:32 pm

Hi all,

When you are trying to build big OJS site (20 or more magazines), the first technical dilemma to solve is if you are going to go with ONE or MULTIPLE OJS installations.

There is a nice post that explains how to proceed with ONE single multi-magazine installation: Individual Domain Name for Each Journal within ONE OJS inst. but I didn't see much information about how to address a multi-ojs secneario, so this post it's done to report my advances for those that arrive to this point now as well as discuss and learn from those that walk this way before me.

Although the discussion about "why multiple-OJS instead of one-OJS" is really interesting (and I love to read more about it), this post didn't focuses in it and just reports and open discussion about how to implement the multi-OJSs proposal.

This is what I'm trying to accomplish:

Code: Select all
   http://example.com
                                http://example.com/ojs1
    ----------------                                           http://example.com/magazine1
    |              |               -----------------
    |              |               |               |                ---------------
    |              |-------------> |    OJS 1      | -------------> |  Magazine 1 |
    |              |               |               |                ---------------
    |     CMS      |               -----------------
    |              |               -----------------            http://magazineN.foo.net
    |              |               |               |                ---------------
    |              |-------------> |    OJS n      | -------------> |  Magazine n |
    |              |               |               |                ---------------
    |              |               -----------------
    ----------------


In the root directory we will place a CMS (a drupal) to publish news and a list of all the magazines included in the system.
Each OJS subfolder will be a physical directory with symbolic links to a "base" ojs.
Not everything will be "symlinked": index.php, config.inc.php and cache will be different for each OJS installation.
A few extra folders (webdata) will be also specific for each OJS: files, public and registry.
An .htaccess (in root folder) or vhost will do the redirection work.

Basic maintenance (ojs creation, delete, backup) could be easily accomplished with an script (I attach to this post my first release).

This script generates all the structure of a new OJS, and fills the database with a "preconfigurated basic OJS".
The script plays with string-replacement (sed) to substitute some tags with the appropriate information in config.inc.php, database dumps and so on.

This is the general folder structure as is thought now:

Code: Select all
/home/webuser
|__ backup
|__ logs
|__ scripts
|__ htdocs
|   |__ (a few CMS files and folders)
|   |__ ojs1
|   |   |__ index.php
|   |   |__ config.inc.php
|   |   |__ cache
|   |   |__ (the rest of ojs folders are linked to: /home/webuser/ojs/versions/current/*)
|   |__ ojs2
|       |__ index.php
|       |__ config.inc.php
|       |__ cache
|       |__ (the rest of ojs folders are linked to: /home/webuser/ojs/versions/current/*)
|__ ojs
    |__ versions
    |   |__ current (-> ojs2.3.4)
    |   |__ ojs-2.3.4
    |   |__ ojs-2.3.3
    |__ templates
    |   |__ baseMagazineDump.sql
    |   |__ createDB.sql
    |   |__ deleteDB.sql
    |   |__ config.inc.php.base
    |__ webdata
        |__ ojs1
        |   |__ files
        |   |__ public
        |   |__ registry
        |__ ojs2
            |__ files
            |__ public
            |__ registry


As you will appreciate, this structure is flexible enough to allow sites with specific themes or plugins, but rigid enough to facilitate the administration.

Right now, the script is working fine (will be translated to English and released soon) but as I announced in the first diagram, I want "clean urls" (RESTful ones) so more job need to be done.

First at all, we need to configure our OJS to build the URLs as we like.
It means that each OJS config.inc.php need to define some variables as:

* base_url = "http://redi-test.uab.cat/ojs-test03"
* base_url[index] = http://example.com/ojs1
* base_url[magazine1] = http://redi-test.uab.cat/magazine1
* restful_urls = On

After this, OJS is ready, but Apache didn't so .htaccess or vhost need to be modified to do the redirection work.
If I understood former posts (this or that), those are the basic redirections that need to be done:

* The magazines: http://example.com/magazine1 --> http://example.com/ojsN/index.php/magazineN/*
* The ojss: http://example.com/ojs1 --> http://example.com/ojsN/index.php/index/*

More complex ones -for instance with external domains or with slash fixing- would be nice, but right now let's go with the KISS solution.

So translated to "mod_rewrite" syntax this is what I thought that need to be included in the vhost or .htaccess in the main root web folder (/home/webuser/htdocs):

Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^magazine1$ magazine1/
RewriteRule ^magazine1/(.*)$ ojs1/index.php/magazine1/$1 [L]
RewriteRule ^ojs1$ ojs1/
RewriteRule ^ojs1/(.*)$ ojs1/index.php/index/$1 [L]


Here is where I'm sucked: Although magazine navigation is working fine, I'm unable to login or register any user.

Instead of login, page is redirected to: http://example.com/magazine1/login?sour ... ne1%2Fuser

So I suspect my rules aren't well configured but after tones of testing I can't manage to make them work.

Any body had similar experiences? Any clue about how to fix it? Any suggestion to the multi-OJS proposal.

Thanks a lot for your help,

m.

PD: This post will be rewritten as a manual as soon as I fix this final point and I finish the script.
mbria
 
Posts: 306
Joined: Wed Dec 14, 2005 4:15 am

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby asmecher » Wed May 25, 2011 4:50 pm

Hi mbria,

Sounds very interesting and I think that once you get a firm set of mod_rewrite voodoo figured out it'll work well. We do have experience with one small aspect of this -- symlinking to common code. We experimented a little with this in the form of the PKP library (the contents of lib/pkp) being shared across many OJS installations. One major benefit to this is that a PHP optimizer will be able to store and optimize a single copy of all the contents of that directory for all OJS installs, rather than caching each of many copies, even though they may be identical. Practically this decreased the required size of the opcode cache and drastically increased the cache hit rate.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby mbria » Wed May 25, 2011 5:13 pm

Thanks Alec for the answer,

I didn't thought about php optimization when "symlinking". My main concern was the easy mantainance, but what you said makes a lot of sense.
I will monitor the optimizer to see if we get similar results.

About the mod_rewrite voodoo... I'm ashamed but I recognize (maybe it's just that I'm tired) that I feel like I arrived to a death end.

While search form redirects correctly, login and register didn't !!

In what sense are different? Tomorrow I will activate rewrite log to understand the process but I don't feel much confident.
Do you have a similar installation to take a look to your mod_rewrites rules?
It's as simple as admin adds /index.php/index while magazine adds /index.php/magazine?

Thanks again for your help and good night (2:15 here in Barcelona :-P),
m.
mbria
 
Posts: 306
Joined: Wed Dec 14, 2005 4:15 am

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby asmecher » Wed May 25, 2011 5:27 pm

Hi mbria,

The problem is most likely that those two functions (register and login), as well as the language toggle block, store a URL in a GET parameter (called "source"). After the login/registration/language change occurs the user is directed to the location stored in that parameter. See:
  • plugins/blocks/languageToggle/block.tpl
  • lib/pkp/pages/login/PKPLoginHandler.inc.php
  • classes/security/Validation.inc.php
  • pages/user/RegistrationHandler.inc.php
...and look through the code in each file for "source" to see what you're dealing with.

OJS generates what it thinks are the right URLs, and since they're URL-encoded and show up as URL parameters, mod_rewrite isn't properly changing them.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby mbria » Thu May 26, 2011 9:10 am

Thanks Alec for the feedback.

Just a last question: From your knowledge of OJS wich solution do you recommend:

a) Patch the files you mention: Add a config variable to let OJS build the right urls in the source GET param.
b) Follow with mod_rewrite: For instance, creating an exception for the login/register/lang cases.

Thanks again for your help,
m.
mbria
 
Posts: 306
Joined: Wed Dec 14, 2005 4:15 am

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby asmecher » Thu May 26, 2011 9:34 am

Hi mbria,

I suspect the problem boils down to the use of the $_SERVER['REQUEST_URI'] variable -- it's only used in classes/security/Validation.inc.php and plugins/blocks/languageToggle/block.tpl. You may be able to achieve the same affect, but with the right URL, using Request::url() with no parameters at all. Alternately, if you use the same pattern for this server variable that we use for e.g. getIndexUrl function (see lib/pkp/classes/core/PKPRouter.inc.php and lib/pkp/classes/core/PKPRequest.inc.php) you'll be able to use a simple plugin to override the value that it would usually return. But try using the Request::url() function first.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby mbria » Wed Jun 01, 2011 9:40 am

Hi Alec,

I didn't want to answer without checking everything in deep but after a few days digging into the code and making tests I feel like I'm more or less in the same place I was. :-(

So summarizing this what happens now:

    1) If I disable RESTful and base_urls everything works like a charm.
    2) If I enable RESTful and base_url (plus a few changes in my rewrite rules) I can login at site level but not into magazines
    3) With disabled RESTful and base_urls (but with rewrite rules enabled) all works fine, until I visit the url alias (I'm a kind of logged out)

Alec, I followed your indications (as far as I understood them :oops: ) and I tried to patch classes/security/Validation.inc.php to avoid asking for REQUEST_URI and using Request::url() instead (also tried hadcoding the right url with same effect), but the result is still the same... After login I'm redirected to login page again without any error message. I don't know if this is important, but although validation seams to work fine the final url looks wired (http://example.com/magazineN/login?sour ... t03%2Fuser) and the user is unable to see the user page and menu links.

I look into the code trying to parse source variable with "html_entity_decode" hopping this was the issue to fix, but between recursive redirections and template variables I didn't succeed and I tried with a different approach.

I wanted to understand how all works so I traced the code with and without RESTful to compare:
1) lib/pkp/pages/login/PKPLoginHandler.inc.php: -> function signIn() --> same in both cases [$source is empty first time]--> goes to "Request::redirectHome"
2) classes/core/Request.inc.php -> function redirectHome [deprecated] --> same in both cases ---> goes to "_delegateToRouter('redirectHome')"
3) lib/pkp/classes/core/PKPRequest.inc.php --> function &_delegateToRouter($method) [deprecated] --> same in both cases
... (I get lost quite lost with the call_user_func_array, that is eveything except readable :-P)
n) lib/pkp/classes/core/PKPRequest.inc.php: function redirectUrl($url) --> all right doing the redirection.
(and so on)

A few hours after and tones of var_dumping ($source, $context, $user, $jurnal...) I noticed this strategy was stupid because recursion is really huuuudge. :-(

Then I decide to include a log file to discover the stack of "methods" called by Request::redirectUrl($method) and what $returners are created so finally I found the first difference:

Without RESTful: (working)
Code: Select all
start
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getRequestedPage
string(4) "user"
============
METHOD: getRequestedPage
string(4) "user"
============
METHOD: getRequestedPage
string(4) "user"
============
METHOD: getRequestedOp
string(5) "index"
============
METHOD: getRequestedPage
string(4) "user"
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: url
string(80) "http://redi-test.uab.cat/ojs-test03/index.php/test03/help/view/user/topic/000007"
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: url
string(65) "http://redi-test.uab.cat/ojs-test03/index.php/test03/login/signIn"
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getRequestedPage
string(4) "user"
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#17 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getRequestedPage
string(4) "user"
============


While with RESTful enabled: (fails)

Code: Select all
start
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getRequestedPage
string(5) "login"
============
METHOD: getRequestedPage
string(5) "login"
============
METHOD: getRequestedPage
string(5) "login"
============
METHOD: getRequestedOp
string(5) "index"
============
METHOD: getRequestedPage
string(5) "login"
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: url
string(59) "http://redi-test.uab.cat/test03/help/view/user/topic/000003"
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: url
string(44) "http://redi-test.uab.cat/test03/login/signIn"
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getContext
object(Journal)#15 (2) {
  ["_data"]=>
  array(5) {
    ["id"]=>
    string(1) "1"
    ["path"]=>
    string(6) "test03"
    ["sequence"]=>
    string(1) "1"
    ["enabled"]=>
    string(1) "1"
    ["primaryLocale"]=>
    string(5) "es_ES"
  }
  ["_metadataAdapters"]=>
  array(0) {
  }
}
============
METHOD: getRequestedPage
string(5) "login"
============


As far as my diff can see, first significant difference appears arround line 322: While "normal" ojs requests user page, the RESTful one asks for "login".
(BTW, journal object id is also different but I suppose/hope it didn't really matter.)

Normal ojs:
Code: Select all
METHOD: getRequestedPage
string(4) "user"


RESTful ojs:
Code: Select all
METHOD: getRequestedPage
string(5) "login"


As I said at the beginning, after all this, I feel like I'm quite at the same point and what really drive me mad it's that I'm still ignore about WHY it happens. Any lighting comment or documentation to understand it better?

My question is: If the user is correctly authenticated/validated (and suspect it is because user var is the same in both cases), what makes OJS load the "login" template page (without role authenticated links) instead of redirecting to "user" template (like if I were a visitor).
Where in the code this decision is taken? What data is mismatched to redirect me to login?

Sorry if the answer is obvious or answered in your former posts but I promise I read them some times and I didn't find how to follow.

The only good news is that I improved the mod_rewrite rules so now I'm able to login in the OJS site:

Those are the new rules:
Code: Select all
RewriteRule ^magazineN$ magazineN/
RewriteRule ^test03/(.*)$ ojs-1/index.php/magazineN/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ojs-test03/(.*)$ ojs-1/index.php/index/$1 [L]


Please Alec, any comment or further information is extremely welcomed.

Thanks a lot in advance,
m.
mbria
 
Posts: 306
Joined: Wed Dec 14, 2005 4:15 am

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby asmecher » Wed Jun 01, 2011 9:58 am

Hi mbria,

Unfortunately what you're seeing is indeed more complex than any of us would like -- between API changes that need backward compatibility for plugins, support for different URL generation schemes (RESTful, path_info, path_info_disabled, and both component and page routers), and application-independent code that supports OJS, OCS, and the Harvester, there are a lot of details.

Before we dig too far into this code, one thing worth checking: is the session cookie path being set properly? One reason the different URL modes might be redirecting differently is that in one situation you're getting logged in successfully and in the other the cookie isn't getting returned to the browser. Have a look at the SessionManager's constructor -- the session.cookie_path variable is set there. Try dumping it out in the various modes you're experimenting with and see if it's getting set correctly. If not, logins will fail because the cookie won't be sent back to the server to indicate an authenticated session.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby mbria » Thu Jun 02, 2011 2:27 pm

Hi Alec,

> Unfortunately what you're seeing is indeed more complex than any of us would like...
Thanks for the comment. I was starting to think I was worst programmer that I am. ;-)
Any case, thanks a a lot for the patience and the feedback.

> Before we dig too far into this code, one thing worth checking: is the session cookie path being set properly?
I also thought in this. While we will have multiple magazines and multiple ojs under the same domain I changed config.inc.php
from: "session_cookie_name = OJSSID"
to: "session_cookie_name = OJSSID-test3"
so I follow your indications and I var_dumped "session.cookie_path" but cookies are identical in both cases. :-(

Any further suggestion to follow?

Cheers,

Marc
mbria
 
Posts: 306
Joined: Wed Dec 14, 2005 4:15 am

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby mbria » Fri Jun 03, 2011 2:30 am

Hi,

I made further testing and I'm suspicious about the entities that appear in the querystring:
http://example.com/magazineN/login?sour ... t03%2Fuser

Is it normal?

My theory is OJS checks $source var to discover in what magazine needs to login but with the entities is unable to do this.

Any suggestion about how to fix it? Class or template level? May be mod_rewrite issue?

I tired with [QSA] modwrite tag but the result is still the same.

Cheers,
m.
mbria
 
Posts: 306
Joined: Wed Dec 14, 2005 4:15 am

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby asmecher » Fri Jun 03, 2011 8:32 am

Hi mbria,

The "source" variable is only used as a redirect location once the login / registration is complete. If you're having login troubles, it must be earlier in the process.

So is the login itself happening successfully, i.e. is it just the redirect that's the problem, or is the login not working either?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby mbria » Mon Jun 06, 2011 8:59 am

Hi Alec,

As fas as I can see, it's a redirection issue. I mean, $user variable looks right in both cases.

If there is something that I can test to be sure login is ok, please, let me know.

Thanks for your help,

m.
mbria
 
Posts: 306
Joined: Wed Dec 14, 2005 4:15 am

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby asmecher » Mon Jun 06, 2011 9:39 am

Hi mbria,

Could you post the patch for your modifications for http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578#p29292? It'll be tough to duplicate a mod_rewrite environment for full testing, but I'll see what I can do.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby mbria » Tue Jun 07, 2011 9:59 am

Hi Alec,

Thanks a lot to take a look (and I feel like "thanks" is short to express my feeling :-P)

I attach the patch as you request (a single line) but I don't think it will be useful to reproduce the issue even to discover what I'm trying to accomplish.

So apart of the patch I also include a tarball with the structure of folders, the magazine's creation script and the DB and config templates.
(The tarball is too heavy to attach so it could be downloaded here: http://www.comunitic.net/OJS/multiOJS/r ... 0.1.tar.gz)

I tested the tarball in an old server (a "honeypot" :-P) and the steeps that need to be done to make it all run are:
(indications will be obvious for you, but it could be helpful in case others want to do something similar)

0) LAMP (debian 5 with php 5.2.x and mysql 5) --> php version is important.

AS ROOT (or sudoer):
1) Create a new user (in my case /home/oaid)
Code: Select all
    $ adduser oaid

2) Uncompress the tarball user's root and check permissions:
Code: Select all
    $ cd /home/oaid
    $ wget http://www.comunitic.net/OJS/multiOJS/rediOJS-v0.1.tar.gz
    $ tar xvzf rediOJS-v0.1.tar.gz
    $ chown oaid:www-data /home/oaid -Rf; chmod 775 /home/oaid -Rf    <--- adjust better in a production environment

3) Modify your host to add "redi-test.uab.cat" to point localhost (or set your DNS)
4) Add a virtual host to answer "redi-test.uab.cat" petitions at /home/oaid/htdocs.
Code: Select all
    $ wget http://www.comunitic.net/OJS/multiOJS/redi.vhost
    $ cp redi.vhost /etc/apache/sites-avaliable
    $ ln -s /etc/apache/sites-avaliable/redi.vhost /etc/apache/sites-enabled/010-redi

5) Edit /home/oaid/scripts and modify the mysql root password to fit yours (line 146, string "AddYourMySqlRootPwd").
6) Edit /home/oaid/ojs/templates/config.inc.php.base to fit your DB credentials (edit "username" and "password" in "[database]" section).
7) Now, everything is ready. As root , run the magazine's creation script (from ~/scripts).
Code: Select all
    Example: $ ./magazine createall magazine1


8) Open your browser and visit http://redi-test.uab.cat/ojs-magazine1

Some further comments:

The script is still under development (some features half developed, comments in Catalan... just let me know if you want them translated) and will be released and improved to be more general as soon as I fix the redirection issue.

If you follow the instructions you will get a "replica" of the full environment.

If you run step 7, you will get an new OJS (with symlinks to "current" ojs version) and a preconfigured magazine inside, working fine without RESTfull urls.

Finally, if you enable RESTfull (uncommenting and "setting" .htaccess rules -or in vhost- and uncommenting some preset OJS config vars) you will be EXACTLY in the point I'm now.

If you prefer access to the server where I re- installed all the stuff instead of reproduce the environment, you just need to ask.

Any case, if you give me more clues to follow I will dig doing my best.

Once again (sorry to be a pain in the neck with my reiterative gratitude :-)), thanks a lot for your expert help.

Cheers,
m.
Attachments
Validation.inc.php.patch
Unified patch for /classes/security/Validation.inc.php
Reachable at: http://redi-formacio.uab.cat/ojs-magazine1/classes/security/Validation.inc.php.patch
(416 Bytes) Downloaded 172 times
mbria
 
Posts: 306
Joined: Wed Dec 14, 2005 4:15 am

Re: Individual Name for Each Journal within MULTIPLE OJS inst.

Postby asmecher » Tue Jun 07, 2011 4:34 pm

Hi mbria,

Hmm, getting the whole environment duplicated over here unfortunately takes more time than I can invest -- but if you're currently working on a non-production environment and would be willing, maybe you could give me a temporary login to tinker with the PHP? I generally avoid that sort of involvement, but I'd like to support the work you're doing and that might be the easiest way. PM me if that's possible.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8851
Joined: Wed Aug 10, 2005 12:56 pm

Next

Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 4 guests