Exemplo n.º 1
0
    exit(1);
}
fwrite($logfile, 'The following files were created ' . date('Y:m:d H:i:s') . ':' . PHP_EOL . PHP_EOL);
for ($i = 1; $i < $_SERVER['argc']; $i++) {
    $class_name = $_SERVER['argv'][$i];
    // Create model file
    $boilerplate = modelFileBoilerplate($class_name);
    createSourceFile($class_name, $boilerplate, 'Model', $logfile);
    // Create controller file
    $boilerplate = controllerFileBoilerplate($class_name);
    createSourceFile($class_name, $boilerplate, 'Controller', $logfile);
    echo PHP_EOL;
    // Create views
    createViews(strtolower($class_name), 'index', $logfile);
    createViews(strtolower($class_name), 'view', $logfile);
    createViews(strtolower($class_name), 'add', $logfile);
    echo PHP_EOL;
}
createCDatabaseModel($logfile);
fwrite($logfile, PHP_EOL);
fclose($logfile);
echo PHP_EOL . "--> Log written to anax-scaffold.log" . PHP_EOL;
echo PHP_EOL;
exit(0);
/**
 * Create source files
 *
 * @param string $class_name, name of class
 * @param string $boilerplate, code
 * @param string $type, type of file
 *
Exemplo n.º 2
0
             $chk1 = $sql->query($query, $FANNIE_ARCHIVE_DB);
             $chk2 = true;
             if (strstr($FANNIE_SERVER_DBMS, "MYSQL")) {
                 // mysql doesn't create & populate in one step
                 $chk2 = $sql->query("INSERT INTO {$table} SELECT * FROM {$FANNIE_TRANS_DB}.dtransactions\n                                    WHERE " . $sql->datediff('datetime', "'{$date}'") . "= 0");
             }
             if ($chk1 === false || $chk2 === false) {
                 echo cron_msg("Error creating new archive {$table}");
             } else {
                 echo cron_msg("Created new table {$table} and archived dtransactions");
             }
             if ($UPDATED_DLOG_SCHEMA) {
                 $model = new DTransactionsModel($sql);
                 $model->normalizeLog('dlog' . $str, $table, BasicModel::NORMALIZE_MODE_APPLY);
             } else {
                 createViews($dstr, $sql);
             }
         } else {
             $query = "INSERT INTO {$table} SELECT * FROM {$FANNIE_TRANS_DB}.dtransactions\n                        WHERE " . $sql->datediff('datetime', "'{$date}'") . "= 0";
             if ($FANNIE_SERVER_DBMS == 'MSSQL') {
                 $query = "INSERT INTO {$table} SELECT * FROM {$FANNIE_TRANS_DB}.dbo.dtransactions\n                        WHERE " . $sql->datediff('datetime', "'{$date}'") . "= 0";
             }
             $chk = $sql->query($query, $FANNIE_ARCHIVE_DB);
             if ($chk === false) {
                 echo cron_msg("Error archiving dtransactions");
             } else {
                 echo cron_msg("Success archiving dtransactions");
             }
         }
     }
 }