Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4085823
benchLookup.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
benchLookup.php
View Options
<?php
/**
* Copyright (C) 2018 Kunal Mehta <legoktm@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace
MediaWiki\SecureLinkFixer
;
use
MediaWiki\Maintenance\Benchmarker
;
use
MediaWiki\MediaWikiServices
;
use
const
RUN_MAINTENANCE_IF_MAIN
;
$IP
=
getenv
(
'MW_INSTALL_PATH'
);
if
(
$IP
===
false
)
{
$IP
=
__DIR__
.
'/../../..'
;
}
require_once
"$IP/maintenance/includes/Benchmarker.php"
;
/**
* Benchmark the current HSTSPreloadLookup implementation
*
* @codeCoverageIgnore
*/
class
BenchLookup
extends
Benchmarker
{
public
function
__construct
()
{
parent
::
__construct
();
$this
->
addDescription
(
'Benchmark for HSTSPreloadLookup'
);
$this
->
requireExtension
(
'SecureLinkFixer'
);
}
public
function
execute
()
{
$lookup
=
MediaWikiServices
::
getInstance
()->
getService
(
'HSTSPreloadLookup'
);
$domains
=
[
// Need to traverse up one domain to find it
'foobar.dev'
,
// Directly in map
'wikipedia.org'
,
// Need to traverse up one domain to not find it
'not-preloaded.com'
,
// Need to traverse up 6 domains to not find it
'pathological.case.that.is.not.preloaded.org'
,
];
$benches
=
[];
foreach
(
$domains
as
$domain
)
{
$benches
[]
=
[
'function'
=>
[
$lookup
,
'isPreloaded'
],
'args'
=>
[
$domain
],
];
}
$this
->
bench
(
$benches
);
}
}
$maintClass
=
BenchLookup
::
class
;
require_once
RUN_MAINTENANCE_IF_MAIN
;
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 18 2026, 08:33 (6 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
28/d1/e36bd630afe1ae41852a70ed80c0
Default Alt Text
benchLookup.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment