MediaWiki REL1_35
ForeignResourceManager Class Reference

Manage foreign resources registered with ResourceLoader. More...

Collaboration diagram for ForeignResourceManager:

Public Member Functions

 __construct ( $registryFile, $libDir, callable $infoPrinter=null, callable $errorPrinter=null, callable $verbosePrinter=null)
 
 run ( $action, $module)
 

Private Member Functions

 cacheGet ( $key)
 
 cacheKey ( $src, $integrity)
 
 cacheSet ( $key, $data)
 
 cleanUp ()
 
 error ( $text)
 
 fetch ( $src, $integrity)
 
 handleTypeFile ( $moduleName, $destDir, array $info)
 
 handleTypeMultiFile ( $moduleName, $destDir, array $info)
 
 handleTypeTar ( $moduleName, $destDir, array $info)
 
 output ( $text)
 
 parseBasicYaml ( $input)
 Basic YAML parser.
 
 verbose ( $text)
 

Private Attributes

 $action
 
 $cacheDir
 
 $defaultAlgo = 'sha384'
 
callable Closure $errorPrinter
 -var callable(string):void
 
 $hasErrors = false
 
callable Closure $infoPrinter
 -var callable(string):void
 
 $libDir
 
array[] $registry
 
 $registryFile
 
 $tmpParentDir
 
callable Closure $verbosePrinter
 -var callable(string):void
 

Detailed Description

Manage foreign resources registered with ResourceLoader.

Since
1.32

Definition at line 30 of file ForeignResourceManager.php.

Constructor & Destructor Documentation

◆ __construct()

ForeignResourceManager::__construct (   $registryFile,
  $libDir,
callable  $infoPrinter = null,
callable  $errorPrinter = null,
callable  $verbosePrinter = null 
)
Parameters
string$registryFilePath to YAML file
string$libDirPath to a modules directory
callable | null$infoPrinterCallback for printing info about the run.
callable | null$errorPrinterCallback for printing errors from the run.
callable | null$verbosePrinterCallback for printing extra verbose progress information from the run.

Definition at line 64 of file ForeignResourceManager.php.

References $errorPrinter, $infoPrinter, $libDir, $registryFile, and $verbosePrinter.

Member Function Documentation

◆ cacheGet()

ForeignResourceManager::cacheGet (   $key)
private
Parameters
string$key
Returns
string|false

Definition at line 173 of file ForeignResourceManager.php.

Referenced by fetch().

◆ cacheKey()

ForeignResourceManager::cacheKey (   $src,
  $integrity 
)
private

Definition at line 163 of file ForeignResourceManager.php.

Referenced by cleanUp(), and fetch().

◆ cacheSet()

ForeignResourceManager::cacheSet (   $key,
  $data 
)
private

Definition at line 177 of file ForeignResourceManager.php.

References wfMkdirParents().

Referenced by fetch().

◆ cleanUp()

ForeignResourceManager::cleanUp ( )
private

Definition at line 326 of file ForeignResourceManager.php.

References $file, cacheKey(), and wfRecursiveRemoveDir().

Referenced by run().

◆ error()

ForeignResourceManager::error (   $text)
private

Definition at line 322 of file ForeignResourceManager.php.

References $errorPrinter.

Referenced by handleTypeTar(), and run().

◆ fetch()

ForeignResourceManager::fetch (   $src,
  $integrity 
)
private

◆ handleTypeFile()

ForeignResourceManager::handleTypeFile (   $moduleName,
  $destDir,
array  $info 
)
private

Definition at line 214 of file ForeignResourceManager.php.

References $path, fetch(), and wfMkdirParents().

Referenced by run().

◆ handleTypeMultiFile()

ForeignResourceManager::handleTypeMultiFile (   $moduleName,
  $destDir,
array  $info 
)
private

Definition at line 230 of file ForeignResourceManager.php.

References $file, $path, fetch(), and wfMkdirParents().

Referenced by run().

◆ handleTypeTar()

ForeignResourceManager::handleTypeTar (   $moduleName,
  $destDir,
array  $info 
)
private

Definition at line 249 of file ForeignResourceManager.php.

References $file, error(), fetch(), verbose, and wfMkdirParents().

Referenced by run().

◆ output()

ForeignResourceManager::output (   $text)
private

Definition at line 318 of file ForeignResourceManager.php.

References $infoPrinter.

Referenced by fetch(), and run().

◆ parseBasicYaml()

ForeignResourceManager::parseBasicYaml (   $input)
private

Basic YAML parser.

Supports only string or object values, and 2 spaces indentation.

Todo:
Just ship symfony/yaml.
Parameters
string$input
Returns
array

Definition at line 356 of file ForeignResourceManager.php.

References $line, and $lines.

Referenced by run().

◆ run()

ForeignResourceManager::run (   $action,
  $module 
)
Parameters
string$action
string$module
Returns
bool
Exceptions
Exception

Definition at line 94 of file ForeignResourceManager.php.

References $action, $modules, $registry, cleanUp(), error(), handleTypeFile(), handleTypeMultiFile(), handleTypeTar(), output(), parseBasicYaml(), verbose, wfMkdirParents(), and wfRecursiveRemoveDir().

◆ verbose()

ForeignResourceManager::verbose (   $text)
private

Definition at line 314 of file ForeignResourceManager.php.

References $verbosePrinter.

Member Data Documentation

◆ $action

ForeignResourceManager::$action
private

Definition at line 52 of file ForeignResourceManager.php.

Referenced by run().

◆ $cacheDir

ForeignResourceManager::$cacheDir
private

Definition at line 36 of file ForeignResourceManager.php.

◆ $defaultAlgo

ForeignResourceManager::$defaultAlgo = 'sha384'
private

Definition at line 31 of file ForeignResourceManager.php.

◆ $errorPrinter

callable Closure ForeignResourceManager::$errorPrinter
private

-var callable(string):void

Definition at line 46 of file ForeignResourceManager.php.

Referenced by __construct(), and error().

◆ $hasErrors

ForeignResourceManager::$hasErrors = false
private

Definition at line 32 of file ForeignResourceManager.php.

◆ $infoPrinter

callable Closure ForeignResourceManager::$infoPrinter
private

-var callable(string):void

Definition at line 41 of file ForeignResourceManager.php.

Referenced by __construct(), and output().

◆ $libDir

ForeignResourceManager::$libDir
private

Definition at line 34 of file ForeignResourceManager.php.

Referenced by __construct().

◆ $registry

array [] ForeignResourceManager::$registry
private

Definition at line 54 of file ForeignResourceManager.php.

Referenced by run().

◆ $registryFile

ForeignResourceManager::$registryFile
private

Definition at line 33 of file ForeignResourceManager.php.

Referenced by __construct().

◆ $tmpParentDir

ForeignResourceManager::$tmpParentDir
private

Definition at line 35 of file ForeignResourceManager.php.

◆ $verbosePrinter

callable Closure ForeignResourceManager::$verbosePrinter
private

-var callable(string):void

Definition at line 51 of file ForeignResourceManager.php.

Referenced by __construct(), and verbose().


The documentation for this class was generated from the following file: