summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-07-07 18:16:27 -0400
committerEudyptula <eitan@mosenkis.net>2009-07-07 18:16:27 -0400
commit37741a49577f95a1645c3b75e56ffae85fcc5d11 (patch)
tree44062dd2c9e834250d5f3871dec914cb380e4629 /update_sql_classes.php
parentMajor restructuring of frontend modules (package selection not done yet); cre... (diff)
downloadingenue-37741a49577f95a1645c3b75e56ffae85fcc5d11.tar.gz
ingenue-37741a49577f95a1645c3b75e56ffae85fcc5d11.tar.bz2
ingenue-37741a49577f95a1645c3b75e56ffae85fcc5d11.zip
Remove interactive merging from class update script; allow classes that are indirect children of sql_row_obj; ugly hacks so abstract classes don't break setup and class update scripts
Diffstat (limited to 'update_sql_classes.php')
-rwxr-xr-xupdate_sql_classes.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/update_sql_classes.php b/update_sql_classes.php
index da713f8..ddef0b1 100755
--- a/update_sql_classes.php
+++ b/update_sql_classes.php
@@ -1,5 +1,6 @@
#!/usr/bin/php
<?php
+// TODO Get rid of interactive merging
require_once(dirname(__FILE__).'/shared/include/includes.php'); // USE __DIR__ in 5.3.0
require_once(SHARED.'/config.php');
require_once(SHARED.'/include/dbinit.php');
@@ -35,7 +36,7 @@ function write_table_class_to_file($table, $class, $file) {
$stream=fopen($file, 'w');
fputs($stream, "<?php\n");
$tmpclass='genclass_'.randstring(30);
- eval ("class $tmpclass extends sql_row_obj {\nprotected \$table='$table';\t}");
+ eval ("class $tmpclass extends ".(class_exists($class)?get_parent_class($class):'sql_row_obj')." {\nprotected \$table='$table';\t}");
$obj=new $tmpclass();
fputs($stream, str_replace($tmpclass, $class, $obj->to_php()));
fputs($stream, "?>\n");
@@ -84,18 +85,13 @@ foreach ($tables as $i => $table) {
copy($origfile, '.temp_class');
shell_exec('patch .temp_class < .temp_diff');
passthru('colordiff -u "'.$origfile.'" .temp_class');
- if (prompt_bool('Merge differences?')) {
- passthru('sdiff -o .temp_class2 "'.$origfile.'" .temp_class');
- passthru('colordiff -u "'.$origfile.'" .temp_class2');
- if (prompt_bool('Keep changes?')) {
- rename('.temp_class2', $origfile);
- } else {
- unlink('.temp_class2');
- }
+ if (prompt_bool('Keep changes?')) {
+ rename('.temp_class', $origfile);
}
}
unlink('.temp_diff');
- unlink('.temp_class'); // TODO unlink others
+ if (is_file('.temp_class'))
+ unlink('.temp_class'); // TODO unlink others
}
}
}