diff options
Diffstat (limited to 'shared/classes')
-rw-r--r-- | shared/classes/cache_entry.php | 21 | ||||
-rw-r--r-- | shared/classes/gentoo_baseinit.php | 10 | ||||
-rw-r--r-- | shared/classes/gentoo_basepkg.php | 11 | ||||
-rw-r--r-- | shared/classes/gentoo_profile.php | 38 |
4 files changed, 37 insertions, 43 deletions
diff --git a/shared/classes/cache_entry.php b/shared/classes/cache_entry.php new file mode 100644 index 0000000..4395632 --- /dev/null +++ b/shared/classes/cache_entry.php @@ -0,0 +1,21 @@ +<?php +class sql_cache_entry extends sql_row_obj { + protected $table='cache', $primary_key=array('type', 'key'), $columns=array( + 'type' => array ( + 'type' => 'ENUM', + 'length' => '\'cd\',\'portage\',\'stage3\'', + 'not_null' => true + ), + 'key' => array ( + 'type' => 'VARCHAR', + 'length' => 255, + 'not_null' => true + ), + 'file' => array ( + 'type' => 'VARCHAR', + 'length' => 255 + ) + + ); +} +?> diff --git a/shared/classes/gentoo_baseinit.php b/shared/classes/gentoo_baseinit.php index 03c9569..c9acc4e 100644 --- a/shared/classes/gentoo_baseinit.php +++ b/shared/classes/gentoo_baseinit.php @@ -1,12 +1,10 @@ <?php class sql_gentoo_baseinit extends sql_row_obj { protected $table='gentoo_baseinit', $columns=array( - 'profile' => array ( - 'type' => 'TINYINT', - 'length' => 3, - 'unsigned' => true, - 'not_null' => true, - 'default' => 0 + 'key' => array ( + 'type' => 'VARCHAR', + 'length' => 255, + 'not_null' => true ), 'name' => array ( 'type' => 'VARCHAR', diff --git a/shared/classes/gentoo_basepkg.php b/shared/classes/gentoo_basepkg.php index d61b3dc..c140ee9 100644 --- a/shared/classes/gentoo_basepkg.php +++ b/shared/classes/gentoo_basepkg.php @@ -1,13 +1,10 @@ <?php class sql_gentoo_basepkg extends sql_row_obj { protected $table='gentoo_basepkgs', $columns=array( - 'profile' => array ( - 'type' => 'TINYINT', - 'length' => 3, - 'unsigned' => true, - 'not_null' => true, - 'default' => 0, - 'refers_to' => 'gentoo_profiles.id' + 'key' => array ( + 'type' => 'VARCHAR', + 'length' => 255, + 'not_null' => true ), 'pkg' => array ( 'type' => 'VARCHAR', diff --git a/shared/classes/gentoo_profile.php b/shared/classes/gentoo_profile.php index d7726f8..d41497b 100644 --- a/shared/classes/gentoo_profile.php +++ b/shared/classes/gentoo_profile.php @@ -15,12 +15,6 @@ class sql_gentoo_profile extends sql_row_obj { 'default' => '', 'unique' => true ), - 'stage3' => array ( - 'type' => 'VARCHAR', - 'length' => 255, - 'not_null' => true, - 'default' => '' - ), 'name' => array ( 'type' => 'VARCHAR', 'length' => 255, @@ -171,30 +165,6 @@ class sql_gentoo_profile extends sql_row_obj { if ($update) query('DELETE FROM `gentoo_pkgsets` WHERE `profile`='.$this->id.($exists?' AND `id` NOT IN ('.implode(',', $exists).')':'')); } - public function read_stage3($update=false) { - global $S; - if ($update) { - query('DELETE FROM `gentoo_basepkgs` WHERE `profile`='.$this->id); - query('DELETE FROM `gentoo_baseinit` WHERE `profile`='.$this->id); - } - $file=realpath(CACHE.'/stage3/'.$this->stage3); - if (!is_readable($file)) return false; - $opt='-tv'.(substr($file, -3) == 'bz2'?'j':'z').'f'; - $prefix='./var/db/pkg/'; - $files=explode("\n", is_readable("$file.CONTENTS")?file_get_contents("$file.CONTENTS"):shell_exec('tar '.$opt.' '.escapeshellarg($file))); - if (!is_file("$file.CONTENTS")) - file_put_contents("$file.CONTENTS", implode("\n", $files)); - foreach ($files as $file) { - if (preg_match('#^[^.]+\./var/db/pkg/(.*/.*)/$#', $file, $match)) { - $pkg=new sql_gentoo_basepkg($this->id, $match[1]); - $pkg->write(); - } elseif (preg_match('#^[^.]+\./etc/runlevels/([^/]+)/([^/]+) -> /etc/init\.d/#', $file, $match)) { - $init=new sql_gentoo_baseinit($this->id, $match[2], $match[1]); - $init->write(); - } - } - return true; - } public function &get_packages($omit_masked=false, $trim=null) { global $S; $skip_masked=!in_array('masked', $trim); @@ -214,5 +184,13 @@ class sql_gentoo_profile extends sql_row_obj { $arch=ltrim($arch[0], '~'); return $arch; } + function is_hardened() { + $profile=$this->get_headers(); + $profile=$profile['profile']; + return (strpos(strtolower($profile), 'hardened') !== false); + } + function get_identifier() { + return ($this->is_hardened()?'hardened-':'').$this->get_arch(); + } } ?> |