Blame view

framework/dev/BuildTask.php 1.31 KB
0084d336   Administrator   Importers CRUD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  <?php
  
  /**
   * Interface for a generic build task. Does not support dependencies. This will simply
   * run a chunk of code when called.
   * 
   * To disable the task (in the case of potentially destructive updates or deletes), declare
   * the $Disabled property on the subclass.
   * 
   * @package framework
   * @subpackage dev
   */
  abstract class BuildTask extends Object {
  	
  	/**
  	 * @var bool $enabled If set to FALSE, keep it from showing in the list
  	 * and from being executable through URL or CLI.
  	 */
  	protected $enabled = true;
  	
  	/**
  	 * @var string $title Shown in the overview on the {@link TaskRunner}
  	 * HTML or CLI interface. Should be short and concise, no HTML allowed.
  	 */
  	protected $title;
  	
  	/**
  	 * @var string $description Describe the implications the task has,
  	 * and the changes it makes. Accepts HTML formatting.
  	 */
  	protected $description = 'No description available';
  	
  	/**
   	 * Implement this method in the task subclass to
  	 * execute via the TaskRunner
  	 */
  	abstract public function run($request);
  	
  	public function isEnabled() {
  		return $this->enabled;
  	}
  	
  	/**
  	 * @return string
  	 */
  	public function getTitle() {
  		return ($this->title) ? $this->title : $this->class;
  	}
  	
  	/**
  	 * @return string HTML formatted description
  	 */
  	public function getDescription() {
  		return $this->description;
  	}
  	
  }