From 5bf66662a9bdd62c5bccab15e607cd95cfb8fcab Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 27 Jul 2020 10:05:23 +0200 Subject: Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my familly --- .../classes/Plugins/Schema/TableStats.php | 208 --------------------- 1 file changed, 208 deletions(-) delete mode 100644 srcs/phpmyadmin/libraries/classes/Plugins/Schema/TableStats.php (limited to 'srcs/phpmyadmin/libraries/classes/Plugins/Schema/TableStats.php') diff --git a/srcs/phpmyadmin/libraries/classes/Plugins/Schema/TableStats.php b/srcs/phpmyadmin/libraries/classes/Plugins/Schema/TableStats.php deleted file mode 100644 index a3d3b5c..0000000 --- a/srcs/phpmyadmin/libraries/classes/Plugins/Schema/TableStats.php +++ /dev/null @@ -1,208 +0,0 @@ -diagram = $diagram; - $this->db = $db; - $this->pageNumber = $pageNumber; - $this->tableName = $tableName; - - $this->showKeys = $showKeys; - $this->tableDimension = $tableDimension; - - $this->offline = $offline; - - $this->relation = new Relation($GLOBALS['dbi']); - $this->font = new Font(); - - // checks whether the table exists - // and loads fields - $this->validateTableAndLoadFields(); - // load table coordinates - $this->loadCoordinates(); - // loads display field - $this->loadDisplayField(); - // loads primary keys - $this->loadPrimaryKey(); - } - - /** - * Validate whether the table exists. - * - * @return void - */ - protected function validateTableAndLoadFields() - { - $sql = 'DESCRIBE ' . Util::backquote($this->tableName); - $result = $GLOBALS['dbi']->tryQuery( - $sql, - DatabaseInterface::CONNECT_USER, - DatabaseInterface::QUERY_STORE - ); - if (! $result || ! $GLOBALS['dbi']->numRows($result)) { - $this->showMissingTableError(); - } - - if ($this->showKeys) { - $indexes = Index::getFromTable($this->tableName, $this->db); - $all_columns = []; - foreach ($indexes as $index) { - $all_columns = array_merge( - $all_columns, - array_flip(array_keys($index->getColumns())) - ); - } - $this->fields = array_keys($all_columns); - } else { - while ($row = $GLOBALS['dbi']->fetchRow($result)) { - $this->fields[] = $row[0]; - } - } - } - - /** - * Displays an error when the table cannot be found. - * - * @return void - * @abstract - */ - abstract protected function showMissingTableError(); - - /** - * Loads coordinates of a table - * - * @return void - */ - protected function loadCoordinates() - { - if (isset($_POST['t_h'])) { - foreach ($_POST['t_h'] as $key => $value) { - $db = rawurldecode($_POST['t_db'][$key]); - $tbl = rawurldecode($_POST['t_tbl'][$key]); - if ($this->db . '.' . $this->tableName === $db . '.' . $tbl) { - $this->x = (double) $_POST['t_x'][$key]; - $this->y = (double) $_POST['t_y'][$key]; - break; - } - } - } - } - - /** - * Loads the table's display field - * - * @return void - */ - protected function loadDisplayField() - { - $this->displayfield = $this->relation->getDisplayField($this->db, $this->tableName); - } - - /** - * Loads the PRIMARY key. - * - * @return void - */ - protected function loadPrimaryKey() - { - $result = $GLOBALS['dbi']->query( - 'SHOW INDEX FROM ' . Util::backquote($this->tableName) . ';', - DatabaseInterface::CONNECT_USER, - DatabaseInterface::QUERY_STORE - ); - if ($GLOBALS['dbi']->numRows($result) > 0) { - while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { - if ($row['Key_name'] == 'PRIMARY') { - $this->primary[] = $row['Column_name']; - } - } - } - } - - /** - * Returns title of the current table, - * title can have the dimensions/co-ordinates of the table - * - * @return string title of the current table - */ - protected function getTitle() - { - return ($this->tableDimension - ? sprintf('%.0fx%0.f', $this->width, $this->heightCell) - : '' - ) - . ' ' . $this->tableName; - } -} -- cgit