MediaWiki REL1_30
langmemusage.php
Go to the documentation of this file.
1<?php
25require_once __DIR__ . '/../Maintenance.php';
26require_once __DIR__ . '/languages.inc';
27
34
35 public function __construct() {
36 parent::__construct();
37 $this->addDescription( "Dumb program that tries to get the memory usage\n" .
38 "for each language file" );
39 }
40
41 public function execute() {
42 if ( !function_exists( 'memory_get_usage' ) ) {
43 $this->error( "You must compile PHP with --enable-memory-limit", true );
44 }
45
46 $langtool = new Languages();
47 $memlast = $memstart = memory_get_usage();
48
49 $this->output( "Base memory usage: $memstart\n" );
50
51 foreach ( $langtool->getLanguages() as $langcode ) {
52 Language::factory( $langcode );
53 $memstep = memory_get_usage();
54 $this->output( sprintf( "%12s: %d\n", $langcode, ( $memstep - $memlast ) ) );
55 $memlast = $memstep;
56 }
57
58 $memend = memory_get_usage();
59
60 $this->output( ' Total Usage: ' . ( $memend - $memstart ) . "\n" );
61 }
62}
63
64$maintClass = "LangMemUsage";
65require_once RUN_MAINTENANCE_IF_MAIN;
This is a command line script.
execute()
Do the actual work.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
addDescription( $text)
Set the description text.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
Definition hooks.txt:2581
$maintClass
require_once RUN_MAINTENANCE_IF_MAIN