if (!empty($options['mods'] ) && !in_array($m, $options['mods'] )) {
continue;
}
+ // this happens when we have no database tables from a module,
+ // but module code has been defined.
+ if (!file_exists($options['rootDir'].'/'.$m)) {
+ continue;
+ }
foreach(scandir($options['rootDir'].'/'.$m) as $f) {
if (!strlen($f) || $f[0] == '.') {
continue;
if (!file_exists($tg) || !filesize($tg) ) {
- if ($cli && in_array($f, $flist)) {
- echo "COPY $src $tg" . ($cli ? "\n" : "<BR>");
+ if ($cli && !filesize($tg) || in_array($f, $flist)) {
+ echo "COPY $src $tg" . ($cli ? "\n" : "<BR>");
copy($src, $tg);
continue;
}
}
-
-
-
+ /**
+ * imports SQL files from all DataObjects directories....
+ *
+ * except any matching /migrate/
+ */
function importSQL()
{
$options = &PEAR::getStaticProperty('DB_DataObject','options');
$url['user'] = '*****';
$url['host'] = '*****';
}
-
-
require_once 'System.php';
$cat = System::which('cat');
foreach($this->modsql as $m => $fl)
{
if ($cli && isset($options['database_'. $m])) {
- $url =parse_url($options['database_'.$m]);
+ $url = parse_url($options['database_'.$m]);
}
$mysql_cmd = $mysql .
if (in_array($this->table, $ignore)) {
continue;
}
-
-
- die("No existing DataObject file found for table {$this->table}
+ if (empty($mods)) {
+
+ die("No existing DataObject file found for table {$this->table}
+
- either add it to Pman_Builder[skip_tables] or\n
+- run generator and specify that module..
- create an empty file in the related Module/DataObjects directory
eg.
touch Pman/????/DataObjects/".ucfirst($this->table).".php
-
-");
-
+
+ ");
+ }
+ // use mods to determine where it should output to..
+ //var_dump($mods);exit;
+ $this->modmap[$tn] = $mods[0];
+
+
}
$mod = $this->modmap[$tn];
$inis[$mod] = isset($inis[$mod]) ? $inis[$mod] : '';
// file_get_contents???
- $oldcontents = file_get_contents($orig);
+
+ $oldcontents = file_exists($orig) ? file_get_contents($orig) : '';
echo "GENERATE: " . $this->classname . ($cli ? "\n" : "<BR>");
$out = preg_replace('/(\n|\r\n)\s*function staticGet[^\n]+(\n|\r\n)/s', '', $out);
$out = preg_replace('#/\* Static get \*/#s', '', $out);
- if (!file_exists(dirname($outfilename)) {
+ if (!file_exists(dirname($outfilename))) {
mkdir(dirname($outfilename), 0755, true);
}
// $this->debug( "writing $this->classname\n");