diff options
author | ffflabs <amenadiel@gmail.com> | 2020-03-05 21:28:55 +0300 |
---|---|---|
committer | ffflabs <amenadiel@gmail.com> | 2020-03-05 21:28:55 +0300 |
commit | cb2fe756114c2cc7738f2caafe86054728b43b7b (patch) | |
tree | 0f2d04c92191e5afc26d6bde85654b5c3fa2de3d | |
parent | bef5d9af05715d6ec7d54b614bab312c383cf44f (diff) |
reverting type hinting where it broke stuff
40 files changed, 623 insertions, 618 deletions
diff --git a/src/classes/ContainerUtils.php b/src/classes/ContainerUtils.php index 4c3d6403..92a91752 100644 --- a/src/classes/ContainerUtils.php +++ b/src/classes/ContainerUtils.php @@ -288,6 +288,22 @@ class ContainerUtils return $destinationurl; } + /** + * Adds a flash message to the session that will be displayed on the next request. + * + * @param mixed $content msg content (can be object, array, etc) + * @param string $key The key to associate with the message. Defaults to the stack + * trace of the closure or method that called addFlassh + */ + public function addFlash($content, $key = ''): void + { + if ('' === $key) { + $key = self::getBackTrace(); + } + // $this->dump(__METHOD__ . ': addMessage ' . $key . ' ' . json_encode($content)); + + $this->container->flash->addMessage($key, $content); + } /** * Gets the destination with the last active tab selected for that controller diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index 280ab338..c7dc4e2e 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -222,7 +222,7 @@ class BaseController /** * Display a table of data. * - * @param \PHPPgAdmin\ADORecordSet|\PHPPgAdmin\ArrayRecordSet $tabledata a set of data to be formatted + * @param \ADORecordSet|\PHPPgAdmin\ArrayRecordSet $tabledata a set of data to be formatted * @param array $columns An associative array of columns to be displayed: * @param array $actions Actions that can be performed on each object: * @param string $place Place where the $actions are displayed. Like 'display-browse', diff --git a/src/controllers/DisplayController.php b/src/controllers/DisplayController.php index 95732d33..b444529a 100644 --- a/src/controllers/DisplayController.php +++ b/src/controllers/DisplayController.php @@ -146,6 +146,7 @@ class DisplayController extends BaseController ); $_REQUEST['query'] = $query; $_REQUEST['return'] = 'selectrows'; + $this->prtrace($query); } //$object = $this->setIfIsset($object, $_REQUEST[$subject]); @@ -163,6 +164,8 @@ class DisplayController extends BaseController $this->printTabs($subject, $tabsPosition); [$query, $title, $type] = $this->getQueryTitleAndType($data, $object); + $this->prtrace($query); + $this->printTitle($this->lang[$title]); //$this->prtrace($subject, $object, $query, $_SESSION['sqlquery']); @@ -509,7 +512,7 @@ class DisplayController extends BaseController /** * Print table header cells. * - * @param \PHPPgAdmin\ADORecordSet $resultset set of results from getRow operation + * @param \ADORecordSet $resultset set of results from getRow operation * @param array|bool $args - associative array for sort link parameters, or false if there isn't any * @param bool $withOid either to display OIDs or not */ @@ -555,7 +558,7 @@ class DisplayController extends BaseController /** * Print table rows. * - * @param \PHPPgAdmin\ADORecordSet $resultset The resultset + * @param \ADORecordSet $resultset The resultset * @param array $fkey_information The fkey information * @param bool $withOid either to display OIDs or not */ @@ -960,16 +963,17 @@ class DisplayController extends BaseController // Check that the key is actually in the result set. This can occur for select // operations where the key fields aren't part of the select. XXX: We should // be able to support this, somehow. - foreach ($key as $v) { - // If a key column is not found in the record set, then we - // can't use the key. - if (!\array_key_exists($v, $resultset->fields)) { - $key = []; - - break; + if (\is_iterable($key)) { + foreach ($key as $v) { + // If a key column is not found in the record set, then we + // can't use the key. + if (!\array_key_exists($v, $resultset->fields)) { + $key = []; + + break; + } } } - $buttons = [ 'edit' => [ 'content' => $this->lang['stredit'], @@ -1019,7 +1023,7 @@ class DisplayController extends BaseController return [$actions, $key]; } - private function _printResultsTableActionButtons(\PHPPgAdmin\ADORecordSet $resultset, $key, $actions, bool $display_action_column, string $buttonclass): void + private function _printResultsTableActionButtons(\ADORecordSet $resultset, $key, $actions, bool $display_action_column, string $buttonclass): void { if (!$display_action_column) { return; @@ -1072,7 +1076,7 @@ class DisplayController extends BaseController /** * @param bool[] $printvalOpts */ - private function _printFKLinks(\PHPPgAdmin\ADORecordSet $resultset, array $fkey_information, $k, $v, array &$printvalOpts): void + private function _printFKLinks(\ADORecordSet $resultset, array $fkey_information, $k, $v, array &$printvalOpts): void { if ((null === $v) || !isset($fkey_information['byfield'][$k])) { return; diff --git a/src/controllers/FunctionsController.php b/src/controllers/FunctionsController.php index d76d66f8..853d90fd 100644 --- a/src/controllers/FunctionsController.php +++ b/src/controllers/FunctionsController.php @@ -114,17 +114,17 @@ class FunctionsController extends BaseController $funcs = $data->getFunctions(); $columns = [ - 'function' => [ + 'function' => [ 'title' => $this->lang['strfunction'], 'field' => Decorator::field('proproto'), - 'url' => self::SUBFOLDER . "/redirect/function?action=properties&{$this->misc->href}&", - 'vars' => ['function' => 'proproto', 'function_oid' => 'prooid'], + 'url' => self::SUBFOLDER . "/redirect/function?action=properties&{$this->misc->href}&", + 'vars' => ['function' => 'proproto', 'function_oid' => 'prooid'], ], - 'returns' => [ + 'returns' => [ 'title' => $this->lang['strreturns'], 'field' => Decorator::field('proreturns'), ], - 'owner' => [ + 'owner' => [ 'title' => $this->lang['strowner'], 'field' => Decorator::field('proowner'), ], @@ -132,10 +132,10 @@ class FunctionsController extends BaseController 'title' => $this->lang['strproglanguage'], 'field' => Decorator::field('prolanguage'), ], - 'actions' => [ + 'actions' => [ 'title' => $this->lang['stractions'], ], - 'comment' => [ + 'comment' => [ 'title' => $this->lang['strcomment'], 'field' => Decorator::field('procomment'), ], @@ -144,43 +144,43 @@ class FunctionsController extends BaseController $actions = [ 'multiactions' => [ 'keycols' => ['function' => 'proproto', 'function_oid' => 'prooid'], - 'url' => 'functions', + 'url' => 'functions', ], - 'alter' => [ + 'alter' => [ 'content' => $this->lang['stralter'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'functions', + 'url' => 'functions', 'urlvars' => [ - 'action' => 'edit', - 'function' => Decorator::field('proproto'), + 'action' => 'edit', + 'function' => Decorator::field('proproto'), 'function_oid' => Decorator::field('prooid'), ], ], ], ], - 'drop' => [ + 'drop' => [ 'multiaction' => 'confirm_drop', - 'content' => $this->lang['strdrop'], - 'attr' => [ + 'content' => $this->lang['strdrop'], + 'attr' => [ 'href' => [ - 'url' => 'functions', + 'url' => 'functions', 'urlvars' => [ - 'action' => 'confirm_drop', - 'function' => Decorator::field('proproto'), + 'action' => 'confirm_drop', + 'function' => Decorator::field('proproto'), 'function_oid' => Decorator::field('prooid'), ], ], ], ], - 'privileges' => [ + 'privileges' => [ 'content' => $this->lang['strprivileges'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'privileges', + 'url' => 'privileges', 'urlvars' => [ - 'subject' => 'function', - 'function' => Decorator::field('proproto'), + 'subject' => 'function', + 'function' => Decorator::field('proproto'), 'function_oid' => Decorator::field('prooid'), ], ], @@ -207,15 +207,15 @@ class FunctionsController extends BaseController $reqvars = $this->misc->getRequestVars('function'); $attrs = [ - 'text' => $proto, - 'icon' => 'Function', + 'text' => $proto, + 'icon' => 'Function', 'toolTip' => Decorator::field('procomment'), - 'action' => Decorator::redirecturl( + 'action' => Decorator::redirecturl( 'redirect', $reqvars, [ - 'action' => 'properties', - 'function' => $proto, + 'action' => 'properties', + 'function' => $proto, 'function_oid' => Decorator::field('prooid'), ] ), @@ -489,8 +489,8 @@ class FunctionsController extends BaseController $this->printTabs('function', 'export'); $this->printTitle($this->lang['strproperties'], 'pg.function'); - $fname = \str_replace(' ', '', $f); - $funcdata = $data->getFunctionDef($function_oid); + $fname = \str_replace(' ', '', $f); + $funcdata = $data->getFunctionDef($function_oid); $func_full = ''; if (0 >= $funcdata->recordCount()) { @@ -545,7 +545,7 @@ class FunctionsController extends BaseController $this->printTitle($this->lang['strproperties'], 'pg.function'); $this->printMsg($msg); - $funcdata = $data->getFunction($_REQUEST['function_oid']); + $funcdata = $data->getFunction($_REQUEST['function_oid']); $func_full = ''; if (0 >= $funcdata->recordCount()) { @@ -562,7 +562,7 @@ class FunctionsController extends BaseController } $funcdata->fields['proretset'] = $data->phpBool($funcdata->fields['proretset']); - $func_full = $funcdata->fields['proname'] . '(' . $funcdata->fields['proarguments'] . ')'; + $func_full = $funcdata->fields['proname'] . '(' . $funcdata->fields['proarguments'] . ')'; echo '<table style="width: 95%">' . \PHP_EOL; @@ -668,7 +668,7 @@ class FunctionsController extends BaseController echo '</form>' . \PHP_EOL; } else { if (\is_array($_POST['function_oid'])) { - $msg = ''; + $msg = ''; $status = $data->beginTransaction(); if (0 === $status) { @@ -743,8 +743,8 @@ class FunctionsController extends BaseController $_POST['formComment'] = $this->getPostParam('formComment', ''); - $types = $data->getTypes(true, true, true); - $langs = $data->getLanguages(true); + $types = $data->getTypes(true, true, true); + $langs = $data->getLanguages(true); $fnlang = \mb_strtolower($_POST['formLanguage']); switch ($fnlang) { @@ -785,7 +785,7 @@ class FunctionsController extends BaseController $szArguments = '<td class="data1"><input name="formArguments" style="width:100%;" size="16" value="' . \htmlspecialchars($_POST['formArguments']) . '" /></td>'; - $szSetOfSelected = ''; + $szSetOfSelected = ''; $szNotSetOfSelected = ''; if ('' === $_POST['formSetOf']) { @@ -803,7 +803,7 @@ class FunctionsController extends BaseController // Create string array type selector - $szArraySelected = ''; + $szArraySelected = ''; $szNotArraySelected = ''; if ('' === $_POST['formArray']) { @@ -845,8 +845,8 @@ class FunctionsController extends BaseController $szLanguage .= '</td>'; $szJSArguments = "<tr><th class=\"data\" colspan=\"7\">{$this->lang['strarguments']}</th></tr>"; - $arrayModes = ['IN', 'OUT', 'INOUT']; - $szModes = '<select name="formArgModes[]" style="width:100%;">'; + $arrayModes = ['IN', 'OUT', 'INOUT']; + $szModes = '<select name="formArgModes[]" style="width:100%;">'; foreach ($arrayModes as $pV) { $szModes .= "<option value=\"{$pV}\">{$pV}</option>"; @@ -1048,44 +1048,44 @@ class FunctionsController extends BaseController if ('functions-properties' === $place) { $navlinks = [ 'showall' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'functions', + 'url' => 'functions', 'urlvars' => [ - 'server' => $_REQUEST['server'], + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], + 'schema' => $_REQUEST['schema'], ], ], ], 'content' => $this->lang['strshowallfunctions'], ], - 'alter' => [ - 'attr' => [ + 'alter' => [ + 'attr' => [ 'href' => [ - 'url' => 'functions', + 'url' => 'functions', 'urlvars' => [ - 'action' => 'edit', - 'server' => $_REQUEST['server'], - 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], - 'function' => $_REQUEST['function'], + 'action' => 'edit', + 'server' => $_REQUEST['server'], + 'database' => $_REQUEST['database'], + 'schema' => $_REQUEST['schema'], + 'function' => $_REQUEST['function'], 'function_oid' => $_REQUEST['function_oid'], ], ], ], 'content' => $this->lang['stralter'], ], - 'drop' => [ - 'attr' => [ + 'drop' => [ + 'attr' => [ 'href' => [ - 'url' => 'functions', + 'url' => 'functions', 'urlvars' => [ - 'action' => 'confirm_drop', - 'server' => $_REQUEST['server'], - 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], - 'function' => $func_full, + 'action' => 'confirm_drop', + 'server' => $_REQUEST['server'], + 'database' => $_REQUEST['database'], + 'schema' => $_REQUEST['schema'], + 'function' => $func_full, 'function_oid' => $_REQUEST['function_oid'], ], ], @@ -1095,45 +1095,45 @@ class FunctionsController extends BaseController ]; } elseif ('functions-functions' === $place) { $navlinks = [ - 'createpl' => [ - 'attr' => [ + 'createpl' => [ + 'attr' => [ 'href' => [ - 'url' => 'functions', + 'url' => 'functions', 'urlvars' => [ - 'action' => 'create', - 'server' => $_REQUEST['server'], + 'action' => 'create', + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], + 'schema' => $_REQUEST['schema'], ], ], ], 'content' => $this->lang['strcreateplfunction'], ], 'createinternal' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'functions', + 'url' => 'functions', 'urlvars' => [ - 'action' => 'create', + 'action' => 'create', 'language' => 'internal', - 'server' => $_REQUEST['server'], + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], + 'schema' => $_REQUEST['schema'], ], ], ], 'content' => $this->lang['strcreateinternalfunction'], ], - 'createc' => [ - 'attr' => [ + 'createc' => [ + 'attr' => [ 'href' => [ - 'url' => 'functions', + 'url' => 'functions', 'urlvars' => [ - 'action' => 'create', + 'action' => 'create', 'language' => 'C', - 'server' => $_REQUEST['server'], + 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], - 'schema' => $_REQUEST['schema'], + 'schema' => $_REQUEST['schema'], ], ], ], @@ -1154,9 +1154,9 @@ class FunctionsController extends BaseController } else { $args_arr = \explode(', ', $fndata->fields['proarguments']); } - $names_arr = $data->phpArray($fndata->fields['proargnames']); - $modes_arr = $data->phpArray($fndata->fields['proargmodes']); - $args = ''; + $names_arr = $data->phpArray($fndata->fields['proargnames']); + $modes_arr = $data->phpArray($fndata->fields['proargmodes']); + $args = ''; $args_arr_size = \count($args_arr); for ($i = 0; $i < $args_arr_size; ++$i) { @@ -1228,12 +1228,12 @@ class FunctionsController extends BaseController */ private function _buildJSRows($szArgs) { - $arrayModes = ['IN', 'OUT', 'INOUT']; - $arrayArgs = \explode(',', $szArgs); + $arrayModes = ['IN', 'OUT', 'INOUT']; + $arrayArgs = \explode(',', $szArgs); $arrayProperArgs = []; - $nC = 0; - $szReturn = ''; - $szMode = []; + $nC = 0; + $szReturn = ''; + $szMode = []; foreach ($arrayArgs as $pV) { $arrayWords = \explode(' ', $pV); @@ -1245,14 +1245,14 @@ class FunctionsController extends BaseController $szArgName = \array_shift($arrayWords); if (false === \mb_strpos($arrayWords[\count($arrayWords) - 1], '[]')) { - $szArgType = \implode(' ', $arrayWords); + $szArgType = \implode(' ', $arrayWords); $bArgIsArray = 'false'; } else { - $szArgType = \str_replace('[]', '', \implode(' ', $arrayWords)); + $szArgType = \str_replace('[]', '', \implode(' ', $arrayWords)); $bArgIsArray = 'true'; } $arrayProperArgs[] = [$szMode, $szArgName, $szArgType, $bArgIsArray]; - $subfolder = self::SUBFOLDER; + $subfolder = self::SUBFOLDER; // $this->prtrace($subfolder); $szReturn .= '<script type="text/javascript">'; $szReturn .= "RebuildArgTR('{$szMode}','{$szArgName}','{$szArgType}',new Boolean({$bArgIsArray},{$subfolder}));"; @@ -1267,8 +1267,8 @@ class FunctionsController extends BaseController { $data = $this->misc->getDatabaseAccessor(); - $arrayModes = ['IN', 'OUT', 'INOUT']; - $arrayTypes = $data->getTypes(true, true, true); + $arrayModes = ['IN', 'OUT', 'INOUT']; + $arrayTypes = $data->getTypes(true, true, true); $arrayPTypes = []; $arrayPModes = []; @@ -1290,7 +1290,7 @@ class FunctionsController extends BaseController /** * Get the concatenated arguments for a function. * - * @param \PHPPgAdmin\ADORecordSet $funcdata The funcdata record + * @param \ADORecordSet $funcdata The funcdata record * * @return string The arguments of the function */ @@ -1304,9 +1304,9 @@ class FunctionsController extends BaseController } else { $args_arr = \explode(', ', $funcdata->fields['proarguments']); } - $names_arr = $data->phpArray($funcdata->fields['proargnames']); - $modes_arr = $data->phpArray($funcdata->fields['proargmodes']); - $args = ''; + $names_arr = $data->phpArray($funcdata->fields['proargnames']); + $modes_arr = $data->phpArray($funcdata->fields['proargmodes']); + $args = ''; $args_arr_size = \count($args_arr); for ($i = 0; $i < $args_arr_size; ++$i) { diff --git a/src/controllers/RolesController.php b/src/controllers/RolesController.php index 2ea77e51..0ac18574 100644 --- a/src/controllers/RolesController.php +++ b/src/controllers/RolesController.php @@ -97,7 +97,7 @@ class RolesController extends BaseController { $data = $this->misc->getDatabaseAccessor(); - $lang = $this->lang; + $lang = $this->lang; $renderRoleConnLimit = static function ($val) use ($lang) { return '-1' === $val ? $lang['strnolimit'] : \htmlspecialchars($val); }; @@ -113,54 +113,54 @@ class RolesController extends BaseController $roles = $data->getRoles(); $columns = [ - 'role' => [ + 'role' => [ 'title' => $this->lang['strrole'], 'field' => Decorator::field('rolname'), - 'url' => self::SUBFOLDER . "/redirect/role?action=properties&{$this->misc->href}&", - 'vars' => ['rolename' => 'rolname'], + 'url' => self::SUBFOLDER . "/redirect/role?action=properties&{$this->misc->href}&", + 'vars' => ['rolename' => 'rolname'], ], - 'group' => [ + 'group' => [ 'title' => $this->lang['strgroup'], 'field' => Decorator::field('group'), ], - 'superuser' => [ + 'superuser' => [ 'title' => $this->lang['strsuper'], 'field' => Decorator::field('rolsuper'), - 'type' => 'yesno', + 'type' => 'yesno', ], - 'createdb' => [ + 'createdb' => [ 'title' => $this->lang['strcreatedb'], 'field' => Decorator::field('rolcreatedb'), - 'type' => 'yesno', + 'type' => 'yesno', ], 'createrole' => [ 'title' => $this->lang['strcancreaterole'], 'field' => Decorator::field('rolcreaterole'), - 'type' => 'yesno', + 'type' => 'yesno', ], - 'inherits' => [ + 'inherits' => [ 'title' => $this->lang['strinheritsprivs'], 'field' => Decorator::field('rolinherit'), - 'type' => 'yesno', + 'type' => 'yesno', ], - 'canloging' => [ + 'canloging' => [ 'title' => $this->lang['strcanlogin'], 'field' => Decorator::field('rolcanlogin'), - 'type' => 'yesno', + 'type' => 'yesno', ], - 'connlimit' => [ - 'title' => $this->lang['strconnlimit'], - 'field' => Decorator::field('rolconnlimit'), - 'type' => 'callback', + 'connlimit' => [ + 'title' => $this->lang['strconnlimit'], + 'field' => Decorator::field('rolconnlimit'), + 'type' => 'callback', 'params' => ['function' => $renderRoleConnLimit], ], - 'expires' => [ - 'title' => $this->lang['strexpires'], - 'field' => Decorator::field('rolvaliduntil'), - 'type' => 'callback', + 'expires' => [ + 'title' => $this->lang['strexpires'], + 'field' => Decorator::field('rolvaliduntil'), + 'type' => 'callback', 'params' => ['function' => $renderRoleExpires, 'null' => $this->lang['strnever']], ], - 'actions' => [ + 'actions' => [ 'title' => $this->lang['stractions'], ], ]; @@ -168,23 +168,23 @@ class RolesController extends BaseController $actions = [ 'alter' => [ 'content' => $this->lang['stralter'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'roles', + 'url' => 'roles', 'urlvars' => [ - 'action' => 'alter', + 'action' => 'alter', 'rolename' => Decorator::field('rolname'), ], ], ], ], - 'drop' => [ + 'drop' => [ 'content' => $this->lang['strdrop'], - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'roles', + 'url' => 'roles', 'urlvars' => [ - 'action' => 'confirm_drop', + 'action' => 'confirm_drop', 'rolename' => Decorator::field('rolname'), ], ], @@ -196,9 +196,9 @@ class RolesController extends BaseController $navlinks = [ 'create' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'roles', + 'url' => 'roles', 'urlvars' => [ 'action' => 'create', 'server' => $_REQUEST['server'], @@ -383,13 +383,13 @@ class RolesController extends BaseController return; } - $server_info = $this->misc->getServerInfo(); - $canRename = $data->hasUserRename() && ($_REQUEST['rolename'] !== $server_info['username']); - $roledata->fields['rolsuper'] = $data->phpBool($roledata->fields['rolsuper']); - $roledata->fields['rolcreatedb'] = $data->phpBool($roledata->fields['rolcreatedb']); + $server_info = $this->misc->getServerInfo(); + $canRename = $data->hasUserRename() && ($_REQUEST['rolename'] !== $server_info['username']); + $roledata->fields['rolsuper'] = $data->phpBool($roledata->fields['rolsuper']); + $roledata->fields['rolcreatedb'] = $data->phpBool($roledata->fields['rolcreatedb']); $roledata->fields['rolcreaterole'] = $data->phpBool($roledata->fields['rolcreaterole']); - $roledata->fields['rolinherit'] = $data->phpBool($roledata->fields['rolinherit']); - $roledata->fields['rolcanlogin'] = $data->phpBool($roledata->fields['rolcanlogin']); + $roledata->fields['rolinherit'] = $data->phpBool($roledata->fields['rolinherit']); + $roledata->fields['rolcanlogin'] = $data->phpBool($roledata->fields['rolcanlogin']); $this->_adjustPostVars($roledata, $canRename); @@ -569,11 +569,11 @@ class RolesController extends BaseController $roledata = $data->getRole($_REQUEST['rolename']); if (0 < $roledata->recordCount()) { - $roledata->fields['rolsuper'] = $data->phpBool($roledata->fields['rolsuper']); - $roledata->fields['rolcreatedb'] = $data->phpBool($roledata->fields['rolcreatedb']); + $roledata->fields['rolsuper'] = $data->phpBool($roledata->fields['rolsuper']); + $roledata->fields['rolcreatedb'] = $data->phpBool($roledata->fields['rolcreatedb']); $roledata->fields['rolcreaterole'] = $data->phpBool($roledata->fields['rolcreaterole']); - $roledata->fields['rolinherit'] = $data->phpBool($roledata->fields['rolinherit']); - $roledata->fields['rolcanlogin'] = $data->phpBool($roledata->fields['rolcanlogin']); + $roledata->fields['rolinherit'] = $data->phpBool($roledata->fields['rolinherit']); + $roledata->fields['rolcanlogin'] = $data->phpBool($roledata->fields['rolcanlogin']); echo '<table>' . \PHP_EOL; echo "\t<tr>\n\t\t<th class=\"data\" style=\"width: 130px\">Description</th>" . \PHP_EOL; @@ -636,9 +636,9 @@ class RolesController extends BaseController $navlinks = [ 'showall' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'roles', + 'url' => 'roles', 'urlvars' => [ 'server' => $_REQUEST['server'], ], @@ -646,26 +646,26 @@ class RolesController extends BaseController ], 'content' => $this->lang['strshowallroles'], ], - 'alter' => [ - 'attr' => [ + 'alter' => [ + 'attr' => [ 'href' => [ - 'url' => 'roles', + 'url' => 'roles', 'urlvars' => [ - 'action' => 'alter', - 'server' => $_REQUEST['server'], + 'action' => 'alter', + 'server' => $_REQUEST['server'], 'rolename' => $_REQUEST['rolename'], ], ], ], 'content' => $this->lang['stralter'], ], - 'drop' => [ - 'attr' => [ + 'drop' => [ + 'attr' => [ 'href' => [ - 'url' => 'roles', + 'url' => 'roles', 'urlvars' => [ - 'action' => 'confirm_drop', - 'server' => $_REQUEST['server'], + 'action' => 'confirm_drop', + 'server' => $_REQUEST['server'], 'rolename' => $_REQUEST['rolename'], ], ], @@ -691,7 +691,7 @@ class RolesController extends BaseController $server_info = $this->misc->getServerInfo(); - $roledata = $data->getRole($server_info['username']); + $roledata = $data->getRole($server_info['username']); $_REQUEST['rolename'] = $server_info['username']; $this->printTrail('role'); @@ -699,10 +699,10 @@ class RolesController extends BaseController $this->printMsg($msg); if (0 < $roledata->recordCount()) { - $roledata->fields['rolsuper'] = $data->phpBool($roledata->fields['rolsuper']); - $roledata->fields['rolcreatedb'] = $data->phpBool($roledata->fields['rolcreatedb']); + $roledata->fields['rolsuper'] = $data->phpBool($roledata->fields['rolsuper']); + $roledata->fields['rolcreatedb'] = $data->phpBool($roledata->fields['rolcreatedb']); $roledata->fields['rolcreaterole'] = $data->phpBool($roledata->fields['rolcreaterole']); - $roledata->fields['rolinherit'] = $data->phpBool($roledata->fields['rolinherit']); + $roledata->fields['rolinherit'] = $data->phpBool($roledata->fields['rolinherit']); echo '<table>' . \PHP_EOL; echo "\t<tr>\n\t\t<th class=\"data\">{$this->lang['strname']}</th>" . \PHP_EOL; echo "\t\t<th class=\"data\">{$this->lang['strsuper']}</th>" . \PHP_EOL; @@ -727,9 +727,9 @@ class RolesController extends BaseController } $this->printNavLinks(['changepassword' => [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'roles', + 'url' => 'roles', 'urlvars' => [ 'action' => 'confchangepassword', 'server' => $_REQUEST['server'], @@ -797,7 +797,7 @@ class RolesController extends BaseController /** * Adjusts the content of the $_POST superglobal according to role data. * - * @param \PHPPgAdmin\ADORecordSet $roledata The roledata + * @param \ADORecordSet $roledata The roledata * @param bool $canRename Indicates if role can be renamed */ private function _adjustPostVars($roledata, $canRename): void @@ -831,8 +831,8 @@ class RolesController extends BaseController } $_POST['formConnLimit'] = '-1' === $roledata->fields['rolconnlimit'] ? '' : $roledata->fields['rolconnlimit']; - $_POST['formExpires'] = 'infinity' === $roledata->fields['rolvaliduntil'] ? '' : $roledata->fields['rolvaliduntil']; - $_POST['formPassword'] = ''; + $_POST['formExpires'] = 'infinity' === $roledata->fields['rolvaliduntil'] ? '' : $roledata->fields['rolvaliduntil']; + $_POST['formPassword'] = ''; } private function _populateMemberof($data): void diff --git a/src/database/ADOdbBase.php b/src/database/ADOdbBase.php index da862627..f7b5d33d 100644 --- a/src/database/ADOdbBase.php +++ b/src/database/ADOdbBase.php @@ -34,7 +34,7 @@ class ADOdbBase */ public function __construct(&$conn, $container, $server_info) { - $this->container = $container; + $this->container = $container; $this->server_info = $server_info; $this->lang = $container->get('lang'); @@ -55,7 +55,7 @@ class ADOdbBase * @param string $comment the comment to add * @param null|string $basetype * - * @return int|\PHPPgAdmin\ADORecordSet recordset of results or error code + * @return int|\ADORecordSet recordset of results or error code */ public function setComment($obj_type, $obj_name, $table, $comment, $basetype = null) { @@ -174,7 +174,8 @@ class ADOdbBase * * @param string $sql The SQL query to execute * - * @return int|\PHPPgAdmin\ADORecordSet A recordset or an error code + * @return int|\ADORecordSet A recordset or an error code + * (However, error code 0 means success WTF) */ public function execute($sql) { @@ -202,7 +203,7 @@ class ADOdbBase * * @param string $sql The SQL statement to be executed * - * @return int|\PHPPgAdmin\ADORecordSet A recordset or an error number + * @return int|\ADORecordSet A recordset or an error number */ public function selectSet($sql) { @@ -403,7 +404,7 @@ class ADOdbBase { $this->fieldClean($table); - $setClause = ''; + $setClause = ''; $whereClause = ''; // Populate the syntax arrays @@ -559,8 +560,8 @@ class ADOdbBase // Pick out array entries by carefully parsing. This is necessary in order // to cope with double quotes and commas, etc. - $elements = []; - $i = $j = 0; + $elements = []; + $i = $j = 0; $in_quotes = false; while (\mb_strlen($arr) > $i) { @@ -573,7 +574,7 @@ class ADOdbBase } elseif (',' === $char && !$in_quotes) { // Add text so far to the array $elements[] = \mb_substr($arr, $j, $i - $j); - $j = $i + 1; + $j = $i + 1; } ++$i; } @@ -587,9 +588,9 @@ class ADOdbBase $v = $elements[$i]; if (0 === \mb_strpos($v, '"')) { - $v = \mb_substr($v, 1, \mb_strlen($v) - 2); - $v = \str_replace('\\"', '"', $v); - $v = \str_replace('\\\\', '\\', $v); + $v = \mb_substr($v, 1, \mb_strlen($v) - 2); + $v = \str_replace('\\"', '"', $v); + $v = \str_replace('\\\\', '\\', $v); $elements[$i] = $v; } } diff --git a/src/database/Postgres.php b/src/database/Postgres.php index e36916e7..86bb5a98 100644 --- a/src/database/Postgres.php +++ b/src/database/Postgres.php @@ -43,11 +43,11 @@ class Postgres extends ADOdbBase public function __construct(&$conn, $container, $server_info) { //$this->prtrace('major_version :' . $this->major_version); - $this->conn = $conn; + $this->conn = $conn; $this->container = $container; - $this->lang = $container->get('lang'); - $this->conf = $container->get('conf'); + $this->lang = $container->get('lang'); + $this->conf = $container->get('conf'); $this->server_info = $server_info; } @@ -89,7 +89,7 @@ class Postgres extends ADOdbBase if (null === $this->help_page || null === $this->help_base) { $help_classname = '\PHPPgAdmin\Help\PostgresDoc' . \str_replace('.', '', $this->major_version); - $help_class = new $help_classname($this->conf, $this->major_version); + $help_class = new $help_classname($this->conf, $this->major_version); $this->help_page = $help_class->getHelpPage(); $this->help_base = $help_class->getHelpBase(); } @@ -183,7 +183,7 @@ class Postgres extends ADOdbBase * @param string $term The search term * @param string $filter The object type to restrict to ('' means no restriction) * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function findObject($term, $filter) { @@ -207,10 +207,10 @@ class Postgres extends ADOdbBase if (!$conf['show_system']) { // XXX: The mention of information_schema here is in the wrong place, but // it's the quickest fix to exclude the info schema from 7.4 - $where = " AND pn.nspname NOT LIKE \$_PATERN_\$pg\\_%\$_PATERN_\$ AND pn.nspname != 'information_schema'"; + $where = " AND pn.nspname NOT LIKE \$_PATERN_\$pg\\_%\$_PATERN_\$ AND pn.nspname != 'information_schema'"; $lan_where = 'AND pl.lanispl'; } else { - $where = ''; + $where = ''; $lan_where = ''; } @@ -383,7 +383,7 @@ class Postgres extends ADOdbBase * * @param bool $all True to get all languages, regardless of show_system * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getLanguages($all = false) { @@ -436,18 +436,18 @@ class Postgres extends ADOdbBase } // Build up each SQL statement, they can be multiline - $query_buf = null; - $query_start = 0; - $in_quote = 0; - $in_xcomment = 0; + $query_buf = null; + $query_start = 0; + $in_quote = 0; + $in_xcomment = 0; $bslash_count = 0; - $dol_quote = ''; - $paren_level = 0; - $len = 0; - $i = 0; - $prevlen = 0; - $thislen = 0; - $lineno = 0; + $dol_quote = ''; + $paren_level = 0; + $len = 0; + $i = 0; + $prevlen = 0; + $thislen = 0; + $lineno = 0; // Loop over each line in the file while (!\feof($fd)) { @@ -459,7 +459,7 @@ class Postgres extends ADOdbBase continue; } - $len = \mb_strlen($line); + $len = \mb_strlen($line); $query_start = 0; /** @@ -521,11 +521,11 @@ class Postgres extends ADOdbBase $line = \mb_substr($line, 0, $i); /* remove comment */ break; } - $pre = \mb_substr($line, 0, $i); - $post = \mb_substr($line, $i + 2 + $finishpos, $len); - $line = $pre . ' ' . $post; + $pre = \mb_substr($line, 0, $i); + $post = \mb_substr($line, $i + 2 + $finishpos, $len); + $line = $pre . ' ' . $post; $in_xcomment = 0; - $i = 0; + $i = 0; } } elseif ($in_xcomment) { $position = \mb_strpos(\mb_substr($line, $i, $len), '*/'); @@ -557,7 +557,7 @@ class Postgres extends ADOdbBase } elseif ('\'' === \mb_substr($line, $i, 1) || '"' === \mb_substr($line, $i, 1)) { $in_quote = \mb_substr($line, $i, 1); } elseif (!$dol_quote && $this->valid_dolquote(\mb_substr($line, $i))) { - $dol_end = \mb_strpos(\mb_substr($line, $i + 1), '$'); + $dol_end = \mb_strpos(\mb_substr($line, $i + 1), '$'); $dol_quote = \mb_substr($line, $i, $dol_end + 1); $this->advance_1($i, $prevlen, $thislen); @@ -615,7 +615,7 @@ class Postgres extends ADOdbBase } } } - $query_buf = null; + $query_buf = null; $query_start = $i + $thislen; } elseif (\preg_match('/^[_[:alpha:]]$/', \mb_substr($line, $i, 1))) { $sub = \mb_substr($line, $i, $thislen); @@ -697,7 +697,7 @@ class Postgres extends ADOdbBase * @param null|int $page_size The number of rows per page * @param int $max_pages (return-by-ref) The max number of pages in the relation * - * @return int|\PHPPgAdmin\ADORecordSet A recordset on success or an int with error code + * @return int|\ADORecordSet A recordset on success or an int with error code * - -1 transaction error * - -2 counting error * - -3 page or page_size invalid @@ -753,7 +753,7 @@ class Postgres extends ADOdbBase if ($this->hasReadOnlyQueries()) { $status = $this->execute('SET TRANSACTION READ ONLY'); - if (false !== $status) { + if ($status !== 0) { $this->rollbackTransaction(); return -5; @@ -801,7 +801,7 @@ class Postgres extends ADOdbBase } // Actually retrieve the rows, with offset and limit - $rs = $this->selectSet("SELECT * FROM ({$query}) AS sub {$orderby} LIMIT {$page_size} OFFSET " . ($page - 1) * $page_size); + $rs = $this->selectSet("SELECT * FROM ({$query}) AS sub {$orderby} LIMIT {$page_size} OFFSET " . ($page - 1) * $page_size); $status = $this->endTransaction(); if (false !== $status) { diff --git a/src/database/Postgres10.php b/src/database/Postgres10.php index 8d429552..5a97e59f 100644 --- a/src/database/Postgres10.php +++ b/src/database/Postgres10.php @@ -25,7 +25,7 @@ class Postgres10 extends Postgres96 /** * Return all tables in current database (and schema). * - * @return int|\PHPPgAdmin\ADORecordSet All tables, sorted alphabetically + * @return int|\ADORecordSet All tables, sorted alphabetically */ public function getTables() { diff --git a/src/database/Postgres11.php b/src/database/Postgres11.php index 8d3dfc8b..61410921 100644 --- a/src/database/Postgres11.php +++ b/src/database/Postgres11.php @@ -26,12 +26,12 @@ class Postgres11 extends Postgres10 * @param bool $all If true, will find all available functions, if false just those in search path * @param mixed $type If truthy, will return functions of type trigger * - * @return int|\PHPPgAdmin\ADORecordSet All functions + * @return int|\ADORecordSet All functions */ public function getFunctions($all = false, $type = null) { if ($all) { - $where = 'pg_catalog.pg_function_is_visible(p.oid)'; + $where = 'pg_catalog.pg_function_is_visible(p.oid)'; $distinct = 'DISTINCT ON (p.proname)'; if ($type) { @@ -40,7 +40,7 @@ class Postgres11 extends Postgres10 } else { $c_schema = $this->_schema; $this->clean($c_schema); - $where = "n.nspname = '{$c_schema}'"; + $where = "n.nspname = '{$c_schema}'"; $distinct = ''; } diff --git a/src/database/Postgres74.php b/src/database/Postgres74.php index 6b205925..b77bae04 100644 --- a/src/database/Postgres74.php +++ b/src/database/Postgres74.php @@ -20,13 +20,13 @@ class Postgres74 extends Postgres80 // List of all legal privileges that can be applied to different types // of objects. public $privlist = [ - 'table' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'RULE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], - 'view' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'RULE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], + 'table' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'RULE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], + 'view' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'RULE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], 'sequence' => ['SELECT', 'UPDATE', 'ALL PRIVILEGES'], 'database' => ['CREATE', 'TEMPORARY', 'ALL PRIVILEGES'], 'function' => ['EXECUTE', 'ALL PRIVILEGES'], 'language' => ['USAGE', 'ALL PRIVILEGES'], - 'schema' => ['CREATE', 'USAGE', 'ALL PRIVILEGES'], + 'schema' => ['CREATE', 'USAGE', 'ALL PRIVILEGES'], ]; // Database functions @@ -63,11 +63,11 @@ class Postgres74 extends Postgres80 * * @param null|string $currentdatabase * - * @return int|\PHPPgAdmin\ADORecordSet A list of databases, sorted alphabetically + * @return int|\ADORecordSet A list of databases, sorted alphabetically */ public function getDatabases($currentdatabase = null) { - $conf = $this->conf; + $conf = $this->conf; $server_info = $this->server_info; if (isset($conf['owned_only']) && $conf['owned_only'] && !$this->isSuperUser()) { @@ -110,7 +110,7 @@ class Postgres74 extends Postgres80 * @param string $term The search term * @param string $filter The object type to restrict to ('' means no restriction) * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function findObject($term, $filter) { @@ -135,10 +135,10 @@ class Postgres74 extends Postgres80 if (!$conf['show_system']) { // XXX: The mention of information_schema here is in the wrong place, but // it's the quickest fix to exclude the info schema from 7.4 - $where = " AND pn.nspname NOT LIKE 'pg\\\\_%' AND pn.nspname != 'information_schema'"; + $where = " AND pn.nspname NOT LIKE 'pg\\\\_%' AND pn.nspname != 'information_schema'"; $lan_where = 'AND pl.lanispl'; } else { - $where = ''; + $where = ''; $lan_where = ''; } @@ -258,7 +258,7 @@ class Postgres74 extends Postgres80 /** * Returns table locks information in the current database. * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getLocks() { @@ -324,7 +324,7 @@ class Postgres74 extends Postgres80 $oldtype, $comment ) { - $sql = ''; + $sql = ''; $status = $this->beginTransaction(); if (0 !== $status) { @@ -388,7 +388,7 @@ class Postgres74 extends Postgres80 * * @param string $table The name of the table * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTable($table) { @@ -429,7 +429,7 @@ class Postgres74 extends Postgres80 * * @param string $table the table where we are looking for fk * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getConstraintsWithFields($table) { @@ -496,7 +496,7 @@ class Postgres74 extends Postgres80 * * @param bool $all * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getSequences($all = false) { @@ -528,7 +528,7 @@ class Postgres74 extends Postgres80 * * @param int $function_oid function identifier * - * @return int|\PHPPgAdmin\ADORecordSet Function info + * @return int|\ADORecordSet Function info * * @internal param string The $func name of the function to retrieve */ @@ -568,7 +568,7 @@ class Postgres74 extends Postgres80 /** * Returns a list of all casts in the database. * - * @return int|\PHPPgAdmin\ADORecordSet All casts + * @return int|\ADORecordSet All casts */ public function getCasts() { @@ -661,7 +661,7 @@ class Postgres74 extends Postgres80 * Protected method which alter a table * SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION. * - * @param \PHPPgAdmin\ADORecordSet $tblrs The table recordSet returned by getTable() + * @param \ADORecordSet $tblrs The table recordSet returned by getTable() * @param string $name The new name for the table * @param string $owner The new owner for the table * @param string $schema The new schema for the table diff --git a/src/database/Postgres80.php b/src/database/Postgres80.php index 4ddc0883..f1afccb7 100644 --- a/src/database/Postgres80.php +++ b/src/database/Postgres80.php @@ -20,35 +20,35 @@ class Postgres80 extends Postgres81 // database encoding does not appear in this list, then its HTTP // encoding name is the same as its database encoding name. public $codemap = [ - 'ALT' => 'CP866', - 'EUC_CN' => 'GB2312', - 'EUC_JP' => 'EUC-JP', - 'EUC_KR' => 'EUC-KR', - 'EUC_TW' => 'EUC-TW', + 'ALT' => 'CP866', + 'EUC_CN' => 'GB2312', + 'EUC_JP' => 'EUC-JP', + 'EUC_KR' => 'EUC-KR', + 'EUC_TW' => 'EUC-TW', 'ISO_8859_5' => 'ISO-8859-5', 'ISO_8859_6' => 'ISO-8859-6', 'ISO_8859_7' => 'ISO-8859-7', 'ISO_8859_8' => 'ISO-8859-8', - 'JOHAB' => 'CP1361', - 'KOI8' => 'KOI8-R', - 'LATIN1' => 'ISO-8859-1', - 'LATIN2' => 'ISO-8859-2', - 'LATIN3' => 'ISO-8859-3', - 'LATIN4' => 'ISO-8859-4', + 'JOHAB' => 'CP1361', + 'KOI8' => 'KOI8-R', + 'LATIN1' => 'ISO-8859-1', + 'LATIN2' => 'ISO-8859-2', + 'LATIN3' => 'ISO-8859-3', + 'LATIN4' => 'ISO-8859-4', // The following encoding map is a known error in PostgreSQL < 7.2 // See the constructor for Postgres72. - 'LATIN5' => 'ISO-8859-5', - 'LATIN6' => 'ISO-8859-10', - 'LATIN7' => 'ISO-8859-13', - 'LATIN8' => 'ISO-8859-14', - 'LATIN9' => 'ISO-8859-15', - 'LATIN10' => 'ISO-8859-16', - 'SQL_ASCII' => 'US-ASCII', - 'TCVN' => 'CP1258', - 'UNICODE' => 'UTF-8', - 'WIN' => 'CP1251', - 'WIN874' => 'CP874', - 'WIN1256' => 'CP1256', + 'LATIN5' => 'ISO-8859-5', + 'LATIN6' => 'ISO-8859-10', + 'LATIN7' => 'ISO-8859-13', + 'LATIN8' => 'ISO-8859-14', + 'LATIN9' => 'ISO-8859-15', + 'LATIN10' => 'ISO-8859-16', + 'SQL_ASCII' => 'US-ASCII', + 'TCVN' => 'CP1258', + 'UNICODE' => 'UTF-8', + 'WIN' => 'CP1251', + 'WIN874' => 'CP874', + 'WIN1256' => 'CP1256', ]; /** @@ -56,11 +56,11 @@ class Postgres80 extends Postgres81 * * @param null|string $currentdatabase * - * @return int|\PHPPgAdmin\ADORecordSet A list of databases, sorted alphabetically + * @return int|\ADORecordSet A list of databases, sorted alphabetically */ public function getDatabases($currentdatabase = null) { - $conf = $this->conf; + $conf = $this->conf; $server_info = $this->server_info; if (isset($conf['owned_only']) && $conf['owned_only'] && !$this->isSuperUser()) { @@ -103,7 +103,7 @@ class Postgres80 extends Postgres81 /** * Return all schemas in the current database. * - * @return int|\PHPPgAdmin\ADORecordSet All schemas, sorted alphabetically + * @return int|\ADORecordSet All schemas, sorted alphabetically */ public function getSchemas() { @@ -131,7 +131,7 @@ class Postgres80 extends Postgres81 * * @param string $schema The name of the schema * - * @return int|\PHPPgAdmin\ADORecordSet Schema information + * @return int|\ADORecordSet Schema information */ public function getSchemaByName($schema) { @@ -154,7 +154,7 @@ class Postgres80 extends Postgres81 * @param string $username The username * @param string $password The new password * - * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful + * @return int|\ADORecordSet 0 if operation was successful */ public function changePassword($username, $password) { @@ -175,7 +175,7 @@ class Postgres80 extends Postgres81 * @param string $name The name of the aggregate * @param string $basetype The input data type of the aggregate * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getAggregate($name, $basetype) { @@ -259,7 +259,7 @@ class Postgres80 extends Postgres81 /** * Return all tables in current database (and schema). * - * @return int|\PHPPgAdmin\ADORecordSet All tables, sorted alphabetically + * @return int|\ADORecordSet All tables, sorted alphabetically */ public function getTables() { @@ -283,7 +283,7 @@ class Postgres80 extends Postgres81 * Protected method which alter a table * SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION. * - * @param \PHPPgAdmin\ADORecordSet $tblrs The table recordSet returned by getTable() + * @param \ADORecordSet $tblrs The table recordSet returned by getTable() * @param string $name The new name for the table * @param string $owner The new owner for the table * @param string $schema The new schema for the table @@ -334,7 +334,7 @@ class Postgres80 extends Postgres81 * Protected method which alter a view * SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION. * - * @param \PHPPgAdmin\ADORecordSet $vwrs The view recordSet returned by getView() + * @param \ADORecordSet $vwrs The view recordSet returned by getView() * @param string $name The new name for the view * @param string $owner The new owner for the view * @param string $schema The view schema @@ -380,7 +380,7 @@ class Postgres80 extends Postgres81 * Protected method which alter a sequence * SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence recordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence recordSet returned by getSequence() * @param string $name The new name for the sequence * @param string $comment The comment on the sequence * @param string $owner The new owner for the sequence diff --git a/src/database/Postgres81.php b/src/database/Postgres81.php index 39203208..a01686e8 100644 --- a/src/database/Postgres81.php +++ b/src/database/Postgres81.php @@ -19,13 +19,13 @@ class Postgres81 extends Postgres82 // List of all legal privileges that can be applied to different types // of objects. public $privlist = [ - 'table' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'RULE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], - 'view' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'RULE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], - 'sequence' => ['SELECT', 'UPDATE', 'ALL PRIVILEGES'], - 'database' => ['CREATE', 'TEMPORARY', 'ALL PRIVILEGES'], - 'function' => ['EXECUTE', 'ALL PRIVILEGES'], - 'language' => ['USAGE', 'ALL PRIVILEGES'], - 'schema' => ['CREATE', 'USAGE', 'ALL PRIVILEGES'], + 'table' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'RULE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], + 'view' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'RULE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], + 'sequence' => ['SELECT', 'UPDATE', 'ALL PRIVILEGES'], + 'database' => ['CREATE', 'TEMPORARY', 'ALL PRIVILEGES'], + 'function' => ['EXECUTE', 'ALL PRIVILEGES'], + 'language' => ['USAGE', 'ALL PRIVILEGES'], + 'schema' => ['CREATE', 'USAGE', 'ALL PRIVILEGES'], 'tablespace' => ['CREATE', 'ALL PRIVILEGES'], ]; @@ -55,11 +55,11 @@ class Postgres81 extends Postgres82 * * @param null|string $currentdatabase * - * @return int|\PHPPgAdmin\ADORecordSet A list of databases, sorted alphabetically + * @return int|\ADORecordSet A list of databases, sorted alphabetically */ public function getDatabases($currentdatabase = null) { - $conf = $this->conf; + $conf = $this->conf; $server_info = $this->server_info; if (isset($conf['owned_only']) && $conf['owned_only'] && !$this->isSuperUser()) { @@ -158,7 +158,7 @@ class Postgres81 extends Postgres82 * @param mixed $vaccostdelay * @param mixed $vaccostlimit * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function saveAutovacuum( $table, @@ -266,7 +266,7 @@ class Postgres81 extends Postgres82 * * @param null|string $database (optional) Find only connections to specified database * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getProcesses($database = null) { @@ -294,7 +294,7 @@ class Postgres81 extends Postgres82 * * @param string $spcname namespace * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTablespace($spcname) { @@ -311,7 +311,7 @@ class Postgres81 extends Postgres82 * * @param bool $all Include all tablespaces (necessary when moving objects back to the default space) * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTablespaces($all = false) { diff --git a/src/database/Postgres82.php b/src/database/Postgres82.php index 9d811452..9c3b2074 100644 --- a/src/database/Postgres82.php +++ b/src/database/Postgres82.php @@ -18,30 +18,30 @@ class Postgres82 extends Postgres83 // Select operators public $selectOps = [ - '=' => 'i', - '!=' => 'i', - '<' => 'i', - '>' => 'i', - '<=' => 'i', - '>=' => 'i', - '<<' => 'i', - '>>' => 'i', - '<<=' => 'i', - '>>=' => 'i', - 'LIKE' => 'i', - 'NOT LIKE' => 'i', - 'ILIKE' => 'i', - 'NOT ILIKE' => 'i', - 'SIMILAR TO' => 'i', + '=' => 'i', + '!=' => 'i', + '<' => 'i', + '>' => 'i', + '<=' => 'i', + '>=' => 'i', + '<<' => 'i', + '>>' => 'i', + '<<=' => 'i', + '>>=' => 'i', + 'LIKE' => 'i', + 'NOT LIKE' => 'i', + 'ILIKE' => 'i', + 'NOT ILIKE' => 'i', + 'SIMILAR TO' => 'i', 'NOT SIMILAR TO' => 'i', - '~' => 'i', - '!~' => 'i', - '~*' => 'i', - '!~*' => 'i', - 'IS NULL' => 'p', - 'IS NOT NULL' => 'p', - 'IN' => 'x', - 'NOT IN' => 'x', + '~' => 'i', + '!~' => 'i', + '~*' => 'i', + '!~*' => 'i', + 'IS NULL' => 'p', + 'IS NOT NULL' => 'p', + 'IN' => 'x', + 'NOT IN' => 'x', ]; // Database functions @@ -49,7 +49,7 @@ class Postgres82 extends Postgres83 /** * Returns table locks information in the current database. * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getLocks() { @@ -74,10 +74,10 @@ class Postgres82 extends Postgres83 /** * Rename a sequence. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence RecordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence RecordSet returned by getSequence() * @param string $name The new name for the sequence * - * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful + * @return int|\ADORecordSet 0 if operation was successful */ public function alterSequenceName($seqrs, $name) { @@ -85,7 +85,7 @@ class Postgres82 extends Postgres83 if (!empty($name) && ($seqrs->fields['seqname'] !== $name)) { $f_schema = $this->_schema; $this->fieldClean($f_schema); - $sql = "ALTER TABLE \"{$f_schema}\".\"{$seqrs->fields['seqname']}\" RENAME TO \"{$name}\""; + $sql = "ALTER TABLE \"{$f_schema}\".\"{$seqrs->fields['seqname']}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 === $status) { @@ -103,10 +103,10 @@ class Postgres82 extends Postgres83 /** * Rename a view. * - * @param \PHPPgAdmin\ADORecordSet $vwrs The view recordSet returned by getView() + * @param \ADORecordSet $vwrs The view recordSet returned by getView() * @param string $name The new view's name * - * @return int|\PHPPgAdmin\ADORecordSet -1 if Failed + * @return int|\ADORecordSet -1 if Failed */ public function alterViewName($vwrs, $name) { @@ -115,7 +115,7 @@ class Postgres82 extends Postgres83 if (!empty($name) && ($name !== $vwrs->fields['relname'])) { $f_schema = $this->_schema; $this->fieldClean($f_schema); - $sql = "ALTER TABLE \"{$f_schema}\".\"{$vwrs->fields['relname']}\" RENAME TO \"{$name}\""; + $sql = "ALTER TABLE \"{$f_schema}\".\"{$vwrs->fields['relname']}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 === $status) { @@ -135,7 +135,7 @@ class Postgres82 extends Postgres83 * * @param string $table The name of a table whose triggers to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTriggers($table = '') { @@ -167,7 +167,7 @@ class Postgres82 extends Postgres83 * * @param int $function_oid * - * @return int|\PHPPgAdmin\ADORecordSet Function info + * @return int|\ADORecordSet Function info * * @internal param string The $func name of the function to retrieve */ @@ -344,7 +344,7 @@ class Postgres82 extends Postgres83 * * @param int $operator_oid The oid of the operator * - * @return int|\PHPPgAdmin\ADORecordSet Function info + * @return int|\ADORecordSet Function info */ public function getOperator($operator_oid) { @@ -380,7 +380,7 @@ class Postgres82 extends Postgres83 /** * Gets all opclasses. * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getOpClasses() { diff --git a/src/database/Postgres83.php b/src/database/Postgres83.php index 28daa1a8..a492cf1d 100644 --- a/src/database/Postgres83.php +++ b/src/database/Postgres83.php @@ -19,13 +19,13 @@ class Postgres83 extends Postgres84 // List of all legal privileges that can be applied to different types // of objects. public $privlist = [ - 'table' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], - 'view' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], - 'sequence' => ['SELECT', 'UPDATE', 'ALL PRIVILEGES'], - 'database' => ['CREATE', 'TEMPORARY', 'CONNECT', 'ALL PRIVILEGES'], - 'function' => ['EXECUTE', 'ALL PRIVILEGES'], - 'language' => ['USAGE', 'ALL PRIVILEGES'], - 'schema' => ['CREATE', 'USAGE', 'ALL PRIVILEGES'], + 'table' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], + 'view' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], + 'sequence' => ['SELECT', 'UPDATE', 'ALL PRIVILEGES'], + 'database' => ['CREATE', 'TEMPORARY', 'CONNECT', 'ALL PRIVILEGES'], + 'function' => ['EXECUTE', 'ALL PRIVILEGES'], + 'language' => ['USAGE', 'ALL PRIVILEGES'], + 'schema' => ['CREATE', 'USAGE', 'ALL PRIVILEGES'], 'tablespace' => ['CREATE', 'ALL PRIVILEGES'], ]; @@ -53,11 +53,11 @@ class Postgres83 extends Postgres84 * * @param string $currentdatabase database name that should be on top of the resultset * - * @return int|\PHPPgAdmin\ADORecordSet A recordset or an error number A list of databases, sorted alphabetically + * @return int|\ADORecordSet A recordset or an error number A list of databases, sorted alphabetically */ public function getDatabases($currentdatabase = null) { - $conf = $this->conf; + $conf = $this->conf; $server_info = $this->server_info; if (isset($conf['owned_only']) && $conf['owned_only'] && !$this->isSuperUser()) { @@ -102,7 +102,7 @@ class Postgres83 extends Postgres84 * * @param string $table * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTableAutovacuum($table = '') { @@ -158,7 +158,7 @@ class Postgres83 extends Postgres84 * @param mixed $vaccostdelay * @param mixed $vaccostlimit * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function saveAutovacuum( $table, @@ -302,7 +302,7 @@ class Postgres83 extends Postgres84 /** * Alter a sequence's properties. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence RecordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence RecordSet returned by getSequence() * @param int $increment The sequence incremental value * @param int $minvalue The sequence minimum value * @param int $maxvalue The sequence maximum value @@ -311,7 +311,7 @@ class Postgres83 extends Postgres84 * @param bool $cycledvalue Sequence can cycle ? * @param int $startvalue The sequence start value when issueing a restart (ignored) * - * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful + * @return int|\ADORecordSet 0 if operation was successful */ public function alterSequenceProps( $seqrs, @@ -364,10 +364,10 @@ class Postgres83 extends Postgres84 /** * Alter a sequence's owner. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence RecordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence RecordSet returned by getSequence() * @param string $owner sequence owner * - * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful + * @return int|\ADORecordSet 0 if operation was successful * * @internal param string The $name new owner for the sequence */ @@ -395,7 +395,7 @@ class Postgres83 extends Postgres84 * * @param $function_oid * - * @return int|\PHPPgAdmin\ADORecordSet Function info + * @return int|\ADORecordSet Function info * * @internal param string $func name of the function to retrieve */ diff --git a/src/database/Postgres84.php b/src/database/Postgres84.php index a40317f1..f7829df2 100644 --- a/src/database/Postgres84.php +++ b/src/database/Postgres84.php @@ -19,15 +19,15 @@ class Postgres84 extends Postgres90 // List of all legal privileges that can be applied to different types // of objects. public $privlist = [ - 'table' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], - 'view' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], - 'sequence' => ['SELECT', 'UPDATE', 'ALL PRIVILEGES'], - 'database' => ['CREATE', 'TEMPORARY', 'CONNECT', 'ALL PRIVILEGES'], - 'function' => ['EXECUTE', 'ALL PRIVILEGES'], - 'language' => ['USAGE', 'ALL PRIVILEGES'], - 'schema' => ['CREATE', 'USAGE', 'ALL PRIVILEGES'], + 'table' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], + 'view' => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'], + 'sequence' => ['SELECT', 'UPDATE', 'ALL PRIVILEGES'], + 'database' => ['CREATE', 'TEMPORARY', 'CONNECT', 'ALL PRIVILEGES'], + 'function' => ['EXECUTE', 'ALL PRIVILEGES'], + 'language' => ['USAGE', 'ALL PRIVILEGES'], + 'schema' => ['CREATE', 'USAGE', 'ALL PRIVILEGES'], 'tablespace' => ['CREATE', 'ALL PRIVILEGES'], - 'column' => ['SELECT', 'INSERT', 'UPDATE', 'REFERENCES', 'ALL PRIVILEGES'], + 'column' => ['SELECT', 'INSERT', 'UPDATE', 'REFERENCES', 'ALL PRIVILEGES'], ]; // Database functions @@ -37,7 +37,7 @@ class Postgres84 extends Postgres90 * * @param string $table The name of a table whose triggers to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTriggers($table = '') { @@ -69,7 +69,7 @@ class Postgres84 extends Postgres90 * @param string $term The search term * @param string $filter The object type to restrict to ('' means no restriction) * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function findObject($term, $filter) { @@ -93,10 +93,10 @@ class Postgres84 extends Postgres90 if (!$conf['show_system']) { // XXX: The mention of information_schema here is in the wrong place, but // it's the quickest fix to exclude the info schema from 7.4 - $where = " AND pn.nspname NOT LIKE \$_PATERN_\$pg\\_%\$_PATERN_\$ AND pn.nspname != 'information_schema'"; + $where = " AND pn.nspname NOT LIKE \$_PATERN_\$pg\\_%\$_PATERN_\$ AND pn.nspname != 'information_schema'"; $lan_where = 'AND pl.lanispl'; } else { - $where = ''; + $where = ''; $lan_where = ''; } diff --git a/src/database/Postgres91.php b/src/database/Postgres91.php index 9f5a8ba5..e973e4e4 100644 --- a/src/database/Postgres91.php +++ b/src/database/Postgres91.php @@ -25,7 +25,7 @@ class Postgres91 extends Postgres92 * * @param null|string $database (optional) Find only connections to specified database * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getProcesses($database = null) { @@ -51,7 +51,7 @@ class Postgres91 extends Postgres92 * * @param bool $all Include all tablespaces (necessary when moving objects back to the default space) * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTablespaces($all = false) { @@ -75,7 +75,7 @@ class Postgres91 extends Postgres92 * * @param string $spcname * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTablespace($spcname) { diff --git a/src/database/Postgres92.php b/src/database/Postgres92.php index fbe2df5c..512ffc96 100644 --- a/src/database/Postgres92.php +++ b/src/database/Postgres92.php @@ -21,7 +21,7 @@ class Postgres92 extends Postgres93 * * @param null|string $database (optional) Find only connections to specified database * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getProcesses($database = null) { @@ -47,7 +47,7 @@ class Postgres92 extends Postgres93 * * @param bool $all Include all tablespaces (necessary when moving objects back to the default space) * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTablespaces($all = false) { @@ -73,7 +73,7 @@ class Postgres92 extends Postgres93 * * @param $spcname * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getTablespace($spcname) { diff --git a/src/database/Postgres93.php b/src/database/Postgres93.php index 0a9e5fdf..94eb8caa 100644 --- a/src/database/Postgres93.php +++ b/src/database/Postgres93.php @@ -20,12 +20,12 @@ class Postgres93 extends Postgres94 * @param bool $all If true, will find all available functions, if false just those in search path * @param mixed $type If not null, will find all trigger functions * - * @return int|\PHPPgAdmin\ADORecordSet All functions + * @return int|\ADORecordSet All functions */ public function getFunctions($all = false, $type = null) { if ($all) { - $where = 'pg_catalog.pg_function_is_visible(p.oid)'; + $where = 'pg_catalog.pg_function_is_visible(p.oid)'; $distinct = 'DISTINCT ON (p.proname)'; if ($type) { @@ -34,7 +34,7 @@ class Postgres93 extends Postgres94 } else { $c_schema = $this->_schema; $this->clean($c_schema); - $where = "n.nspname = '{$c_schema}'"; + $where = "n.nspname = '{$c_schema}'"; $distinct = ''; } diff --git a/src/database/Postgres96.php b/src/database/Postgres96.php index 2b08523a..be11ec6c 100644 --- a/src/database/Postgres96.php +++ b/src/database/Postgres96.php @@ -23,7 +23,7 @@ class Postgres96 extends Postgres * * @param null|string $database (optional) Find only connections to specified database * - * @return int|\PHPPgAdmin\ADORecordSet A recordset + * @return int|\ADORecordSet A recordset */ public function getProcesses($database = null) { @@ -67,7 +67,7 @@ class Postgres96 extends Postgres * @param string $expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire * @param array $groups The groups to create the user in * - * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful + * @return int|\ADORecordSet 0 if operation was successful * * @internal param $group (array) The groups to create the user in */ diff --git a/src/database/databasetraits/AggregateTrait.php b/src/database/databasetraits/AggregateTrait.php index 64e9627e..88e0b1c8 100644 --- a/src/database/databasetraits/AggregateTrait.php +++ b/src/database/databasetraits/AggregateTrait.php @@ -83,7 +83,7 @@ trait AggregateTrait * @param string $aggrtype The input data type of the aggregate * @param bool $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropAggregate($aggrname, $aggrtype, $cascade) { @@ -107,7 +107,7 @@ trait AggregateTrait * @param string $name The name of the aggregate * @param string $basetype The input data type of the aggregate * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getAggregate($name, $basetype) { @@ -137,7 +137,7 @@ trait AggregateTrait /** * Gets all aggregates. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getAggregates() { @@ -244,7 +244,7 @@ trait AggregateTrait * @param string $aggrtype The input data type of the aggregate * @param string $newaggrowner The new owner of the aggregate * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function changeAggregateOwner($aggrname, $aggrtype, $newaggrowner) { @@ -264,7 +264,7 @@ trait AggregateTrait * @param string $aggrtype The input data type of the aggregate * @param string $newaggrschema The new schema for the aggregate * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function changeAggregateSchema($aggrname, $aggrtype, $newaggrschema) { @@ -285,7 +285,7 @@ trait AggregateTrait * @param string $aggrtype The actual input data type of the aggregate * @param string $newaggrname The new name of the aggregate * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function renameAggregate($aggrschema, $aggrname, $aggrtype, $newaggrname) { diff --git a/src/database/databasetraits/ColumnTrait.php b/src/database/databasetraits/ColumnTrait.php index 4a453658..7ce01cd3 100644 --- a/src/database/databasetraits/ColumnTrait.php +++ b/src/database/databasetraits/ColumnTrait.php @@ -43,13 +43,13 @@ trait ColumnTrait case 'timestamp with time zone': case 'timestamp without time zone': $qual = \mb_substr($type, 9); - $sql = "ALTER TABLE \"{$f_schema}\".\"{$table}\" ADD COLUMN \"{$column}\" timestamp({$length}){$qual}"; + $sql = "ALTER TABLE \"{$f_schema}\".\"{$table}\" ADD COLUMN \"{$column}\" timestamp({$length}){$qual}"; break; case 'time with time zone': case 'time without time zone': $qual = \mb_substr($type, 4); - $sql = "ALTER TABLE \"{$f_schema}\".\"{$table}\" ADD COLUMN \"{$column}\" time({$length}){$qual}"; + $sql = "ALTER TABLE \"{$f_schema}\".\"{$table}\" ADD COLUMN \"{$column}\" time({$length}){$qual}"; break; @@ -136,8 +136,8 @@ trait ColumnTrait $comment ) { // Begin transaction - $status = $this->beginTransaction(); - $sql = ''; + $status = $this->beginTransaction(); + $sql = ''; $sqlrename = ''; if (0 !== $status) { @@ -187,13 +187,13 @@ trait ColumnTrait // time zone types case 'timestamp with time zone': case 'timestamp without time zone': - $qual = \mb_substr($type, 9); + $qual = \mb_substr($type, 9); $ftype = "timestamp({$length}){$qual}"; break; case 'time with time zone': case 'time without time zone': - $qual = \mb_substr($type, 4); + $qual = \mb_substr($type, 4); $ftype = "time({$length}){$qual}"; break; @@ -270,7 +270,7 @@ trait ColumnTrait * @param string $column The column name to set * @param mixed $default The new default value * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function setColumnDefault($table, $column, $default) { @@ -291,7 +291,7 @@ trait ColumnTrait * @param string $column The column to alter * @param bool $state True to set null, false to set not null * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function setColumnNull($table, $column, $state) { @@ -338,7 +338,7 @@ trait ColumnTrait * @param string $table The table from which to drop * @param string $column The column name to drop default * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropColumnDefault($table, $column) { diff --git a/src/database/databasetraits/DatabaseTrait.php b/src/database/databasetraits/DatabaseTrait.php index 221df9ce..de66fb44 100644 --- a/src/database/databasetraits/DatabaseTrait.php +++ b/src/database/databasetraits/DatabaseTrait.php @@ -58,7 +58,7 @@ trait DatabaseTrait * * @param string $table (optional) The table to analyze * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function analyzeDB($table = '') { @@ -80,7 +80,7 @@ trait DatabaseTrait * * @param string $database The name of the database to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getDatabase($database) { @@ -95,11 +95,11 @@ trait DatabaseTrait * * @param null|string $currentdatabase database name that should be on top of the resultset * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getDatabases($currentdatabase = null) { - $conf = $this->conf; + $conf = $this->conf; $server_info = $this->server_info; //$this->prtrace('server_info', $server_info); @@ -164,7 +164,7 @@ trait DatabaseTrait * * @param string $database the name of the database to get the comment for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getDatabaseComment($database) { @@ -183,7 +183,7 @@ trait DatabaseTrait * * @param string $database the name of the database to get the owner for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getDatabaseOwner($database) { @@ -276,7 +276,7 @@ trait DatabaseTrait * * @param string $database The name of the database to drop * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropDatabase($database) { @@ -347,7 +347,7 @@ trait DatabaseTrait * @param string $oldName name of database to rename * @param string $newName new name of database * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterDatabaseRename($oldName, $newName) { @@ -370,7 +370,7 @@ trait DatabaseTrait * @param string $dbName database to change ownership of * @param string $newOwner user that will own the database * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterDatabaseOwner($dbName, $newOwner) { @@ -387,7 +387,7 @@ trait DatabaseTrait * * @param null|string $database (optional) Find only prepared transactions executed in a specific database * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getPreparedXacts($database = null) { @@ -407,7 +407,7 @@ trait DatabaseTrait * * @param null|string $database (optional) Find only connections to specified database * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getProcesses($database = null) { @@ -433,7 +433,7 @@ trait DatabaseTrait /** * Returns table locks information in the current database. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getLocks() { @@ -571,7 +571,7 @@ trait DatabaseTrait /** * Returns all available variable information. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getVariables() { diff --git a/src/database/databasetraits/DomainTrait.php b/src/database/databasetraits/DomainTrait.php index 6c9291d7..1d4d3a98 100644 --- a/src/database/databasetraits/DomainTrait.php +++ b/src/database/databasetraits/DomainTrait.php @@ -16,7 +16,7 @@ trait DomainTrait * * @param string $domain The name of the domain to fetch * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getDomain($domain) { @@ -46,7 +46,7 @@ trait DomainTrait /** * Return all domains in current schema. Excludes domain constraints. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getDomains() { @@ -77,7 +77,7 @@ trait DomainTrait * * @param string $domain The name of the domain whose constraints to fetch * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getDomainConstraints($domain) { @@ -116,7 +116,7 @@ trait DomainTrait * @param string $default Default value for domain * @param string $check A CHECK constraint if there is one * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function createDomain($domain, $type, $length, $array, $notnull, $default, $check) { @@ -245,7 +245,7 @@ trait DomainTrait * @param string $domain The name of the domain to drop * @param string $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropDomain($domain, $cascade) { @@ -269,7 +269,7 @@ trait DomainTrait * @param string $definition The definition of the check * @param string $name (optional) The name to give the check, otherwise default name is assigned * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function addDomainCheckConstraint($domain, $definition, $name = '') { @@ -296,7 +296,7 @@ trait DomainTrait * @param string $constraint The constraint to remove * @param bool $cascade True to cascade, false otherwise * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropDomainConstraint($domain, $constraint, $cascade) { diff --git a/src/database/databasetraits/FtsTrait.php b/src/database/databasetraits/FtsTrait.php index 564e32e2..f32b4bb5 100644 --- a/src/database/databasetraits/FtsTrait.php +++ b/src/database/databasetraits/FtsTrait.php @@ -87,7 +87,7 @@ trait FtsTrait * * @param bool $all if false, returns schema qualified FTS confs * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsConfigurations($all = true) { @@ -121,7 +121,7 @@ trait FtsTrait * * @param string $ftscfg Name of the FTS configuration * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsConfigurationMap($ftscfg) { @@ -161,7 +161,7 @@ trait FtsTrait * * @param bool $all if false, return only Parsers from the current schema * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsParsers($all = true) { @@ -190,7 +190,7 @@ trait FtsTrait * * @param bool $all if false, return only Dics from the current schema * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsDictionaries($all = true) { @@ -216,7 +216,7 @@ trait FtsTrait /** * Returns all FTS dictionary templates available. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsDictionaryTemplates() { @@ -247,7 +247,7 @@ trait FtsTrait * @param string $ftscfg The configuration's name * @param bool $cascade true to Cascade to dependenced objects * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropFtsConfiguration($ftscfg, $cascade) { @@ -270,7 +270,7 @@ trait FtsTrait * @param string $ftsdict The dico's name * @param bool $cascade Cascade to dependenced objects * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @todo Support of dictionary templates dropping */ @@ -325,7 +325,7 @@ trait FtsTrait $this->fieldClean($f_schema); $this->fieldClean($name); - $sql = "ALTER TEXT SEARCH CONFIGURATION \"{$f_schema}\".\"{$cfgname}\" RENAME TO \"{$name}\""; + $sql = "ALTER TEXT SEARCH CONFIGURATION \"{$f_schema}\".\"{$cfgname}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -471,7 +471,7 @@ trait FtsTrait $this->fieldClean($f_schema); $this->fieldClean($name); - $sql = "ALTER TEXT SEARCH DICTIONARY \"{$f_schema}\".\"{$dictname}\" RENAME TO \"{$name}\""; + $sql = "ALTER TEXT SEARCH DICTIONARY \"{$f_schema}\".\"{$dictname}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -489,7 +489,7 @@ trait FtsTrait * * @param string $ftsdict The name of the FTS dictionary * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsDictionaryByName($ftsdict) { @@ -524,7 +524,7 @@ trait FtsTrait * @param string $action What to do with the mapping: add, alter or drop * @param string $dictname Dictionary that will process tokens given or null in case of drop action * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal param string $cfgname The name of the FTS configuration to alter */ @@ -572,7 +572,7 @@ trait FtsTrait * @param string $ftscfg The name of the FTS configuration * @param string $mapping The name of the mapping * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsMappingByName($ftscfg, $mapping) { @@ -587,7 +587,7 @@ trait FtsTrait WHERE c.cfgname = '{$ftscfg}' AND n.nspname='{$c_schema}'"); - $oid = $oidSet->fields['oid']; + $oid = $oidSet->fields['oid']; $cfgparser = $oidSet->fields['cfgparser']; $tokenIdSet = $this->selectSet("SELECT tokid @@ -612,7 +612,7 @@ trait FtsTrait * * @param string $ftscfg The config's name that use the parser * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsMappings($ftscfg) { @@ -630,7 +630,7 @@ trait FtsTrait * * @param string $ftscfg The name of the FTS configuration * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFtsConfigurationByName($ftscfg) { diff --git a/src/database/databasetraits/FunctionTrait.php b/src/database/databasetraits/FunctionTrait.php index 0570c403..19a8f9c4 100644 --- a/src/database/databasetraits/FunctionTrait.php +++ b/src/database/databasetraits/FunctionTrait.php @@ -17,12 +17,12 @@ trait FunctionTrait * @param bool $all If true, will find all available functions, if false just those in search path * @param mixed $type If truthy, will return functions of type trigger * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFunctions($all = false, $type = null) { if ($all) { - $where = 'pg_catalog.pg_function_is_visible(p.oid)'; + $where = 'pg_catalog.pg_function_is_visible(p.oid)'; $distinct = 'DISTINCT ON (p.proname)'; if ($type) { @@ -31,7 +31,7 @@ trait FunctionTrait } else { $c_schema = $this->_schema; $this->clean($c_schema); - $where = "n.nspname = '{$c_schema}'"; + $where = "n.nspname = '{$c_schema}'"; $distinct = ''; } @@ -64,7 +64,7 @@ trait FunctionTrait /** * Returns a list of all functions that can be used in triggers. * - * @return \PHPPgAdmin\ADORecordSet|int + * @return \ADORecordSet|int */ public function getTriggerFunctions() { @@ -177,7 +177,7 @@ trait FunctionTrait $this->fieldClean($newname); /* $funcname is escaped in createFunction */ if ($funcname !== $newname) { - $sql = "ALTER FUNCTION \"{$f_schema}\".\"{$funcname}\"({$args}) RENAME TO \"{$newname}\""; + $sql = "ALTER FUNCTION \"{$f_schema}\".\"{$funcname}\"({$args}) RENAME TO \"{$newname}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -194,7 +194,7 @@ trait FunctionTrait $this->fieldClean($newown); if ($funcown !== $newown) { - $sql = "ALTER FUNCTION \"{$f_schema}\".\"{$funcname}\"({$args}) OWNER TO \"{$newown}\""; + $sql = "ALTER FUNCTION \"{$f_schema}\".\"{$funcname}\"({$args}) OWNER TO \"{$newown}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -210,7 +210,7 @@ trait FunctionTrait $this->fieldClean($newschema); /* $funcschema is escaped in createFunction */ if ($funcschema !== $newschema) { - $sql = "ALTER FUNCTION \"{$f_schema}\".\"{$funcname}\"({$args}) SET SCHEMA \"{$newschema}\""; + $sql = "ALTER FUNCTION \"{$f_schema}\".\"{$funcname}\"({$args}) SET SCHEMA \"{$newschema}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -342,12 +342,12 @@ trait FunctionTrait * @param int $function_oid The OID of the function to drop * @param bool $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropFunction($function_oid, $cascade) { // Function comes in with $object as function OID - $fn = $this->getFunction($function_oid); + $fn = $this->getFunction($function_oid); $f_schema = $this->_schema; $this->fieldClean($f_schema); $this->fieldClean($fn->fields['proname']); @@ -366,7 +366,7 @@ trait FunctionTrait * * @param int $function_oid * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal param string The $func name of the function to retrieve */ @@ -405,7 +405,7 @@ trait FunctionTrait * * @param int $function_oid * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getFunctionDef($function_oid) { diff --git a/src/database/databasetraits/IndexTrait.php b/src/database/databasetraits/IndexTrait.php index 14b59591..df54570d 100644 --- a/src/database/databasetraits/IndexTrait.php +++ b/src/database/databasetraits/IndexTrait.php @@ -126,7 +126,7 @@ trait IndexTrait * @param bool $force If true, recreates indexes forcedly in PostgreSQL 7.0-7.1, forces rebuild of system indexes in * 7.2-7.3, ignored in >=7.4 * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function reindex($type, $name, $force = false) { @@ -199,7 +199,7 @@ trait IndexTrait * * @param string $table the table where we are looking for fk * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getConstraintsWithFields($table) { @@ -267,7 +267,7 @@ trait IndexTrait * @param string $name (optional) The name to give the key, otherwise default name is assigned * @param string $tablespace (optional) The tablespace for the schema, '' indicates default * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function addPrimaryKey($table, $fields, $name = '', $tablespace = '') { @@ -305,7 +305,7 @@ trait IndexTrait * @param string $name (optional) The name to give the key, otherwise default name is assigned * @param string $tablespace (optional) The tablespace for the schema, '' indicates default * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function addUniqueKey($table, $fields, $name = '', $tablespace = '') { @@ -344,7 +344,7 @@ trait IndexTrait * @param string $definition The definition of the check * @param string $name (optional) The name to give the check, otherwise default name is assigned * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function addCheckConstraint($table, $definition, $name = '') { @@ -392,7 +392,7 @@ trait IndexTrait } // Properly lock the table - $sql = "LOCK TABLE \"{$f_schema}\".\"{$table}\" IN ACCESS EXCLUSIVE MODE"; + $sql = "LOCK TABLE \"{$f_schema}\".\"{$table}\" IN ACCESS EXCLUSIVE MODE"; $status = $this->execute($sql); if (0 !== $status) { @@ -446,7 +446,7 @@ trait IndexTrait * @param string $initially The initially parameter for the FK (eg. INITIALLY IMMEDIATE) * @param string $name [optional] The name to give the key, otherwise default name is assigned * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal param \PHPPgAdmin\Database\The $target table that contains the target columns * @internal param \PHPPgAdmin\Database\The $intially initial deferrability (eg. INITIALLY IMMEDIATE) @@ -519,7 +519,7 @@ trait IndexTrait * @param string $type The type of constraint (c, f, u or p) * @param bool $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropConstraint($constraint, $relation, $type, $cascade) { @@ -542,7 +542,7 @@ trait IndexTrait * * @param array $tables multi dimensional assoc array that holds schema and table name * - * @return int|\PHPPgAdmin\ADORecordSet recordset of linked tables and columns or -1 if $tables isn't an array + * @return int|\ADORecordSet recordset of linked tables and columns or -1 if $tables isn't an array */ public function getLinkingKeys($tables) { @@ -552,10 +552,10 @@ trait IndexTrait $this->clean($tables[0]['tablename']); $this->clean($tables[0]['schemaname']); - $tables_list = "'{$tables[0]['tablename']}'"; - $schema_list = "'{$tables[0]['schemaname']}'"; + $tables_list = "'{$tables[0]['tablename']}'"; + $schema_list = "'{$tables[0]['schemaname']}'"; $schema_tables_list = "'{$tables[0]['schemaname']}.{$tables[0]['tablename']}'"; - $tablescount = \count($tables); + $tablescount = \count($tables); for ($i = 1; $i < $tablescount; ++$i) { $this->clean($tables[$i]['tablename']); @@ -584,7 +584,7 @@ trait IndexTrait $rs = $this->selectSet($sql); while (!$rs->EOF) { - $arrData = \explode(':', $rs->fields['arr_dim']); + $arrData = \explode(':', $rs->fields['arr_dim']); $strdimension = \trim(\mb_substr($arrData[1], 0, \mb_strlen($arrData[1]) - 1)); $tmpDimension = (int) $strdimension; $maxDimension = $tmpDimension > $maxDimension ? $tmpDimension : $maxDimension; @@ -636,7 +636,7 @@ trait IndexTrait * * @param string $table The table to find referrers for * - * @return int|\PHPPgAdmin\ADORecordSet A recordset or -1 in case of error + * @return int|\ADORecordSet A recordset or -1 in case of error */ public function getReferrers($table) { diff --git a/src/database/databasetraits/OperatorTrait.php b/src/database/databasetraits/OperatorTrait.php index ffe6c18a..cba3ee0d 100644 --- a/src/database/databasetraits/OperatorTrait.php +++ b/src/database/databasetraits/OperatorTrait.php @@ -14,7 +14,7 @@ trait OperatorTrait /** * Returns a list of all operators in the database. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getOperators() { @@ -45,12 +45,12 @@ trait OperatorTrait * @param mixed $operator_oid The OID of the operator to drop * @param bool $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropOperator($operator_oid, $cascade) { // Function comes in with $object as operator OID - $opr = $this->getOperator($operator_oid); + $opr = $this->getOperator($operator_oid); $f_schema = $this->_schema; $this->fieldClean($f_schema); $this->fieldClean($opr->fields['oprname']); @@ -81,7 +81,7 @@ trait OperatorTrait * * @param mixed $operator_oid The oid of the operator * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getOperator($operator_oid) { @@ -112,7 +112,7 @@ trait OperatorTrait /** * Gets all opclasses. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getOpClasses() { diff --git a/src/database/databasetraits/PrivilegesTrait.php b/src/database/databasetraits/PrivilegesTrait.php index 6b2c5db0..7b99dbf5 100644 --- a/src/database/databasetraits/PrivilegesTrait.php +++ b/src/database/databasetraits/PrivilegesTrait.php @@ -108,7 +108,7 @@ trait PrivilegesTrait * @param bool $cascade True for cascade revoke, false otherwise * @param string $table the column's table if type=column * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function setPrivileges( $mode, @@ -285,8 +285,8 @@ trait PrivilegesTrait // Pick out individual ACE's by carefully parsing. This is necessary in order // to cope with usernames and stuff that contain commas - $aces = []; - $i = $j = 0; + $aces = []; + $i = $j = 0; $in_quotes = false; while (\mb_strlen($acl) > $i) { @@ -299,7 +299,7 @@ trait PrivilegesTrait } elseif (',' === $char && !$in_quotes) { // Add text so far to the array $aces[] = \mb_substr($acl, $j, $i - $j); - $j = $i + 1; + $j = $i + 1; } ++$i; } @@ -338,15 +338,15 @@ trait PrivilegesTrait } // Break on unquoted equals sign... - $i = 0; + $i = 0; $in_quotes = false; - $entity = null; - $chars = null; + $entity = null; + $chars = null; while (\mb_strlen($v) > $i) { // If current char is a double quote and it's not escaped, then // enter quoted bit - $char = \mb_substr($v, $i, 1); + $char = \mb_substr($v, $i, 1); $next_char = \mb_substr($v, $i + 1, 1); if ('"' === $char && (0 === $i || '"' !== $next_char)) { @@ -357,7 +357,7 @@ trait PrivilegesTrait } elseif ('=' === $char && !$in_quotes) { // Split on current equals sign $entity = \mb_substr($v, 0, $i); - $chars = \mb_substr($v, $i + 1); + $chars = \mb_substr($v, $i + 1); break; } @@ -375,7 +375,7 @@ trait PrivilegesTrait $row = [$atype, $entity, [], '', []]; // Loop over chars and add privs to $row - for ($i = 0; \mb_strlen($chars) > $i; ++$i) { + for ($i = 0;\mb_strlen($chars) > $i; ++$i) { // Append to row's privs list the string representing // the privilege $char = \mb_substr($chars, $i, 1); diff --git a/src/database/databasetraits/RoleTrait.php b/src/database/databasetraits/RoleTrait.php index 7de51622..d97c357f 100644 --- a/src/database/databasetraits/RoleTrait.php +++ b/src/database/databasetraits/RoleTrait.php @@ -16,7 +16,7 @@ trait RoleTrait * * @param string $rolename (optional) The role name to exclude from the select * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getRoles($rolename = '') { @@ -51,7 +51,7 @@ trait RoleTrait * * @param string $rolename The name of the role to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getRole($rolename) { @@ -80,7 +80,7 @@ trait RoleTrait /** * Returns all users in the database cluster. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getUsers() { @@ -102,7 +102,7 @@ trait RoleTrait * * @param string $username The username of the user to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getUser($username) { @@ -138,7 +138,7 @@ trait RoleTrait * @param array $new_members_of_role (array) Roles which are automatically added as members of the new role * @param array $new_admins_of_role (array) Roles which are automatically added as admin members of the new role * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function createRole( $rolename, @@ -305,7 +305,7 @@ trait RoleTrait * @param string $rolename The name of the role to rename * @param string $newrolename The new name of the role * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function renameRole($rolename, $newrolename) { @@ -404,7 +404,7 @@ trait RoleTrait * @param string $rolename The name of the role that will belong to the target role * @param int $admin (optional) Flag to grant the admin option * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function grantRole($role, $rolename, $admin = 0) { @@ -428,7 +428,7 @@ trait RoleTrait * @param int $admin (optional) Flag to revoke only the admin option * @param string $type (optional) Type of revoke: RESTRICT | CASCADE * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function revokeRole($role, $rolename, $admin = 0, $type = 'RESTRICT') { @@ -451,7 +451,7 @@ trait RoleTrait * * @param string $rolename The name of the role to drop * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropRole($rolename) { @@ -472,7 +472,7 @@ trait RoleTrait * @param string $expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire * @param array $groups The groups to create the user in * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal param $group (array) The groups to create the user in */ @@ -554,7 +554,7 @@ trait RoleTrait * @param string $username The username of the user to rename * @param string $newname The new name of the user * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function renameUser($username, $newname) { @@ -577,7 +577,7 @@ trait RoleTrait * @param bool $createuser boolean Whether or not the user can create other users * @param string $expiry string Format 'YYYY-MM-DD HH:MM:SS'. '' means never expire. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function setUser($username, $password, $createdb, $createuser, $expiry) { @@ -609,7 +609,7 @@ trait RoleTrait * * @param string $username The username of the user to drop * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropUser($username) { @@ -626,7 +626,7 @@ trait RoleTrait * @param string $rolename The role name * @param string $password The new password * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function changePassword($rolename, $password) { @@ -645,7 +645,7 @@ trait RoleTrait * @param string $groname The name of the group * @param string $user The name of the user to add to the group * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function addGroupMember($groname, $user) { @@ -662,7 +662,7 @@ trait RoleTrait * * @param string $rolename The role name * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getMemberOf($rolename) { @@ -687,7 +687,7 @@ trait RoleTrait * @param string $rolename The role name * @param string $admin (optional) Find only admin members * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getMembers($rolename, $admin = 'f') { @@ -709,7 +709,7 @@ trait RoleTrait * @param string $groname The name of the group * @param string $user The name of the user to remove from the group * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropGroupMember($groname, $user) { @@ -726,7 +726,7 @@ trait RoleTrait * * @param string $groname The name of the group * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getGroup($groname) { @@ -743,7 +743,7 @@ trait RoleTrait /** * Returns all groups in the database cluser. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getGroups() { @@ -758,7 +758,7 @@ trait RoleTrait * @param string $groname The name of the group * @param array $users An array of users to add to the group * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function createGroup($groname, $users) { @@ -779,7 +779,7 @@ trait RoleTrait * * @param string $groname The name of the group to drop * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropGroup($groname) { diff --git a/src/database/databasetraits/RowTrait.php b/src/database/databasetraits/RowTrait.php index 5aa28684..7107606d 100644 --- a/src/database/databasetraits/RowTrait.php +++ b/src/database/databasetraits/RowTrait.php @@ -17,7 +17,7 @@ trait RowTrait * @param string $table The name of a table * @param array $key The associative array holding the key to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function browseRow($table, $key) { @@ -112,7 +112,7 @@ trait RowTrait * @param array $format An array of the data type (VALUE or EXPRESSION) * @param array $types An array of field types * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function insertRow($table, $fields, $values, $nulls, $format, $types) { @@ -126,7 +126,7 @@ trait RowTrait // Build clause if (0 < \count($values)) { // Escape all field names - $fields = \array_map(['\PHPPgAdmin\Database\Postgres', 'fieldClean'], $fields); + $fields = \array_map(['\PHPPgAdmin\Database\Postgres', 'fieldClean'], $fields); $f_schema = $this->_schema; $this->fieldClean($table); $this->fieldClean($f_schema); diff --git a/src/database/databasetraits/SchemaTrait.php b/src/database/databasetraits/SchemaTrait.php index ca988547..fa8a1dce 100644 --- a/src/database/databasetraits/SchemaTrait.php +++ b/src/database/databasetraits/SchemaTrait.php @@ -16,7 +16,7 @@ trait SchemaTrait /** * Return all schemas in the current database. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getSchemas() { @@ -58,7 +58,7 @@ trait SchemaTrait * * @param string $schema The the name of the schema to work in * - * @return \PHPPgAdmin\ADORecordSet|int + * @return \ADORecordSet|int */ public function setSchema($schema) { @@ -99,7 +99,7 @@ trait SchemaTrait * * @param mixed $paths An array of schemas in required search order * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function setSearchPath($paths) { @@ -219,7 +219,7 @@ trait SchemaTrait $schema_rs = $this->getSchemaByName($schemaname); /* Only if the owner change */ if ($schema_rs->fields['ownername'] !== $owner) { - $sql = "ALTER SCHEMA \"{$schemaname}\" OWNER TO \"{$owner}\""; + $sql = "ALTER SCHEMA \"{$schemaname}\" OWNER TO \"{$owner}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -231,7 +231,7 @@ trait SchemaTrait // Only if the name has changed if ($name !== $schemaname) { - $sql = "ALTER SCHEMA \"{$schemaname}\" RENAME TO \"{$name}\""; + $sql = "ALTER SCHEMA \"{$schemaname}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -249,7 +249,7 @@ trait SchemaTrait * * @param string $schema The name of the schema * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getSchemaByName($schema) { @@ -272,7 +272,7 @@ trait SchemaTrait * @param string $schemaname The name of the schema to drop * @param bool $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropSchema($schemaname, $cascade) { diff --git a/src/database/databasetraits/SequenceTrait.php b/src/database/databasetraits/SequenceTrait.php index 8dac8c79..8c2cae0b 100644 --- a/src/database/databasetraits/SequenceTrait.php +++ b/src/database/databasetraits/SequenceTrait.php @@ -16,7 +16,7 @@ trait SequenceTrait * * @param bool $all true to get all sequences of all schemas * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getSequences($all = false) { @@ -46,7 +46,7 @@ trait SequenceTrait * * @param string $sequence Sequence name * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function nextvalSequence($sequence) { @@ -68,7 +68,7 @@ trait SequenceTrait * @param string $sequence Sequence name * @param number $nextvalue The next value * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function setvalSequence($sequence, $nextvalue) { @@ -90,7 +90,7 @@ trait SequenceTrait * * @param string $sequence Sequence name * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function restartSequence($sequence) { @@ -108,7 +108,7 @@ trait SequenceTrait * * @param string $sequence Sequence name * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function resetSequence($sequence) { @@ -137,7 +137,7 @@ trait SequenceTrait * * @param string $sequence Sequence name * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getSequence($sequence) { @@ -170,7 +170,7 @@ trait SequenceTrait * @param number $cachevalue The cache value * @param bool $cycledvalue True if cycled, false otherwise * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function createSequence( $sequence, @@ -296,10 +296,10 @@ trait SequenceTrait /** * Alter a sequence's owner. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence RecordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence RecordSet returned by getSequence() * @param string $owner the new owner of the sequence * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal string $name new owner for the sequence */ @@ -323,7 +323,7 @@ trait SequenceTrait /** * Alter a sequence's properties. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence RecordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence RecordSet returned by getSequence() * @param number $increment The sequence incremental value * @param number $minvalue The sequence minimum value * @param number $maxvalue The sequence maximum value @@ -332,7 +332,7 @@ trait SequenceTrait * @param null|bool $cycledvalue Sequence can cycle ? * @param number $startvalue The sequence start value when issueing a restart * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterSequenceProps( $seqrs, @@ -389,10 +389,10 @@ trait SequenceTrait /** * Rename a sequence. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence RecordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence RecordSet returned by getSequence() * @param string $name The new name for the sequence * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterSequenceName($seqrs, $name) { @@ -400,7 +400,7 @@ trait SequenceTrait if (!empty($name) && ($seqrs->fields['seqname'] !== $name)) { $f_schema = $this->_schema; $this->fieldClean($f_schema); - $sql = "ALTER SEQUENCE \"{$f_schema}\".\"{$seqrs->fields['seqname']}\" RENAME TO \"{$name}\""; + $sql = "ALTER SEQUENCE \"{$f_schema}\".\"{$seqrs->fields['seqname']}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 === $status) { @@ -416,10 +416,10 @@ trait SequenceTrait /** * Alter a sequence's schema. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence RecordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence RecordSet returned by getSequence() * @param string $schema * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal param The $name new schema for the sequence */ @@ -443,7 +443,7 @@ trait SequenceTrait * @param $sequence Sequence name * @param $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropSequence($sequence, $cascade) { @@ -482,7 +482,7 @@ trait SequenceTrait * Protected method which alter a sequence * SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION. * - * @param \PHPPgAdmin\ADORecordSet $seqrs The sequence recordSet returned by getSequence() + * @param \ADORecordSet $seqrs The sequence recordSet returned by getSequence() * @param string $name The new name for the sequence * @param string $comment The comment on the sequence * @param string $owner The new owner for the sequence diff --git a/src/database/databasetraits/StatsTrait.php b/src/database/databasetraits/StatsTrait.php index 2dd8220d..fe9bfb5c 100644 --- a/src/database/databasetraits/StatsTrait.php +++ b/src/database/databasetraits/StatsTrait.php @@ -16,7 +16,7 @@ trait StatsTrait * * @param string $database The database to fetch stats for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getStatsDatabase($database) { @@ -32,7 +32,7 @@ trait StatsTrait * * @param string $table The table to fetch stats for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getStatsTableTuples($table) { @@ -51,7 +51,7 @@ trait StatsTrait * * @param string $table The table to fetch stats for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getStatsTableIO($table) { @@ -70,7 +70,7 @@ trait StatsTrait * * @param string $table The table to fetch index stats for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getStatsIndexTuples($table) { @@ -89,7 +89,7 @@ trait StatsTrait * * @param string $table The table to fetch index stats for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getStatsIndexIO($table) { diff --git a/src/database/databasetraits/TableTrait.php b/src/database/databasetraits/TableTrait.php index bda6c38b..49220d68 100644 --- a/src/database/databasetraits/TableTrait.php +++ b/src/database/databasetraits/TableTrait.php @@ -18,7 +18,7 @@ trait TableTrait /** * Return all tables in current database excluding schemas 'pg_catalog', 'information_schema' and 'pg_toast'. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getAllTables() { @@ -36,7 +36,7 @@ trait TableTrait /** * Return all tables in current database (and schema). * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTables() { @@ -75,7 +75,7 @@ trait TableTrait * * @param string $table The table to find the parents for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTableParents($table) { @@ -105,7 +105,7 @@ trait TableTrait * * @param string $table The table to find the children for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTableChildren($table) { @@ -135,7 +135,7 @@ trait TableTrait * @param string $table The table to define * @param string $cleanprefix set to '-- ' to avoid issuing DROP statement */ - public function getTableDefPrefix($table, $cleanprefix = ''): ?string + public function getTableDefPrefix($table, $cleanprefix = ''): ? string { // Fetch table $t = $this->getTable($table); @@ -173,8 +173,8 @@ trait TableTrait // Output all table columns $col_comments_sql = ''; // Accumulate comments on columns - $num = $atts->recordCount() + $cons->recordCount(); - $i = 1; + $num = $atts->recordCount() + $cons->recordCount(); + $i = 1; $sql = $this->_dumpSerials($atts, $t, $sql, $col_comments_sql, $i, $num); @@ -269,7 +269,7 @@ trait TableTrait * * @param string $table The name of the table * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTable($table) { @@ -304,7 +304,7 @@ trait TableTrait * @param string $table The name of the table * @param string $field (optional) The name of a field to return * - * @return \PHPPgAdmin\ADORecordSet|int + * @return \ADORecordSet|int */ public function getTableAttributes($table, $field = '') { @@ -328,7 +328,7 @@ trait TableTrait * * @param string $table The table to find rules for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getConstraints($table) { @@ -403,7 +403,7 @@ trait TableTrait * * @param string $table The table to define */ - public function getTableDefSuffix($table): ?string + public function getTableDefSuffix($table) : ? string { $sql = ''; @@ -474,7 +474,7 @@ trait TableTrait * @param string $table The name of a table whose indexes to retrieve * @param bool $unique Only get unique/pk indexes * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getIndexes($table = '', $unique = false) { @@ -502,7 +502,7 @@ trait TableTrait * * @param string $table The name of a table whose triggers to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTriggers($table = '') { @@ -533,7 +533,7 @@ trait TableTrait * * @param string $table The table to find rules for * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getRules($table) { @@ -598,10 +598,10 @@ trait TableTrait return -1; } - $found = false; - $first = true; + $found = false; + $first = true; $comment_sql = ''; //Accumulate comments for the columns - $sql = "CREATE TABLE \"{$f_schema}\".\"{$name}\" ("; + $sql = "CREATE TABLE \"{$f_schema}\".\"{$name}\" ("; for ($i = 0; $i < $fields; ++$i) { $this->fieldClean($field[$i]); @@ -852,10 +852,10 @@ trait TableTrait * Alter a table's owner * /!\ this function is called from _alterTable which take care of escaping fields. * - * @param \PHPPgAdmin\ADORecordSet $tblrs The table RecordSet returned by getTable() + * @param \ADORecordSet $tblrs The table RecordSet returned by getTable() * @param null|string $owner * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterTableOwner($tblrs, $owner = null) { @@ -878,10 +878,10 @@ trait TableTrait * Alter a table's tablespace * /!\ this function is called from _alterTable which take care of escaping fields. * - * @param \PHPPgAdmin\ADORecordSet $tblrs The table RecordSet returned by getTable() + * @param \ADORecordSet $tblrs The table RecordSet returned by getTable() * @param null|string $tablespace * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterTableTablespace($tblrs, $tablespace = null) { @@ -904,10 +904,10 @@ trait TableTrait * Alter a table's name * /!\ this function is called from _alterTable which take care of escaping fields. * - * @param \PHPPgAdmin\ADORecordSet $tblrs The table RecordSet returned by getTable() + * @param \ADORecordSet $tblrs The table RecordSet returned by getTable() * @param string $name The new table's name * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterTableName($tblrs, $name = null) { @@ -917,7 +917,7 @@ trait TableTrait $f_schema = $this->_schema; $this->fieldClean($f_schema); - $sql = "ALTER TABLE \"{$f_schema}\".\"{$tblrs->fields['relname']}\" RENAME TO \"{$name}\""; + $sql = "ALTER TABLE \"{$f_schema}\".\"{$tblrs->fields['relname']}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 === $status) { @@ -936,10 +936,10 @@ trait TableTrait * Alter a table's schema * /!\ this function is called from _alterTable which take care of escaping fields. * - * @param \PHPPgAdmin\ADORecordSet $tblrs The table RecordSet returned by getTable() + * @param \ADORecordSet $tblrs The table RecordSet returned by getTable() * @param null|string $schema * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterTableSchema($tblrs, $schema = null) { @@ -988,7 +988,7 @@ trait TableTrait * @param string $table The table to drop * @param bool $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropTable($table, $cascade) { @@ -1021,7 +1021,7 @@ trait TableTrait } // Set serializable - $sql = 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'; + $sql = 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'; $status = $this->execute($sql); if (0 !== $status) { @@ -1031,7 +1031,7 @@ trait TableTrait } // Set datestyle to ISO - $sql = 'SET DATESTYLE = ISO'; + $sql = 'SET DATESTYLE = ISO'; $status = $this->execute($sql); if (0 !== $status) { @@ -1041,7 +1041,7 @@ trait TableTrait } // Set extra_float_digits to 2 - $sql = 'SET extra_float_digits TO 2'; + $sql = 'SET extra_float_digits TO 2'; $status = $this->execute($sql); if (0 !== $status) { @@ -1071,7 +1071,7 @@ trait TableTrait * @param string $relation The name of a relation * @param bool $oids true to dump also the oids * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dumpRelation($relation, $oids) { @@ -1135,7 +1135,7 @@ trait TableTrait foreach (\explode(',', $_autovacs->fields['reloptions']) as $var) { [$o, $v] = \explode('=', $var); - $_[$o] = $v; + $_[$o] = $v; } $autovacs[] = $_; @@ -1172,7 +1172,7 @@ trait TableTrait * @param int $vaccostdelay vacuum cost delay * @param int $vaccostlimit vacuum cost limit * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function saveAutovacuum( $table, @@ -1239,7 +1239,7 @@ trait TableTrait * * @param string $table The table * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropAutovacuum($table) { @@ -1298,7 +1298,7 @@ trait TableTrait * Protected method which alter a table * SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION. * - * @param \PHPPgAdmin\ADORecordSet $tblrs The table recordSet returned by getTable() + * @param \ADORecordSet $tblrs The table recordSet returned by getTable() * @param string $name The new name for the table * @param string $owner The new owner for the table * @param string $schema The new schema for the table @@ -1356,8 +1356,8 @@ trait TableTrait /** * Dumps serial-like columns in the table. * - * @param \PHPPgAdmin\ADORecordSet $atts table attributes - * @param \PHPPgAdmin\ADORecordSet $tblfields table fields object + * @param \ADORecordSet $atts table attributes + * @param \ADORecordSet $tblfields table fields object * @param string $sql The sql sentence * generated so far * @param string $col_comments_sql Column comments, @@ -1422,7 +1422,7 @@ trait TableTrait /** * Dumps constraints. * - * @param \PHPPgAdmin\ADORecordSet $cons The table constraints + * @param \ADORecordSet $cons The table constraints * @param string $table The table to define * @param string $sql The sql sentence generated so * far @@ -1430,7 +1430,7 @@ trait TableTrait * @param int $num Table attributes count + table * constraints count */ - private function _dumpConstraints($cons, $table, $sql, $i, $num): ?string + private function _dumpConstraints($cons, $table, $sql, $i, $num): ? string { // Output all table constraints while (!$cons->EOF) { @@ -1477,11 +1477,11 @@ trait TableTrait /** * Dumps col statistics. * - * @param \PHPPgAdmin\ADORecordSet $atts table attributes - * @param \PHPPgAdmin\ADORecordSet $tblfields table field attributes + * @param \ADORecordSet $atts table attributes + * @param \ADORecordSet $tblfields table field attributes * @param string $sql The sql sentence generated so far */ - private function _dumpColStats($atts, $tblfields, $sql): ?string + private function _dumpColStats($atts, $tblfields, $sql): ? string { // Column storage and statistics $atts->moveFirst(); @@ -1535,11 +1535,11 @@ trait TableTrait /** * Dumps privileges. * - * @param \PHPPgAdmin\ADORecordSet $privs The table privileges - * @param \PHPPgAdmin\ADORecordSet $tblfields The table fields definition + * @param \ADORecordSet $privs The table privileges + * @param \ADORecordSet $tblfields The table fields definition * @param string $sql The sql sentence generated so far */ - private function _dumpPrivileges($privs, $tblfields, $sql): ?string + private function _dumpPrivileges($privs, $tblfields, $sql): ? string { if (0 >= \count($privs)) { return $sql; @@ -1651,7 +1651,7 @@ trait TableTrait /** * Dumps a create. * - * @param \PHPPgAdmin\ADORecordSet $tblfields table fields object + * @param \ADORecordSet $tblfields table fields object * @param string $sql The sql sentence generated so far * @param string $cleanprefix set to '-- ' to avoid issuing DROP statement * @param mixed $fields @@ -1679,7 +1679,7 @@ trait TableTrait * @param string $table The name of the table * @param string $c_schema The name of the schema * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ private function _getTableAttributesAll($table, $c_schema) { @@ -1731,7 +1731,7 @@ trait TableTrait * @param string $c_schema The schema of the table * @param string $field (optional) The name of a field to return * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ private function _getTableAttribute($table, $c_schema, $field) { diff --git a/src/database/databasetraits/TablespaceTrait.php b/src/database/databasetraits/TablespaceTrait.php index dee7ff69..8e81c117 100644 --- a/src/database/databasetraits/TablespaceTrait.php +++ b/src/database/databasetraits/TablespaceTrait.php @@ -16,7 +16,7 @@ trait TablespaceTrait * * @param bool $all Include all tablespaces (necessary when moving objects back to the default space) * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTablespaces($all = false) { @@ -42,7 +42,7 @@ trait TablespaceTrait * * @param string $spcname * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTablespace($spcname) { @@ -120,7 +120,7 @@ trait TablespaceTrait } // Owner - $sql = "ALTER TABLESPACE \"{$spcname}\" OWNER TO \"{$owner}\""; + $sql = "ALTER TABLESPACE \"{$spcname}\" OWNER TO \"{$owner}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -131,7 +131,7 @@ trait TablespaceTrait // Rename (only if name has changed) if ($name !== $spcname) { - $sql = "ALTER TABLESPACE \"{$spcname}\" RENAME TO \"{$name}\""; + $sql = "ALTER TABLESPACE \"{$spcname}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 !== $status) { @@ -160,7 +160,7 @@ trait TablespaceTrait * * @param string $spcname The name of the domain to drop * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropTablespace($spcname) { diff --git a/src/database/databasetraits/TriggerTrait.php b/src/database/databasetraits/TriggerTrait.php index a6c431eb..bd6617e0 100644 --- a/src/database/databasetraits/TriggerTrait.php +++ b/src/database/databasetraits/TriggerTrait.php @@ -17,7 +17,7 @@ trait TriggerTrait * @param string $table The name of a table whose triggers to retrieve * @param string $trigger The name of the trigger to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTrigger($table, $trigger) { @@ -47,7 +47,7 @@ trait TriggerTrait * @param string $tgfrequency * @param string $tgargs The function arguments * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function createTrigger($tgname, $table, $tgproc, $tgtime, $tgevent, $tgfrequency, $tgargs) { @@ -72,7 +72,7 @@ trait TriggerTrait * @param string $trigger The name of the trigger to alter * @param string $name The new name for the trigger * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterTrigger($table, $trigger, $name) { @@ -94,7 +94,7 @@ trait TriggerTrait * @param string $table The table from which to drop the trigger * @param bool $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropTrigger($tgname, $table, $cascade) { @@ -118,7 +118,7 @@ trait TriggerTrait * @param string $tgname The name of the trigger to enable * @param string $table The table in which to enable the trigger * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function enableTrigger($tgname, $table) { @@ -138,7 +138,7 @@ trait TriggerTrait * @param string $tgname The name of the trigger to disable * @param string $table The table in which to disable the trigger * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function disableTrigger($tgname, $table) { @@ -167,7 +167,7 @@ trait TriggerTrait * @param string $type NOTHING for a do nothing rule, SOMETHING to use given action * @param string $action The action to take * - * @return \PHPPgAdmin\ADORecordSet|int + * @return \ADORecordSet|int */ public function setRule($name, $event, $table, $where, $instead, $type, $action) { @@ -189,7 +189,7 @@ trait TriggerTrait * @param bool $replace (optional) True to replace existing rule, false * otherwise * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function createRule($name, $event, $table, $where, $instead, $type, $action, $replace = false) { @@ -236,7 +236,7 @@ trait TriggerTrait * @param string $relation The relation from which to drop * @param string $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropRule($rule, $relation, $cascade) { diff --git a/src/database/databasetraits/TypeTrait.php b/src/database/databasetraits/TypeTrait.php index 3ce138c4..cdc6f13a 100644 --- a/src/database/databasetraits/TypeTrait.php +++ b/src/database/databasetraits/TypeTrait.php @@ -30,12 +30,12 @@ trait TypeTrait if ('_' === \mb_substr($typname, 0, 1)) { $is_array = true; - $typname = \mb_substr($typname, 1); + $typname = \mb_substr($typname, 1); } // Show lengths on bpchar and varchar if ('bpchar' === $typname) { - $len = $typmod - $varhdrsz; + $len = $typmod - $varhdrsz; $temp = 'character'; if (1 < $len) { @@ -52,8 +52,8 @@ trait TypeTrait if (-1 !== $typmod) { $tmp_typmod = $typmod - $varhdrsz; - $precision = ($tmp_typmod >> 16) & 0xffff; - $scale = $tmp_typmod & 0xffff; + $precision = ($tmp_typmod >> 16) & 0xffff; + $scale = $tmp_typmod & 0xffff; $temp .= "({$precision}, {$scale})"; } } else { @@ -73,7 +73,7 @@ trait TypeTrait * * @param string $typname The name of the view to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getType($typname) { @@ -92,7 +92,7 @@ trait TypeTrait * @param bool $tabletypes If true, will include table types * @param bool $domains If true, will include domains * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getTypes($all = false, $tabletypes = false, $domains = false) { @@ -150,7 +150,7 @@ trait TypeTrait * @param string $typalign * @param string $typstorage * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal param $ ... */ @@ -213,7 +213,7 @@ trait TypeTrait * @param string $typname The name of the type to drop * @param bool $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropType($typname, $cascade) { @@ -293,7 +293,7 @@ trait TypeTrait * * @param string $name * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getEnumValues($name) { @@ -334,10 +334,10 @@ trait TypeTrait return -1; } - $found = false; - $first = true; + $found = false; + $first = true; $comment_sql = ''; // Accumulate comments for the columns - $sql = "CREATE TYPE \"{$f_schema}\".\"{$name}\" AS ("; + $sql = "CREATE TYPE \"{$f_schema}\".\"{$name}\" AS ("; for ($i = 0; $i < $fields; ++$i) { $this->fieldClean($field[$i]); @@ -444,7 +444,7 @@ trait TypeTrait /** * Returns a list of all casts in the database. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getCasts() { @@ -489,7 +489,7 @@ trait TypeTrait /** * Returns a list of all conversions in the database. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getConversions() { diff --git a/src/database/databasetraits/ViewTrait.php b/src/database/databasetraits/ViewTrait.php index beadb54c..a8ffc6da 100644 --- a/src/database/databasetraits/ViewTrait.php +++ b/src/database/databasetraits/ViewTrait.php @@ -14,7 +14,7 @@ trait ViewTrait /** * Returns a list of all views in the database. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getViews() { @@ -34,7 +34,7 @@ trait ViewTrait /** * Returns a list of all materialized views in the database. * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getMaterializedViews() { @@ -163,7 +163,7 @@ trait ViewTrait * * @param string $view The name of the view or materialized to retrieve * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function getView($view) { @@ -186,10 +186,10 @@ trait ViewTrait /** * Alter a view's owner. * - * @param \PHPPgAdmin\ADORecordSet $vwrs The view recordSet returned by getView() + * @param \ADORecordSet $vwrs The view recordSet returned by getView() * @param null|string $owner * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal param $name new view's owner */ @@ -214,10 +214,10 @@ trait ViewTrait /** * Rename a view. * - * @param \PHPPgAdmin\ADORecordSet $vwrs The view recordSet returned by getView() + * @param \ADORecordSet $vwrs The view recordSet returned by getView() * @param string $name The new view's name * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function alterViewName($vwrs, $name) { @@ -227,7 +227,7 @@ trait ViewTrait if (!empty($name) && ($name !== $vwrs->fields['relname'])) { $f_schema = $this->_schema; $this->fieldClean($f_schema); - $sql = "ALTER {$type} \"{$f_schema}\".\"{$vwrs->fields['relname']}\" RENAME TO \"{$name}\""; + $sql = "ALTER {$type} \"{$f_schema}\".\"{$vwrs->fields['relname']}\" RENAME TO \"{$name}\""; $status = $this->execute($sql); if (0 === $status) { @@ -243,10 +243,10 @@ trait ViewTrait /** * Alter a view's schema. * - * @param \PHPPgAdmin\ADORecordSet $vwrs The view recordSet returned by getView() + * @param \ADORecordSet $vwrs The view recordSet returned by getView() * @param string $schema * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet * * @internal param The $name new view's schema */ @@ -274,7 +274,7 @@ trait ViewTrait * @param string $viewname The name of the view to drop * @param string $cascade True to cascade drop, false to restrict * - * @return int|\PHPPgAdmin\ADORecordSet + * @return int|\ADORecordSet */ public function dropView($viewname, $cascade) { @@ -316,7 +316,7 @@ trait ViewTrait * Protected method which alter a view * SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION. * - * @param \PHPPgAdmin\ADORecordSet $vwrs The view recordSet returned by getView() + * @param \ADORecordSet $vwrs The view recordSet returned by getView() * @param string $name The new name for the view * @param string $owner The new owner for the view * @param string $schema Schema name diff --git a/src/traits/HelperTrait.php b/src/traits/HelperTrait.php index c761571a..2984121b 100644 --- a/src/traits/HelperTrait.php +++ b/src/traits/HelperTrait.php @@ -54,22 +54,6 @@ trait HelperTrait throw new \Slim\Exception\SlimException($this->container->requestobj, $this->container->responseobj); } - /** - * Adds a flash message to the session that will be displayed on the next request. - * - * @param mixed $content msg content (can be object, array, etc) - * @param string $key The key to associate with the message. Defaults to the stack - * trace of the closure or method that called addFlassh - */ - public function addFlash($content, $key = ''): void - { - if ('' === $key) { - $key = self::getBackTrace(); - } - // $this->dump(__METHOD__ . ': addMessage ' . $key . ' ' . json_encode($content)); - $this->container->flash->addMessage($key, $content); - } - public static function getBackTrace($offset = 0) { $i0 = $offset; @@ -96,7 +80,7 @@ trait HelperTrait /** * Converts an ADORecordSet to an array. * - * @param \PHPPgAdmin\ADORecordSet $set The set + * @param \ADORecordSet $set The set * @param string $field optionally the field to query for * * @return array the parsed array @@ -201,7 +185,7 @@ trait HelperTrait /** * Receives N parameters and sends them to the console adding where was it called from. * - * @param array ...$args + * @param mixed ...$args */ public function prtrace(...$args): void { @@ -211,7 +195,7 @@ trait HelperTrait /** * Just a proxy for prtrace. * - * @param array ...$args The arguments + * @param mixed ...$args The arguments */ public function dump(...$args): void { @@ -221,7 +205,7 @@ trait HelperTrait /**Claveunica.,219 * Dumps and die. * - * @param array ...$args The arguments + * @param mixed ...$args The arguments */ public function dumpAndDie(...$args): void { @@ -233,10 +217,10 @@ trait HelperTrait * Receives N parameters and sends them to the console adding where was it * called from. * - * @param array $variablesToDump + * @param mixed $variablesToDump */ private static function staticTrace( - array...$variablesToDump + ...$variablesToDump ): void { if (!$variablesToDump) { $variablesToDump = \func_get_args(); diff --git a/src/xhtml/HTMLTableController.php b/src/xhtml/HTMLTableController.php index bc082c51..35a091bb 100644 --- a/src/xhtml/HTMLTableController.php +++ b/src/xhtml/HTMLTableController.php @@ -36,7 +36,7 @@ class HTMLTableController extends HTMLController /** * Display a table of data. * - * @param \PHPPgAdmin\ADORecordSet|\PHPPgAdmin\ArrayRecordSet $tabledata a set of data to be formatted, as returned by $data->getDatabases() etc + * @param \ADORecordSet|\PHPPgAdmin\ArrayRecordSet $tabledata a set of data to be formatted, as returned by $data->getDatabases() etc * @param array $columns An associative array of columns to be displayed: * $columns = array( * column_id => array( @@ -79,7 +79,7 @@ class HTMLTableController extends HTMLController // Action buttons hook's place $this->plugin_functions_parameters = [ 'actionbuttons' => &$actions, - 'place' => $place, + 'place' => $place, ]; if ($this->has_ma = isset($actions['multiactions'])) { @@ -88,11 +88,11 @@ class HTMLTableController extends HTMLController unset($actions['multiactions']); $this->tabledata = $tabledata; - $this->columns = $columns; - $this->actions = $actions; - $this->place = $place; - $this->nodata = $nodata; - $this->pre_fn = $pre_fn; + $this->columns = $columns; + $this->actions = $actions; + $this->place = $place; + $this->nodata = $nodata; + $this->pre_fn = $pre_fn; } public function printTable($turn_into_datatable = true, $with_body = true) @@ -207,9 +207,9 @@ class HTMLTableController extends HTMLController private function _getMaHtml() { - $matop_html = ''; + $matop_html = ''; $ma_bottomhtml = ''; - $lang = $this->lang; + $lang = $this->lang; if ($this->has_ma) { $matop_html .= '<script src="' . SUBFOLDER . '/assets/js/multiactionform.js" type="text/javascript"></script>' . \PHP_EOL; @@ -265,13 +265,13 @@ class HTMLTableController extends HTMLController private function getTbody() { - $columns = $this->columns; - $actions = $this->actions; + $columns = $this->columns; + $actions = $this->actions; $tabledata = $this->tabledata; - $pre_fn = $this->pre_fn; + $pre_fn = $this->pre_fn; // Display table rows - $i = 0; + $i = 0; $tbody_html = '<tbody>'; while (!$tabledata->EOF) { @@ -337,7 +337,7 @@ class HTMLTableController extends HTMLController $tbody_html .= $this->printUrlVars($column['vars'], $tabledata->fields, false); $tbody_html .= '">'; } - $type = $column['type'] ?? null; + $type = $column['type'] ?? null; $params = $column['params'] ?? []; $tbody_html .= $this->misc->printVal($val, $type, $params); |