Prefix all global vars

This commit is contained in:
Bernd Bestel
2018-07-24 19:41:35 +02:00
parent 7f8540ff4e
commit bcbdf58376
13 changed files with 34 additions and 34 deletions

View File

@@ -9,7 +9,7 @@ class ApplicationService extends BaseService
*/
public function IsDemoInstallation()
{
return file_exists(DATAPATH . '/demo.txt');
return file_exists(GROCY_DATAPATH . '/demo.txt');
}
/**

View File

@@ -11,7 +11,7 @@ class BaseService
$this->DatabaseService = new DatabaseService();
$this->Database = $this->DatabaseService->GetDbConnection();
$localizationService = new LocalizationService(CULTURE);
$localizationService = new LocalizationService(GROCY_CULTURE);
$this->LocalizationService = $localizationService;
}

View File

@@ -14,7 +14,7 @@ class DatabaseService
{
if ($this->DbConnectionRaw == null)
{
$pdo = new \PDO('sqlite:' . DATAPATH . '/grocy.db');
$pdo = new \PDO('sqlite:' . GROCY_DATAPATH . '/grocy.db');
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$this->DbConnectionRaw = $pdo;
}

View File

@@ -8,7 +8,7 @@ class DemoDataGeneratorService extends BaseService
{
public function PopulateDemoData()
{
$localizationService = new LocalizationService(CULTURE);
$localizationService = new LocalizationService(GROCY_CULTURE);
$rowCount = $this->DatabaseService->ExecuteDbQuery('SELECT COUNT(*) FROM migrations WHERE migration = -1')->fetchColumn();
if (intval($rowCount) === 0)
@@ -125,7 +125,7 @@ class DemoDataGeneratorService extends BaseService
public function RecreateDemo()
{
unlink(DATAPATH . '/grocy.db');
unlink(GROCY_DATAPATH . '/grocy.db');
$this->PopulateDemoData();
}
}

View File

@@ -36,7 +36,7 @@ class LocalizationService
private function LogMissingLocalization(string $culture, string $text)
{
$file = DATAPATH . "/missing_translations_$culture.json";
$file = GROCY_DATAPATH . "/missing_translations_$culture.json";
$missingTranslations = array();
if (file_exists($file))
@@ -57,7 +57,7 @@ class LocalizationService
public function Localize(string $text, ...$placeholderValues)
{
if (MODE === 'dev')
if (GROCY_MODE === 'dev')
{
if (!array_key_exists($text, $this->StringsDefaultCulture))
{

View File

@@ -216,13 +216,13 @@ class StockService extends BaseService
private function LoadBarcodeLookupPlugin()
{
$pluginName = defined('STOCK_BARCODE_LOOKUP_PLUGIN') ? STOCK_BARCODE_LOOKUP_PLUGIN : '';
$pluginName = defined('GROCY_STOCK_BARCODE_LOOKUP_PLUGIN') ? GROCY_STOCK_BARCODE_LOOKUP_PLUGIN : '';
if (empty($pluginName))
{
throw new \Exception('No barcode lookup plugin defined');
}
$path = DATAPATH . "/plugins/$pluginName.php";
$path = GROCY_DATAPATH . "/plugins/$pluginName.php";
if (file_exists($path))
{
require_once $path;