Browse Source

[DOCUMENTATION] Document All The Things!

v3
Hugo Sales 1 year ago
parent
commit
596009c924
Signed by: someonewithpc <hugo@hsal.es> GPG Key ID: 7D0C7EAFC9D835A0
16 changed files with 516 additions and 157 deletions
  1. +53
    -50
      CREDITS.md
  2. +29
    -1
      public/index.php
  3. +28
    -0
      src/Command/ListEventsCommand.php
  4. +28
    -0
      src/Controller/NetworkPublic.php
  5. +29
    -0
      src/DependencyInjection/Compiler/SchemaDefPass.php
  6. +28
    -0
      src/Entity/User.php
  7. +28
    -0
      src/Kernel.php
  8. +28
    -0
      src/Routes/Main.php
  9. +43
    -19
      src/Util/Common.php
  10. +31
    -0
      src/Util/ExtensionManager.php
  11. +43
    -39
      src/Util/GNUsocial.php
  12. +28
    -14
      src/Util/GSEvent.php
  13. +18
    -15
      src/Util/I18n.php
  14. +57
    -0
      src/Util/Log.php
  15. +17
    -15
      src/Util/RouteLoader.php
  16. +28
    -4
      src/Util/SchemaDefDriver.php

+ 53
- 50
CREDITS.md View File

@@ -6,60 +6,63 @@ StatusNet and Free Social. Apologies for any
oversight; please let mail@diogo.site know if
anyone's been overlooked in error.

Current team
------------
* Alexei Sorokin
* Diogo Cordeiro
* Eliseu Amaro
* Hugo Sales

V2 team
-------
* Diogo Cordeiro
* Alexei Sorokin
* Bruno Casteleiro

Credits for GNU social v1
------------------------
Leads
* Mikael Nordfeldth
* Matt Lee

Additional Contributors
* Ciaran Gultnieks
* Michael Landers
* Ori Avtalion
* Garret Buell
* Mike Cochrane
* Matthew Gregg
* Sean Murphy
* Leslie Michael Orchard
* Eric Helgeson
* Ken Sedgwick
* Brian Hendrickson
* Tobias Diekershoff
* Dan Moore
* Fil
* Jeff Mitchell
-----------------------
* Akio
* Blaine Cook
* Bob Mottram
* Brenda Wallace
* Jeffery To
* Federico Marani
* mEDI
* Brett Taylor
* Brian Hendrickson
* Brigitte Schuster
* Ciaran Gultnieks
* Craig Andrews
* Donald Robertson
* Daniel Supernault
* Dan Moore
* David Yip
* Deb Nicholson
* Ian Denhart
* Steven DuBois
* Blaine Cook
* Donald Robertson
* Eric Helgeson
* Federico Marani
* Fil
* Garret Buell
* Henry Story
* Melvin Carvalho
* Stéphane Bérubé (chimo)
* Akio
* Ian Denhart
* Jeffery To
* Jeff Mitchell
* Ken Sedgwick
* Leslie Michael Orchard
* Maiyannah Bishop
* Bob Mottram
* David Yip
* Neil E Hodges
* Matthew Gregg
* Matt Lee
* mEDI
* Melvin Carvalho
* Michael Landers
* Miguel Dantas
* Mikael Nordfeldth
* Mike Cochrane
* Moonman
* Neil E Hodges
* Normandy
* Ori Avtalion
* Sean Murphy
* Stéphane Bérubé
* Steven DuBois
* Tobias Diekershoff
* Verius
* Diogo Peralta Cordeiro
* Daniel Supernault
* Miguel Dantas

Credits for StatusNet
--------------
@@ -68,24 +71,24 @@ Leads
* Zach Copley

Team
* Earle Martin
* Marie-Claude Doyon
* Sarven Capadisli
* Robin Millette
* Adrian Lang
* Brion Vibber
* James Walker
* Samantha Doherty
* Florian Biree
* Erik Stambaugh
* 'drry'
* Earle Martin
* Erik Stambaugh
* Florian Biree
* Gina Haeussge
* Tryggvi Björgvinsson
* Adrian Lang
* Ori Avtalion
* Meitar Moscovitz
* James Walker
* Joshua Judson Rosen (rozzin)
* Ken Sheppardson
* Marie-Claude Doyon
* Meitar Moscovitz
* Ori Avtalion
* Robin Millette
* Samantha Doherty
* Sarven Capadisli
* Simon Waters, Surevine
* Joshua Judson Rosen (rozzin)
* Tryggvi Björgvinsson

Translators
-----------


+ 29
- 1
public/index.php View File

@@ -1,5 +1,32 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* GNU social's true web entry point, bootstraps Symfony's configuration and instantiates our Kernel
*
* @package GNUsocial
* @category Framework
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
@@ -13,7 +40,8 @@ if ($_SERVER['APP_DEBUG']) {
}

if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(\explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
Request::setTrustedProxies(\explode(',', $trustedProxies),
Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}

if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {


+ 28
- 0
src/Command/ListEventsCommand.php View File

@@ -1,5 +1,33 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Command to search for event by pattern
*
* @package GNUsocial
* @category Command
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Command;

use Functional as F;


+ 28
- 0
src/Controller/NetworkPublic.php View File

@@ -1,5 +1,33 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Handle network public feed
*
* @package GNUsocial
* @category Controller
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Controller;

use App\Util\GSEvent as Event;


+ 29
- 0
src/DependencyInjection/Compiler/SchemaDefPass.php View File

@@ -1,5 +1,34 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Compiler pass which triggers Symgony to tell Doctrine to
* use out `SchemaDef` metadata driver
*
* @package GNUsocial
* @category DB
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;


+ 28
- 0
src/Entity/User.php View File

@@ -1,5 +1,33 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* GNU social user ORM
*
* @package GNUsocial
* @category ORM
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Entity;

class User


+ 28
- 0
src/Kernel.php View File

@@ -1,5 +1,33 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Symfony Kernel, which is responsible for configuring the whole application
*
* @package GNUsocial
* @category Kernel
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App;

use App\DependencyInjection\Compiler\SchemaDefPass;


+ 28
- 0
src/Routes/Main.php View File

@@ -1,5 +1,33 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Define social's main routes
*
* @package GNUsocial
* @category Router
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Routes;

use App\Util\RouteLoader;


+ 43
- 19
src/Util/Common.php View File

@@ -1,19 +1,32 @@
<?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
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/*
* 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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Common utility functions
*
* @package GNUsocial
* @category Util
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Util;

@@ -26,6 +39,9 @@ abstract class Common
{
}

/**
* Normalize path by converting \ to /
*/
public static function normalizePath(string $path): string
{
if (\DIRECTORY_SEPARATOR !== '/') {
@@ -34,6 +50,9 @@ abstract class Common
return $path;
}

/**
* Get plugin name from it's path, or null if not a plugin
*/
public static function pluginFromPath(string $path): ?string
{
$plug = strpos($path, '/plugins/');
@@ -52,11 +71,11 @@ abstract class Common
return $final;
}

public static function swapArgs($call, $arg)
{
return function ($v) use ($call, $arg) { return self::$call($v, $arg); };
}
/**
* Check whether $haystack starts with $needle
*
* @param array|string $haystack if array, check that all strings start with $needle
*/
public static function startsWith($haystack, string $needle): bool
{
if (is_string($haystack)) {
@@ -69,6 +88,11 @@ abstract class Common
});
}

/**
* Check whether $haystack ends with $needle
*
* @param array|string $haystack if array, check that all strings end with $needle
*/
public static function endsWith($haystack, string $needle)
{
if (is_string($haystack)) {


+ 31
- 0
src/Util/ExtensionManager.php View File

@@ -1,5 +1,36 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Extension loader code, one of the main features of GNU social
*
* Loads plugins from `plugins/enabled`, instances them
* and hooks its events
*
* @package GNUsocial
* @category Extensions
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Util;

use App\Util\GSEvent as Event;


+ 43
- 39
src/Util/GNUsocial.php View File

@@ -1,19 +1,21 @@
<?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
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/*
* 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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Main GNU social entry point
@@ -21,33 +23,18 @@
* @package GNUsocial
* @category Framework
*
* @author Brenda Wallace <shiny@cpan.org>
* @author Brion Vibber <brion@pobox.com>
* @author Brion Vibber <brion@status.net>
* @author Christopher Vollick <candrews@integralblue.com>
* @author CiaranG <ciaran@ciarang.com>
* @author Craig Andrews <candrews@integralblue.com>
* @author Craig Andrews <evan@status.net>
* @author Evan Prodromou <evan@controlezvous.ca>
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Evan Prodromou <evan@prodromou.name>
* @author Evan Prodromou <evan@status.net>
* @author Gina Haeussge <osd@foosel.net>
* @author James Walker <walkah@walkah.net>
* @author Jeffery To <candrews@integralblue.com>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Mikael Nordfeldth <mmn@hethane.se>
* @author Mike Cochrane <mikec@mikenz.geek.nz>
* @author Robin Millette <millette@controlyourself.ca>
* @author Sarven Capadisli <csarven@controlyourself.ca>
* @author Sarven Capadisli <csarven@status.net>
* @author Siebrand Mazeland <s.mazeland@xs4all.nl>
* @author Tom Adams <candrews@integralblue.com>
* @author Tom Adams <tom@holizz.com>
* @author Zach Copley <zach@status.net>
* StatusNet and GNU social 1
*
* @author Refer to CREDITS.md
* @copyright 2010 Free Software Foundation, Inc http://www.fsf.org
*
* GNU social 2
* @author Bruno Casteleiro <brunoccast@fc.up.pt>
* @author Diogo Cordeiro <diogo@fc.up.pt>
*
* GNU social 3
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2010, 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @copyright 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

@@ -68,6 +55,9 @@ class GNUsocial implements EventSubscriberInterface
protected LoggerInterface $logger;
protected TranslatorInterface $translator;

/**
* Symfony dependency injection gives us access to these services
*/
public function __construct(ContainerInterface $container,
LoggerInterface $logger,
TranslatorInterface $translator)
@@ -77,6 +67,9 @@ class GNUsocial implements EventSubscriberInterface
$this->translator = $translator;
}

/**
* Store these services to be accessed statically and load extensions
*/
public function register(EventDispatcherInterface $event_dispatcher): void
{
Log::setLogger($this->logger);
@@ -85,6 +78,10 @@ class GNUsocial implements EventSubscriberInterface
ExtensionManager::loadExtensions();
}

/**
* Event very early on in the Symfony HTTP lifecycle, but after everyting is registered
* where we get access to the event dispatcher
*/
public function onKernelRequest(RequestEvent $event,
string $event_name,
EventDispatcherInterface $event_dispatcher): RequestEvent
@@ -93,6 +90,9 @@ class GNUsocial implements EventSubscriberInterface
return $event;
}

/**
* Event after everything is initialized when using the `bin/console` command
*/
public function onCommand(ConsoleCommandEvent $event,
string $event_name,
EventDispatcherInterface $event_dispatcher): ConsoleCommandEvent
@@ -101,6 +101,10 @@ class GNUsocial implements EventSubscriberInterface
return $event;
}

/**
* Tell Symfony which events we want to listen to, which Symfony detects and autowires
* due to this implementing the `EventSubscriberInterface`
*/
public static function getSubscribedEvents()
{
return [


+ 28
- 14
src/Util/GSEvent.php View File

@@ -1,19 +1,33 @@
<?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
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/*
* 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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* GNU social's event handler wrapper around Symfony's,
* keeping our old interface, which is more convenient and just as powerful
*
* @package GNUsocial
* @category Event
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Util;



+ 18
- 15
src/Util/I18n.php View File

@@ -1,19 +1,21 @@
<?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
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/*
* 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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Utility functions for i18n
@@ -25,7 +27,8 @@
* @author Ciaran Gultnieks <ciaran@ciarang.com>
* @author Evan Prodromou <evan@status.net>
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @copyright 2010, 2019 Free Software Foundation, Inc http://www.fsf.org
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2010, 2018-2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/



+ 57
- 0
src/Util/Log.php View File

@@ -1,5 +1,34 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* GNU social's logger wrapper around Symfony's,
* keeping our old static interface, which is more convenient and just as powerful
*
* @package GNUsocial
* @category Log
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Util;

use Psr\Log\LoggerInterface;
@@ -13,11 +42,39 @@ class Log
self::$logger = $l;
}

/**
* Simple static wrappers around Monolog's functions
*/
public static function emergency(string $msg): void
{
self::$logger->emergency($msg);
}

public static function alert(string $msg): void
{
self::$logger->alert($msg);
}

public static function critical(string $msg): void
{
self::$logger->critical($msg);
}

public static function error(string $msg): void
{
self::$logger->error($msg);
}

public static function warning(string $msg): void
{
self::$logger->warning($msg);
}

public static function notice(string $msg): void
{
self::$logger->notice($msg);
}

public static function info(string $msg): void
{
self::$logger->info($msg);


+ 17
- 15
src/Util/RouteLoader.php View File

@@ -1,22 +1,24 @@
<?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
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/*
* 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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Old URLMapper interface atop Symfony's router
* Dynamic router loader and URLMapper interface atop Symfony's router
*
* Converts a path into a set of parameters, and vice versa
*


+ 28
- 4
src/Util/SchemaDefDriver.php View File

@@ -1,5 +1,33 @@
<?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
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNU social is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* Doctrine metadata driver which implements our old `schemaDef` interface
*
* @package GNUsocial
* @category DB
*
* @author Hugo Sales <hugo@fc.up.pt>
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace App\Util;

use Doctrine\Persistence\Mapping\ClassMetadata;
@@ -118,10 +146,6 @@ class SchemaDefDriver extends StaticPHPDriver

/**
* Convert [$key => $val] to ['name' => $key, 'columns' => $val]
*
* @param array
*
* @return array
*/
private static function kv_to_name_col(array $arr): array
{


Loading…
Cancel
Save