+ function getError()
+ {
+ return $this->error;
+ }
+
+ function getInfo()
+ {
+ return $this->msg;
+ }
+
+ static public function run(array $args=array(), $output='php://output', $indent=null) {
+ $class = get_called_class();
+ $action = new $class($output, $indent);
+ $action->execute($args);
+ return $action;
+ }
+
+ public function execute(array $args=array()) {
+ // checkMirror stuff
+ if (common_config('db', 'mirror') && $this->isReadOnly($args)) {
+ if (is_array(common_config('db', 'mirror'))) {
+ // "load balancing", ha ha
+ $arr = common_config('db', 'mirror');
+ $k = array_rand($arr);
+ $mirror = $arr[$k];
+ } else {
+ $mirror = common_config('db', 'mirror');
+ }
+
+ // everyone else uses the mirror
+ common_config_set('db', 'database', $mirror);
+ }
+
+ if ($this->prepare($args)) {
+ $this->handle($args);
+ }
+ }
+