1: <?php
2: /**
3: * Base class for Bake Tasks.
4: *
5: * PHP versions 4 and 5
6: *
7: * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
8: * Copyright 2005-2012, Cake Software Foundation, Inc.
9: *
10: * Licensed under The MIT License
11: * Redistributions of files must retain the above copyright notice.
12: *
13: * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
14: * @link http://cakephp.org CakePHP(tm) Project
15: * @package cake
16: * @subpackage cake.cake.console.libs.tasks
17: * @since CakePHP(tm) v 1.3
18: * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
19: */
20: class BakeTask extends Shell {
21:
22: /**
23: * Name of plugin
24: *
25: * @var string
26: * @access public
27: */
28: var $plugin = null;
29:
30: /**
31: * The db connection being used for baking
32: *
33: * @var string
34: * @access public
35: */
36: var $connection = null;
37:
38: /**
39: * Flag for interactive mode
40: *
41: * @var boolean
42: */
43: var $interactive = false;
44:
45: /**
46: * Disable caching for baking.
47: * This forces the most current database schema to be used.
48: *
49: * @return void
50: */
51: function startup() {
52: Configure::write('Cache.disable', 1);
53: parent::startup();
54: }
55:
56: /**
57: * Gets the path for output. Checks the plugin property
58: * and returns the correct path.
59: *
60: * @return string Path to output.
61: * @access public
62: */
63: function getPath() {
64: $path = $this->path;
65: if (isset($this->plugin)) {
66: $name = substr($this->name, 0, strlen($this->name) - 4);
67: $path = $this->_pluginPath($this->plugin) . Inflector::pluralize(Inflector::underscore($name)) . DS;
68: }
69: return $path;
70: }
71: }
72: