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
33 public function getName() {
34 return $this->name;
35 }
36
37 public function getProvidedNames() {
38 return array_keys( $this->provisions );
39 }
40
41 public function execute(): Status {
42 foreach ( $this->provisions as $name => $value ) {
43 $this->getContext()->provide( $name, $value );
44 }
45 return Status::newGood();
46 }
47}
A scheduled provider which simply provides data given to it through its constructor.
getName()
Get the symbolic name of the task.
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:171
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:54