1 | <?php |
||
31 | class WebStart extends ApplicationBase |
||
32 | { |
||
33 | /** |
||
34 | * @var IRequestRouter $requestRouter The request router to use. Note that different entry points have different |
||
35 | * routers and hence different URL mappings |
||
36 | */ |
||
37 | private $requestRouter; |
||
38 | /** |
||
39 | * @var bool $isPublic Determines whether to use public interface objects or internal interface objects |
||
40 | */ |
||
41 | private $isPublic = false; |
||
42 | |||
43 | /** |
||
44 | * WebStart constructor. |
||
45 | * |
||
46 | * @param SiteConfiguration $configuration The site configuration |
||
47 | * @param IRequestRouter $router The request router to use |
||
48 | */ |
||
49 | 2 | public function __construct(SiteConfiguration $configuration, IRequestRouter $router) |
|
50 | { |
||
51 | 2 | parent::__construct($configuration); |
|
52 | |||
53 | 2 | $this->requestRouter = $router; |
|
54 | 2 | } |
|
55 | |||
56 | /** |
||
57 | * @param ITask $page |
||
58 | * @param SiteConfiguration $siteConfiguration |
||
59 | * @param PdoDatabase $database |
||
60 | * @param PdoDatabase $notificationsDatabase |
||
|
|||
61 | * |
||
62 | * @return void |
||
63 | */ |
||
64 | protected function setupHelpers( |
||
65 | ITask $page, |
||
66 | SiteConfiguration $siteConfiguration, |
||
67 | PdoDatabase $database, |
||
68 | PdoDatabase $notificationsDatabase = null |
||
69 | ) { |
||
70 | parent::setupHelpers($page, $siteConfiguration, $database, $notificationsDatabase); |
||
71 | |||
72 | if ($page instanceof PageBase) { |
||
73 | $page->setTokenManager(new TokenManager()); |
||
74 | |||
75 | if ($page instanceof InternalPageBase) { |
||
76 | $page->setTypeAheadHelper(new TypeAheadHelper()); |
||
77 | |||
78 | $identificationVerifier = new IdentificationVerifier($page->getHttpHelper(), $siteConfiguration, |
||
79 | $database); |
||
80 | $page->setIdentificationVerifier($identificationVerifier); |
||
81 | |||
82 | $page->setSecurityManager(new SecurityManager($identificationVerifier, new RoleConfiguration())); |
||
83 | |||
84 | if ($siteConfiguration->getTitleBlacklistEnabled()) { |
||
85 | $page->setBlacklistHelper(new FakeBlacklistHelper()); |
||
86 | } |
||
87 | else { |
||
88 | $page->setBlacklistHelper(new BlacklistHelper($page->getHttpHelper(), |
||
89 | $siteConfiguration->getMediawikiWebServiceEndpoint())); |
||
90 | } |
||
91 | } |
||
92 | } |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * Application entry point. |
||
97 | * |
||
98 | * Sets up the environment and runs the application, performing any global cleanup operations when done. |
||
99 | */ |
||
100 | public function run() |
||
119 | |||
120 | /** |
||
121 | * Environment setup |
||
122 | * |
||
123 | * This method initialises the tool environment. If the tool cannot be initialised correctly, it will return false |
||
124 | * and shut down prematurely. |
||
125 | * |
||
126 | * @return bool |
||
127 | * @throws EnvironmentException |
||
128 | */ |
||
129 | protected function setupEnvironment() |
||
167 | |||
168 | /** |
||
169 | * Main application logic |
||
170 | */ |
||
171 | protected function main() |
||
200 | |||
201 | /** |
||
202 | * Any cleanup tasks should go here |
||
203 | * |
||
204 | * Note that we need to be very careful here, as exceptions may have been thrown and handled. |
||
205 | * This should *only* be for cleaning up, no logic should go here. |
||
206 | */ |
||
207 | protected function cleanupEnvironment() |
||
216 | |||
217 | private function checkForceLogout() |
||
218 | { |
||
243 | |||
244 | 1 | public function isPublic() |
|
248 | |||
249 | 1 | public function setPublic($isPublic) |
|
253 | } |
||
254 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.