Move more specific routes ahead of more general routes

A lot of API routes have versions with or without params. I moved the
ones with params up so they match correctly.
This commit is contained in:
Evan Prodromou 2011-09-18 19:20:55 -04:00
parent 822cb1482a
commit ffe5702dc3

View File

@ -341,17 +341,13 @@ class Router
array('action' => 'ApiTimelinePublic', array('action' => 'ApiTimelinePublic',
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/friends_timeline.:format',
array('action' => 'ApiTimelineFriends',
'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/friends_timeline/:id.:format', $m->connect('api/statuses/friends_timeline/:id.:format',
array('action' => 'ApiTimelineFriends', array('action' => 'ApiTimelineFriends',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/home_timeline.:format', $m->connect('api/statuses/friends_timeline.:format',
array('action' => 'ApiTimelineHome', array('action' => 'ApiTimelineFriends',
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/home_timeline/:id.:format', $m->connect('api/statuses/home_timeline/:id.:format',
@ -359,8 +355,8 @@ class Router
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/user_timeline.:format', $m->connect('api/statuses/home_timeline.:format',
array('action' => 'ApiTimelineUser', array('action' => 'ApiTimelineHome',
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/user_timeline/:id.:format', $m->connect('api/statuses/user_timeline/:id.:format',
@ -368,8 +364,8 @@ class Router
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/mentions.:format', $m->connect('api/statuses/user_timeline.:format',
array('action' => 'ApiTimelineMentions', array('action' => 'ApiTimelineUser',
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/mentions/:id.:format', $m->connect('api/statuses/mentions/:id.:format',
@ -377,7 +373,7 @@ class Router
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/replies.:format', $m->connect('api/statuses/mentions.:format',
array('action' => 'ApiTimelineMentions', array('action' => 'ApiTimelineMentions',
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
@ -386,6 +382,10 @@ class Router
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/replies.:format',
array('action' => 'ApiTimelineMentions',
'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/retweeted_by_me.:format', $m->connect('api/statuses/retweeted_by_me.:format',
array('action' => 'ApiTimelineRetweetedByMe', array('action' => 'ApiTimelineRetweetedByMe',
'format' => '(xml|json|atom|as)')); 'format' => '(xml|json|atom|as)'));
@ -398,17 +398,13 @@ class Router
array('action' => 'ApiTimelineRetweetsOfMe', array('action' => 'ApiTimelineRetweetsOfMe',
'format' => '(xml|json|atom|as)')); 'format' => '(xml|json|atom|as)'));
$m->connect('api/statuses/friends.:format',
array('action' => 'ApiUserFriends',
'format' => '(xml|json)'));
$m->connect('api/statuses/friends/:id.:format', $m->connect('api/statuses/friends/:id.:format',
array('action' => 'ApiUserFriends', array('action' => 'ApiUserFriends',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statuses/followers.:format', $m->connect('api/statuses/friends.:format',
array('action' => 'ApiUserFollowers', array('action' => 'ApiUserFriends',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statuses/followers/:id.:format', $m->connect('api/statuses/followers/:id.:format',
@ -416,28 +412,32 @@ class Router
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statuses/show.:format', $m->connect('api/statuses/followers.:format',
array('action' => 'ApiStatusesShow', array('action' => 'ApiUserFollowers',
'format' => '(xml|json|atom)')); 'format' => '(xml|json)'));
$m->connect('api/statuses/show/:id.:format', $m->connect('api/statuses/show/:id.:format',
array('action' => 'ApiStatusesShow', array('action' => 'ApiStatusesShow',
'id' => '[0-9]+', 'id' => '[0-9]+',
'format' => '(xml|json|atom)')); 'format' => '(xml|json|atom)'));
$m->connect('api/statuses/show.:format',
array('action' => 'ApiStatusesShow',
'format' => '(xml|json|atom)'));
$m->connect('api/statuses/update.:format', $m->connect('api/statuses/update.:format',
array('action' => 'ApiStatusesUpdate', array('action' => 'ApiStatusesUpdate',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statuses/destroy.:format',
array('action' => 'ApiStatusesDestroy',
'format' => '(xml|json)'));
$m->connect('api/statuses/destroy/:id.:format', $m->connect('api/statuses/destroy/:id.:format',
array('action' => 'ApiStatusesDestroy', array('action' => 'ApiStatusesDestroy',
'id' => '[0-9]+', 'id' => '[0-9]+',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statuses/destroy.:format',
array('action' => 'ApiStatusesDestroy',
'format' => '(xml|json)'));
$m->connect('api/statuses/retweet/:id.:format', $m->connect('api/statuses/retweet/:id.:format',
array('action' => 'ApiStatusesRetweet', array('action' => 'ApiStatusesRetweet',
'id' => '[0-9]+', 'id' => '[0-9]+',
@ -450,15 +450,15 @@ class Router
// users // users
$m->connect('api/users/show.:format',
array('action' => 'ApiUserShow',
'format' => '(xml|json)'));
$m->connect('api/users/show/:id.:format', $m->connect('api/users/show/:id.:format',
array('action' => 'ApiUserShow', array('action' => 'ApiUserShow',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/users/show.:format',
array('action' => 'ApiUserShow',
'format' => '(xml|json)'));
$m->connect('api/users/profile_image/:screen_name.:format', $m->connect('api/users/profile_image/:screen_name.:format',
array('action' => 'ApiUserProfileImage', array('action' => 'ApiUserProfileImage',
'screen_name' => Nickname::DISPLAY_FMT, 'screen_name' => Nickname::DISPLAY_FMT,
@ -489,24 +489,24 @@ class Router
array('action' => 'ApiFriendshipsExists', array('action' => 'ApiFriendshipsExists',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/friendships/create.:format',
array('action' => 'ApiFriendshipsCreate',
'format' => '(xml|json)'));
$m->connect('api/friendships/destroy.:format',
array('action' => 'ApiFriendshipsDestroy',
'format' => '(xml|json)'));
$m->connect('api/friendships/create/:id.:format', $m->connect('api/friendships/create/:id.:format',
array('action' => 'ApiFriendshipsCreate', array('action' => 'ApiFriendshipsCreate',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/friendships/create.:format',
array('action' => 'ApiFriendshipsCreate',
'format' => '(xml|json)'));
$m->connect('api/friendships/destroy/:id.:format', $m->connect('api/friendships/destroy/:id.:format',
array('action' => 'ApiFriendshipsDestroy', array('action' => 'ApiFriendshipsDestroy',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/friendships/destroy.:format',
array('action' => 'ApiFriendshipsDestroy',
'format' => '(xml|json)'));
// Social graph // Social graph
$m->connect('api/friends/ids/:id.:format', $m->connect('api/friends/ids/:id.:format',
@ -549,15 +549,15 @@ class Router
// favorites // favorites
$m->connect('api/favorites.:format',
array('action' => 'ApiTimelineFavorites',
'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/favorites/:id.:format', $m->connect('api/favorites/:id.:format',
array('action' => 'ApiTimelineFavorites', array('action' => 'ApiTimelineFavorites',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/favorites.:format',
array('action' => 'ApiTimelineFavorites',
'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/favorites/create/:id.:format', $m->connect('api/favorites/create/:id.:format',
array('action' => 'ApiFavoriteCreate', array('action' => 'ApiFavoriteCreate',
'id' => '[0-9]+', 'id' => '[0-9]+',
@ -569,12 +569,17 @@ class Router
'format' => '(xml|json)')); 'format' => '(xml|json)'));
// blocks // blocks
$m->connect('api/blocks/create/:id.:format',
array('action' => 'ApiBlockCreate',
'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)'));
$m->connect('api/blocks/create.:format', $m->connect('api/blocks/create.:format',
array('action' => 'ApiBlockCreate', array('action' => 'ApiBlockCreate',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/blocks/create/:id.:format', $m->connect('api/blocks/destroy/:id.:format',
array('action' => 'ApiBlockCreate', array('action' => 'ApiBlockDestroy',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
@ -582,10 +587,6 @@ class Router
array('action' => 'ApiBlockDestroy', array('action' => 'ApiBlockDestroy',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/blocks/destroy/:id.:format',
array('action' => 'ApiBlockDestroy',
'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)'));
// help // help
$m->connect('api/help/test.:format', $m->connect('api/help/test.:format',
@ -623,13 +624,17 @@ class Router
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json|rss|atom|as)')); 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statusnet/groups/show/:id.:format',
array('action' => 'ApiGroupShow',
'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/show.:format', $m->connect('api/statusnet/groups/show.:format',
array('action' => 'ApiGroupShow', array('action' => 'ApiGroupShow',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/show/:id.:format', $m->connect('api/statusnet/groups/join/:id.:format',
array('action' => 'ApiGroupShow', array('action' => 'ApiGroupJoin',
'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/join.:format', $m->connect('api/statusnet/groups/join.:format',
@ -637,8 +642,8 @@ class Router
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/join/:id.:format', $m->connect('api/statusnet/groups/leave/:id.:format',
array('action' => 'ApiGroupJoin', array('action' => 'ApiGroupLeave',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/leave.:format', $m->connect('api/statusnet/groups/leave.:format',
@ -646,36 +651,32 @@ class Router
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/leave/:id.:format',
array('action' => 'ApiGroupLeave',
'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/is_member.:format', $m->connect('api/statusnet/groups/is_member.:format',
array('action' => 'ApiGroupIsMember', array('action' => 'ApiGroupIsMember',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/list.:format',
array('action' => 'ApiGroupList',
'format' => '(xml|json|rss|atom)'));
$m->connect('api/statusnet/groups/list/:id.:format', $m->connect('api/statusnet/groups/list/:id.:format',
array('action' => 'ApiGroupList', array('action' => 'ApiGroupList',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json|rss|atom)')); 'format' => '(xml|json|rss|atom)'));
$m->connect('api/statusnet/groups/list.:format',
array('action' => 'ApiGroupList',
'format' => '(xml|json|rss|atom)'));
$m->connect('api/statusnet/groups/list_all.:format', $m->connect('api/statusnet/groups/list_all.:format',
array('action' => 'ApiGroupListAll', array('action' => 'ApiGroupListAll',
'format' => '(xml|json|rss|atom)')); 'format' => '(xml|json|rss|atom)'));
$m->connect('api/statusnet/groups/membership.:format',
array('action' => 'ApiGroupMembership',
'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/membership/:id.:format', $m->connect('api/statusnet/groups/membership/:id.:format',
array('action' => 'ApiGroupMembership', array('action' => 'ApiGroupMembership',
'id' => Nickname::INPUT_FMT, 'id' => Nickname::INPUT_FMT,
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/membership.:format',
array('action' => 'ApiGroupMembership',
'format' => '(xml|json)'));
$m->connect('api/statusnet/groups/create.:format', $m->connect('api/statusnet/groups/create.:format',
array('action' => 'ApiGroupCreate', array('action' => 'ApiGroupCreate',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
@ -709,39 +710,28 @@ class Router
array('action' => 'ApiListSubscriptions', array('action' => 'ApiListSubscriptions',
'user' => '[a-zA-Z0-9]+', 'user' => '[a-zA-Z0-9]+',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/lists.:format', $m->connect('api/lists.:format',
array('action' => 'ApiLists', array('action' => 'ApiLists',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/:user/lists.:format',
array('action' => 'ApiLists',
'user' => '[a-zA-Z0-9]+',
'format' => '(xml|json)'));
$m->connect('api/:user/lists/:id.:format', $m->connect('api/:user/lists/:id.:format',
array('action' => 'ApiList', array('action' => 'ApiList',
'user' => '[a-zA-Z0-9]+', 'user' => '[a-zA-Z0-9]+',
'id' => '[a-zA-Z0-9]+', 'id' => '[a-zA-Z0-9]+',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/:user/lists.:format',
array('action' => 'ApiLists',
'user' => '[a-zA-Z0-9]+',
'format' => '(xml|json)'));
$m->connect('api/:user/lists/:id/statuses.:format', $m->connect('api/:user/lists/:id/statuses.:format',
array('action' => 'ApiTimelineList', array('action' => 'ApiTimelineList',
'user' => '[a-zA-Z0-9]+', 'user' => '[a-zA-Z0-9]+',
'id' => '[a-zA-Z0-9]+', 'id' => '[a-zA-Z0-9]+',
'format' => '(xml|json|rss|atom)')); 'format' => '(xml|json|rss|atom)'));
$m->connect('api/:user/:list_id/members.:format',
array('action' => 'ApiListMembers',
'user' => '[a-zA-Z0-9]+',
'list_id' => '[a-zA-Z0-9]+',
'format' => '(xml|json)'));
$m->connect('api/:user/:list_id/subscribers.:format',
array('action' => 'ApiListSubscribers',
'user' => '[a-zA-Z0-9]+',
'list_id' => '[a-zA-Z0-9]+',
'format' => '(xml|json)'));
$m->connect('api/:user/:list_id/members/:id.:format', $m->connect('api/:user/:list_id/members/:id.:format',
array('action' => 'ApiListMember', array('action' => 'ApiListMember',
'user' => '[a-zA-Z0-9]+', 'user' => '[a-zA-Z0-9]+',
@ -749,6 +739,12 @@ class Router
'id' => '[a-zA-Z0-9]+', 'id' => '[a-zA-Z0-9]+',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/:user/:list_id/members.:format',
array('action' => 'ApiListMembers',
'user' => '[a-zA-Z0-9]+',
'list_id' => '[a-zA-Z0-9]+',
'format' => '(xml|json)'));
$m->connect('api/:user/:list_id/subscribers/:id.:format', $m->connect('api/:user/:list_id/subscribers/:id.:format',
array('action' => 'ApiListSubscriber', array('action' => 'ApiListSubscriber',
'user' => '[a-zA-Z0-9]+', 'user' => '[a-zA-Z0-9]+',
@ -756,6 +752,12 @@ class Router
'id' => '[a-zA-Z0-9]+', 'id' => '[a-zA-Z0-9]+',
'format' => '(xml|json)')); 'format' => '(xml|json)'));
$m->connect('api/:user/:list_id/subscribers.:format',
array('action' => 'ApiListSubscribers',
'user' => '[a-zA-Z0-9]+',
'list_id' => '[a-zA-Z0-9]+',
'format' => '(xml|json)'));
// Tags // Tags
$m->connect('api/statusnet/tags/timeline/:tag.:format', $m->connect('api/statusnet/tags/timeline/:tag.:format',
array('action' => 'ApiTimelineTag', array('action' => 'ApiTimelineTag',