mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 01:43:13 +00:00
34 lines
696 B
PHP
34 lines
696 B
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\WorkerManager\Configuration;
|
|
|
|
class Config
|
|
{
|
|
const WORKER_DATABASE_FILE = 'worker.db';
|
|
|
|
public static function getPluginDatabaseFile()
|
|
{
|
|
$dbDir = realpath(dirname(__FILE__) . "/../") . "/Db" ;
|
|
|
|
if (!is_dir($dbDir)) {
|
|
mkdir($dbDir, 0755, true);
|
|
}
|
|
|
|
$dbFile = $dbDir . '/' . self::WORKER_DATABASE_FILE;
|
|
|
|
if (!is_file($dbFile)) {
|
|
file_put_contents($dbFile, '');
|
|
}
|
|
|
|
return $dbFile;
|
|
}
|
|
|
|
public static function getWorkerSqliteConnection()
|
|
{
|
|
$db_conn = 'sqlite:'. self::getPluginDatabaseFile();
|
|
$pdo = new \PDO($db_conn);
|
|
|
|
return $pdo;
|
|
}
|
|
}
|