diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-07-07 18:23:56 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-07-07 18:23:56 -0400 |
commit | beb238596be8f4e6f7a0ebd9a1eb35ae715e4dce (patch) | |
tree | 01e4ea42d59971d3c52b5db06ea890bbb2bf3844 | |
parent | Remove interactive merging from class update script; allow classes that are i... (diff) | |
download | ingenue-beb238596be8f4e6f7a0ebd9a1eb35ae715e4dce.tar.gz ingenue-beb238596be8f4e6f7a0ebd9a1eb35ae715e4dce.tar.bz2 ingenue-beb238596be8f4e6f7a0ebd9a1eb35ae715e4dce.zip |
Got rid of ugly hacks for abstract classes and used ReflectionClass instead
-rw-r--r-- | depend | 2 | ||||
-rwxr-xr-x | setup.php | 5 | ||||
-rw-r--r-- | shared/classes/0sql_row_obj.php | 4 | ||||
-rw-r--r-- | shared/classes/1conf_build_common.php | 3 |
4 files changed, 9 insertions, 5 deletions
@@ -1,4 +1,4 @@ ->=dev-lang/php-5.2.2 USE=pdo hash pcntl pcre cli pdo mysqli apache2 curl ctype +>=dev-lang/php-5.2.2 USE=pdo hash pcntl pcre cli pdo mysqli apache2 curl ctype reflection sys-apps/fakeroot ? sys-apps/portage # In case you use paludis www-servers/apache APACHE2_MODULES=rewrite? @@ -19,7 +19,10 @@ foreach (get_declared_classes() as $class) { if (!is_subclass_of($class, 'sql_row_obj')) { continue; } - if (substr($class, 0, 4) != 'sql_') continue; // TODO FIXME BAD! Replace with real checks to avoid abstract classes in 5.3.0 + $r=new ReflectionClass($class); + if (!$r->isInstantiable()) continue; + unset($r); +// if (substr($class, 0, 4) != 'sql_') continue; // TODO FIXME BAD! Replace with real checks to avoid abstract classes in 5.3.0 $o=new $class(); // TODO this will be static once 5.3.0 is out if (isset($opts['R'])) { echo_and_query($o->drop_table()); diff --git a/shared/classes/0sql_row_obj.php b/shared/classes/0sql_row_obj.php index ebff3be..564da0a 100644 --- a/shared/classes/0sql_row_obj.php +++ b/shared/classes/0sql_row_obj.php @@ -507,7 +507,9 @@ abstract class sql_row_obj { // If the name of this class changes, it must be up } foreach (get_declared_classes() as $class) { if (is_subclass_of($class, 'sql_row_obj')) { - if (substr($class, 0, 4) !== 'sql_') continue; // TODO FIXME BAD! In 5.3.0, use a different way of checking if it's abstract + $r=new ReflectionClass($class); + if (!$r->isInstantiable()) continue; + unset($r); $obj=new $class(); if ($obj->table == $table) { self::$table_cache[$table]=$class; diff --git a/shared/classes/1conf_build_common.php b/shared/classes/1conf_build_common.php index 406ebc1..4e74d09 100644 --- a/shared/classes/1conf_build_common.php +++ b/shared/classes/1conf_build_common.php @@ -1,6 +1,5 @@ <?php -// TODO In 5.3.0, this can be static without causing fatal errors trying to instantiate it -class conf_build_common extends sql_row_obj { +abstract class conf_build_common extends sql_row_obj { private $info; private function set_vars() { if (isset($this->info)) { |