Bug 7073 - Review/facilitate mbria's hosting configuration
Review/facilitate mbria's hosting configuration
Status: NEW
Product: OJS
Classification: Unclassified
Component: General
2.4.x
All All
: P3 normal
Assigned To: PKP Support
Depends on: 8344
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-26 04:14 PST by Alec Smecher
Modified: 2014-08-19 08:44 PDT (History)
2 users (show)

See Also:
Version Reported In:
Also Affects:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Smecher 2012-01-26 04:14:43 PST
See http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578&start=15 for details.
Comment 1 Marc Bria 2013-07-24 07:39:14 PDT
For OJS 2.3.6, two minor changes are required for RESTFUL urls. 
More info about those changes here:
* http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578&start=15#p32090
* http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578&start=15#p32525

Summarizing:

At lib/pkp/classes/session/SessionManager.inc.php:
// ini_set('session.cookie_path', $request->getBasePath() . '/');
   ini_set('session.cookie_path', Config::getVar('general', 'session_cookie_path')); //MBR: To allow RESTful with multiple O

And in config.inc.php, add a new variable:
; Variable to allow multiple OJS sites with RESTful URLs in a multisite configuration:
    session_cookie_path = /
Comment 2 Alec Smecher 2013-07-24 12:09:42 PDT
Marc, the trouble with this change...


//define('INDEX_FILE_LOCATION', dirname(dirname(__FILE__)) . '/index.php');
define('INDEX_FILE_LOCATION', realpath(dirname(dirname($_SERVER["SCRIPT_FILENAME"]))). '/index.php');

...is that PHP can be invoked from at least four places:
- Through the web server via the index.php script
- Via the tools/ scripts
- Via the lib/pkp/tools/ scripts
- Via lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/jbimages/integratePKP.php (this one is an outlier)

The proposed approach calculates a relative directory based on the invoking script, which could be one of several directories depending on which of the above cases were dealing with.

The original approach works out a relative directory based on the location of the bootstrap.inc.php script itself, which is less likely to change (though your symlinked situation is running into trouble here).

Unfortunately we can't use a configuration variable here because we need to load the config file classes, and that depends on INDEX_FILE_LOCATION being correct.
Comment 3 Marc Bria 2013-07-25 02:33:47 PDT
So, ok with this patch:
http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578&start=15#p32090

But need to test deeper this one:
http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7578&start=15#p32525

... to detail what are the collateral effects in a symlinked environment.

Isn't it?
Comment 4 Alec Smecher 2013-07-25 10:46:02 PDT
Add config template for session_cookie_path (optional)
https://github.com/pkp/ojs/commit/7908d5320091db1ceb1d6894f42a90f251ac46de
Comment 5 Alec Smecher 2013-07-25 10:47:02 PDT
Add support for config-specified session_cookie_path (optional)
https://github.com/pkp/pkp-lib/commit/67c96f2933d2c60d449968eb0a8b5dbe456e9f47
Comment 6 Alec Smecher 2013-07-25 10:47:02 PDT
Add config template for session_cookie_path (optional)
https://github.com/pkp/omp/commit/ff3f2cb58604ecd1304dc19e73e837a947858531
Comment 7 Alec Smecher 2013-07-25 10:48:02 PDT
Add config template for session_cookie_path (optional)
https://github.com/pkp/ocs/commit/8cedacf766492c8db1981c565413eae07890e3f5
Comment 8 Alec Smecher 2013-07-25 10:48:52 PDT
Marc, that's correct. I've just committed the changes to add support for the session_cookie_path config parameter to the master branches for OJS, OCS, OHS, and OMP -- the only difference from what you've suggested is that I added a default fallback to the old behavior when the variable isn't specified. By default it isn't specified in the config template. That ought to prevent this from surprising anyone on upgrade.
Comment 9 Alec Smecher 2013-07-25 10:49:02 PDT
Add config template for session_cookie_path (optional)
https://github.com/pkp/harvester/commit/fd37a22f3a5cf29f839b23462bb37c55fbe3cb2c
Comment 10 Marc Bria 2013-07-29 00:35:32 PDT
Thanks Alec.

To avoid mixing stuff, I open new issues with the problems that still need to be fixed to close this global task.

Symlinked hosted configuration: Unable to reach /tools scripts
http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=8344

Symlinked hosted configuration: Some PKP classes redirect to base folder.
(need more info to report properly)