summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-07-07 18:23:56 -0400
committerEudyptula <eitan@mosenkis.net>2009-07-07 18:23:56 -0400
commitbeb238596be8f4e6f7a0ebd9a1eb35ae715e4dce (patch)
tree01e4ea42d59971d3c52b5db06ea890bbb2bf3844
parentRemove interactive merging from class update script; allow classes that are i... (diff)
downloadingenue-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--depend2
-rwxr-xr-xsetup.php5
-rw-r--r--shared/classes/0sql_row_obj.php4
-rw-r--r--shared/classes/1conf_build_common.php3
4 files changed, 9 insertions, 5 deletions
diff --git a/depend b/depend
index 00ef6d6..95bc518 100644
--- a/depend
+++ b/depend
@@ -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?
diff --git a/setup.php b/setup.php
index 915dcbf..15782bd 100755
--- a/setup.php
+++ b/setup.php
@@ -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)) {