SpecialSchemaLinks.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Links configuration for MySQL system tables
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. declare(strict_types=1);
  9. namespace PhpMyAdmin\Config;
  10. use PhpMyAdmin\Util;
  11. /**
  12. * Class SpecialSchemaLinks
  13. * @package PhpMyAdmin\Config
  14. */
  15. class SpecialSchemaLinks
  16. {
  17. /**
  18. * This array represent the details for generating links inside
  19. * special schemas like mysql, information_schema etc.
  20. * Major element represent a schema.
  21. * All the strings in this array represented in lower case
  22. *
  23. * Array structure ex:
  24. * array(
  25. * // Database name is the major element
  26. * 'mysql' => array(
  27. * // Table name
  28. * 'db' => array(
  29. * // Column name
  30. * 'user' => array(
  31. * // Main url param (can be an array where represent sql)
  32. * 'link_param' => 'username',
  33. * // Other url params
  34. * 'link_dependancy_params' => array(
  35. * 0 => array(
  36. * // URL parameter name
  37. * // (can be array where url param has static value)
  38. * 'param_info' => 'hostname',
  39. * // Column name related to url param
  40. * 'column_name' => 'host'
  41. * )
  42. * ),
  43. * // Page to link
  44. * 'default_page' => './server_privileges.php'
  45. * )
  46. * )
  47. * )
  48. * );
  49. *
  50. * @return array
  51. */
  52. public static function get(): array
  53. {
  54. global $cfg;
  55. $defaultPage = './' . Util::getScriptNameForOption(
  56. $cfg['DefaultTabTable'],
  57. 'table'
  58. );
  59. return [
  60. 'mysql' => [
  61. 'columns_priv' => [
  62. 'user' => [
  63. 'link_param' => 'username',
  64. 'link_dependancy_params' => [
  65. 0 => [
  66. 'param_info' => 'hostname',
  67. 'column_name' => 'host',
  68. ],
  69. ],
  70. 'default_page' => './server_privileges.php',
  71. ],
  72. 'table_name' => [
  73. 'link_param' => 'table',
  74. 'link_dependancy_params' => [
  75. 0 => [
  76. 'param_info' => 'db',
  77. 'column_name' => 'Db',
  78. ],
  79. ],
  80. 'default_page' => $defaultPage,
  81. ],
  82. 'column_name' => [
  83. 'link_param' => 'field',
  84. 'link_dependancy_params' => [
  85. 0 => [
  86. 'param_info' => 'db',
  87. 'column_name' => 'Db',
  88. ],
  89. 1 => [
  90. 'param_info' => 'table',
  91. 'column_name' => 'Table_name',
  92. ],
  93. ],
  94. 'default_page' => './tbl_structure.php?change_column=1',
  95. ],
  96. ],
  97. 'db' => [
  98. 'user' => [
  99. 'link_param' => 'username',
  100. 'link_dependancy_params' => [
  101. 0 => [
  102. 'param_info' => 'hostname',
  103. 'column_name' => 'host',
  104. ],
  105. ],
  106. 'default_page' => './server_privileges.php',
  107. ],
  108. ],
  109. 'event' => [
  110. 'name' => [
  111. 'link_param' => 'item_name',
  112. 'link_dependancy_params' => [
  113. 0 => [
  114. 'param_info' => 'db',
  115. 'column_name' => 'db',
  116. ],
  117. ],
  118. 'default_page' => './db_events.php?edit_item=1',
  119. ],
  120. ],
  121. 'innodb_index_stats' => [
  122. 'table_name' => [
  123. 'link_param' => 'table',
  124. 'link_dependancy_params' => [
  125. 0 => [
  126. 'param_info' => 'db',
  127. 'column_name' => 'database_name',
  128. ],
  129. ],
  130. 'default_page' => $defaultPage,
  131. ],
  132. 'index_name' => [
  133. 'link_param' => 'index',
  134. 'link_dependancy_params' => [
  135. 0 => [
  136. 'param_info' => 'db',
  137. 'column_name' => 'database_name',
  138. ],
  139. 1 => [
  140. 'param_info' => 'table',
  141. 'column_name' => 'table_name',
  142. ],
  143. ],
  144. 'default_page' => './tbl_structure.php',
  145. ],
  146. ],
  147. 'innodb_table_stats' => [
  148. 'table_name' => [
  149. 'link_param' => 'table',
  150. 'link_dependancy_params' => [
  151. 0 => [
  152. 'param_info' => 'db',
  153. 'column_name' => 'database_name',
  154. ],
  155. ],
  156. 'default_page' => $defaultPage,
  157. ],
  158. ],
  159. 'proc' => [
  160. 'name' => [
  161. 'link_param' => 'item_name',
  162. 'link_dependancy_params' => [
  163. 0 => [
  164. 'param_info' => 'db',
  165. 'column_name' => 'db',
  166. ],
  167. 1 => [
  168. 'param_info' => 'item_type',
  169. 'column_name' => 'type',
  170. ],
  171. ],
  172. 'default_page' => './db_routines.php?edit_item=1',
  173. ],
  174. 'specific_name' => [
  175. 'link_param' => 'item_name',
  176. 'link_dependancy_params' => [
  177. 0 => [
  178. 'param_info' => 'db',
  179. 'column_name' => 'db',
  180. ],
  181. 1 => [
  182. 'param_info' => 'item_type',
  183. 'column_name' => 'type',
  184. ],
  185. ],
  186. 'default_page' => './db_routines.php?edit_item=1',
  187. ],
  188. ],
  189. 'proc_priv' => [
  190. 'user' => [
  191. 'link_param' => 'username',
  192. 'link_dependancy_params' => [
  193. 0 => [
  194. 'param_info' => 'hostname',
  195. 'column_name' => 'Host',
  196. ],
  197. ],
  198. 'default_page' => './server_privileges.php',
  199. ],
  200. 'routine_name' => [
  201. 'link_param' => 'item_name',
  202. 'link_dependancy_params' => [
  203. 0 => [
  204. 'param_info' => 'db',
  205. 'column_name' => 'Db',
  206. ],
  207. 1 => [
  208. 'param_info' => 'item_type',
  209. 'column_name' => 'Routine_type',
  210. ],
  211. ],
  212. 'default_page' => './db_routines.php?edit_item=1',
  213. ],
  214. ],
  215. 'proxies_priv' => [
  216. 'user' => [
  217. 'link_param' => 'username',
  218. 'link_dependancy_params' => [
  219. 0 => [
  220. 'param_info' => 'hostname',
  221. 'column_name' => 'Host',
  222. ],
  223. ],
  224. 'default_page' => './server_privileges.php',
  225. ],
  226. ],
  227. 'tables_priv' => [
  228. 'user' => [
  229. 'link_param' => 'username',
  230. 'link_dependancy_params' => [
  231. 0 => [
  232. 'param_info' => 'hostname',
  233. 'column_name' => 'Host',
  234. ],
  235. ],
  236. 'default_page' => './server_privileges.php',
  237. ],
  238. 'table_name' => [
  239. 'link_param' => 'table',
  240. 'link_dependancy_params' => [
  241. 0 => [
  242. 'param_info' => 'db',
  243. 'column_name' => 'Db',
  244. ],
  245. ],
  246. 'default_page' => $defaultPage,
  247. ],
  248. ],
  249. 'user' => [
  250. 'user' => [
  251. 'link_param' => 'username',
  252. 'link_dependancy_params' => [
  253. 0 => [
  254. 'param_info' => 'hostname',
  255. 'column_name' => 'host',
  256. ],
  257. ],
  258. 'default_page' => './server_privileges.php',
  259. ],
  260. ],
  261. ],
  262. 'information_schema' => [
  263. 'columns' => [
  264. 'table_name' => [
  265. 'link_param' => 'table',
  266. 'link_dependancy_params' => [
  267. 0 => [
  268. 'param_info' => 'db',
  269. 'column_name' => 'table_schema',
  270. ],
  271. ],
  272. 'default_page' => $defaultPage,
  273. ],
  274. 'column_name' => [
  275. 'link_param' => 'field',
  276. 'link_dependancy_params' => [
  277. 0 => [
  278. 'param_info' => 'db',
  279. 'column_name' => 'table_schema',
  280. ],
  281. 1 => [
  282. 'param_info' => 'table',
  283. 'column_name' => 'table_name',
  284. ],
  285. ],
  286. 'default_page' => './tbl_structure.php?change_column=1',
  287. ],
  288. ],
  289. 'key_column_usage' => [
  290. 'table_name' => [
  291. 'link_param' => 'table',
  292. 'link_dependancy_params' => [
  293. 0 => [
  294. 'param_info' => 'db',
  295. 'column_name' => 'constraint_schema',
  296. ],
  297. ],
  298. 'default_page' => $defaultPage,
  299. ],
  300. 'column_name' => [
  301. 'link_param' => 'field',
  302. 'link_dependancy_params' => [
  303. 0 => [
  304. 'param_info' => 'db',
  305. 'column_name' => 'table_schema',
  306. ],
  307. 1 => [
  308. 'param_info' => 'table',
  309. 'column_name' => 'table_name',
  310. ],
  311. ],
  312. 'default_page' => './tbl_structure.php?change_column=1',
  313. ],
  314. 'referenced_table_name' => [
  315. 'link_param' => 'table',
  316. 'link_dependancy_params' => [
  317. 0 => [
  318. 'param_info' => 'db',
  319. 'column_name' => 'referenced_table_schema',
  320. ],
  321. ],
  322. 'default_page' => $defaultPage,
  323. ],
  324. 'referenced_column_name' => [
  325. 'link_param' => 'field',
  326. 'link_dependancy_params' => [
  327. 0 => [
  328. 'param_info' => 'db',
  329. 'column_name' => 'referenced_table_schema',
  330. ],
  331. 1 => [
  332. 'param_info' => 'table',
  333. 'column_name' => 'referenced_table_name',
  334. ],
  335. ],
  336. 'default_page' => './tbl_structure.php?change_column=1',
  337. ],
  338. ],
  339. 'partitions' => [
  340. 'table_name' => [
  341. 'link_param' => 'table',
  342. 'link_dependancy_params' => [
  343. 0 => [
  344. 'param_info' => 'db',
  345. 'column_name' => 'table_schema',
  346. ],
  347. ],
  348. 'default_page' => $defaultPage,
  349. ],
  350. ],
  351. 'processlist' => [
  352. 'user' => [
  353. 'link_param' => 'username',
  354. 'link_dependancy_params' => [
  355. 0 => [
  356. 'param_info' => 'hostname',
  357. 'column_name' => 'host',
  358. ],
  359. ],
  360. 'default_page' => './server_privileges.php',
  361. ],
  362. ],
  363. 'referential_constraints' => [
  364. 'table_name' => [
  365. 'link_param' => 'table',
  366. 'link_dependancy_params' => [
  367. 0 => [
  368. 'param_info' => 'db',
  369. 'column_name' => 'constraint_schema',
  370. ],
  371. ],
  372. 'default_page' => $defaultPage,
  373. ],
  374. 'referenced_table_name' => [
  375. 'link_param' => 'table',
  376. 'link_dependancy_params' => [
  377. 0 => [
  378. 'param_info' => 'db',
  379. 'column_name' => 'constraint_schema',
  380. ],
  381. ],
  382. 'default_page' => $defaultPage,
  383. ],
  384. ],
  385. 'routines' => [
  386. 'routine_name' => [
  387. 'link_param' => 'item_name',
  388. 'link_dependancy_params' => [
  389. 0 => [
  390. 'param_info' => 'db',
  391. 'column_name' => 'routine_schema',
  392. ],
  393. 1 => [
  394. 'param_info' => 'item_type',
  395. 'column_name' => 'routine_type',
  396. ],
  397. ],
  398. 'default_page' => './db_routines.php',
  399. ],
  400. ],
  401. 'schemata' => [
  402. 'schema_name' => [
  403. 'link_param' => 'db',
  404. 'default_page' => $defaultPage,
  405. ],
  406. ],
  407. 'statistics' => [
  408. 'table_name' => [
  409. 'link_param' => 'table',
  410. 'link_dependancy_params' => [
  411. 0 => [
  412. 'param_info' => 'db',
  413. 'column_name' => 'table_schema',
  414. ],
  415. ],
  416. 'default_page' => $defaultPage,
  417. ],
  418. 'column_name' => [
  419. 'link_param' => 'field',
  420. 'link_dependancy_params' => [
  421. 0 => [
  422. 'param_info' => 'db',
  423. 'column_name' => 'table_schema',
  424. ],
  425. 1 => [
  426. 'param_info' => 'table',
  427. 'column_name' => 'table_name',
  428. ],
  429. ],
  430. 'default_page' => './tbl_structure.php?change_column=1',
  431. ],
  432. ],
  433. 'tables' => [
  434. 'table_name' => [
  435. 'link_param' => 'table',
  436. 'link_dependancy_params' => [
  437. 0 => [
  438. 'param_info' => 'db',
  439. 'column_name' => 'table_schema',
  440. ],
  441. ],
  442. 'default_page' => $defaultPage,
  443. ],
  444. ],
  445. 'table_constraints' => [
  446. 'table_name' => [
  447. 'link_param' => 'table',
  448. 'link_dependancy_params' => [
  449. 0 => [
  450. 'param_info' => 'db',
  451. 'column_name' => 'table_schema',
  452. ],
  453. ],
  454. 'default_page' => $defaultPage,
  455. ],
  456. ],
  457. 'views' => [
  458. 'table_name' => [
  459. 'link_param' => 'table',
  460. 'link_dependancy_params' => [
  461. 0 => [
  462. 'param_info' => 'db',
  463. 'column_name' => 'table_schema',
  464. ],
  465. ],
  466. 'default_page' => $defaultPage,
  467. ],
  468. ],
  469. ],
  470. ];
  471. }
  472. }