Example #1
0
 public function saveInstanceToFile($template, $to_filename, $replacements = array(), $delete_template = false)
 {
     $content = self::createInstance($template, $replacements);
     Pfw_Script_FileSystem::createFileWithContents($to_filename, $content);
     if ($delete_template) {
         Pfw_Script_FileSystem::unlink($template);
     }
 }
Example #2
0
 public static function getNextFilename($table, $migration_type, $adapter = 'mysql')
 {
     global $_PATHS;
     $files = Pfw_Script_FileSystem::getFilesInDir($_PATHS['deltas']);
     $next_int = time();
     $deltas_path = rtrim(rtrim($_PATHS['deltas'], '/'), "\\\\");
     $ds = DIRECTORY_SEPARATOR;
     return "{$deltas_path}{$ds}{$next_int}-{$adapter}-{$table}_{$migration_type}.sql";
 }
 function testGetFilesInDirRecursive()
 {
     $this->testFileCopy(false);
     $files = Pfw_Script_FileSystem::getFilesInDirRecursive('/tmp/mypfwtestdir');
     $this->assertEquals(array('/tmp/mypfwtestdir/recursive/text.txt', '/tmp/mypfwtestdir/recursive'), $files);
 }