array ( 'type' => 'CHAR', 'length' => 6, 'not_null' => true, 'default' => '' ), 'owner' => array ( 'type' => 'INT', 'length' => 10, 'unsigned' => true, 'not_null' => true, 'default' => 0, 'refers_to' => 'users.id' ), 'name' => array ( 'type' => 'VARCHAR', 'length' => 255 ), 'module' => array ( 'type' => 'VARCHAR', 'length' => 255, 'not_null' => true, 'default' => '' ), 'status' => array ( 'type' => 'TINYINT', 'length' => 4, 'not_null' => true, 'default' => 0 ) ); public function build($name=null) { $module=new module($this->module); for ($i=1; $i<=$module->numsteps; $i++) { $step=new wizard_step($this, $i); if (!$step->verify()) { $this->status=$i; $this->write(); return $i; } } $build=new sql_build(); $build->init(); $build->name=$name; $build->module=$this->module; $opts=$this->get_opts(); $opts['configuration']=$this->id; foreach ($opts as $name => $val) { $opt=new sql_buildopt($build->id, $name, $val); $opt->write(); } $build->ctime=time(); $build->status='build/ready'; $build->write(); return $build; } // Returns an array of the IDs of all the builds that report this configuration as their source public function get_builds() { global $S; $r=$S['pdo']->query('SELECT `build` FROM `buildopts` WHERE `name`="configuration" AND `value`="'.$this->id.'"'); if ($r->rowCount()) { $builds=array(); while ($b=$r->fetch(PDO::FETCH_COLUMN)) { $builds[]=$b; } return $builds; } else { return null; } } } ?>