Переделка для composer autoload

This commit is contained in:
origami11 2017-02-09 14:57:40 +03:00
parent ad69746347
commit b5641db607
100 changed files with 14 additions and 325 deletions

54
src/setup.php Normal file
View file

@ -0,0 +1,54 @@
<?php
/**
* Обработка файлов для установки
*/
class Setup
{
/**
* Содержимое PHP файла
*/
static function fileContent($file, array $tpl)
{
ob_start();
include $file;
$result = ob_get_contents();
ob_clean();
return $result;
}
/**
* Копирует файлы шаблонной директории
*/
static function copyTemplatePath($srcPath, $dstPath, array $tpl, $tplFile = 'tpl')
{
$out = new Path($srcPath);
$path = new Path($dstPath);
$files = $path->getContentRec(null, array(".svn"));
foreach ($files as $file) {
if (Path::getExtension($file) == $tplFile) {
// Шаблон
$dst = $out->append($path->relPath (Path::skipExtension($file)));
Path::prepare($dst);
file_put_contents($dst, self::fileContent($file, $tpl));
} else {
// Обычный файл
$dst = $out->append($path->relPath ($file));
Path::prepare($dst);
copy($file, $dst);
}
}
}
/**
* Выполнение Списка SQL команд
*/
static function batchSQL(Connection $conn, $file)
{
$stmtList = SQLStatementExtractor::extractFile ($file);
foreach ($stmtList as $stmt) {
$conn->executeQuery ($stmt);
}
}
}