Библиотека для cis, online, cms1
This commit is contained in:
commit
3c2e614d87
269 changed files with 39854 additions and 0 deletions
59
core/setup.php
Normal file
59
core/setup.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
require_once 'core/path.php';
|
||||
require_once 'creole/util/sql/SQLStatementExtractor.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue