-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This updates LORIS to use the PSR15 RequestHandler/Middleware based router that was implemented in PRs #3477, #3480, and #3513. Most of the mod_rewrite rules, main.php, and NDB_Caller are replaced by a new index.php, which generates a PSR7 ServerRequestInterface and delegates to the module's Module handler. AjaxHelper.php remains, but is deprecated, as existing scripts will need to be updated to be proper endpoints in the module's router. (Once this is done, the separate router.php for PHP's built in web server can also be removed, and mod_rewrite dependency for LORIS can be removed.) main.php and NDB_Caller also remain for now in order to load instruments. Once an instrument module is implemented to handle the instruments routers, they can be removed. Note that instrument URLs also change from $LORIS/instrumentname to $LORIS/instruments/instrumentname as part of this change.
- Loading branch information
Showing
52 changed files
with
660 additions
and
784 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,19 @@ | ||
<IfModule mod_rewrite.c> | ||
RewriteEngine on | ||
|
||
RewriteRule ^([a-zA-Z_-]+)/api/([a-zA-Z0-9_.-/]+)$ module-api.php | ||
# FIXME: The /module/$name/ajax directory needs to be replaced with real NDB_Pages that | ||
# remove the page decoration middlewares, but for now we need to keep this helper script. | ||
RewriteRule ^([a-zA-Z_-]+)/ajax/([a-zA-Z0-9_.-]+)$ AjaxHelper.php?Module=$1&script=$2 [QSA,L] | ||
|
||
# Bootstrap is not a Loris module, don't rewrite it. | ||
RewriteRule ^bootstrap/(.*) bootstrap/$1 [L] | ||
# Excel Dumps aren't a Loris module, don't rewrite it. | ||
RewriteRule ^dataDumps/(.*) dataDumps/$1 [L] | ||
# Instruments and reliability still use main.php, for now | ||
RewriteRule ^instruments/([a-zA-Z0-9_-]+)/$ main.php?test_name=$1 [QSA,L] | ||
RewriteRule ^instruments/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_.-]+)/$ main.php?test_name=$1&subtest=$2 [QSA,L] | ||
|
||
# Redirect /CandID/ to visit label list | ||
RewriteRule ^([0-9]{6,6})/$ main.php?test_name=timepoint_list&candID=$1 | ||
# Want to redirect /CandID/Visit_label/ to instrument list, but | ||
# because of the main.php URL structure it needs to be the sessionID instead | ||
# of Visit_label | ||
RewriteRule ^([0-9]{6,6})/([0-9]+)/$ main.php?test_name=instrument_list&candID=$1&sessionID=$2 | ||
|
||
# Redirect /CandID/Visit/Instrument/(subtest/) to the instrument | ||
RewriteRule ^([0-9]{6,6})/([0-9]+)/([a-zA-Z0-9_]+)/$ main.php?test_name=$3&candID=$1&sessionID=$2 [QSA] | ||
RewriteRule ^([0-9]{6,6})/([0-9]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/$ main.php?test_name=$3&candID=$1&sessionID=$2&subtest=$4 [QSA] | ||
|
||
# Rewrite /foo/ to appropriate module | ||
# Includes /foo/css/cssfile.css | ||
# /foo/js/javascriptfile.js | ||
# /foo/ajax/AjaxScript.php | ||
# To use the appropriate helper script as well. | ||
RewriteRule ^([a-zA-Z0-9_-]+)/$ main.php?test_name=$1 [QSA] | ||
RewriteRule ^([a-zA-Z_-]+)/css/([a-zA-Z0-9_.-]+)$ GetCSS.php?Module=$1&file=$2 | ||
RewriteRule ^([a-zA-Z_-]+)/js/([a-zA-Z0-9_.-]+)$ GetJS.php?Module=$1&file=$2 | ||
RewriteRule ^([a-zA-Z_-]+)/static/([a-zA-Z0-9_.-/]+)$ GetStatic.php?Module=$1&file=$2 | ||
RewriteRule ^([a-zA-Z_-]+)/ajax/([a-zA-Z0-9_.-]+)$ AjaxHelper.php?Module=$1&script=$2 [QSA] | ||
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_.-]+)/$ main.php?test_name=$1&subtest=$2 [QSA] | ||
|
||
# Add trailing slash to all directories | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteRule ^(.*[^/])$ /$1/ [L,R=307] | ||
RewriteRule ^([a-zA-Z0-9_-]+)reliability([a-zA-Z0-9_-]*) main.php?test_name=$1reliability$2 [QSA,L] | ||
|
||
# Everything else gets rewritten to be handled by index.php, unless it's a file that's served | ||
# directly from apache | ||
RewriteCond "%{REQUEST_FILENAME}" "!-f" | ||
RewriteRule ^(.*)$ index.php?lorispath=$1 [QSA,L] | ||
</IfModule> | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.