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 --- .../libraries/classes/Plugins/Import/ImportSql.php | 200 --------------------- 1 file changed, 200 deletions(-) delete mode 100644 srcs/phpmyadmin/libraries/classes/Plugins/Import/ImportSql.php (limited to 'srcs/phpmyadmin/libraries/classes/Plugins/Import/ImportSql.php') diff --git a/srcs/phpmyadmin/libraries/classes/Plugins/Import/ImportSql.php b/srcs/phpmyadmin/libraries/classes/Plugins/Import/ImportSql.php deleted file mode 100644 index 599db37..0000000 --- a/srcs/phpmyadmin/libraries/classes/Plugins/Import/ImportSql.php +++ /dev/null @@ -1,200 +0,0 @@ -setProperties(); - } - - /** - * Sets the import plugin properties. - * Called in the constructor. - * - * @return void - */ - protected function setProperties() - { - $importPluginProperties = new ImportPluginProperties(); - $importPluginProperties->setText('SQL'); - $importPluginProperties->setExtension('sql'); - $importPluginProperties->setOptionsText(__('Options')); - - $compats = $GLOBALS['dbi']->getCompatibilities(); - if (count($compats) > 0) { - $values = []; - foreach ($compats as $val) { - $values[$val] = $val; - } - - // create the root group that will be the options field for - // $importPluginProperties - // this will be shown as "Format specific options" - $importSpecificOptions = new OptionsPropertyRootGroup( - "Format Specific Options" - ); - - // general options main group - $generalOptions = new OptionsPropertyMainGroup("general_opts"); - // create primary items and add them to the group - $leaf = new SelectPropertyItem( - "compatibility", - __('SQL compatibility mode:') - ); - $leaf->setValues($values); - $leaf->setDoc( - [ - 'manual_MySQL_Database_Administration', - 'Server_SQL_mode', - ] - ); - $generalOptions->addProperty($leaf); - $leaf = new BoolPropertyItem( - "no_auto_value_on_zero", - __('Do not use AUTO_INCREMENT for zero values') - ); - $leaf->setDoc( - [ - 'manual_MySQL_Database_Administration', - 'Server_SQL_mode', - 'sqlmode_no_auto_value_on_zero', - ] - ); - $generalOptions->addProperty($leaf); - - // add the main group to the root group - $importSpecificOptions->addProperty($generalOptions); - // set the options for the import plugin property item - $importPluginProperties->setOptions($importSpecificOptions); - } - - $this->properties = $importPluginProperties; - } - - /** - * Handles the whole import logic - * - * @param array $sql_data 2-element array with sql data - * - * @return void - */ - public function doImport(array &$sql_data = []) - { - global $error, $timeout_passed; - - // Handle compatibility options. - $this->_setSQLMode($GLOBALS['dbi'], $_REQUEST); - - $bq = new BufferedQuery(); - if (isset($_POST['sql_delimiter'])) { - $bq->setDelimiter($_POST['sql_delimiter']); - } - - /** - * Will be set in Import::getNextChunk(). - * - * @global bool $GLOBALS ['finished'] - */ - $GLOBALS['finished'] = false; - - while ((! $error) && (! $timeout_passed)) { - // Getting the first statement, the remaining data and the last - // delimiter. - $statement = $bq->extract(); - - // If there is no full statement, we are looking for more data. - if (empty($statement)) { - // Importing new data. - $newData = $this->import->getNextChunk(); - - // Subtract data we didn't handle yet and stop processing. - if ($newData === false) { - $GLOBALS['offset'] -= mb_strlen($bq->query); - break; - } - - // Checking if the input buffer has finished. - if ($newData === true) { - $GLOBALS['finished'] = true; - break; - } - - // Convert CR (but not CRLF) to LF otherwise all queries may - // not get executed on some platforms. - $bq->query .= preg_replace("/\r($|[^\n])/", "\n$1", $newData); - - continue; - } - - // Executing the query. - $this->import->runQuery($statement, $statement, $sql_data); - } - - // Extracting remaining statements. - while (! $error && ! $timeout_passed && ! empty($bq->query)) { - $statement = $bq->extract(true); - if (! empty($statement)) { - $this->import->runQuery($statement, $statement, $sql_data); - } - } - - // Finishing. - $this->import->runQuery('', '', $sql_data); - } - - /** - * Handle compatibility options - * - * @param DatabaseInterface $dbi Database interface - * @param array $request Request array - * - * @return void - */ - private function _setSQLMode($dbi, array $request) - { - $sql_modes = []; - if (isset($request['sql_compatibility']) - && 'NONE' != $request['sql_compatibility'] - ) { - $sql_modes[] = $request['sql_compatibility']; - } - if (isset($request['sql_no_auto_value_on_zero'])) { - $sql_modes[] = 'NO_AUTO_VALUE_ON_ZERO'; - } - if (count($sql_modes) > 0) { - $dbi->tryQuery( - 'SET SQL_MODE="' . implode(',', $sql_modes) . '"' - ); - } - } -} -- cgit