MediaWiki  1.23.2
Wiki.php
Go to the documentation of this file.
1 <?php
28 class MediaWiki {
29 
34  private $context;
35 
40  public function request( WebRequest $x = null ) {
41  $old = $this->context->getRequest();
42  $this->context->setRequest( $x );
43  return $old;
44  }
45 
50  public function output( OutputPage $x = null ) {
51  $old = $this->context->getOutput();
52  $this->context->setOutput( $x );
53  return $old;
54  }
55 
59  public function __construct( IContextSource $context = null ) {
60  if ( !$context ) {
62  }
63 
64  $this->context = $context;
65  }
66 
72  private function parseTitle() {
74 
75  $request = $this->context->getRequest();
76  $curid = $request->getInt( 'curid' );
77  $title = $request->getVal( 'title' );
78  $action = $request->getVal( 'action', 'view' );
79 
80  if ( $request->getCheck( 'search' ) ) {
81  // Compatibility with old search URLs which didn't use Special:Search
82  // Just check for presence here, so blank requests still
83  // show the search page when using ugly URLs (bug 8054).
84  $ret = SpecialPage::getTitleFor( 'Search' );
85  } elseif ( $curid ) {
86  // URLs like this are generated by RC, because rc_title isn't always accurate
87  $ret = Title::newFromID( $curid );
88  } else {
90  // Alias NS_MEDIA page URLs to NS_FILE...we only use NS_MEDIA
91  // in wikitext links to tell Parser to make a direct file link
92  if ( !is_null( $ret ) && $ret->getNamespace() == NS_MEDIA ) {
93  $ret = Title::makeTitle( NS_FILE, $ret->getDBkey() );
94  }
95  // Check variant links so that interwiki links don't have to worry
96  // about the possible different language variants
97  if ( count( $wgContLang->getVariants() ) > 1
98  && !is_null( $ret ) && $ret->getArticleID() == 0
99  ) {
100  $wgContLang->findVariantLink( $title, $ret );
101  }
102  }
103 
104  // If title is not provided, always allow oldid and diff to set the title.
105  // If title is provided, allow oldid and diff to override the title, unless
106  // we are talking about a special page which might use these parameters for
107  // other purposes.
108  if ( $ret === null || !$ret->isSpecialPage() ) {
109  // We can have urls with just ?diff=,?oldid= or even just ?diff=
110  $oldid = $request->getInt( 'oldid' );
111  $oldid = $oldid ? $oldid : $request->getInt( 'diff' );
112  // Allow oldid to override a changed or missing title
113  if ( $oldid ) {
114  $rev = Revision::newFromId( $oldid );
115  $ret = $rev ? $rev->getTitle() : $ret;
116  }
117  }
118 
119  // Use the main page as default title if nothing else has been provided
120  if ( $ret === null && strval( $title ) === '' && !$request->getCheck( 'curid' ) && $action !== 'delete' ) {
122  }
123 
124  if ( $ret === null || ( $ret->getDBkey() == '' && !$ret->isExternal() ) ) {
125  $ret = SpecialPage::getTitleFor( 'Badtitle' );
126  }
127 
128  return $ret;
129  }
130 
135  public function getTitle() {
136  if ( $this->context->getTitle() === null ) {
137  $this->context->setTitle( $this->parseTitle() );
138  }
139  return $this->context->getTitle();
140  }
141 
147  public function getAction() {
148  static $action = null;
149 
150  if ( $action === null ) {
151  $action = Action::getActionName( $this->context );
152  }
153 
154  return $action;
155  }
156 
169  private function performRequest() {
170  global $wgServer, $wgUsePathInfo, $wgTitle;
171 
172  wfProfileIn( __METHOD__ );
173 
174  $request = $this->context->getRequest();
175  $requestTitle = $title = $this->context->getTitle();
176  $output = $this->context->getOutput();
177  $user = $this->context->getUser();
178 
179  if ( $request->getVal( 'printable' ) === 'yes' ) {
180  $output->setPrintable();
181  }
182 
183  $unused = null; // To pass it by reference
184  wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) );
185 
186  // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
187  if ( is_null( $title ) || ( $title->getDBkey() == '' && !$title->isExternal() )
188  || $title->isSpecial( 'Badtitle' )
189  ) {
190  $this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
191  wfProfileOut( __METHOD__ );
192  throw new BadTitleError();
193  }
194 
195  // Check user's permissions to read this page.
196  // We have to check here to catch special pages etc.
197  // We will check again in Article::view().
198  $permErrors = $title->getUserPermissionsErrors( 'read', $user );
199  if ( count( $permErrors ) ) {
200  // Bug 32276: allowing the skin to generate output with $wgTitle or
201  // $this->context->title set to the input title would allow anonymous users to
202  // determine whether a page exists, potentially leaking private data. In fact, the
203  // curid and oldid request parameters would allow page titles to be enumerated even
204  // when they are not guessable. So we reset the title to Special:Badtitle before the
205  // permissions error is displayed.
206  //
207  // The skin mostly uses $this->context->getTitle() these days, but some extensions
208  // still use $wgTitle.
209 
210  $badTitle = SpecialPage::getTitleFor( 'Badtitle' );
211  $this->context->setTitle( $badTitle );
212  $wgTitle = $badTitle;
213 
214  wfProfileOut( __METHOD__ );
215  throw new PermissionsError( 'read', $permErrors );
216  }
217 
218  $pageView = false; // was an article or special page viewed?
219 
220  // Interwiki redirects
221  if ( $title->isExternal() ) {
222  $rdfrom = $request->getVal( 'rdfrom' );
223  if ( $rdfrom ) {
224  $url = $title->getFullURL( array( 'rdfrom' => $rdfrom ) );
225  } else {
226  $query = $request->getValues();
227  unset( $query['title'] );
228  $url = $title->getFullURL( $query );
229  }
230  // Check for a redirect loop
231  if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url )
232  && $title->isLocal()
233  ) {
234  // 301 so google et al report the target as the actual url.
235  $output->redirect( $url, 301 );
236  } else {
237  $this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
238  wfProfileOut( __METHOD__ );
239  throw new BadTitleError();
240  }
241  // Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
242  } elseif ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted()
243  && ( $request->getVal( 'title' ) === null
244  || $title->getPrefixedDBkey() != $request->getVal( 'title' ) )
245  && !count( $request->getValueNames( array( 'action', 'title' ) ) )
246  && wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) )
247  ) {
248  if ( $title->isSpecialPage() ) {
249  list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
250  if ( $name ) {
251  $title = SpecialPage::getTitleFor( $name, $subpage );
252  }
253  }
254  $targetUrl = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
255  // Redirect to canonical url, make it a 301 to allow caching
256  if ( $targetUrl == $request->getFullRequestURL() ) {
257  $message = "Redirect loop detected!\n\n" .
258  "This means the wiki got confused about what page was " .
259  "requested; this sometimes happens when moving a wiki " .
260  "to a new server or changing the server configuration.\n\n";
261 
262  if ( $wgUsePathInfo ) {
263  $message .= "The wiki is trying to interpret the page " .
264  "title from the URL path portion (PATH_INFO), which " .
265  "sometimes fails depending on the web server. Try " .
266  "setting \"\$wgUsePathInfo = false;\" in your " .
267  "LocalSettings.php, or check that \$wgArticlePath " .
268  "is correct.";
269  } else {
270  $message .= "Your web server was detected as possibly not " .
271  "supporting URL path components (PATH_INFO) correctly; " .
272  "check your LocalSettings.php for a customized " .
273  "\$wgArticlePath setting and/or toggle \$wgUsePathInfo " .
274  "to true.";
275  }
276  throw new HttpError( 500, $message );
277  } else {
278  $output->setSquidMaxage( 1200 );
279  $output->redirect( $targetUrl, '301' );
280  }
281  // Special pages
282  } elseif ( NS_SPECIAL == $title->getNamespace() ) {
283  $pageView = true;
284  // Actions that need to be made when we have a special pages
285  SpecialPageFactory::executePath( $title, $this->context );
286  } else {
287  // ...otherwise treat it as an article view. The article
288  // may be a redirect to another article or URL.
289  $article = $this->initializeArticle();
290  if ( is_object( $article ) ) {
291  $pageView = true;
292  $this->performAction( $article, $requestTitle );
293  } elseif ( is_string( $article ) ) {
294  $output->redirect( $article );
295  } else {
296  wfProfileOut( __METHOD__ );
297  throw new MWException( "Shouldn't happen: MediaWiki::initializeArticle()"
298  . " returned neither an object nor a URL" );
299  }
300  }
301 
302  if ( $pageView ) {
303  // Promote user to any groups they meet the criteria for
304  $user->addAutopromoteOnceGroups( 'onView' );
305  }
306 
307  wfProfileOut( __METHOD__ );
308  }
309 
316  private function initializeArticle() {
317  global $wgDisableHardRedirects;
318 
319  wfProfileIn( __METHOD__ );
320 
321  $title = $this->context->getTitle();
322  if ( $this->context->canUseWikiPage() ) {
323  // Try to use request context wiki page, as there
324  // is already data from db saved in per process
325  // cache there from this->getAction() call.
326  $page = $this->context->getWikiPage();
327  $article = Article::newFromWikiPage( $page, $this->context );
328  } else {
329  // This case should not happen, but just in case.
330  $article = Article::newFromTitle( $title, $this->context );
331  $this->context->setWikiPage( $article->getPage() );
332  }
333 
334  // NS_MEDIAWIKI has no redirects.
335  // It is also used for CSS/JS, so performance matters here...
336  if ( $title->getNamespace() == NS_MEDIAWIKI ) {
337  wfProfileOut( __METHOD__ );
338  return $article;
339  }
340 
341  $request = $this->context->getRequest();
342 
343  // Namespace might change when using redirects
344  // Check for redirects ...
345  $action = $request->getVal( 'action', 'view' );
346  $file = ( $title->getNamespace() == NS_FILE ) ? $article->getFile() : null;
347  if ( ( $action == 'view' || $action == 'render' ) // ... for actions that show content
348  && !$request->getVal( 'oldid' ) // ... and are not old revisions
349  && !$request->getVal( 'diff' ) // ... and not when showing diff
350  && $request->getVal( 'redirect' ) != 'no' // ... unless explicitly told not to
351  // ... and the article is not a non-redirect image page with associated file
352  && !( is_object( $file ) && $file->exists() && !$file->getRedirected() )
353  ) {
354  // Give extensions a change to ignore/handle redirects as needed
355  $ignoreRedirect = $target = false;
356 
357  wfRunHooks( 'InitializeArticleMaybeRedirect',
358  array( &$title, &$request, &$ignoreRedirect, &$target, &$article ) );
359 
360  // Follow redirects only for... redirects.
361  // If $target is set, then a hook wanted to redirect.
362  if ( !$ignoreRedirect && ( $target || $article->isRedirect() ) ) {
363  // Is the target already set by an extension?
364  $target = $target ? $target : $article->followRedirect();
365  if ( is_string( $target ) ) {
366  if ( !$wgDisableHardRedirects ) {
367  // we'll need to redirect
368  wfProfileOut( __METHOD__ );
369  return $target;
370  }
371  }
372  if ( is_object( $target ) ) {
373  // Rewrite environment to redirected article
374  $rarticle = Article::newFromTitle( $target, $this->context );
375  $rarticle->loadPageData();
376  if ( $rarticle->exists() || ( is_object( $file ) && !$file->isLocal() ) ) {
377  $rarticle->setRedirectedFrom( $title );
378  $article = $rarticle;
379  $this->context->setTitle( $target );
380  $this->context->setWikiPage( $article->getPage() );
381  }
382  }
383  } else {
384  $this->context->setTitle( $article->getTitle() );
385  $this->context->setWikiPage( $article->getPage() );
386  }
387  }
388 
389  wfProfileOut( __METHOD__ );
390  return $article;
391  }
392 
399  private function performAction( Page $page, Title $requestTitle ) {
400  global $wgUseSquid, $wgSquidMaxage;
401 
402  wfProfileIn( __METHOD__ );
403 
404  $request = $this->context->getRequest();
405  $output = $this->context->getOutput();
406  $title = $this->context->getTitle();
407  $user = $this->context->getUser();
408 
409  if ( !wfRunHooks( 'MediaWikiPerformAction',
410  array( $output, $page, $title, $user, $request, $this ) )
411  ) {
412  wfProfileOut( __METHOD__ );
413  return;
414  }
415 
416  $act = $this->getAction();
417 
418  $action = Action::factory( $act, $page, $this->context );
419 
420  if ( $action instanceof Action ) {
421  # Let Squid cache things if we can purge them.
422  if ( $wgUseSquid &&
423  in_array( $request->getFullRequestURL(), $requestTitle->getSquidURLs() )
424  ) {
425  $output->setSquidMaxage( $wgSquidMaxage );
426  }
427 
428  $action->show();
429  wfProfileOut( __METHOD__ );
430  return;
431  }
432 
433  if ( wfRunHooks( 'UnknownAction', array( $request->getVal( 'action', 'view' ), $page ) ) ) {
434  $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
435  }
436 
437  wfProfileOut( __METHOD__ );
438  }
439 
444  public function run() {
445  try {
446  $this->checkMaxLag();
447  $this->main();
448  if ( function_exists( 'fastcgi_finish_request' ) ) {
449  fastcgi_finish_request();
450  }
451  $this->triggerJobs();
452  $this->restInPeace();
453  } catch ( Exception $e ) {
455  }
456  }
457 
463  private function checkMaxLag() {
464  global $wgShowHostnames;
465 
466  wfProfileIn( __METHOD__ );
467  $maxLag = $this->context->getRequest()->getVal( 'maxlag' );
468  if ( !is_null( $maxLag ) ) {
469  list( $host, $lag ) = wfGetLB()->getMaxLag();
470  if ( $lag > $maxLag ) {
471  $resp = $this->context->getRequest()->response();
472  $resp->header( 'HTTP/1.1 503 Service Unavailable' );
473  $resp->header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) );
474  $resp->header( 'X-Database-Lag: ' . intval( $lag ) );
475  $resp->header( 'Content-Type: text/plain' );
476  if ( $wgShowHostnames ) {
477  echo "Waiting for $host: $lag seconds lagged\n";
478  } else {
479  echo "Waiting for a database server: $lag seconds lagged\n";
480  }
481 
482  wfProfileOut( __METHOD__ );
483 
484  exit;
485  }
486  }
487  wfProfileOut( __METHOD__ );
488  return true;
489  }
490 
491  private function main() {
492  global $wgUseFileCache, $wgTitle, $wgUseAjax;
493 
494  wfProfileIn( __METHOD__ );
495 
496  $request = $this->context->getRequest();
497 
498  // Send Ajax requests to the Ajax dispatcher.
499  if ( $wgUseAjax && $request->getVal( 'action', 'view' ) == 'ajax' ) {
500 
501  // Set a dummy title, because $wgTitle == null might break things
502  $title = Title::makeTitle( NS_MAIN, 'AJAX' );
503  $this->context->setTitle( $title );
504  $wgTitle = $title;
505 
506  $dispatcher = new AjaxDispatcher();
507  $dispatcher->performAction();
508  wfProfileOut( __METHOD__ );
509  return;
510  }
511 
512  // Get title from request parameters,
513  // is set on the fly by parseTitle the first time.
514  $title = $this->getTitle();
515  $action = $this->getAction();
516  $wgTitle = $title;
517 
518  // If the user has forceHTTPS set to true, or if the user
519  // is in a group requiring HTTPS, or if they have the HTTPS
520  // preference set, redirect them to HTTPS.
521  // Note: Do this after $wgTitle is setup, otherwise the hooks run from
522  // isLoggedIn() will do all sorts of weird stuff.
523  if (
524  (
525  $request->getCookie( 'forceHTTPS', '' ) ||
526  // check for prefixed version for currently logged in users
527  $request->getCookie( 'forceHTTPS' ) ||
528  // Avoid checking the user and groups unless it's enabled.
529  (
530  $this->context->getUser()->isLoggedIn()
531  && $this->context->getUser()->requiresHTTPS()
532  )
533  ) &&
534  $request->getProtocol() == 'http'
535  ) {
536  $oldUrl = $request->getFullRequestURL();
537  $redirUrl = str_replace( 'http://', 'https://', $oldUrl );
538 
539  if ( $request->wasPosted() ) {
540  // This is weird and we'd hope it almost never happens. This
541  // means that a POST came in via HTTP and policy requires us
542  // redirecting to HTTPS. It's likely such a request is going
543  // to fail due to post data being lost, but let's try anyway
544  // and just log the instance.
545  //
546  // @todo @fixme See if we could issue a 307 or 308 here, need
547  // to see how clients (automated & browser) behave when we do
548  wfDebugLog( 'RedirectedPosts', "Redirected from HTTP to HTTPS: $oldUrl" );
549  }
550 
551  // Setup dummy Title, otherwise OutputPage::redirect will fail
552  $title = Title::newFromText( NS_MAIN, 'REDIR' );
553  $this->context->setTitle( $title );
554  $output = $this->context->getOutput();
555  // Since we only do this redir to change proto, always send a vary header
556  $output->addVaryHeader( 'X-Forwarded-Proto' );
557  $output->redirect( $redirUrl );
558  $output->output();
559  wfProfileOut( __METHOD__ );
560  return;
561  }
562 
563  if ( $wgUseFileCache && $title->getNamespace() >= 0 ) {
564  wfProfileIn( 'main-try-filecache' );
565  if ( HTMLFileCache::useFileCache( $this->context ) ) {
566  // Try low-level file cache hit
568  if ( $cache->isCacheGood( /* Assume up to date */ ) ) {
569  // Check incoming headers to see if client has this cached
570  $timestamp = $cache->cacheTimestamp();
571  if ( !$this->context->getOutput()->checkLastModified( $timestamp ) ) {
572  $cache->loadFromFileCache( $this->context );
573  }
574  // Do any stats increment/watchlist stuff
575  // Assume we're viewing the latest revision (this should always be the case with file cache)
576  $this->context->getWikiPage()->doViewUpdates( $this->context->getUser() );
577  // Tell OutputPage that output is taken care of
578  $this->context->getOutput()->disable();
579  wfProfileOut( 'main-try-filecache' );
580  wfProfileOut( __METHOD__ );
581  return;
582  }
583  }
584  wfProfileOut( 'main-try-filecache' );
585  }
586 
587  // Actually do the work of the request and build up any output
588  $this->performRequest();
589 
590  // Either all DB and deferred updates should happen or none.
591  // The later should not be cancelled due to client disconnect.
592  ignore_user_abort( true );
593  // Now commit any transactions, so that unreported errors after
594  // output() don't roll back the whole DB transaction
595  wfGetLBFactory()->commitMasterChanges();
596 
597  // Output everything!
598  $this->context->getOutput()->output();
599 
600  wfProfileOut( __METHOD__ );
601  }
602 
606  public function restInPeace() {
607  // Do any deferred jobs
608  DeferredUpdates::doUpdates( 'commit' );
609 
610  // Log profiling data, e.g. in the database or UDP
612 
613  // Commit and close up!
615  $factory->commitMasterChanges();
616  $factory->shutdown();
617 
618  wfDebug( "Request ended normally\n" );
619  }
620 
626  protected function triggerJobs() {
627  global $wgJobRunRate, $wgServer, $wgRunJobsAsync;
628 
629  if ( $wgJobRunRate <= 0 || wfReadOnly() ) {
630  return;
631  } elseif ( $this->getTitle()->isSpecial( 'RunJobs' ) ) {
632  return; // recursion guard
633  }
634 
635  $section = new ProfileSection( __METHOD__ );
636 
637  if ( $wgJobRunRate < 1 ) {
638  $max = mt_getrandmax();
639  if ( mt_rand( 0, $max ) > $max * $wgJobRunRate ) {
640  return; // the higher $wgJobRunRate, the less likely we return here
641  }
642  $n = 1;
643  } else {
644  $n = intval( $wgJobRunRate );
645  }
646 
647  if ( !$wgRunJobsAsync ) {
648  // If running jobs asynchronously has been disabled, run the job here
649  // while the user waits
651  return;
652  }
653 
654  if ( !JobQueueGroup::singleton()->queuesHaveJobs( JobQueueGroup::TYPE_DEFAULT ) ) {
655  return; // do not send request if there are probably no jobs
656  }
657 
658  $query = array( 'title' => 'Special:RunJobs',
659  'tasks' => 'jobs', 'maxjobs' => $n, 'sigexpiry' => time() + 5 );
661 
662  $errno = $errstr = null;
663  $info = wfParseUrl( $wgServer );
665  $sock = fsockopen(
666  $info['host'],
667  isset( $info['port'] ) ? $info['port'] : 80,
668  $errno,
669  $errstr,
670  // If it takes more than 100ms to connect to ourselves there
671  // is a problem elsewhere.
672  0.1
673  );
675  if ( !$sock ) {
676  wfDebugLog( 'runJobs', "Failed to start cron API (socket error $errno): $errstr\n" );
677  // Fall back to running the job here while the user waits
679  return;
680  }
681 
682  $url = wfAppendQuery( wfScript( 'index' ), $query );
683  $req = "POST $url HTTP/1.1\r\nHost: {$info['host']}\r\nConnection: Close\r\n\r\n";
684 
685  wfDebugLog( 'runJobs', "Running $n job(s) via '$url'\n" );
686  // Send a cron API request to be performed in the background.
687  // Give up if this takes too long to send (which should be rare).
688  stream_set_timeout( $sock, 1 );
689  $bytes = fwrite( $sock, $req );
690  if ( $bytes !== strlen( $req ) ) {
691  wfDebugLog( 'runJobs', "Failed to start cron API (socket write error)\n" );
692  } else {
693  // Do not wait for the response (the script should handle client aborts).
694  // Make sure that we don't close before that script reaches ignore_user_abort().
695  $status = fgets( $sock );
696  if ( !preg_match( '#^HTTP/\d\.\d 202 #', $status ) ) {
697  wfDebugLog( 'runJobs', "Failed to start cron API: received '$status'\n" );
698  }
699  }
700  fclose( $sock );
701  }
702 }
Action\getActionName
static getActionName(IContextSource $context)
Get the action that will be executed, not necessarily the one passed passed through the "action" requ...
Definition: Action.php:112
$factory
$factory
Definition: img_auth.php:54
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
Page
Abstract class for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
Definition: WikiPage.php:26
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
MediaWiki\checkMaxLag
checkMaxLag()
Checks if the request should abort due to a lagged server, for given maxlag parameter.
Definition: Wiki.php:462
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
Revision\newFromId
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
Definition: Revision.php:88
wfGetLB
wfGetLB( $wiki=false)
Get a load balancer object.
Definition: GlobalFunctions.php:3660
MediaWiki\run
run()
Run the current MediaWiki instance index.php just calls this.
Definition: Wiki.php:443
JobQueueGroup\TYPE_DEFAULT
const TYPE_DEFAULT
Definition: JobQueueGroup.php:40
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
MediaWiki\restInPeace
restInPeace()
Ends this task peacefully.
Definition: Wiki.php:605
Title\newMainPage
static newMainPage()
Create a new Title for the Main Page.
Definition: Title.php:441
MediaWiki\getTitle
getTitle()
Get the Title object that we'll be acting on, as specified in the WebRequest.
Definition: Wiki.php:134
wfDebugLog
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:1040
wfProfileIn
wfProfileIn( $functionname)
Begin profiling of a function.
Definition: Profiler.php:33
$n
$n
Definition: RandomTest.php:76
$ret
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition: hooks.txt:1530
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2387
MediaWiki\main
main()
Definition: Wiki.php:490
Title\getSquidURLs
getSquidURLs()
Get a list of URLs to purge from the Squid cache when this page changes.
Definition: Title.php:3503
NS_FILE
const NS_FILE
Definition: Defines.php:85
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1313
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:74
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:77
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:28
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
SpecialPageFactory\executePath
static executePath(Title &$title, IContextSource &$context, $including=false)
Execute a special page path.
Definition: SpecialPageFactory.php:443
DeferredUpdates\doUpdates
static doUpdates( $commit='')
Do any deferred updates and clear the list.
Definition: DeferredUpdates.php:82
HttpError
Show an error that looks like an HTTP server error.
Definition: HttpError.php:28
Action
Actions are things which can be done to pages (edit, delete, rollback, etc).
Definition: Action.php:37
wfAppendQuery
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
Definition: GlobalFunctions.php:459
NS_MAIN
const NS_MAIN
Definition: Defines.php:79
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:68
wfParseUrl
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
Definition: GlobalFunctions.php:755
ProfileSection
Class for handling function-scope profiling.
Definition: Profiler.php:60
Article\newFromWikiPage
static newFromWikiPage(WikiPage $page, IContextSource $context)
Create an Article object of the appropriate class for the given page.
Definition: Article.php:174
MWException
MediaWiki exception.
Definition: MWException.php:26
MediaWiki\performAction
performAction(Page $page, Title $requestTitle)
Perform one of the "standard" actions.
Definition: Wiki.php:398
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2417
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:3730
HTMLFileCache\useFileCache
static useFileCache(IContextSource $context)
Check if pages can be cached for this request/user.
Definition: HTMLFileCache.php:90
MediaWiki\parseTitle
parseTitle()
Parse the request to get the Title object.
Definition: Wiki.php:71
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
MediaWiki
PROTO_CURRENT
const PROTO_CURRENT
Definition: Defines.php:270
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4001
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
OutputPage
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:38
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
SpecialRunJobs\executeJobs
static executeJobs( $maxJobs)
Run jobs from the job queue.
Definition: SpecialRunJobs.php:123
MediaWiki\triggerJobs
triggerJobs()
Potentially open a socket and sent an HTTP request back to the server to run a specified number of jo...
Definition: Wiki.php:625
$section
$section
Definition: Utf8Test.php:88
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:933
AjaxDispatcher
Object-Oriented Ajax functions.
Definition: AjaxDispatcher.php:32
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:67
MediaWiki\__construct
__construct(IContextSource $context=null)
Definition: Wiki.php:58
HTMLFileCache\newFromTitle
static newFromTitle( $title, $action)
Construct an ObjectFileCache from a Title and an action.
Definition: HTMLFileCache.php:39
Title\newFromURL
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
Definition: Title.php:241
SpecialPageFactory\resolveAlias
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
Definition: SpecialPageFactory.php:271
RequestContext\getMain
static getMain()
Static methods.
Definition: RequestContext.php:420
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
SpecialRunJobs\getQuerySignature
static getQuerySignature(array $query)
Definition: SpecialRunJobs.php:108
MWExceptionHandler\handle
static handle( $e)
Exception handler which simulates the appropriate catch() handling:
Definition: MWExceptionHandler.php:134
IContextSource
Interface for objects which can provide a context on request.
Definition: IContextSource.php:29
WebRequest
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form,...
Definition: WebRequest.php:38
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
MediaWiki\performRequest
performRequest()
Performs the request.
Definition: Wiki.php:168
$rev
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition: hooks.txt:1337
MediaWiki\getAction
getAction()
Returns the name of the action that will be executed.
Definition: Wiki.php:146
Title
Represents a title within MediaWiki.
Definition: Title.php:35
MediaWiki\output
output(OutputPage $x=null)
Definition: Wiki.php:49
MediaWiki\initializeArticle
initializeArticle()
Initialize the main Article object for "standard" actions (view, etc) Create an Article object for th...
Definition: Wiki.php:315
wfGetLBFactory
& wfGetLBFactory()
Get the load balancer factory object.
Definition: GlobalFunctions.php:3669
$cache
$cache
Definition: mcc.php:32
MediaWiki\request
request(WebRequest $x=null)
Definition: Wiki.php:39
$output
& $output
Definition: hooks.txt:375
JobQueueGroup\singleton
static singleton( $wiki=false)
Definition: JobQueueGroup.php:61
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:87
MediaWiki\$context
IContextSource $context
TODO: fold $output, etc, into this.
Definition: Wiki.php:33
$e
if( $useReadline) $e
Definition: eval.php:66
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
Title\newFromID
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
Definition: Title.php:297
$article
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
Definition: hooks.txt:78
Action\factory
static factory( $action, Page $page, IContextSource $context=null)
Get an appropriate Action subclass for the given action.
Definition: Action.php:88
BadTitleError
Show an error page on a badtitle.
Definition: BadTitleError.php:29
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:497
$wgTitle
if(! $wgRequest->checkUrlExtension()) if(! $wgEnableAPI) $wgTitle
Definition: api.php:63
wfLogProfilingData
wfLogProfilingData()
Definition: GlobalFunctions.php:1226
Article\newFromTitle
static newFromTitle( $title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
Definition: Article.php:142