Files
mediawiki-extensions-Univer…/scripts/compile-font-repo.php
Timo Tijhof 4e067715dc Remove redundant closure aliases
'mw' are '$' are globals, always have been, and aren't going
anywhere. They're every bit as real as their longer versions.
If anything, the longer ones are less "real" or 'stable" because
they're not used internally by RL and easier to accidentally
replace or override. For anecdotes and history, see 91f950d6b0.

Change-Id: I526fb8c961d9477992d88f2780a0ff4cbdc51923
2018-09-07 19:23:17 +00:00

51 lines
1.1 KiB
PHP

<?php
/**
*
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @file
*/
// Standard boilerplate to define $IP
if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
$IP = getenv( 'MW_INSTALL_PATH' );
} else {
$dir = __DIR__;
$IP = "$dir/../../..";
}
require_once "$IP/maintenance/Maintenance.php";
class CompileFontRepo extends Maintenance {
public function __construct() {
parent::__construct();
$this->mDescription = 'Creates JavaScript font repository.';
}
public function execute() {
$base = dirname( __DIR__ );
$compiler = new FontRepoCompiler(
"$base/data/fontrepo/fonts",
'../data/fontrepo/fonts/'
);
$list = $compiler->getRepository();
$json = FormatJson::encode( $list, "\t" );
$js = <<<JAVASCRIPT
// Do not edit! This file is generated from data/fontrepo by scripts/compile-font-repo.php
( function () {
$.webfonts = $.webfonts || {};
$.webfonts.repository = $json;
}() );
JAVASCRIPT;
file_put_contents( "$base/resources/js/ext.uls.webfonts.repository.js", $js );
$this->output( "Done.\n" );
}
}
$maintClass = 'CompileFontRepo';
require_once RUN_MAINTENANCE_IF_MAIN;