Renamed Diagnostic to Debug and deleted ItemSource (already defined)

This commit is contained in:
Philipp Holzer 2019-05-19 03:02:58 +02:00
parent 48bba87abe
commit 492d7abe92
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
8 changed files with 21 additions and 77 deletions

View file

@ -92,7 +92,7 @@ class Router
$this->routeCollector->addRoute(['GET'], '/allfriends/{id:\d+}', Module\AllFriends::class); $this->routeCollector->addRoute(['GET'], '/allfriends/{id:\d+}', Module\AllFriends::class);
$this->routeCollector->addRoute(['GET'], '/apps', Module\Apps::class); $this->routeCollector->addRoute(['GET'], '/apps', Module\Apps::class);
$this->routeCollector->addRoute(['GET'], '/attach/{item:\d+}', Module\Attach::class); $this->routeCollector->addRoute(['GET'], '/attach/{item:\d+}', Module\Attach::class);
$this->routeCollector->addRoute(['GET'], '/babel', Module\Diagnostic\Babel::class); $this->routeCollector->addRoute(['GET'], '/babel', Module\Debug\Babel::class);
$this->routeCollector->addRoute(['GET'], '/bookmarklet', Module\Bookmarklet::class); $this->routeCollector->addRoute(['GET'], '/bookmarklet', Module\Bookmarklet::class);
$this->routeCollector->addGroup('/contact', function (RouteCollector $collector) { $this->routeCollector->addGroup('/contact', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '[/]', Module\Contact::class); $collector->addRoute(['GET'], '[/]', Module\Contact::class);
@ -121,7 +121,7 @@ class Router
$collector->addRoute(['GET'], '/{nickname}/replies', Module\Feed::class); $collector->addRoute(['GET'], '/{nickname}/replies', Module\Feed::class);
$collector->addRoute(['GET'], '/{nickname}/activity', Module\Feed::class); $collector->addRoute(['GET'], '/{nickname}/activity', Module\Feed::class);
}); });
$this->routeCollector->addRoute(['GET'], '/feedtest', Module\Feedtest::class); $this->routeCollector->addRoute(['GET'], '/feedtest', Module\Debug\Feed::class);
$this->routeCollector->addGroup('/fetch', function (RouteCollector $collector) { $this->routeCollector->addGroup('/fetch', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '/{guid}/post', Module\Diaspora\Fetch::class); $collector->addRoute(['GET'], '/{guid}/post', Module\Diaspora\Fetch::class);
$collector->addRoute(['GET'], '/{guid}/status_message', Module\Diaspora\Fetch::class); $collector->addRoute(['GET'], '/{guid}/status_message', Module\Diaspora\Fetch::class);
@ -153,9 +153,8 @@ class Router
$collector->addRoute(['GET', 'POST'], '[/]', Module\Install::class); $collector->addRoute(['GET', 'POST'], '[/]', Module\Install::class);
$collector->addRoute(['GET'], '/testrewrite', Module\Install::class); $collector->addRoute(['GET'], '/testrewrite', Module\Install::class);
}); });
$this->routeCollector->addRoute(['GET', 'POST'], '/itemsource[/{guid}]', Module\Diagnostic\ItemSource::class);
$this->routeCollector->addRoute(['GET'], '/like/{item:\d+}', Module\Like::class); $this->routeCollector->addRoute(['GET'], '/like/{item:\d+}', Module\Like::class);
$this->routeCollector->addRoute(['GET', 'POST'], '/localtime', Module\Diagnostic\Localtime::class); $this->routeCollector->addRoute(['GET', 'POST'], '/localtime', Module\Debug\Localtime::class);
$this->routeCollector->addRoute(['GET', 'POST'], '/login', Module\Login::class); $this->routeCollector->addRoute(['GET', 'POST'], '/login', Module\Login::class);
$this->routeCollector->addRoute(['GET', 'POST'], '/logout', Module\Logout::class); $this->routeCollector->addRoute(['GET', 'POST'], '/logout', Module\Logout::class);
$this->routeCollector->addRoute(['GET'], '/magic', Module\Magic::class); $this->routeCollector->addRoute(['GET'], '/magic', Module\Magic::class);
@ -185,7 +184,7 @@ class Router
$collector->addRoute(['GET'], '/{type}/{customize}/{name}', Module\Photo::class); $collector->addRoute(['GET'], '/{type}/{customize}/{name}', Module\Photo::class);
}); });
$this->routeCollector->addRoute(['GET'], '/pretheme', Module\ThemeDetails::class); $this->routeCollector->addRoute(['GET'], '/pretheme', Module\ThemeDetails::class);
$this->routeCollector->addRoute(['GET'], '/probe', Module\Diagnostic\Probe::class); $this->routeCollector->addRoute(['GET'], '/probe', Module\Debug\Probe::class);
$this->routeCollector->addGroup('/profile', function (RouteCollector $collector) { $this->routeCollector->addGroup('/profile', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '/{nickname}', Module\Profile::class); $collector->addRoute(['GET'], '/{nickname}', Module\Profile::class);
$collector->addRoute(['GET'], '/{profile:\d+}/view', Module\Profile::class); $collector->addRoute(['GET'], '/{profile:\d+}/view', Module\Profile::class);
@ -214,8 +213,8 @@ class Router
$this->routeCollector->addRoute(['GET'], '/toggle_mobile', Module\ToggleMobile::class); $this->routeCollector->addRoute(['GET'], '/toggle_mobile', Module\ToggleMobile::class);
$this->routeCollector->addRoute(['GET'], '/tos', Module\Tos::class); $this->routeCollector->addRoute(['GET'], '/tos', Module\Tos::class);
$this->routeCollector->addRoute(['GET'], '/view/theme/{theme}/style.pcss', Module\Theme::class); $this->routeCollector->addRoute(['GET'], '/view/theme/{theme}/style.pcss', Module\Theme::class);
$this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\Diagnostic\ItemBody::class); $this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\Debug\ItemBody::class);
$this->routeCollector->addRoute(['GET'], '/webfinger', Module\Diagnostic\WebFinger::class); $this->routeCollector->addRoute(['GET'], '/webfinger', Module\Debug\WebFinger::class);
$this->routeCollector->addRoute(['GET'], '/xrd', Module\Xrd::class); $this->routeCollector->addRoute(['GET'], '/xrd', Module\Xrd::class);
} }

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Friendica\Module\Diagnostic; namespace Friendica\Module\Debug;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\Text; use Friendica\Content\Text;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Friendica\Module\Diagnostic; namespace Friendica\Module\Debug;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\L10n; use Friendica\Core\L10n;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Friendica\Module\Diagnostic; namespace Friendica\Module\Debug;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\L10n; use Friendica\Core\L10n;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Friendica\Module\Diagnostic; namespace Friendica\Module\Debug;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\Installer; use Friendica\Core\Installer;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Friendica\Module\Diagnostic; namespace Friendica\Module\Debug;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -16,8 +16,8 @@ class Probe extends BaseModule
public static function content() public static function content()
{ {
if (!local_user()) { if (!local_user()) {
$e = new HTTPException\ForbiddenException(L10n::t("Only logged in users are permitted to perform a probing.")); $e = new HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));
$e->httpdesc = L10n::t("Public access denied."); $e->httpdesc = L10n::t('Public access denied.');
throw $e; throw $e;
} }

View file

@ -1,6 +1,6 @@
<?php <?php
namespace Friendica\Module\Diagnostic; namespace Friendica\Module\Debug;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -15,8 +15,8 @@ class WebFinger extends BaseModule
public static function content() public static function content()
{ {
if (!local_user()) { if (!local_user()) {
$e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t("Only logged in users are permitted to perform a probing.")); $e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));
$e->httpdesc = L10n::t("Public access denied."); $e->httpdesc = L10n::t('Public access denied.');
throw $e; throw $e;
} }

View file

@ -1,55 +0,0 @@
<?php
namespace Friendica\Module\Diagnostic;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Model;
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
*/
class ItemSource extends \Friendica\BaseModule
{
public static function content()
{
if (!is_site_admin()) {
return;
}
$a = self::getApp();
// @TODO: Replace with parameter from router
if (!empty($a->argv[1])) {
$guid = $a->argv[1];
}
$guid = defaults($_REQUEST['guid'], $guid);
$source = '';
$item_uri = '';
$item_id = '';
$terms = [];
if (!empty($guid)) {
$item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
$conversation = Model\Conversation::getByItemUri($item['uri']);
$item_id = $item['id'];
$item_uri = $item['uri'];
$source = $conversation['source'];
$terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
}
$tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
$o = Renderer::replaceMacros($tpl, [
'$guid' => ['guid', L10n::t('Item Guid'), $guid, ''],
'$source' => $source,
'$item_uri' => $item_uri,
'$item_id' => $item_id,
'$terms' => $terms,
]);
return $o;
}
}