diff options
author | 2009-08-27 12:28:37 -0400 | |
---|---|---|
committer | 2009-08-27 12:28:37 -0400 | |
commit | 7fc74f6ed6a776aedbf8a9ce6ab3f5e40b10a98d (patch) | |
tree | 54a43a4d2c0dd07768e0f804d6e2f7f1be37e374 | |
parent | Fix builds->bundle() to use bundle column, not look in buildopts for bundler (diff) | |
download | ingenue-7fc74f6ed6a776aedbf8a9ce6ab3f5e40b10a98d.tar.gz ingenue-7fc74f6ed6a776aedbf8a9ce6ab3f5e40b10a98d.tar.bz2 ingenue-7fc74f6ed6a776aedbf8a9ce6ab3f5e40b10a98d.zip |
Fix two bugs with gentoo_portage/init.d.php; update some comments in sql_row_obj
-rw-r--r-- | backend/modules/gentoo_portage/build.php | 2 | ||||
-rw-r--r-- | backend/modules/gentoo_portage/init.d.php | 12 | ||||
-rw-r--r-- | shared/classes/0sql_row_obj.php | 9 |
3 files changed, 13 insertions, 10 deletions
diff --git a/backend/modules/gentoo_portage/build.php b/backend/modules/gentoo_portage/build.php index 2d2f32f..e930001 100644 --- a/backend/modules/gentoo_portage/build.php +++ b/backend/modules/gentoo_portage/build.php @@ -11,7 +11,7 @@ $extra=explode(' ', $opts['options']); if (in_array('portage', $extra)) add_step('portage'); if (in_array('prune_init', $extra)) - add_step('init.d.php'); + add_step('init.d'); if (in_array('timezone', $extra)) add_step('timezone'); if (in_array('hostname', $extra)) diff --git a/backend/modules/gentoo_portage/init.d.php b/backend/modules/gentoo_portage/init.d.php index 9ab61e6..5d4f499 100644 --- a/backend/modules/gentoo_portage/init.d.php +++ b/backend/modules/gentoo_portage/init.d.php @@ -1,8 +1,10 @@ <?php -start_internal_task('Remove unwanted init scripts'); -foreach (explode(' ', $opts['pruneinit']) as $init) { - list($name, $runlevel)=explode(':', $init, 2); - log_status("$name ($runlevel)", unlink("$imagedir/etc/runlevels/$runlevel/$name")); +if (isset($opts['pruneinit']) && strlen(trim($opts['pruneinit'])) > 0) { + start_internal_task('Remove unwanted init scripts'); + foreach (explode(' ', $opts['pruneinit']) as $init) { + list($name, $runlevel)=explode(':', $init, 2); + log_status("$name ($runlevel)", unlink("$imagedir/etc/runlevels/$runlevel/$name")); + } + end_internal_task(0); } -end_internal_task(0); ?> diff --git a/shared/classes/0sql_row_obj.php b/shared/classes/0sql_row_obj.php index d625071..8e13a3a 100644 --- a/shared/classes/0sql_row_obj.php +++ b/shared/classes/0sql_row_obj.php @@ -111,7 +111,7 @@ abstract class sql_row_obj { // If the name of this class changes, it must be up self::$table_cache[$this->table]=get_class($this); } } - // Initializes this class based in the sql table given by $this->table + // Initializes this class based on the sql table given by $this->table // TODO should be static (5.3.0) private function init_from_create() { $c=self::sql_query('SHOW CREATE TABLE `'.$this->table.'`')->fetchColumn(1); @@ -330,7 +330,7 @@ abstract class sql_row_obj { // If the name of this class changes, it must be up // 1. Primary key // 2. Numeric key // 3. Misc. key - // 4. Multi key + // TODO support multi-column unique keys function sql_id() { if (isset($this->primary_key)) { $id=count($this->primary_key)>1?'(':''; @@ -353,7 +353,7 @@ abstract class sql_row_obj { // If the name of this class changes, it must be up } // If no argument is given, returns whether this object represents a row that is currently in the database. // If an argument that evaluates to false is given, clears the db_values array, causing it to be known as not in the db. - // if an argument that evaluates to true is given, fills the db_values array with values fromt the values array. + // if an argument that evaluates to true is given, fills the db_values array with values from the values array. function is_in_db() { if (func_num_args() == 0) { // db_values being populated indicates that it is in the database @@ -383,13 +383,13 @@ abstract class sql_row_obj { // If the name of this class changes, it must be up $i=1; $rows=array(); foreach ($this->columns as $name => $col) { - // TODO for the , at EOL, this checks for PRIMARY KEY to indicate that there should be an extra $rows[]="\t".'`'.$name.'` '.$col->describe(); } if (isset($this->primary_key)) { $rows[]="\t".'PRIMARY KEY (`'.implode('`, `', $this->primary_key).'`)'; } foreach ($this->columns as $name => $col) { + // TODO support multi-column unique keys if ($col->unique && is_string($col->unique)) { $rows[]="\t".' UNIQUE KEY `'.$col->unique.'` (`'.$col->unique.'`)'; } @@ -398,6 +398,7 @@ abstract class sql_row_obj { // If the name of this class changes, it must be up $q.=')'; return $q; } + // Returns PHP code to define this class with the description of the SQL table already set up function to_php() { $r="class ".get_class($this)." extends ".get_parent_class($this)." {\n\tprotected \$table='".$this->table."', "; if (isset($this->primary_key)) { |