[DOCTRINE][SCHEMADEF] Create a new metadata driver to allow us to continue using static schemaDef functions

This has the benefit of requiring fewer code changes, as well as providing a better isolation
between GNU social and symfony, useful in case the framework needs to be changed
This commit is contained in:
Hugo Sales
2020-03-15 21:21:11 +00:00
committed by Hugo Sales
parent 710aa946ab
commit cc72373e3d
24 changed files with 835 additions and 148 deletions

View File

@@ -1,4 +1,5 @@
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
@@ -20,12 +21,11 @@ abstract class Common
{
public static function config(string $section, string $field)
{
}
public static function normalizePath(string $path): string
{
if (DIRECTORY_SEPARATOR !== '/') {
if (\DIRECTORY_SEPARATOR !== '/') {
$path = strtr($path, DIRECTORY_SEPARATOR, '/');
}
return $path;
@@ -36,18 +36,18 @@ abstract class Common
$plug = strpos($path, '/plugins/');
if ($plug === false) {
return null;
} else {
$cut = $plug + strlen('/plugins/');
$cut2 = strpos($path, '/', $cut);
if ($cut2) {
$final = substr($path, $cut, $cut2 - $cut);
} else {
// We might be running directly from the plugins dir?
// If so, there's no place to store locale info.
Log::error("The GNU social install dir seems to contain a piece named plugin");
return false;
}
}
$cut = $plug + strlen('/plugins/');
$cut2 = strpos($path, '/', $cut);
if ($cut2) {
$final = substr($path, $cut, $cut2 - $cut);
} else {
// We might be running directly from the plugins dir?
// If so, there's no place to store locale info.
Log::error('The GNU social install dir seems to contain a piece named plugin');
return false;
}
return $final;
}
}