mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
0bc0a09bf4
- application/extensions file system permission now is 775 - application/logs file system permission now is 775 - Added extensions directory in application/: config, controllers, helpers, hooks, libraries, models, views and widgets - Added view views/extensions/manage.php - Added controller controllers/system/extensions/Manager.php - Added library ExtensionsLib to manage extensions - Added model models/system/Extensions_model.php - Moved code related to print out info from MigrationLib to EPrintfLib
52 lines
999 B
PHP
52 lines
999 B
PHP
<?php
|
|
|
|
namespace Sabre;
|
|
|
|
class TestUtil {
|
|
|
|
/**
|
|
* This function deletes all the contents of the temporary directory.
|
|
*
|
|
* @return void
|
|
*/
|
|
static function clearTempDir() {
|
|
|
|
self::deleteTree(SABRE_TEMPDIR,false);
|
|
|
|
}
|
|
|
|
|
|
static private function deleteTree($path,$deleteRoot = true) {
|
|
|
|
foreach(scandir($path) as $node) {
|
|
|
|
if ($node=='.' || $node=='..') continue;
|
|
$myPath = $path.'/'. $node;
|
|
if (is_file($myPath)) {
|
|
unlink($myPath);
|
|
} else {
|
|
self::deleteTree($myPath);
|
|
}
|
|
|
|
}
|
|
if ($deleteRoot) {
|
|
rmdir($path);
|
|
}
|
|
|
|
}
|
|
|
|
static function getMySQLDB() {
|
|
|
|
try {
|
|
$pdo = new \PDO(SABRE_MYSQLDSN,SABRE_MYSQLUSER,SABRE_MYSQLPASS);
|
|
$pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION);
|
|
return $pdo;
|
|
} catch (\PDOException $e) {
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|