[DOCUMENTATION] Document All The Things!

This commit is contained in:
Hugo Sales 2020-03-21 20:18:05 +00:00 committed by Hugo Sales
parent 5d1685b142
commit 596009c924
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
16 changed files with 525 additions and 166 deletions

View File

@ -6,60 +6,63 @@ StatusNet and Free Social. Apologies for any
oversight; please let mail@diogo.site know if oversight; please let mail@diogo.site know if
anyone's been overlooked in error. anyone's been overlooked in error.
Current team
------------
* Alexei Sorokin
* Diogo Cordeiro
* Eliseu Amaro
* Hugo Sales
V2 team V2 team
------- -------
* Diogo Cordeiro * Diogo Cordeiro
* Alexei Sorokin * Alexei Sorokin
* Bruno Casteleiro * Bruno Casteleiro
Credits for GNU social v1
------------------------
Leads
* Mikael Nordfeldth
* Matt Lee
Additional Contributors 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
* Brenda Wallace
* Jeffery To
* Federico Marani
* mEDI
* Brett Taylor
* Brigitte Schuster
* Craig Andrews
* Donald Robertson
* Deb Nicholson
* Ian Denhart
* Steven DuBois
* Blaine Cook
* Henry Story
* Melvin Carvalho
* Stéphane Bérubé (chimo)
* Akio * Akio
* Maiyannah Bishop * Blaine Cook
* Bob Mottram * Bob Mottram
* David Yip * Brenda Wallace
* Neil E Hodges * Brett Taylor
* Moonman * Brian Hendrickson
* Normandy * Brigitte Schuster
* Verius * Ciaran Gultnieks
* Diogo Peralta Cordeiro * Craig Andrews
* Daniel Supernault * Daniel Supernault
* Dan Moore
* David Yip
* Deb Nicholson
* Donald Robertson
* Eric Helgeson
* Federico Marani
* Fil
* Garret Buell
* Henry Story
* Ian Denhart
* Jeffery To
* Jeff Mitchell
* Ken Sedgwick
* Leslie Michael Orchard
* Maiyannah Bishop
* Matthew Gregg
* Matt Lee
* mEDI
* Melvin Carvalho
* Michael Landers
* Miguel Dantas * Miguel Dantas
* Mikael Nordfeldth
* Mike Cochrane
* Moonman
* Neil E Hodges
* Normandy
* Ori Avtalion
* Sean Murphy
* Stéphane Bérubé
* Steven DuBois
* Tobias Diekershoff
* Verius
Credits for StatusNet Credits for StatusNet
-------------- --------------
@ -68,24 +71,24 @@ Leads
* Zach Copley * Zach Copley
Team Team
* Earle Martin
* Marie-Claude Doyon
* Sarven Capadisli
* Robin Millette
* Brion Vibber
* James Walker
* Samantha Doherty
* Florian Biree
* Erik Stambaugh
* 'drry'
* Gina Haeussge
* Tryggvi Björgvinsson
* Adrian Lang * Adrian Lang
* Ori Avtalion * Brion Vibber
* Meitar Moscovitz * 'drry'
* Ken Sheppardson * Earle Martin
* Simon Waters, Surevine * Erik Stambaugh
* Florian Biree
* Gina Haeussge
* James Walker
* Joshua Judson Rosen (rozzin) * Joshua Judson Rosen (rozzin)
* Ken Sheppardson
* Marie-Claude Doyon
* Meitar Moscovitz
* Ori Avtalion
* Robin Millette
* Samantha Doherty
* Sarven Capadisli
* Simon Waters, Surevine
* Tryggvi Björgvinsson
Translators Translators
----------- -----------

View File

@ -1,5 +1,32 @@
<?php <?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 App\Kernel;
use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -13,7 +40,8 @@ if ($_SERVER['APP_DEBUG']) {
} }
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) { 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) { if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {

View File

@ -1,5 +1,33 @@
<?php <?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; namespace App\Command;
use Functional as F; use Functional as F;

View File

@ -1,5 +1,33 @@
<?php <?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; namespace App\Controller;
use App\Util\GSEvent as Event; use App\Util\GSEvent as Event;

View File

@ -1,5 +1,34 @@
<?php <?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; namespace App\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

View File

@ -1,5 +1,33 @@
<?php <?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; namespace App\Entity;
class User class User

View File

@ -1,5 +1,33 @@
<?php <?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; namespace App;
use App\DependencyInjection\Compiler\SchemaDefPass; use App\DependencyInjection\Compiler\SchemaDefPass;

View File

@ -1,5 +1,33 @@
<?php <?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; namespace App\Routes;
use App\Util\RouteLoader; use App\Util\RouteLoader;

View File

@ -1,19 +1,32 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social /*
// * 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 * GNU social is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU Affero General Public License as published by
// (at your option) any later version. * 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 * GNU social is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU Affero General Public License for more details. * 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/>. * 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; namespace App\Util;
@ -26,6 +39,9 @@ abstract class Common
{ {
} }
/**
* Normalize path by converting \ to /
*/
public static function normalizePath(string $path): string public static function normalizePath(string $path): string
{ {
if (\DIRECTORY_SEPARATOR !== '/') { if (\DIRECTORY_SEPARATOR !== '/') {
@ -34,6 +50,9 @@ abstract class Common
return $path; return $path;
} }
/**
* Get plugin name from it's path, or null if not a plugin
*/
public static function pluginFromPath(string $path): ?string public static function pluginFromPath(string $path): ?string
{ {
$plug = strpos($path, '/plugins/'); $plug = strpos($path, '/plugins/');
@ -52,11 +71,11 @@ abstract class Common
return $final; return $final;
} }
public static function swapArgs($call, $arg) /**
{ * Check whether $haystack starts with $needle
return function ($v) use ($call, $arg) { return self::$call($v, $arg); }; *
} * @param array|string $haystack if array, check that all strings start with $needle
*/
public static function startsWith($haystack, string $needle): bool public static function startsWith($haystack, string $needle): bool
{ {
if (is_string($haystack)) { 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) public static function endsWith($haystack, string $needle)
{ {
if (is_string($haystack)) { if (is_string($haystack)) {

View File

@ -1,5 +1,36 @@
<?php <?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; namespace App\Util;
use App\Util\GSEvent as Event; use App\Util\GSEvent as Event;

View File

@ -1,19 +1,21 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social /*
// * 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 * GNU social is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU Affero General Public License as published by
// (at your option) any later version. * 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 * GNU social is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU Affero General Public License for more details. * 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/>. * 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 * Main GNU social entry point
@ -21,33 +23,18 @@
* @package GNUsocial * @package GNUsocial
* @category Framework * @category Framework
* *
* @author Brenda Wallace <shiny@cpan.org> * StatusNet and GNU social 1
* @author Brion Vibber <brion@pobox.com> *
* @author Brion Vibber <brion@status.net> * @author Refer to CREDITS.md
* @author Christopher Vollick <candrews@integralblue.com> * @copyright 2010 Free Software Foundation, Inc http://www.fsf.org
* @author CiaranG <ciaran@ciarang.com> *
* @author Craig Andrews <candrews@integralblue.com> * GNU social 2
* @author Craig Andrews <evan@status.net> * @author Bruno Casteleiro <brunoccast@fc.up.pt>
* @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>
* @author Diogo Cordeiro <diogo@fc.up.pt> * @author Diogo Cordeiro <diogo@fc.up.pt>
*
* GNU social 3
* @author Hugo Sales <hugo@fc.up.pt> * @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 * @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 LoggerInterface $logger;
protected TranslatorInterface $translator; protected TranslatorInterface $translator;
/**
* Symfony dependency injection gives us access to these services
*/
public function __construct(ContainerInterface $container, public function __construct(ContainerInterface $container,
LoggerInterface $logger, LoggerInterface $logger,
TranslatorInterface $translator) TranslatorInterface $translator)
@ -77,6 +67,9 @@ class GNUsocial implements EventSubscriberInterface
$this->translator = $translator; $this->translator = $translator;
} }
/**
* Store these services to be accessed statically and load extensions
*/
public function register(EventDispatcherInterface $event_dispatcher): void public function register(EventDispatcherInterface $event_dispatcher): void
{ {
Log::setLogger($this->logger); Log::setLogger($this->logger);
@ -85,6 +78,10 @@ class GNUsocial implements EventSubscriberInterface
ExtensionManager::loadExtensions(); 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, public function onKernelRequest(RequestEvent $event,
string $event_name, string $event_name,
EventDispatcherInterface $event_dispatcher): RequestEvent EventDispatcherInterface $event_dispatcher): RequestEvent
@ -93,6 +90,9 @@ class GNUsocial implements EventSubscriberInterface
return $event; return $event;
} }
/**
* Event after everything is initialized when using the `bin/console` command
*/
public function onCommand(ConsoleCommandEvent $event, public function onCommand(ConsoleCommandEvent $event,
string $event_name, string $event_name,
EventDispatcherInterface $event_dispatcher): ConsoleCommandEvent EventDispatcherInterface $event_dispatcher): ConsoleCommandEvent
@ -101,6 +101,10 @@ class GNUsocial implements EventSubscriberInterface
return $event; 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() public static function getSubscribedEvents()
{ {
return [ return [

View File

@ -1,19 +1,33 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social /*
// * 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 * GNU social is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU Affero General Public License as published by
// (at your option) any later version. * 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 * GNU social is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU Affero General Public License for more details. * 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/>. * 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; namespace App\Util;

View File

@ -1,19 +1,21 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social /*
// * 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 * GNU social is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU Affero General Public License as published by
// (at your option) any later version. * 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 * GNU social is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU Affero General Public License for more details. * 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/>. * 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 * Utility functions for i18n
@ -25,7 +27,8 @@
* @author Ciaran Gultnieks <ciaran@ciarang.com> * @author Ciaran Gultnieks <ciaran@ciarang.com>
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @author Diogo Cordeiro <diogo@fc.up.pt> * @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 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */

View File

@ -1,5 +1,34 @@
<?php <?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; namespace App\Util;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -13,11 +42,39 @@ class Log
self::$logger = $l; 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 public static function error(string $msg): void
{ {
self::$logger->error($msg); 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 public static function info(string $msg): void
{ {
self::$logger->info($msg); self::$logger->info($msg);

View File

@ -1,22 +1,24 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social /*
// * 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 * GNU social is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU Affero General Public License as published by
// (at your option) any later version. * 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 * GNU social is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU Affero General Public License for more details. * 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/>. * 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 * Converts a path into a set of parameters, and vice versa
* *

View File

@ -1,5 +1,33 @@
<?php <?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; namespace App\Util;
use Doctrine\Persistence\Mapping\ClassMetadata; use Doctrine\Persistence\Mapping\ClassMetadata;
@ -118,10 +146,6 @@ class SchemaDefDriver extends StaticPHPDriver
/** /**
* Convert [$key => $val] to ['name' => $key, 'columns' => $val] * Convert [$key => $val] to ['name' => $key, 'columns' => $val]
*
* @param array
*
* @return array
*/ */
private static function kv_to_name_col(array $arr): array private static function kv_to_name_col(array $arr): array
{ {