+ /**
+ * Helper for getLocalUrl() to handles $wgActionPaths
+ *
+ * @param $dbkey string Title in database key format
+ * @param $query string request parameters in CGI format (p=1&q=2&..)
+ * @return Url resolved or boolean false
+ */
+ private static function resolveActionPath( $dbkey, $query ) {
+ $url = '';
+
+ # query parameters are easier to handle using an array:
+ $queryArray = wfCGIToArray( $query );
+
+ global $wgActionPaths;
+ if( !array_key_exists( 'action', $queryArray ) ) {
+ // Makes the default action 'view' and points to $wgArticlePath
+ // @todo FIXME: This should be handled in Setup or Wiki!
+ global $wgArticlePath;
+ $url = str_replace( '$1', $dbkey, $wgArticlePath );
+ } elseif( isset( $wgActionPaths[$queryArray['action']] ) ) {
+ $url = str_replace( '$1', $dbkey, $wgActionPaths[$queryArray['action']] );
+ } else {
+ # No path found
+ return false;
+ }
+
+ #Â No need to append the action since we have embed it in the path
+ unset( $queryArray['action'] );
+ $url = wfAppendQuery( $url, wfArrayToCGI( $queryArray ) );
+ return $url;
+ }
+