Skip to content

Commit

Permalink
Make controllers callable
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Aug 30, 2021
1 parent 64d7245 commit a2ed4df
Show file tree
Hide file tree
Showing 100 changed files with 211 additions and 203 deletions.
2 changes: 1 addition & 1 deletion js/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@

/** @var JavaScriptMessagesController $controller */
$controller = $containerBuilder->get(JavaScriptMessagesController::class);
$controller->index();
$controller();
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct($response, Template $template, $browseForeigners, $r
$this->relation = $relation;
}

public function index(): void
public function __invoke(): void
{
$params = [
'db' => $_POST['db'] ?? null,
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/ChangeLogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class ChangeLogController extends AbstractController
{
public function index(): void
public function __invoke(): void
{
$this->response->disable();
$this->response->getHeader()->sendHttpHeaders();
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/CheckRelationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct($response, Template $template, Relation $relation)
$this->relation = $relation;
}

public function index(): void
public function __invoke(): void
{
global $db;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/ColumnController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($response, Template $template, $dbi)
$this->dbi = $dbi;
}

public function all(): void
public function __invoke(): void
{
if (! isset($_POST['db'], $_POST['table'])) {
$this->response->setRequestStatus(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct($response, Template $template, $db, $relation, $tran
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
Util::checkParameters(['db'], true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
$this->designerCommon = $designerCommon;
}

public function index(): void
public function __invoke(): void
{
global $db, $script_display_field, $tab_column, $tables_all_keys, $tables_pk_or_unique_keys;
global $success, $page, $message, $display_page, $selected_page, $tab_pos, $fullTableNames, $script_tables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct($response, Template $template, $db, Events $events,
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $db, $tables, $num_tables, $total_num_tables, $sub_part, $errors, $text_dir;
global $tooltip_truename, $tooltip_aliasname, $pos, $cfg, $errorUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct($response, Template $template, $db, $dbi)
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $db, $table, $tables, $num_tables, $total_num_tables, $cfg;
global $tooltip_truename, $tooltip_aliasname, $pos, $sub_part, $SESSION_KEY, $errorUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct($response, Template $template, $db, Privileges $priv
/**
* @param array $params Request parameters
*/
public function index(array $params): string
public function __invoke(array $params): string
{
global $cfg, $text_dir;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct($response, Template $template, $db, Relation $relati
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $db, $savedSearchList, $savedSearch, $currentSearchId;
global $sql_query, $goto, $sub_part, $tables, $num_tables, $total_num_tables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct($response, Template $template, $db, CheckUserPrivile
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part;
global $tooltip_truename, $tooltip_aliasname, $pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct($response, Template $template, $db, $dbi)
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $db, $errorUrl, $urlParams, $tables, $num_tables, $total_num_tables, $sub_part;
global $tooltip_truename, $tooltip_aliasname, $pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct($response, Template $template, $db, $dbi)
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $db, $sql_autocomplete;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/Database/SqlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct($response, Template $template, $db, SqlQueryForm $sq
$this->sqlQueryForm = $sqlQueryForm;
}

public function index(): void
public function __invoke(): void
{
global $goto, $back, $db, $cfg, $errorUrl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class SqlFormatController extends AbstractController
{
public function index(): void
public function __invoke(): void
{
$params = ['sql' => $_POST['sql'] ?? null];
$query = strlen((string) $params['sql']) > 0 ? $params['sql'] : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct($response, Template $template, $db, Tracking $tracki
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $db, $text_dir, $urlParams, $tables, $num_tables;
global $total_num_tables, $sub_part, $pos, $data, $cfg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct($response, Template $template, $db, $dbi)
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part;
global $tooltip_truename, $tooltip_aliasname, $pos;
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/DatabaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

final class DatabaseController extends AbstractController
{
public function all(): void
public function __invoke(): void
{
global $dblist;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/ErrorReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct(
$this->errorHandler = $errorHandler;
}

public function index(): void
public function __invoke(): void
{
global $cfg;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/GisDataEditorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class GisDataEditorController extends AbstractController
{
public function index(): void
public function __invoke(): void
{
global $gis_data, $gis_types, $start, $geom_type, $gis_obj, $srid, $wkt, $wkt_with_zero;
global $result, $visualizationSettings, $data, $visualization, $open_layers, $geom_count, $dbi;
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct($response, Template $template, Import $import, Sql $
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $collation_connection, $db, $import_type, $table, $goto, $display_query;
global $format, $local_import_file, $ajax_reload, $import_text, $sql_query, $message, $errorUrl, $urlParams;
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/ImportStatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(Template $template)
$this->template = $template;
}

public function index(): void
public function __invoke(): void
{
global $SESSION_KEY, $upload_id, $plugins, $timestamp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
$this->setMessages();
}

public function index(): void
public function __invoke(): void
{
echo 'var Messages = ' . json_encode($this->messages) . ';';
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/LicenseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
class LicenseController extends AbstractController
{
public function index(): void
public function __invoke(): void
{
$this->response->disable();
$this->response->header('Content-type: text/plain; charset=utf-8');
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/LintController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
class LintController extends AbstractController
{
public function index(): void
public function __invoke(): void
{
$params = [
'sql_query' => $_POST['sql_query'] ?? null,
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/LogoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class LogoutController
{
public function index(): void
public function __invoke(): void
{
global $auth_plugin, $token_mismatch;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/NavigationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
$this->relation = $relation;
}

public function index(): void
public function __invoke(): void
{
if (! $this->response->isAjax()) {
$this->response->addHTML(
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/NormalizationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct($response, Template $template, Normalization $normal
$this->normalization = $normalization;
}

public function index(): void
public function __invoke(): void
{
global $db, $table;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/PhpInfoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class PhpInfoController extends AbstractController
{
public function index(): void
public function __invoke(): void
{
global $cfg;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
$this->config = $config;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $cf, $error, $tabHash, $hash, $server, $route;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
$this->config = $config;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $cf, $error, $tabHash, $hash, $server, $route;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
$this->config = $config;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $cf, $error, $tabHash, $hash, $server, $route;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
$this->config = $config;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $cf, $error, $tabHash, $hash, $server, $route;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct(
$this->config = $config;
}

public function index(): void
public function __invoke(): void
{
global $cf, $error, $filename, $json, $lang;
global $new_config, $return_url, $form_display, $all_ok, $params, $query, $route;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
$this->config = $config;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $cf, $error, $tabHash, $hash, $server, $route;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
$this->config = $config;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $cf, $error, $tabHash, $hash, $server, $route;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct($response, Template $template, Relation $relation)
$this->relation = $relation;
}

public function index(): void
public function __invoke(): void
{
global $cfg, $route;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/SchemaExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(Export $export, Relation $relation)
$this->relation = $relation;
}

public function index(): void
public function __invoke(): void
{
global $cfgRelation;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/Server/BinlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct($response, Template $template, $dbi)
);
}

public function index(): void
public function __invoke(): void
{
global $cfg, $errorUrl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(
$this->collations = $collations ?? Charsets::getCollations($this->dbi, $cfg['Server']['DisableIS']);
}

public function index(): void
public function __invoke(): void
{
global $errorUrl;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/Server/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct($response, Template $template, Options $export, $dbi
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $db, $table, $sql_query, $num_tables, $unlim_num_rows;
global $tmp_select, $select_item, $errorUrl;
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/Server/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct($response, Template $template, $dbi)
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $db, $table, $SESSION_KEY, $cfg, $errorUrl;

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Controllers/Server/PluginsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct($response, Template $template, Plugins $plugins, $db
$this->dbi = $dbi;
}

public function index(): void
public function __invoke(): void
{
global $errorUrl;

Expand Down

0 comments on commit a2ed4df

Please sign in to comment.