2012-03-01 12:12:56 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env php
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<?php
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$root = dirname(dirname(dirname(__FILE__)));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								require_once $root.'/scripts/__init_script__.php';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if ($argc !== 2 || $argv[1] === '--help') {
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-22 17:27:56 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  echo pht('Usage: %s', 'aphrontpath.php <url>')."\n";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  echo pht(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "Purpose: Print controller which will process passed %s.\n",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    '<url>');
							 | 
						
					
						
							
								
									
										
										
										
											2012-03-01 12:12:56 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  exit(1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$url = parse_url($argv[1]);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$path = '/'.(isset($url['path']) ? ltrim($url['path'], '/') : '');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$config_key = 'aphront.default-application-configuration-class';
							 | 
						
					
						
							
								
									
										
										
										
											2012-03-21 14:48:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								$application = PhabricatorEnv::newObjectFromConfig($config_key);
							 | 
						
					
						
							
								
									
										
										
										
											2012-08-09 22:11:50 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								$application->setRequest(new AphrontRequest('', $path));
							 | 
						
					
						
							
								
									
										
										
										
											2012-03-01 12:12:56 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2012-08-09 22:11:50 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								list($controller) = $application->buildControllerForPath($path);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if (!$controller && substr($path, -1) !== '/') {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  list($controller) = $application->buildControllerForPath($path.'/');
							 | 
						
					
						
							
								
									
										
										
										
											2012-03-01 12:12:56 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if ($controller) {
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-09 16:03:58 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  echo get_class($controller)."\n";
							 | 
						
					
						
							
								
									
										
										
										
											2012-03-01 12:12:56 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |