aboutsummaryrefslogtreecommitdiff
path: root/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src
diff options
context:
space:
mode:
Diffstat (limited to 'srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src')
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBDocumentation.php75
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php151
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBException.php12
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/MariaDB.js271
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/MySQL.js251
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php167
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/SlimData.php162
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/cleaner.js128
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/common.js113
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/index.js13
-rw-r--r--srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/merge.php472
11 files changed, 0 insertions, 1815 deletions
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBDocumentation.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBDocumentation.php
deleted file mode 100644
index 958f1ad..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBDocumentation.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace Williamdes\MariaDBMySQLKBS;
-
-use \stdClass;
-use \JsonSerializable;
-
-class KBDocumentation extends stdClass implements JsonSerializable
-{
-
- /**
- * The URL
- *
- * @var string
- */
- private $url;
-
- /**
- * The anchor
- *
- * @var string
- */
- private $anchor = null;
-
- /**
- * Create a KBEntry object
- *
- * @param string $url The url
- * @param string|null $anchor The anchor
- */
- public function __construct(string $url, ?string $anchor = null)
- {
- $this->url = $url;
- if ($anchor !== null) {
- $this->anchor = $anchor;
- }
- }
-
- /**
- * Get the url
- *
- * @return string
- */
- public function getUrl(): string
- {
- return $this->url;
- }
-
- /**
- * Get the anchor
- *
- * @return string|null
- */
- public function getAnchor(): ?string
- {
- return $this->anchor;
- }
-
- /**
- * Used for json_encode function
- * This can seem useless, do not remove it.
- *
- * @return array
- */
- public function jsonSerialize(): array
- {
- $outObj = array();
- $outObj['url'] = $this->url;
- if ($this->anchor !== null) {
- $outObj['anchor'] = $this->anchor;
- }
- return $outObj;
- }
-
-}
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php
deleted file mode 100644
index 7ff7e9c..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace Williamdes\MariaDBMySQLKBS;
-
-use \stdClass;
-use \JsonSerializable;
-
-class KBEntry extends stdClass implements JsonSerializable
-{
-
- /**
- * The name of the variable
- *
- * @var string
- */
- private $name;
-
- /**
- * Type of variable
- *
- * @var string
- */
- private $type = null;
-
- /**
- * Is dynamic ?
- *
- * @var bool
- */
- private $dynamic = null;
-
- /**
- * Documentations
- *
- * @var KBDocumentation[]
- */
- private $docs = null;
-
- /**
- * Create a KBEntry object
- *
- * @param string $name The name of the variable
- * @param string|null $type Type of variable
- * @param bool|null $dynamic Is dynamic ?
- */
- public function __construct(string $name, ?string $type, ?bool $dynamic)
- {
- $this->name = $name;
- if ($type !== null) {
- $this->type = $type;
- }
- if ($dynamic !== null) {
- $this->dynamic = $dynamic;
- }
- }
-
- /**
- * Get the variable name
- *
- * @return string
- */
- public function getName(): string
- {
- return $this->name;
- }
-
- /**
- * Is the variable dynamic
- *
- * @return bool|null
- */
- public function isDynamic(): ?bool
- {
- return $this->dynamic;
- }
-
- /**
- * Get the variable type
- *
- * @return string|null
- */
- public function getType(): ?string
- {
- return $this->type;
- }
-
- /**
- * Variable has documentations
- *
- * @return bool
- */
- public function hasDocumentations(): bool
- {
- if ($this->docs === null) {
- return false;
- } else {
- return count($this->docs) > 0;
- }
- }
-
- /**
- * Get all documentations
- *
- * @return KBDocumentation[]
- */
- public function getDocumentations(): array
- {
- return $this->docs;
- }
-
- /**
- * Add documentation link
- *
- * @param string $url The URL
- * @param string|null $anchor The anchor
- * @return KBDocumentation
- */
- public function addDocumentation(string $url, ?string $anchor = null ): KBDocumentation
- {
- $this->url = $url;
- if ($this->docs === null) {
- $this->docs = array();
- }
- $kbd = new KBDocumentation($url, $anchor);
- $this->docs[] = $kbd;
- return $kbd;
- }
-
- /**
- * Used for json_encode function
- * This can seem useless, do not remove it.
- *
- * @return array
- */
- public function jsonSerialize(): array
- {
- $outObj = array();
- $outObj['name'] = $this->name;
- if ($this->type !== null) {
- $outObj['type'] = $this->type;
- }
- if ($this->dynamic !== null) {
- $outObj['dynamic'] = $this->dynamic;
- }
- if ($this->docs !== null) {
- $outObj['docs'] = $this->docs;
- }
- return $outObj;
- }
-
-}
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBException.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBException.php
deleted file mode 100644
index 05eea91..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBException.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace Williamdes\MariaDBMySQLKBS;
-
-use \Exception;
-
-/**
- * KBException class
- */
-class KBException extends Exception
-{
-}
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/MariaDB.js b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/MariaDB.js
deleted file mode 100644
index a6f3c01..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/MariaDB.js
+++ /dev/null
@@ -1,271 +0,0 @@
-'use strict';
-
-const common = require(__dirname + '/common');
-const cleaner = require(__dirname + '/cleaner');
-
-/**
- * Create a doc element
- * @param {Element} element The root element
- * @returns object The doc object
- */
-const createDoc = function($, element) {
- let doc = {
- id: $(element).attr('id'),
- name: $(element)
- .text()
- .trim(),
- };
- try {
- /* jshint -W083 */
- // Parse ul > li
- const ulElementList = $(element)
- .nextAll()
- .not('p')
- .first();
- if (ulElementList.find('li > strong').length === 0) {
- return { id: null };
- }
- ulElementList.find('li').each((i, elementDescr) => {
- const valueKey = $(elementDescr);
- const key = valueKey
- .find('strong')
- .text()
- .toLowerCase()
- .trim();
- const value = $(elementDescr)
- .text()
- .replace(valueKey.find('strong').text(), '')
- .trim();
- switch (key) {
- case 'dynamic:':
- doc.dynamic = value.toLowerCase() === 'yes';
- break;
- case 'scope:':
- doc.scope = value
- .toLowerCase()
- .split(',')
- .map(item => {
- if (item.match(/session/)) {
- return 'session';
- } else if (item.match(/global/)) {
- return 'global';
- } else {
- return item.trim();
- }
- });
- doc.scope = doc.scope.filter(function(e) {
- return e === 0 || e;
- });
- break;
- case 'type:':
- doc.type = cleaner.cleanType(value.toLowerCase());
- break;
- case 'data type:':
- /*
- * Default method, <li> has a <code> child
- * Example: <li><strong>Data Type:</strong> <code>numeric</code></li>
- */
- let dataType = valueKey.find('code');
- if (dataType.length > 0) {
- doc.type = cleaner.cleanType(
- dataType
- .first()
- .text()
- .toLowerCase()
- .trim()
- );
- } else {
- /*
- * Fallback method, <li> has text
- * Example: <li><strong>Data Type:</strong> boolean</li>
- */
- let dataType = value.replace(/undefined/gi, '');
- dataType = dataType.toLowerCase().trim();
- if (dataType !== '') {
- doc.type = cleaner.cleanType(dataType);
- } else if (dataType === '') {
- console.log('Empty datatype found for : ' + doc.id);
- } else {
- console.log('No datatype found for : ' + doc.id);
- }
- }
- break;
- case 'description:':
- doc.type = cleaner.cleanType(value.toLowerCase());
- break;
- case 'default value:':
- case 'default:':
- doc.default = cleaner.cleanDefault(
- valueKey
- .text()
- .replace(valueKey.find('strong').text(), '')
- .trim()
- );
- break;
- case 'valid values:':
- doc.validValues = valueKey
- .find('code')
- .get()
- .map(el => $(el).text());
- break;
- case 'range:':
- doc.range = valueKey
- .find('code')
- .get()
- .map(el => $(el).text());
- if (doc.range.length === 1) {
- // try x-y
- doc.range = doc.range[0].split('-').map(item => item.trim());
- }
- if (doc.range.length === 1) {
- // try x to y
- doc.range = doc.range[0].split('to').map(item => item.trim());
- }
- if (doc.range[1] !== undefined) {
- doc.range[1] = parseFloat(doc.range[1]);
- }
- if (doc.range.length === 1) {
- // try x upwards
- if (value.includes('upwards')) {
- doc.range[1] = value;
- }
- }
- // Could be oneday a float
- doc.range = {
- from: parseFloat(doc.range[0]),
- to: doc.range[1],
- };
- doc.range = cleaner.cleanRange(doc.range);
-
- break;
- case 'commandline:':
- if (
- typeof value === 'string' &&
- (value.toLowerCase() !== 'no' &&
- value.toLowerCase() !== 'none' &&
- value.toLowerCase() !== 'n/a' &&
- value.toLowerCase() !== 'no commandline option')
- ) {
- doc.cli = cleaner.cleanCli(value, true);
- }
- break;
- default:
- break;
- }
- });
- /* jshint +W083 */
- } catch (e) {
- console.error(e);
- console.log('Error at : #' + doc.id);
- }
- if (doc.type !== undefined) {
- if (doc.type === 'numeric') {
- doc.type = 'integer';
- }
- }
- return doc;
-};
-
-function parsePage($, cbSuccess) {
- var anchors = [];
- $('.anchored_heading').each(function(i, el) {
- let doc = createDoc($, el);
- if (doc.id && typeof doc.id === 'string') {
- anchors.push(doc);
- }
- });
- cbSuccess(anchors);
-}
-
-const KB_URL = 'https://mariadb.com/kb/en/library/documentation/';
-
-const storageEngines = ['aria', 'myrocks', 'cassandra', 'galera-cluster', 'mroonga', 'myisam', 'tokudb', 'connect'];
-
-const systemVariables = ['xtradbinnodb-server', 'mariadb-audit-plugin', 'ssltls', 'performance-schema'];
-
-const custom = [
- {
- url: 'columns-storage-engines-and-plugins/storage-engines/spider/spider-server-system-variables/',
- name: 'spider-server-system-variables',
- },
- {
- url: 'semisynchronous-replication/',
- name: 'semisynchronous-replication-system-variables',
- },
- {
- url: 'replication-and-binary-log-server-system-variables/',
- name: 'replication-and-binary-log-server-system-variables',
- },
- {
- url: 'gtid/',
- name: 'gtid-system-variables',
- },
- {
- url: 'replication/optimization-and-tuning/system-variables/server-system-variables/',
- name: 'server-system-variables',
- },
- {
- url: 'system-versioned-tables/',
- name: 'versioned-tables-system-variables',
- },
-];
-
-const status = [
- 'server',
- 'galera-cluster',
- 'aria-server',
- 'cassandra',
- 'mroonga',
- 'spider-server',
- 'sphinx',
- 'tokudb',
- 'xtradbinnodb-server',
- 'replication-and-binary-log',
- 'oqgraph-system-and',
- 'thread-pool-system-and',
- 'ssltls',
- 'mariadb-audit-plugin',
- 'semisynchronous-replication-plugin',
-];
-
-const pages = [];
-
-storageEngines.forEach(se => {
- pages.push({
- url: KB_URL + 'columns-storage-engines-and-plugins/storage-engines/' + se + '/' + se + '-system-variables/',
- name: se + '-system-variables',
- });
-});
-
-custom.forEach(cu => {
- pages.push({
- url: KB_URL + cu.url,
- name: cu.name,
- });
-});
-
-status.forEach(statusName => {
- pages.push({
- url: KB_URL + statusName + '-status-variables/',
- name: statusName + '-status-variables',
- });
-});
-
-systemVariables.forEach(systemVariableName => {
- pages.push({
- url: KB_URL + systemVariableName + '-system-variables/',
- name: systemVariableName + '-system-variables',
- });
-});
-
-module.exports = {
- run: () => {
- /*var pages = [
- {
- url: 'http://7.2.local/Global%20Transaction%20ID%20-%20MariaDB%20Knowledge%20Base.html',
- name: 'gtid-system-variables'
- }
- ]*/
- return common.processDataExtraction(pages, 'mariadb-', parsePage);
- },
-};
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/MySQL.js b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/MySQL.js
deleted file mode 100644
index 99f4561..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/MySQL.js
+++ /dev/null
@@ -1,251 +0,0 @@
-'use strict';
-
-const common = require(__dirname + '/common');
-const cleaner = require(__dirname + '/cleaner');
-
-/**
- * Complete a doc element with info found in table
- * @param {HTMLTableRowElement[]} rows The table rows
- * @param {Object} doc The doc object
- */
-function completeDoc($, rows, doc) {
- $(rows).each((i, elem) => {
- let tds = $(elem).find('td'); // first is key and last is value
- var name = tds
- .first()
- .text()
- .toLowerCase()
- .trim();
- var value = tds.last();
- switch (name) {
- case 'dynamic':
- doc.dynamic =
- value
- .text()
- .toLowerCase()
- .trim() === 'yes';
- break;
- case 'name':
- doc.name = value.text().trim();
- break;
- case 'system variable':
- // Do not overwrite the name
- if (typeof doc.name === 'undefined') {
- doc.name = value
- .text()
- .toLowerCase()
- .trim();
- }
- break;
- case 'scope':
- let scope = value.text().toLowerCase();
- if (scope === 'both') {
- // found on mysql-cluster-options-variables.html
- doc.scope = ['global', 'session'];
- } else if (scope != '') {
- doc.scope = scope.split(',').map(item => {
- if (item.match(/session/)) {
- return 'session';
- } else if (item.match(/global/)) {
- return 'global';
- } else {
- return item.trim();
- }
- });
- }
- if (doc.scope !== undefined) {
- doc.scope = doc.scope.filter(function(e) {
- return e === 0 || e;
- });
- }
- break;
- case 'type':
- let type = value
- .text()
- .toLowerCase()
- .trim();
- if (type != '') {
- doc.type = cleaner.cleanType(type);
- }
- break;
- case 'default value':
- case 'default, range':
- doc.default = cleaner.cleanDefault(value.text().trim());
- break;
- case 'valid values':
- doc.validValues = $(value)
- .find('code')
- .get()
- .map(el => $(el).text());
- break;
- case 'minimum value':
- if (doc.range == undefined) {
- doc.range = {};
- }
- doc.range.from = parseFloat(value.text().trim());
- break;
- case 'maximum value':
- if (doc.range == undefined) {
- doc.range = {};
- }
- doc.range.to = parseFloat(value.text().trim());
- break;
- case 'command-line format':
- doc.cli = cleaner.cleanCli(value.text().trim());
- break;
- case 'command line':
- if (typeof doc.cli !== 'string') {
- doc.cli =
- value
- .text()
- .toLowerCase()
- .trim() === 'yes';
- }
- break;
- }
- });
-}
-
-/**
- * Create a doc element
- * @param {Element} element The root element
- * @returns object The doc object
- */
-function createDoc($, element, doc) {
- completeDoc($, $(element).find('tbody > tr'), doc);
- if (doc.range !== undefined) {
- doc.range = cleaner.cleanRange(doc.range);
- }
-
- if (doc.name && doc.name.match(cleaner.regexCli)) {
- delete doc.name;
- }
-
- return doc;
-}
-
-function parsePage($, cbSuccess) {
- var anchors = [];
- $('.informaltable, .table')
- .filter(function(i, elem) {
- return (
- $(elem)
- .find('th')
- .first()
- .text() === 'Property'
- );
- })
- .each(function(i, elem) {
- let doc = {
- id: $(elem)
- .prevAll()
- .find('a')
- .filter(function(i, el) {
- return typeof $(el).attr('name') === 'string' && typeof $(el).attr('class') === 'undefined';
- })
- .first()
- .attr('name'),
- };
- if (typeof doc.id !== 'string') {
- doc.id = $(elem)
- .prevAll()
- .find('.link')
- .first()
- .attr('href')
- .split('#')[1];
- }
- createDoc($, elem, doc);
- if (typeof doc.cli === 'boolean') {
- doc.cli = $(elem)
- .prevAll()
- .find('.option')
- .first()
- .text();
- if (doc.cli === '') {
- delete doc.cli;
- }
- }
- if (!doc.name && doc.cli) {
- var matches = doc.cli.match(cleaner.regexCli);
- doc.name = matches[2].replace(/-/g, '_');
- }
- anchors.push(doc);
- });
-
- cbSuccess(anchors);
-}
-
-const KB_URL = 'https://dev.mysql.com/doc/refman/8.0/en/';
-const KB_URL57 = 'https://dev.mysql.com/doc/refman/5.7/en/';
-
-const pages = [
- {
- url: KB_URL + 'server-system-variables.html',
- name: 'server-system-variables',
- },
- {
- url: KB_URL + 'innodb-parameters.html',
- name: 'innodb-parameters',
- },
- {
- url: KB_URL + 'performance-schema-system-variables.html',
- name: 'performance-schema-system-variables',
- },
- {
- url: KB_URL + 'x-plugin-options-system-variables.html',
- name: 'x-plugin-options-system-variables',
- },
- {
- url: KB_URL + 'replication-options-binary-log.html',
- name: 'replication-options-binary-log',
- },
- {
- url: KB_URL57 + 'replication-options-binary-log.html',
- name: 'replication-options-binary-log_5.7',
- },
- {
- url: KB_URL + 'pluggable-authentication-system-variables.html',
- name: 'pluggable-authentication-system-variables',
- },
- {
- url: KB_URL + 'audit-log-reference.html',
- name: 'audit-log-reference',
- },
- {
- url: KB_URL + 'replication-options-gtids.html',
- name: 'replication-options-gtids',
- },
- {
- url: KB_URL + 'replication-options-slave.html',
- name: 'replication-options-slave',
- },
- {
- url: KB_URL + 'replication-options-master.html',
- name: 'replication-options-master',
- },
- {
- url: KB_URL + 'replication-options.html',
- name: 'replication-options',
- },
- {
- url: KB_URL57 + 'mysql-cluster-options-variables.html',
- name: 'mysql-cluster-options-variables',
- },
- {
- url: KB_URL + 'server-options.html',
- name: 'server-options',
- },
- {
- url: KB_URL + 'version-tokens-reference.html',
- name: 'version-tokens-reference',
- },
-];
-
-module.exports = {
- parsePage: parsePage,
- createDoc: createDoc,
- completeDoc: completeDoc,
- run: () => {
- return common.processDataExtraction(pages, 'mysql-', parsePage);
- },
-};
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php
deleted file mode 100644
index 12f8ded..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace Williamdes\MariaDBMySQLKBS;
-
-use \stdClass;
-
-class Search
-{
-
- /**
- * Loaded data
- *
- * @var mixed
- */
- public static $data;
-
- /**
- * Data is loaded
- *
- * @var bool
- */
- public static $loaded = false;
-
- public const ANY = -1;
- public const MYSQL = 1;
- public const MARIADB = 2;
- public const DS = DIRECTORY_SEPARATOR;
- public static $DATA_DIR = __DIR__.self::DS."..".self::DS."dist".self::DS;
-
- /**
- * Load data from disk
- *
- * @return void
- * @throws KBException
- */
- public static function loadData(): void
- {
- if (Search::$loaded === false) {
- $filePath = Search::$DATA_DIR."merged-ultraslim.json";
- $contents = @file_get_contents($filePath);
- if ($contents === false) {
- throw new KBException("$filePath does not exist !");
- }
- Search::$data = json_decode($contents);
- Search::$loaded = true;
- }
- }
-
- /**
- * Load test data
- *
- * @param SlimData $slimData The SlimData object
- * @return void
- */
- public static function loadTestData(SlimData $slimData): void
- {
- Search::$data = json_decode((string) json_encode($slimData));
- Search::$loaded = true;
- }
-
- /**
- * get the first link to doc available
- *
- * @param string $name Name of variable
- * @param int $type (optional) Type of link Search::MYSQL/Search::MARIADB/Search::ANY
- * @return string
- * @throws KBException
- */
- public static function getByName(string $name, int $type = Search::ANY): string
- {
- self::loadData();
- $kbEntrys = self::getVariable($name);
- if (isset($kbEntrys->a)) {
- foreach ($kbEntrys->a as $kbEntry) {
- if ($type === Search::ANY) {
- return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a;
- } elseif ($type === Search::MYSQL) {
- if ($kbEntry->t === Search::MYSQL) {
- return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a;
- }
- } elseif ($type === Search::MARIADB) {
- if ($kbEntry->t === Search::MARIADB) {
- return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a;
- }
- }
- }
- }
-
- throw new KBException("$name does not exist for this type of documentation !");
- }
-
- /**
- * Get a variable
- *
- * @param string $name Name of variable
- * @return stdClass
- * @throws KBException
- */
- public static function getVariable(string $name): stdClass
- {
- self::loadData();
- if (isset(Search::$data->vars->{$name})) {
- return Search::$data->vars->{$name};
- } else {
- throw new KBException("$name does not exist !");
- }
- }
-
- /**
- * get the type of the variable
- *
- * @param string $name Name of variable
- * @return string
- * @throws KBException
- */
- public static function getVariableType(string $name): string
- {
- self::loadData();
- $kbEntry = self::getVariable($name);
- if (isset($kbEntry->t)) {
- return Search::$data->varTypes->{$kbEntry->t};
- } else {
- throw new KBException("$name does have a known type !");
- }
- }
-
- /**
- * Return the list of static variables
- *
- * @return array
- */
- public static function getStaticVariables(): array
- {
- return self::getVariablesWithDynamic(false);
- }
-
- /**
- * Return the list of dynamic variables
- *
- * @return array
- */
- public static function getDynamicVariables(): array
- {
- return self::getVariablesWithDynamic(true);
- }
-
- /**
- * Return the list of variables having dynamic = $dynamic
- *
- * @param bool $dynamic dynamic=true/dynamic=false
- * @return array
- */
- public static function getVariablesWithDynamic(bool $dynamic): array
- {
- self::loadData();
- $staticVars = array();
- foreach (Search::$data->vars as $name => $var) {
- if (isset($var->d)) {
- if ($var->d === $dynamic) {
- $staticVars[] = $name;
- }
- }
- }
- return $staticVars;
- }
-
-}
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/SlimData.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/SlimData.php
deleted file mode 100644
index fc7cd42..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/SlimData.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace Williamdes\MariaDBMySQLKBS;
-
-use \stdClass;
-use \JsonSerializable;
-
-class SlimData extends stdClass implements JsonSerializable
-{
-
- /**
- * Variables
- *
- * @var KBEntry[]
- */
- private $vars = array();
-
- /**
- * File revision
- *
- * @var float
- */
- private $version = 1;
-
- /**
- * Urls
- *
- * @var string[]
- */
- private $urls = array();
-
- /**
- * Types of documentation
- *
- * @var array<string, string|int>
- */
- private $types = array("MYSQL" => 1, "MARIADB" => 2);
-
- /**
- * Types of variables
- *
- * @var array<string, string|int>
- */
- private $varTypes = array(
- "string" => 1,
- "boolean" => 2,
- "integer" => 3,
- "numeric" => 4,
- "enumeration" => 5,
- "set" => 6,
- "directory name" => 7,
- "file name" => 8,
- "byte" => 9
- );
-
- /**
- * Create a slimData object
- *
- * @param float|null $version The version
- * @param array<string, string>|null $types The types of documentations
- * @param array<string, string>|null $varTypes The types of variables
- */
- public function __construct(
- ?float $version = null,
- ?array $types = null,
- ?array $varTypes = null
- ) {
- if ($version !== null) {
- $this->version = $version;
- }
-
- if ($types !== null) {
- $this->types = $types;
- }
-
- if ($varTypes !== null) {
- $this->varTypes = $varTypes;
- }
- }
-
- /**
- * Add a variable
- *
- * @param string $name The name
- * @param string|null $type The type
- * @param bool|null $dynamic Is dynamic
- * @return KBEntry The newly created KBEntry
- */
- public function addVariable(string $name, ?string $type, ?bool $dynamic): KBEntry
- {
- $kbe = new KBEntry($name, $type, $dynamic);
- $this->vars[] = $kbe;
- return $kbe;
- }
-
- /**
- * Used for json_encode function
- * This can seem useless, do not remove it.
- *
- * @return array
- */
- public function jsonSerialize(): array
- {
- $outObj = array();
- if (count($this->vars) > 0) {
- $vars = new stdClass();
- foreach ($this->vars as $var) {
- $variable = new stdClass();
- $variable->d = $var->isDynamic();
- if ($variable->d === null) {
- unset($variable->d);
- }
-
- if ($var->getType() !== null) {
- if (isset($this->varTypes[$var->getType()]) === false) {
- $this->varTypes[$var->getType()] = "".(count($this->varTypes) + 1);
- }
-
- $variable->t = $this->varTypes[$var->getType()];
- }
-
- if ($var->hasDocumentations()) {
- $variable->a = array();
- foreach ($var->getDocumentations() as $kbd) {
- $entry = new stdClass();
- $entry->a = $kbd->getAnchor();
- if ($entry->a === null) {
- unset($entry->a);
- }
- if (preg_match("!^(https|http)://mariadb.com!", $kbd->getUrl())) {
- $entry->t = $this->types["MARIADB"];
- } elseif (preg_match("!^(https|http)://dev.mysql.com!", $kbd->getUrl())) {
- $entry->t = $this->types["MYSQL"];
- }
- if (isset($entry->t)) {// If has no valid type, skip.
- //Do not allow other urls.
- $keyIndex = array_search($kbd->getUrl(), $this->urls);
- if ($keyIndex === false) {
- $this->urls[] = $kbd->getUrl();
- }
- $keyIndex = array_search($kbd->getUrl(), $this->urls);
- $entry->u = $keyIndex;
-
- $variable->a[] = $entry;
- }
- }
- }
-
- $vars->{$var->getName()} = $variable;
- }
- $outObj['vars'] = $vars;
- }
- $outObj['version'] = $this->version;
- if (count($this->vars) > 0) {
- $outObj['types'] = array_flip($this->types);
- $outObj['varTypes'] = array_flip($this->varTypes);
- $outObj['urls'] = $this->urls;
- }
- return $outObj;
- }
-
-}
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/cleaner.js b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/cleaner.js
deleted file mode 100644
index c15d51a..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/cleaner.js
+++ /dev/null
@@ -1,128 +0,0 @@
-'use strict';
-
-const realTypes = [
- 'string',
- 'boolean',
- 'integer',
- 'numeric',
- 'enumeration',
- 'set',
- 'directory name',
- 'file name',
- 'byte',
-];
-
-/**
- * Clean type using real types
- * @param {String} type The type
- * @return {String|undefined} The cleaned type
- */
-const cleanType = function(type) {
- if (realTypes.includes(type) === false && typeof type === 'string') {
- if (type.match(/in bytes/i) || type.match(/number of bytes/i) || type.match(/size in mb/i)) {
- type = 'byte';
- } else if (
- type.match(/number of/i) ||
- type.match(/size of/i) ||
- type.match(/in microseconds/i) ||
- type.match(/in seconds/i)
- ) {
- type = 'integer';
- } else if (
- type.match(/numeric (64-bit unsigned integer)/i) ||
- type.match(/numeric (32-bit unsigned integer)/i)
- ) {
- type = 'numeric';
- } else {
- type = undefined;
- }
- }
- return type;
-};
-
-const regexCli = /([-]{2})([0-9a-z-_]+)/i;
-
-/**
- * Clean cli argument
- * @param {String} cli The command line string
- * @param {boolean} skipRegex Skip regex check
- * @returns {String} The cleaned cli
- */
-const cleanCli = function(cli, skipRegex = false) {
- if (typeof cli === 'string') {
- if (cli.match(/<code\>/i) || cli.match(/<\/code\>/i)) {
- cli = cli.replace(/<code\>/gi, '');
- cli = cli.replace(/<\/code\>/gi, '');
- cli = cli.replace(/\>/gi, '');
- cli = cli.replace(/</gi, '');
- }
- if (!cli.match(regexCli) && skipRegex === false) {
- cli = undefined;
- }
- }
- return cli;
-};
-
-/**
- * Clean the range object
- * @param {Object} range The range object
- * @returns {Object} The cleaned range object
- */
-const cleanRange = function(range) {
- if (range !== undefined) {
- // clean range
- if (typeof range.from !== 'number' || isNaN(range.from)) {
- delete range.from;
- }
- if (typeof range.to === 'string' && range.to.match(/upwards/i)) {
- range.to = 'upwards';
- } else if (typeof range.to !== 'number' || isNaN(range.to)) {
- delete range.to;
- }
- }
- return range;
-};
-
-/**
- * Clean a default value
- * @param {String} defaultValue The default value
- * @returns {String} The same or an alternative formated text
- */
-const cleanDefault = function(defaultValue) {
- return defaultValue
- .split('\n')
- .map(el => cleanTextDefault(el.trim()))
- .join(', ');
-};
-
-/**
- * Clean text of a default value
- * @param {String} defaultTextValue The default text value
- * @returns {String} The same or an alternative text
- */
-const cleanTextDefault = function(defaultTextValue) {
- if (defaultTextValue === 'Autosized (see description)') {
- defaultTextValue = '(autosized)';
- }
- if (defaultTextValue.indexOf('Based on the number of processors') !== -1) {
- defaultTextValue = '(based on the number of processors)';
- }
- if (defaultTextValue === 'The MariaDB data directory') {
- defaultTextValue = '(the MariaDB data directory)';
- }
- if (defaultTextValue.match(/-1 \(signifies (autoscaling); do not assign this literal value\)/g)) {
- defaultTextValue = '(-1 signifies autoscaling; do not use -1)';
- }
- if (defaultTextValue.match(/-1 \(signifies (autosizing); do not assign this literal value\)/g)) {
- defaultTextValue = '(-1 signifies autosizing; do not use -1)';
- }
- return defaultTextValue;
-};
-
-module.exports = {
- regexCli: regexCli,
- cleanType: cleanType,
- cleanCli: cleanCli,
- cleanRange: cleanRange,
- cleanDefault: cleanDefault,
-};
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/common.js b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/common.js
deleted file mode 100644
index d9274dc..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/common.js
+++ /dev/null
@@ -1,113 +0,0 @@
-'use strict';
-
-const fs = require('fs');
-const Crawler = require('crawler');
-const path = require('path');
-
-/**
- * Sort the object keys
- * @see https://stackoverflow.com/a/48112249/5155484
- * @param {Object} obj The object
- * @param {Function} arraySorter The sorter callback
- */
-const sortObject = function(obj, arraySorter) {
- if (typeof obj !== 'object') {
- return obj;
- }
- if (Array.isArray(obj)) {
- if (arraySorter) {
- obj.sort(arraySorter);
- }
- for (var i = 0; i < obj.length; i++) {
- obj[i] = sortObject(obj[i], arraySorter);
- }
- return obj;
- }
- var temp = {};
- var keys = [];
- for (var key in obj) {
- keys.push(key);
- }
- keys.sort();
- for (var index in keys) {
- temp[keys[index]] = sortObject(obj[keys[index]], arraySorter);
- }
- return temp;
-};
-
-const writeJSON = function(filename, data, cbSuccess = null) {
- fs.writeFile(filename, JSON.stringify(sortObject(data), null, 2) + '\n', function(err) {
- if (err) {
- return console.log(err);
- } else {
- if (cbSuccess !== null) {
- cbSuccess();
- }
- }
- });
-};
-
-const readJSON = function(filename, callbackSuccess) {
- fs.readFile(filename, 'utf8', function(err, data) {
- if (err) {
- return console.log(err);
- }
- callbackSuccess(JSON.parse(data), filename);
- });
-};
-
-const listDirectory = function(dirname, callbackSuccess) {
- fs.readdir(dirname, (err, files) => {
- if (err) {
- return console.log(err);
- }
- callbackSuccess(files, dirname);
- });
-};
-
-const writePage = function(filePrefix, name, url, data, onWriteSuccess) {
- let pageKB = {
- url: url,
- name: name,
- data: data,
- };
- writeJSON(path.join(__dirname, '../', 'data', filePrefix + pageKB.name + '.json'), pageKB, onWriteSuccess);
-};
-
-const processDataExtraction = function(pages, filePrefix, parsePage) {
- return new Promise(resolve => {
- var nbrPagesProcessed = 0;
- var crawler = new Crawler({
- maxConnections: 1,
- // This will be called for each crawled page
- callback: function(error, res, done) {
- if (error) {
- console.log(error);
- } else {
- console.log('URL : ' + res.options.url);
- parsePage(res.$, anchors => {
- writePage(filePrefix, res.options.name, res.options.url, anchors, () => {
- nbrPagesProcessed++;
- if (nbrPagesProcessed === pages.length) {
- resolve();
- }
- });
- });
- }
- done();
- },
- });
- crawler.queue(
- pages.map(page => {
- return { uri: page.url, name: page.name, url: page.url };
- })
- );
- });
-};
-
-module.exports = {
- processDataExtraction: processDataExtraction,
- listDirectory: listDirectory,
- readJSON: readJSON,
- writeJSON: writeJSON,
-};
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/index.js b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/index.js
deleted file mode 100644
index e0308f1..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict';
-const MariaDB = require('./MariaDB.js');
-const MySQL = require('./MySQL.js');
-
-console.log('Run build...');
-
-Promise.all([MariaDB.run(), MySQL.run()])
- .then(() => {
- console.log('All done.');
- })
- .then(() => {
- console.log('End !');
- });
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/merge.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/merge.php
deleted file mode 100644
index 471cab1..0000000
--- a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/merge.php
+++ /dev/null
@@ -1,472 +0,0 @@
-<?php
-declare(strict_types = 1);
-$dataDir = __DIR__."/../data/";
-$files = glob("$dataDir*.json");
-
-/**
- * Compare 2 variables
- *
- * @param mixed $var1 First
- * @param mixed $var2 Second
- * @return bool
- */
-function JSONcompare($var1, $var2): bool
-{
- return json_encode($var1) === json_encode($var2);
-}
-
-/**
- * Fix key=range
- *
- * @param stdClass $current Current value
- * @param stdClass $cache Cache value
- * @return void
- */
-function fixRange(stdClass &$current, stdClass &$cache): void
-{
- global $newData, $key, $nbrConflictsSolved;
- $currentHasFrom = isset($current->from);
- $cacheHasFrom = isset($cache->from);
- $currentHasTo = isset($current->to);
- $cacheHasTo = isset($cache->to);
- if ($currentHasFrom === false && $cacheHasFrom === true) {
- $current->from = $cache->from;
- if (JSONcompare($cache, $current)) {
- $newData->$key = $current;
- if (JSONcompare($current, $cache)) {
- $nbrConflictsSolved++;
- } else {
- fixRange($current, $cache);
- }
- }
- } elseif ($currentHasFrom === true && $cacheHasFrom === false) {
- $cache->from = $current->from;
- if (JSONcompare($cache, $current)) {
- $newData->$key = $cache;
- if (JSONcompare($current, $cache)) {
- $nbrConflictsSolved++;
- } else {
- fixRange($current, $cache);
- }
- }
- } elseif ($currentHasTo === false && $cacheHasTo === true) {
- $current->to = $cache->to;
- if (JSONcompare($cache, $current)) {
- $newData->$key = $current;
- if (JSONcompare($current, $cache)) {
- $nbrConflictsSolved++;
- } else {
- fixRange($current, $cache);
- }
- }
- } elseif ($currentHasTo === true && $cacheHasTo === false) {
- $cache->to = $current->to;
- if (JSONcompare($cache, $current)) {
- $newData->$key = $cache;
- if (JSONcompare($current, $cache)) {
- $nbrConflictsSolved++;
- } else {
- fixRange($current, $cache);
- }
- }
- } elseif (( $currentHasFrom === true && $currentHasFrom === true )
- && ( $cache->from === $current->from )
- ) {
- $onlyFrom = new stdClass();
- $onlyFrom->from = $current->from;
- $newData->$key = $onlyFrom;
- $nbrConflictsSolved++;
- echo '[WARN] conflict range to - '.json_encode($cache).' - '.json_encode($current).PHP_EOL;
- } else {
- echo '[ERROR] conflict range - '.json_encode($cache).' - '.json_encode($current).PHP_EOL;
- }
-}
-
-$variables = array();
-
-$nbr = 0;
-$nbrConflicts = 0;
-$nbrConflictsSolved = 0;
-foreach ($files as $file) {
- $fileData = json_decode(file_get_contents($file));
- if (isset($fileData->data) === false) {
- continue;
- } else {
- $data = $fileData->data;
- }
-
- foreach ($data as $doc) {
- $identifier = $doc->name;
- if (isset($identifier)) {
- if (isset($variables[$identifier]) === false) {
- if (isset($doc->ids) === false) {
- $doc->ids = array();
- }
- $variables[$identifier] = $doc;
- $kbEntry = new stdClass();
- $kbEntry->anchor = $doc->id;
- $kbEntry->url = $fileData->url;
- $doc->ids[] = $kbEntry;
- unset($doc->id);
- } else {
- if (isset($doc->ids) === false) {
- $doc->ids = array();
- }
- $kbEntry = new stdClass();
- $kbEntry->anchor = $doc->id;
- $kbEntry->url = $fileData->url;
- $doc->ids[] = $kbEntry;
- unset($doc->id);
- //echo $identifier." duplicate ! in ".str_replace($dataDir, "", $file).PHP_EOL;
- $newData = new stdClass();
- foreach ((array) $doc as $key => $val) {
- if (isset($variables[$identifier]->$key)) {
- $cacheValue = $variables[$identifier]->$key;
- $docValue = $doc->$key;
- if (( strtoupper(json_encode($cacheValue)) === strtoupper(json_encode($docValue)))
- && ( json_encode($cacheValue) !== json_encode($docValue))
- ) {
- $nbrConflicts++;
- $nbrConflictsSolved++;
- //echo 'upper conflict '.$key.' - '.json_encode($cacheValue).' - '.json_encode($docValue).PHP_EOL;
- $docValue = strtoupper(json_encode($docValue));
- } elseif (json_encode($cacheValue) !== json_encode($docValue)) {
- $nbrConflicts++;
- if ($key === "type") {
- $realTypes = array(
- "string",
- "boolean",
- "integer",
- "numeric",
- "enumeration",
- "set",
- "directory name",
- "file name",
- "byte"
- );
- if (in_array($cacheValue, $realTypes)// original
- && in_array($docValue, $realTypes) === false// dupe
- ) {//original type valid
- echo 'original type valid : '.$cacheValue.PHP_EOL;
- } elseif (in_array($cacheValue, $realTypes) === false// original
- && in_array($docValue, $realTypes)// dupe
- ) {// dupe type valid
- $newData->$key = $docValue;
- //echo 'dupe type valid : '.$docValue.PHP_EOL;
- $nbrConflictsSolved++;
- } else {
- if (( json_encode($cacheValue) === '"numeric"'
- && json_encode($docValue) === '"integer"')
- || ( json_encode($cacheValue) === '"integer"'
- && json_encode($docValue) === '"numeric"')
- ) {// numeric vs integer
- //echo "integer wins !".PHP_EOL;
- $newData->$key = "integer";
- $nbrConflictsSolved++;
- } else {
- echo 'type conflict : '.json_encode($cacheValue).' - '.json_encode($docValue).PHP_EOL;
- }
- }
- } elseif ($key === "ids") {
- /*if (isset($newData->ids) === false) {
- $newData->ids = array();
- }*/
- $newData->ids = array_merge($cacheValue, $docValue);
- /*$source = array("_", "option-mysqld-", "sysvar-", );
- $destination = array("-", "","");
- if (// Replace prefix to see if same id
- str_replace($source, $destination, $docValue)
- ===
- str_replace($source, $destination, $cacheValue)
- ) {
- $newData->$key = str_replace($source, $destination, $docValue);
- $nbrConflictsSolved++;// TODO: check if good idea
- } else {
- echo '[ERROR] conflict id : '
- .json_encode($cacheValue)
- .' - '
- .json_encode($docValue)
- .' - '
- .str_replace($source, $destination, $docValue)
- .' - '
- .str_replace($source, $destination, $cacheValue)
- .PHP_EOL;
- }*/
- } elseif ($key === "default") {
- $originalValues = array("on", "off", "ON", "OFF", "true", "false", "TRUE", "FALSE");
- $destinationValues = array("1", "0", "1", "0", "1", "0", "1", "0");
- $docValue = str_replace($originalValues, $destinationValues, $docValue);
- $cacheValue = str_replace($originalValues, $destinationValues, $cacheValue);
- if ($docValue === $cacheValue) {
- $newData->$key = $docValue;
- $nbrConflictsSolved++;
- } else {
- if (is_array($cacheValue) === false
- && is_array($docValue) === false
- ) {
- if (floatval($cacheValue) === floatval($docValue)) {
- $newData->$key = $docValue;
- $nbrConflictsSolved++;
- } else {
- echo '[ERROR] conflict default, not array : '.json_encode($cacheValue).' - '.json_encode($docValue).PHP_EOL;
- }
- } else {
- echo '[ERROR] conflict default : '.json_encode($cacheValue).' - '.json_encode($docValue).PHP_EOL;
- }
- }
- } elseif ($key === "validValues") {
- if (is_array($cacheValue) === false) {
- $cacheValue = array($cacheValue);
- }
- if (is_array($docValue) === false) {
- $docValue = array($docValue);
- }
- $intersecValidValues = array_intersect($docValue, $cacheValue);
- if (count($intersecValidValues) === count($docValue)
- && count($intersecValidValues) === count($cacheValue)
- ) {// No variables were lost in process
- $newData->$key = $intersecValidValues;
- $nbrConflictsSolved++;
- } elseif (array_values(array_diff($docValue, $cacheValue)) === array("32768","65536")
- ) {// Missing translation (in bytes) for 32k and 64k
- $intersecValidValues[] = "32768";
- $intersecValidValues[] = "65536";
- $newData->$key = array_values($intersecValidValues);
- $nbrConflictsSolved++;
- } elseif (strtoupper(json_encode(ksort($docValue))) === strtoupper(json_encode(ksort($cacheValue)))
- ) {// uppercase / lowercase
- ksort($cacheValue);
- $newData->$key = json_decode(json_encode($cacheValue));
- $nbrConflictsSolved++;
- } else {
- echo '[ERROR] conflict validValues : '
- .json_encode($cacheValue)
- .' - '
- .json_encode($docValue)
- .' - '
- .json_encode($intersecValidValues)
- .' - '
- .json_encode(array_values(array_diff($docValue, $cacheValue))).PHP_EOL;
- }
- } elseif ($key === "cli") {
- $replaceSource = array("file", "dir_name", "-- ", "_");
- $replaceDest = array("path", "path", "--", "-");
- $replacedDocValue = str_replace($replaceSource, $replaceDest, $docValue);
- $replacedCacheValue = str_replace($replaceSource, $replaceDest, $cacheValue);
- if (str_replace($replaceSource, $replaceDest, $docValue) === str_replace($replaceSource, $replaceDest, $cacheValue)
- ) {//Try replacements
- $newData->$key = str_replace($replaceSource, $replaceDest, $docValue);
- $nbrConflictsSolved++;
- } elseif (str_replace("--", "", $docValue) === str_replace("--", "", $cacheValue)
- ) {// Doc not well formated, missing -- before cli command
- $newData->$key = "--".str_replace("--", "", $docValue);
- $nbrConflictsSolved++;
- } elseif (strlen(str_replace(str_replace("#", "", $docValue), "", $cacheValue)) !== strlen($cacheValue)
- ) {// More precise doc, value hint, eg: --blablabla={0|1}
- $newData->$key = $cacheValue;
- $nbrConflictsSolved++;
- } elseif (strlen(
- str_replace(
- str_replace(
- array("#"),
- array(""),
- $replacedDocValue
- ), "", $replacedCacheValue
- )
- ) !== strlen($replacedCacheValue)
- ) {// More precise doc, value hint, eg: --blablabla={0|1} using replaced values
- $newData->$key = $replacedCacheValue;
- $nbrConflictsSolved++;
- } elseif (strlen(
- str_replace(
- str_replace(
- array("#"),
- array(""),
- $replacedCacheValue
- ), "", $replacedDocValue
- )
- ) !== strlen($replacedDocValue)
- ) {// More precise doc, value hint, eg: --blablabla={0|1} using replaced values, reversed: cache/doc
- $newData->$key = $replacedDocValue;
- $nbrConflictsSolved++;
- } elseif (strlen(str_replace(str_replace(array("#"), array(""), $docValue), "", $cacheValue)) !== strlen($cacheValue)
- ) {// More precise doc, value hint, eg: --blablabla={0|1}
- $newData->$key = $cacheValue;
- $nbrConflictsSolved++;
- } elseif (strlen(str_replace($cacheValue, "", $docValue)) !== strlen($docValue)
- ) {// contained in cache
- $newData->$key = $docValue;
- $nbrConflictsSolved++;
- } elseif (strlen(str_replace($docValue, "", $cacheValue)) !== strlen($cacheValue)
- ) {// contained in conflict
- $newData->$key = $cacheValue;
- $nbrConflictsSolved++;
- } else {
- echo '[ERROR] conflict cli : cacheValue: '
- .json_encode($cacheValue)
- .' - docValue: '
- .json_encode($docValue)
- .' - docValue: '
- .str_replace($replaceSource, $replaceDest, $docValue)
- .' - cacheValue: '
- .str_replace($replaceSource, $replaceDest, $cacheValue)
- .PHP_EOL;
- }
- } elseif ($key === "range") {
- $current = $docValue;
- $cache = $cacheValue;
- fixRange($current, $cache);
- } else {
- echo '[ERROR] conflict '.$key.' + '.$identifier.' - '.json_encode($cacheValue).' - '.json_encode($docValue).PHP_EOL;
- }
- } else {
- $newData->$key = $val;
- }
- } else {
- $newData->$key = $val;
- }
- }
- //print_r($newData);
- $variables[$identifier] = $newData;
- }
- }
- }
- $nbr += count($data);
-}
-echo "NBR: ".$nbr.PHP_EOL;
-echo "NBR_UNIQUE: ".count($variables).PHP_EOL;
-echo "NBR_CONFLICTS: ".$nbrConflicts.PHP_EOL;
-echo "NBR_CONFLICTS_SOLVED: ".$nbrConflictsSolved.PHP_EOL;
-echo "NBR_CONFLICTS_REMAINING: ".($nbrConflicts - $nbrConflictsSolved).PHP_EOL;
-
-$fileOut = new stdClass();
-$fileOut->vars = json_decode(json_encode($variables));
-$fileOut->version = 1.0;
-
-$md = "# Variables and options".PHP_EOL;
-foreach ($fileOut->vars as $id => $doc) {
- //$md .= "## ".$doc->url.PHP_EOL;
- $md .= "## ".$doc->name.PHP_EOL;
- $md .= "|name|value|".PHP_EOL;
- $md .= "|----|-----|".PHP_EOL;
- if (isset($doc->name)) {
- $md .= "|Name|`$doc->name`|".PHP_EOL;
- }
- if (isset($doc->cli)) {
- $md .= "|Command line|`$doc->cli`|".PHP_EOL;
- }
- if (isset($doc->type)) {
- $md .= "|Type of variable|`$doc->type`|".PHP_EOL;
- }
- if (isset($doc->scope)) {
- $md .= "|Scope|`".implode("`, `", $doc->scope)."`|".PHP_EOL;
- }
- if (isset($doc->default)) {
- $md .= "|Default value|`$doc->default`|".PHP_EOL;
- }
- if (isset($doc->dynamic)) {
- $md .= "|Dynamic|`".( ($doc->dynamic) ? 'true' : 'false')."`|".PHP_EOL;
- }
- if (empty($doc->validValues) === false) {
- $md .= "|Valid value(s)|`".implode("`, `", $doc->validValues)."`|".PHP_EOL;
- }
- if (isset($doc->range)) {
- $r = '';
- if (isset($doc->range->from)) {
- $r .= "from: `".$doc->range->from."`";
- }
-
- if (isset($doc->range->to)) {
- if (isset($doc->range->from)) {
- $r .= " ";
- }
- $r .= "to: `".$doc->range->to."`";
- }
- $md .= "|Range|$r|".PHP_EOL;
- }
- $md .= PHP_EOL;
- $md .= "### Documentation(s)".PHP_EOL;
- $md .= "|source|anchor name|".PHP_EOL;
- $md .= "|------|----|".PHP_EOL;
- foreach ($doc->ids as &$kbEntry) {
- $matchs = array();
- preg_match("/:\/\/([a-z.]+)/i", $kbEntry->url, $matchs);
- $md .= "|$matchs[1]|[$kbEntry->anchor]($kbEntry->url#$kbEntry->anchor)|".PHP_EOL;
- }
- $md .= PHP_EOL;
-}
-
-file_put_contents(__DIR__."/../dist/merged-raw.md", $md.PHP_EOL);
-
-file_put_contents(__DIR__."/../dist/merged-raw.json", json_encode($fileOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL);
-
-$fileOut->urls = array();
-
-foreach ($fileOut->vars as $id => $doc) {
- foreach ($doc->ids as &$kbEntry) {
- $urlId = array_search($kbEntry->url, $fileOut->urls, true);
- if ($urlId === false) {
- $urlId = array_push($fileOut->urls, $kbEntry->url);
- }
- $kbEntry->url = $urlId;
- $kbEntry = "$urlId#$kbEntry->anchor";
- }
-}
-$fileOut->version = 1.0;
-file_put_contents(__DIR__."/../dist/merged-slim.json", json_encode($fileOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL);
-
-$fileOut->vars = json_decode(json_encode($variables));
-$fileOut->types = array( "MYSQL" => 1, "MARIADB" => 2 );
-$fileOut->varTypes = array(
- "string" => 1,
- "boolean" => 2,
- "integer" => 3,
- "numeric" => 4,
- "enumeration" => 5,
- "set" => 6,
- "directory name" => 7,
- "file name" => 8,
- "byte" => 9
-);
-foreach ($fileOut->vars as $id => &$doc) {
- $data = new stdClass();
- if (isset($doc->dynamic)) {
- $data->d = $doc->dynamic;
- }
- if (isset($doc->type)) {
- $data->t = $fileOut->varTypes[$doc->type];
- }
- $data->a = array();
- foreach ($doc->ids as &$kbEntry) {
- $urlId = array_search($kbEntry->url, $fileOut->urls, true);
- if ($urlId === false) {
- $urlId = array_push($fileOut->urls, $kbEntry->url);
- }
- $kbEntryMin = new stdClass();
- $kbEntryMin->a = $kbEntry->anchor;
-
- $kbEntryMin->u = $urlId;
- if (preg_match("/mysql\.com/", $kbEntry->url)) {
- $kbEntryMin->t = $fileOut->types["MYSQL"];
- } elseif (preg_match("/mariadb\.com/", $kbEntry->url)) {
- $kbEntryMin->t = $fileOut->types["MARIADB"];
- }
- $data->a[] = $kbEntryMin;
- }
- $doc = $data;
-}
-$fileOut->types = array_flip($fileOut->types);
-$fileOut->varTypes = array_flip($fileOut->varTypes);
-$fileOut->version = 1.0;
-file_put_contents(__DIR__."/../dist/merged-ultraslim.json", json_encode($fileOut, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL);
-
-$content = '<?php'.PHP_EOL.'$data = '.json_encode($fileOut, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).';'.PHP_EOL;
-
-$content = str_replace(
- array("{", "}", ":"),
- array("[", "]", "=>"),
- $content
-);
-
-file_put_contents(__DIR__."/../dist/merged-ultraslim.php", $content);
-echo "Files merged !".PHP_EOL;