MediaWiki master
CannedProvider.php
Go to the documentation of this file.
1<?php
2
4
6
18class CannedProvider extends Task {
20 private $name;
22 private $provisions;
23
28 public function __construct( $name, $provisions ) {
29 $this->name = $name;
30 $this->provisions = $provisions;
31 }
32
34 public function getName() {
35 return $this->name;
36 }
37
39 public function getProvidedNames() {
40 return array_keys( $this->provisions );
41 }
42
43 public function execute(): Status {
44 foreach ( $this->provisions as $name => $value ) {
45 $this->getContext()->provide( $name, $value );
46 }
47 return Status::newGood();
48 }
49}
A scheduled provider which simply provides data given to it through its constructor.
getName()
Get the symbolic name of the task.string
getProvidedNames()
Get a list of names of objects that this task promises to provide via $this->getContext()->provide()....
Base class for installer tasks.
Definition Task.php:24
getContext()
Get the execution context.
Definition Task.php:169
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:44