wp-studio 1.7.8-beta2 → 1.7.8-beta4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/README.md +54 -1
  2. package/assets/demo.gif +0 -0
  3. package/dist/cli/{_events-BRGCap7g.mjs → _events-C2dFSpKE.mjs} +2 -2
  4. package/dist/cli/{certificate-manager-Dd4zv2_k.mjs → certificate-manager-BMngpL-s.mjs} +12 -4
  5. package/dist/cli/{index-9Oz-0bqF.mjs → index-CkFXAp-n.mjs} +5 -5
  6. package/dist/cli/{index-CT4S2538.mjs → index-odShRBgM.mjs} +171 -117
  7. package/dist/cli/{login-D4E3GoXe.mjs → login-BeT1uKwW.mjs} +2 -2
  8. package/dist/cli/{logout-DE-RoshK.mjs → logout-BFQJBJD0.mjs} +2 -2
  9. package/dist/cli/main.mjs +3 -2
  10. package/dist/cli/proxy-daemon.mjs +1 -1
  11. package/dist/cli/{resume-DLoXmzNG.mjs → resume-D_K0QEl5.mjs} +1 -1
  12. package/dist/cli/{set-B8YYUENH.mjs → set-C5l116L7.mjs} +2 -2
  13. package/dist/cli/{set-B0L-QiXT.mjs → set-DzcR6sFr.mjs} +2 -2
  14. package/dist/cli/{status-DEOAA0yx.mjs → status-CbXnAskz.mjs} +1 -1
  15. package/dist/cli/{wp-CobSX6C6.mjs → wp-CUKyZNTP.mjs} +1 -1
  16. package/dist/cli/wp-files/latest/available-site-translations.json +1 -1
  17. package/dist/cli/wp-files/latest/languages/admin-de_DE.l10n.php +2 -2
  18. package/dist/cli/wp-files/latest/languages/admin-network-de_DE.l10n.php +1 -1
  19. package/dist/cli/wp-files/latest/languages/admin-pl_PL.l10n.php +2 -2
  20. package/dist/cli/wp-files/latest/languages/de_DE-0cc31205f20441b3df1d1b46100f6b8d.json +1 -1
  21. package/dist/cli/wp-files/latest/languages/de_DE-0ce75ad2f775d1cac9696967d484808c.json +1 -1
  22. package/dist/cli/wp-files/latest/languages/de_DE-0eebe503220d4a00341eb011b92769b4.json +1 -1
  23. package/dist/cli/wp-files/latest/languages/de_DE-17179a5f2930647c89151e365f843b6e.json +1 -1
  24. package/dist/cli/wp-files/latest/languages/de_DE-1780a2033cf98d69ce13c2e5c8510004.json +1 -1
  25. package/dist/cli/wp-files/latest/languages/de_DE-1a0cd6a7128913b15c1a10dd68951869.json +1 -1
  26. package/dist/cli/wp-files/latest/languages/de_DE-1bba9045bb07c89671c88a3f328548e8.json +1 -1
  27. package/dist/cli/wp-files/latest/languages/de_DE-1c4303f02ff93b290e9faad991eeb06f.json +1 -1
  28. package/dist/cli/wp-files/latest/languages/de_DE-1d17475f620f63a92e2c5d2681c51ee8.json +1 -1
  29. package/dist/cli/wp-files/latest/languages/de_DE-2617ce121227a46077ede6c69aa9fcb5.json +1 -1
  30. package/dist/cli/wp-files/latest/languages/de_DE-270d72d1cff17227d37f3244759cbecb.json +1 -1
  31. package/dist/cli/wp-files/latest/languages/de_DE-28b3c3d595952907e08d98287077426c.json +1 -1
  32. package/dist/cli/wp-files/latest/languages/de_DE-2b390f85a3048c5b4255fb45960b6514.json +1 -1
  33. package/dist/cli/wp-files/latest/languages/de_DE-2c5d274ea625dd91556554ad82901529.json +1 -1
  34. package/dist/cli/wp-files/latest/languages/de_DE-320f4ad9792aaa6dedb1e71cbdf85d57.json +1 -1
  35. package/dist/cli/wp-files/latest/languages/de_DE-440127dd25bde48a531ded36f33e927b.json +1 -1
  36. package/dist/cli/wp-files/latest/languages/de_DE-49c6d4acf36cf3aca9f0b2a77617304f.json +1 -1
  37. package/dist/cli/wp-files/latest/languages/de_DE-4a38fe1c0c45989e44682ba6109d9f46.json +1 -1
  38. package/dist/cli/wp-files/latest/languages/de_DE-4bfa11da57ff2600004bb500368247f4.json +1 -1
  39. package/dist/cli/wp-files/latest/languages/de_DE-50278328b502f4eb3f2b8b7ab49324a1.json +1 -1
  40. package/dist/cli/wp-files/latest/languages/de_DE-5251f7623766a714c8207c7edb938628.json +1 -1
  41. package/dist/cli/wp-files/latest/languages/de_DE-529362903a5a05b34b06b5e793fb4cf8.json +1 -1
  42. package/dist/cli/wp-files/latest/languages/de_DE-569e85ef168299eb8c8f24d8ef8c8a78.json +1 -1
  43. package/dist/cli/wp-files/latest/languages/de_DE-6025add6bde16aaeb12787d250f9b414.json +1 -1
  44. package/dist/cli/wp-files/latest/languages/de_DE-60d06fac6f98e8e8f0ec5a945738b660.json +1 -1
  45. package/dist/cli/wp-files/latest/languages/de_DE-68f2cec7514bf8563c723a4d675fcfe6.json +1 -1
  46. package/dist/cli/wp-files/latest/languages/de_DE-7233008897033de5ee0d14f86a42a65a.json +1 -1
  47. package/dist/cli/wp-files/latest/languages/de_DE-7289286ed59e90a8f36ae797df62220b.json +1 -1
  48. package/dist/cli/wp-files/latest/languages/de_DE-7436b7ee9e4f11ac0d618d8cc886eb66.json +1 -1
  49. package/dist/cli/wp-files/latest/languages/de_DE-77fdfadaf2e1ca3a027d1956b910bc50.json +1 -1
  50. package/dist/cli/wp-files/latest/languages/de_DE-7b74c8457eaa7fcc50db41b431f8a003.json +1 -1
  51. package/dist/cli/wp-files/latest/languages/de_DE-7c90cd4398ee2d9d3628c387a87a70e5.json +1 -1
  52. package/dist/cli/wp-files/latest/languages/de_DE-7d5ca435e60d92f024d46c9257aaa0f7.json +1 -1
  53. package/dist/cli/wp-files/latest/languages/de_DE-7f13c36c641b114bf18cd0bcc9ecc7e0.json +1 -1
  54. package/dist/cli/wp-files/latest/languages/de_DE-803bf1ce2131e13efc590c1bc47851fc.json +1 -1
  55. package/dist/cli/wp-files/latest/languages/de_DE-81c889563f09dd13de1701135dc62941.json +1 -1
  56. package/dist/cli/wp-files/latest/languages/de_DE-81d6f084cb273e02e15b01bd9ece87f7.json +1 -1
  57. package/dist/cli/wp-files/latest/languages/de_DE-8240df461220d1d3a028a9a4c5652a5b.json +1 -1
  58. package/dist/cli/wp-files/latest/languages/de_DE-8860e58c20c6a2ab5876a0f07be43bd9.json +1 -1
  59. package/dist/cli/wp-files/latest/languages/de_DE-93882e8f9976382d7f724ac595ed7151.json +1 -1
  60. package/dist/cli/wp-files/latest/languages/de_DE-947c76bb5095da30e16668eec15406b2.json +1 -1
  61. package/dist/cli/wp-files/latest/languages/de_DE-9b256ea9cd54df92095e04c76758ceb0.json +1 -1
  62. package/dist/cli/wp-files/latest/languages/de_DE-9c3519f4870fac83dc0dbf18cb6bd4c4.json +1 -1
  63. package/dist/cli/wp-files/latest/languages/de_DE-9d47a87c240c1d10701cd6a02b28aa1b.json +1 -1
  64. package/dist/cli/wp-files/latest/languages/de_DE-a25d1cc7bf7ca0b4e114f6bea64943f4.json +1 -1
  65. package/dist/cli/wp-files/latest/languages/de_DE-a2796e57f680e25d84c4b352ee6d7280.json +1 -1
  66. package/dist/cli/wp-files/latest/languages/de_DE-a9dc201dcd011fe71849743133052619.json +1 -1
  67. package/dist/cli/wp-files/latest/languages/de_DE-aabfce98c410957228848dc581e3c420.json +1 -1
  68. package/dist/cli/wp-files/latest/languages/de_DE-ac23eee47530ac63a1178c827db28087.json +1 -1
  69. package/dist/cli/wp-files/latest/languages/de_DE-bf0f094965d3d4a95b47babcb35fc136.json +1 -1
  70. package/dist/cli/wp-files/latest/languages/de_DE-bf23b24175490c2e46aaf92ff6a0c70f.json +1 -1
  71. package/dist/cli/wp-files/latest/languages/de_DE-c31d5f185753910c14afebc6deb2ce24.json +1 -1
  72. package/dist/cli/wp-files/latest/languages/de_DE-ca28138671823450e87dfd354f7afc6b.json +1 -1
  73. package/dist/cli/wp-files/latest/languages/de_DE-daeb084aab42199d26393a56c3465bc0.json +1 -1
  74. package/dist/cli/wp-files/latest/languages/de_DE-e2791ba830489d23043be8650a22a22b.json +1 -1
  75. package/dist/cli/wp-files/latest/languages/de_DE-e2e4c4b80f3adf2c70b431bfdb1b4872.json +1 -1
  76. package/dist/cli/wp-files/latest/languages/de_DE-e53526243551a102928735ec9eed4edf.json +1 -1
  77. package/dist/cli/wp-files/latest/languages/de_DE-f575f481034e90e21d832e415fd95fcf.json +1 -1
  78. package/dist/cli/wp-files/latest/languages/de_DE-f70806bf0c7d62f2908bd5a1c3fe4efc.json +1 -1
  79. package/dist/cli/wp-files/latest/languages/de_DE-f8f49d9fc4a9cf7d78ec99285417bd9c.json +1 -1
  80. package/dist/cli/wp-files/latest/languages/de_DE.l10n.php +27 -27
  81. package/dist/cli/wp-files/latest/languages/pl_PL-0cc31205f20441b3df1d1b46100f6b8d.json +1 -1
  82. package/dist/cli/wp-files/latest/languages/pl_PL-0eebe503220d4a00341eb011b92769b4.json +1 -1
  83. package/dist/cli/wp-files/latest/languages/pl_PL-1c4303f02ff93b290e9faad991eeb06f.json +1 -1
  84. package/dist/cli/wp-files/latest/languages/pl_PL-1d17475f620f63a92e2c5d2681c51ee8.json +1 -1
  85. package/dist/cli/wp-files/latest/languages/pl_PL-2b390f85a3048c5b4255fb45960b6514.json +1 -1
  86. package/dist/cli/wp-files/latest/languages/pl_PL-4a38fe1c0c45989e44682ba6109d9f46.json +1 -1
  87. package/dist/cli/wp-files/latest/languages/pl_PL-4bfa11da57ff2600004bb500368247f4.json +1 -1
  88. package/dist/cli/wp-files/latest/languages/pl_PL-50278328b502f4eb3f2b8b7ab49324a1.json +1 -1
  89. package/dist/cli/wp-files/latest/languages/pl_PL-5251f7623766a714c8207c7edb938628.json +1 -1
  90. package/dist/cli/wp-files/latest/languages/pl_PL-529362903a5a05b34b06b5e793fb4cf8.json +1 -1
  91. package/dist/cli/wp-files/latest/languages/pl_PL-569e85ef168299eb8c8f24d8ef8c8a78.json +1 -1
  92. package/dist/cli/wp-files/latest/languages/pl_PL-6025add6bde16aaeb12787d250f9b414.json +1 -1
  93. package/dist/cli/wp-files/latest/languages/pl_PL-7436b7ee9e4f11ac0d618d8cc886eb66.json +1 -1
  94. package/dist/cli/wp-files/latest/languages/pl_PL-77fdfadaf2e1ca3a027d1956b910bc50.json +1 -1
  95. package/dist/cli/wp-files/latest/languages/pl_PL-7b74c8457eaa7fcc50db41b431f8a003.json +1 -1
  96. package/dist/cli/wp-files/latest/languages/pl_PL-7d5ca435e60d92f024d46c9257aaa0f7.json +1 -1
  97. package/dist/cli/wp-files/latest/languages/pl_PL-81d6f084cb273e02e15b01bd9ece87f7.json +1 -1
  98. package/dist/cli/wp-files/latest/languages/pl_PL-8240df461220d1d3a028a9a4c5652a5b.json +1 -1
  99. package/dist/cli/wp-files/latest/languages/pl_PL-9b256ea9cd54df92095e04c76758ceb0.json +1 -1
  100. package/dist/cli/wp-files/latest/languages/pl_PL-9c3519f4870fac83dc0dbf18cb6bd4c4.json +1 -1
  101. package/dist/cli/wp-files/latest/languages/pl_PL-9d47a87c240c1d10701cd6a02b28aa1b.json +1 -1
  102. package/dist/cli/wp-files/latest/languages/pl_PL-a9dc201dcd011fe71849743133052619.json +1 -1
  103. package/dist/cli/wp-files/latest/languages/pl_PL-aabfce98c410957228848dc581e3c420.json +1 -1
  104. package/dist/cli/wp-files/latest/languages/pl_PL-ca28138671823450e87dfd354f7afc6b.json +1 -1
  105. package/dist/cli/wp-files/latest/languages/pl_PL-e2e4c4b80f3adf2c70b431bfdb1b4872.json +1 -1
  106. package/dist/cli/wp-files/sqlite-command/composer.json +4 -3
  107. package/dist/cli/wp-files/sqlite-command/composer.lock +132 -80
  108. package/dist/cli/wp-files/sqlite-command/vendor/autoload.php +1 -1
  109. package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_classmap.php +58 -70
  110. package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_namespaces.php +1 -0
  111. package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_psr4.php +1 -1
  112. package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_real.php +5 -5
  113. package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_static.php +78 -80
  114. package/dist/cli/wp-files/sqlite-command/vendor/composer/installed.json +104 -49
  115. package/dist/cli/wp-files/sqlite-command/vendor/composer/installed.php +29 -16
  116. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/CHANGELOG.md +103 -0
  117. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Comparator/Comparator.php +62 -0
  118. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Comparator/DateComparator.php +50 -0
  119. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Comparator/NumberComparator.php +78 -0
  120. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Exception/AccessDeniedException.php +19 -0
  121. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Exception/DirectoryNotFoundException.php +19 -0
  122. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Finder.php +851 -0
  123. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Gitignore.php +91 -0
  124. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Glob.php +116 -0
  125. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/CustomFilterIterator.php +61 -0
  126. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php +58 -0
  127. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php +48 -0
  128. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php +110 -0
  129. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php +51 -0
  130. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/FilecontentFilterIterator.php +58 -0
  131. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/FilenameFilterIterator.php +45 -0
  132. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/LazyIterator.php +32 -0
  133. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php +107 -0
  134. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/PathFilterIterator.php +56 -0
  135. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php +134 -0
  136. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php +57 -0
  137. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/SortableIterator.php +115 -0
  138. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php +173 -0
  139. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/LICENSE +19 -0
  140. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/README.md +14 -0
  141. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/SplFileInfo.php +80 -0
  142. package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/composer.json +31 -0
  143. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/mustache/.gitattributes +8 -0
  144. package/dist/cli/wp-files/sqlite-command/vendor/{mustache → wp-cli}/mustache/LICENSE +1 -1
  145. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/mustache/README.md +76 -0
  146. package/dist/cli/wp-files/sqlite-command/vendor/{mustache → wp-cli}/mustache/composer.json +6 -16
  147. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/mustache/src/Mustache/Autoloader.php +88 -0
  148. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Cache/AbstractCache.php +7 -15
  149. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Cache/FilesystemCache.php +15 -20
  150. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Cache/NoopCache.php +4 -8
  151. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Cache.php +7 -10
  152. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Compiler.php +87 -144
  153. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Context.php +19 -23
  154. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Engine.php +134 -251
  155. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/InvalidArgumentException.php +2 -6
  156. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/LogicException.php +2 -6
  157. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/RuntimeException.php +2 -6
  158. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/SyntaxException.php +8 -7
  159. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/UnknownFilterException.php +7 -7
  160. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/UnknownHelperException.php +7 -7
  161. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/UnknownTemplateException.php +7 -7
  162. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception.php +5 -4
  163. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/HelperCollection.php +17 -22
  164. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/LambdaHelper.php +8 -28
  165. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/ArrayLoader.php +9 -12
  166. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/CascadingLoader.php +15 -18
  167. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/FilesystemLoader.php +18 -24
  168. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/InlineLoader.php +13 -19
  169. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/MutableLoader.php +7 -4
  170. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/ProductionFilesystemLoader.php +16 -23
  171. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/StringLoader.php +4 -8
  172. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader.php +7 -8
  173. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Logger/AbstractLogger.php +26 -22
  174. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Logger/StreamLogger.php +20 -25
  175. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Logger.php +37 -13
  176. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Parser.php +93 -100
  177. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Source/FilesystemSource.php +7 -11
  178. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Source.php +5 -4
  179. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Template.php +32 -39
  180. package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Tokenizer.php +29 -33
  181. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/.actrc +3 -0
  182. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/.gitattributes +6 -0
  183. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/.mailmap +234 -0
  184. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/README.md +4 -4
  185. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/VERSION +1 -1
  186. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/CHANGELOG.md +0 -65
  187. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/README.md +1 -2
  188. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/certificates/cacert.pem +372 -315
  189. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/certificates/cacert.pem.sha256 +1 -1
  190. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/composer.json +5 -7
  191. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Iri.php +18 -20
  192. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Requests.php +1 -1
  193. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Response/Headers.php +1 -1
  194. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Transport/Curl.php +1 -5
  195. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Transport/Fsockopen.php +0 -2
  196. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Utility/CaseInsensitiveDictionary.php +0 -12
  197. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Utility/FilteredIterator.php +2 -2
  198. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/composer.json +13 -30
  199. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/dependencies.yml +6 -0
  200. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/manifest.json +1 -1
  201. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Autoloader.php +2 -4
  202. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/AutoloaderStep.php +1 -10
  203. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/CheckRoot.php +2 -20
  204. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/DefineProtectedCommands.php +3 -3
  205. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/IncludeFrameworkAutoloader.php +4 -3
  206. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/IncludeRequestsAutoloader.php +3 -4
  207. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/InitializeContexts.php +0 -3
  208. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/InitializeLogger.php +1 -1
  209. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php +3 -6
  210. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/{RegisterShutdownHandler.php → LoadDispatcher.php} +4 -6
  211. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LoadRequiredCommand.php +5 -9
  212. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LoadUtilityFunctions.php +0 -1
  213. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Completions.php +6 -149
  214. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Configurator.php +49 -202
  215. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Admin.php +21 -113
  216. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Auto.php +1 -1
  217. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Cli.php +1 -0
  218. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Frontend.php +1 -0
  219. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php +26 -63
  220. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php +9 -19
  221. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php +19 -284
  222. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/DocParser.php +5 -17
  223. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Exception/NonExistentKeyException.php +3 -6
  224. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Extractor.php +54 -30
  225. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Base.php +3 -7
  226. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Comment.php +2 -4
  227. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Post.php +3 -8
  228. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Signup.php +1 -3
  229. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Site.php +4 -12
  230. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/User.php +1 -3
  231. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/FileCache.php +33 -135
  232. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Formatter.php +57 -221
  233. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Inflector.php +4 -4
  234. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/CSV.php +1 -6
  235. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/Query.php +1 -3
  236. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/Table.php +1 -7
  237. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/Transform.php +0 -2
  238. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Loggers/Base.php +0 -15
  239. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Loggers/Quiet.php +3 -2
  240. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Loggers/Regular.php +3 -4
  241. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/NoOp.php +0 -4
  242. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Process.php +7 -40
  243. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/RequestsLibrary.php +1 -4
  244. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php +234 -795
  245. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/SynopsisParser.php +26 -116
  246. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/SynopsisValidator.php +1 -1
  247. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Traverser/RecursiveDataStructureTraverser.php +26 -69
  248. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/UpgraderSkin.php +1 -1
  249. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/WpHttpCacheManager.php +5 -67
  250. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/WpOrgApi.php +3 -3
  251. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/boot-fs.php +2 -2
  252. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/bootstrap.php +2 -5
  253. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/class-wp-cli.php +62 -311
  254. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/commands/src/CLI_Alias_Command.php +60 -292
  255. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/commands/src/CLI_Cache_Command.php +1 -1
  256. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php +31 -191
  257. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/commands/src/Help_Command.php +35 -177
  258. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/config-spec.php +4 -28
  259. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/utils-wp.php +47 -81
  260. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/utils.php +200 -512
  261. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/wp-cli.php +2 -2
  262. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/wp-settings-cli.php +465 -0
  263. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/templates/man-params.mustache +4 -0
  264. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/templates/man.mustache +0 -8
  265. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/ArgValidationTest.php +74 -0
  266. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/CommandFactoryTest.php +420 -0
  267. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/ConfiguratorTest.php +87 -0
  268. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/DocParserTest.php +213 -0
  269. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/ExtractorTest.php +293 -0
  270. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/FileCacheTest.php +207 -0
  271. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/HelpTest.php +119 -0
  272. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/InflectorTest.php +37 -0
  273. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/LoggingTest.php +124 -0
  274. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/ProcessTest.php +30 -0
  275. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/SynopsisParserTest.php +194 -0
  276. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/UtilsTest.php +1092 -0
  277. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WPCLITest.php +16 -0
  278. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WP_CLI/Iterators/CSVTest.php +109 -0
  279. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WP_CLI/Traversers/RecursiveDataStructureTraverserTest.php +151 -0
  280. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WP_CLI/WpOrgApiTest.php +166 -0
  281. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WpVersionCompareTest.php +78 -0
  282. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/bootstrap.php +17 -0
  283. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/commandfactory-doc_comment-class-win.php +70 -0
  284. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/commandfactory-doc_comment-class.php +70 -0
  285. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/commandfactory-doc_comment-function-win.php +19 -0
  286. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/commandfactory-doc_comment-function.php +19 -0
  287. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/bar.ab2 +0 -0
  288. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/baz.ab1 +0 -0
  289. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/baz.ac1 +0 -0
  290. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/baz.efg2 +0 -0
  291. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/foo.ab1 +0 -0
  292. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/foo.ab2 +0 -0
  293. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/foo.efg1 +0 -0
  294. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/foo.efg2 +0 -0
  295. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/mock-requests-transport.php +34 -0
  296. package/dist/cli/wp-files/sqlite-command/version +1 -1
  297. package/package.json +4 -3
  298. package/patches/archiver+7.0.1.patch +14 -0
  299. package/dist/cli/wp-files/sqlite-command/vendor/mustache/mustache/.php-cs-fixer.php +0 -20
  300. package/dist/cli/wp-files/sqlite-command/vendor/mustache/mustache/README.md +0 -94
  301. package/dist/cli/wp-files/sqlite-command/vendor/mustache/mustache/src/RenderedString.php +0 -51
  302. package/dist/cli/wp-files/sqlite-command/vendor/mustache/mustache/src/compat.php +0 -282
  303. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/.typos.toml +0 -14
  304. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/AGENTS.md +0 -121
  305. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/scripts/proxy/proxy.py +0 -5
  306. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/scripts/proxy/start.sh +0 -19
  307. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/scripts/proxy/stop.sh +0 -10
  308. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Path.php +0 -260
  309. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/ShutdownHandler.php +0 -329
  310. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/schemas/wp-cli-config.json +0 -218
  311. package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/schemas/wp-cli.example.yml +0 -55
  312. /package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/{codecov.yml → tests/data/expand_globs/bar.ab1} +0 -0
@@ -12,8 +12,7 @@ use Closure;
12
12
  use Composer\Semver\Comparator;
13
13
  use Composer\Semver\Semver;
14
14
  use Exception;
15
- use Iterator;
16
- use Mustache\Engine as Mustache_Engine;
15
+ use Mustache_Engine;
17
16
  use ReflectionFunction;
18
17
  use RuntimeException;
19
18
  use WP_CLI;
@@ -22,10 +21,8 @@ use WP_CLI\Formatter;
22
21
  use WP_CLI\Inflector;
23
22
  use WP_CLI\Iterators\Transform;
24
23
  use WP_CLI\NoOp;
25
- use WP_CLI\Path;
26
24
  use WP_CLI\Process;
27
25
  use WP_CLI\RequestsLibrary;
28
- use WpOrg\Requests\Response;
29
26
 
30
27
  /**
31
28
  * File stream wrapper prefix for Phar archives.
@@ -53,13 +50,19 @@ const FILE_DIR_PATTERN = '%(?>#.*?$)|(?>//.*?$)|(?>/\*.*?\*/)|(?>\'(?:(?=(\\\\?)
53
50
  * If no path is provided, the function checks whether the current WP_CLI instance is
54
51
  * running from within a Phar archive.
55
52
  *
56
- * @deprecated 2.13.0 Use Path::inside_phar() instead.
57
- *
58
53
  * @param string|null $path Optional. Path to check. Defaults to null, which checks WP_CLI_ROOT.
59
54
  * @return bool Whether path is within a Phar archive.
60
55
  */
61
56
  function inside_phar( $path = null ) {
62
- return Path::inside_phar( $path );
57
+ if ( null === $path ) {
58
+ if ( ! defined( 'WP_CLI_ROOT' ) ) {
59
+ return false;
60
+ }
61
+
62
+ $path = WP_CLI_ROOT;
63
+ }
64
+
65
+ return 0 === strpos( $path, PHAR_STREAM_PREFIX );
63
66
  }
64
67
 
65
68
  /**
@@ -72,11 +75,11 @@ function inside_phar( $path = null ) {
72
75
  * @return string Path to the extracted file.
73
76
  */
74
77
  function extract_from_phar( $path ) {
75
- if ( ! Path::inside_phar( $path ) ) {
78
+ if ( ! inside_phar( $path ) ) {
76
79
  return $path;
77
80
  }
78
81
 
79
- $fname = Path::basename( $path );
82
+ $fname = basename( $path );
80
83
 
81
84
  $tmp_path = get_temp_dir() . uniqid( 'wp-cli-extract-from-phar-', true ) . "-$fname";
82
85
 
@@ -99,7 +102,7 @@ function extract_from_phar( $path ) {
99
102
  * @return void|never
100
103
  */
101
104
  function load_dependencies() {
102
- if ( Path::inside_phar() ) {
105
+ if ( inside_phar() ) {
103
106
  if ( file_exists( WP_CLI_ROOT . '/vendor/autoload.php' ) ) {
104
107
  require WP_CLI_ROOT . '/vendor/autoload.php';
105
108
  } elseif ( file_exists( dirname( dirname( WP_CLI_ROOT ) ) . '/autoload.php' ) ) {
@@ -136,10 +139,7 @@ function get_vendor_paths() {
136
139
  ];
137
140
  $maybe_composer_json = WP_CLI_ROOT . '/../../../composer.json';
138
141
  if ( file_exists( $maybe_composer_json ) && is_readable( $maybe_composer_json ) ) {
139
- /**
140
- * @var object{config: object{'vendor-dir': string}} $composer
141
- */
142
- $composer = json_decode( (string) file_get_contents( $maybe_composer_json ), false );
142
+ $composer = json_decode( file_get_contents( $maybe_composer_json ) );
143
143
  if ( ! empty( $composer->config ) && ! empty( $composer->config->{'vendor-dir'} ) ) {
144
144
  array_unshift( $vendor_paths, WP_CLI_ROOT . '/../../../' . $composer->config->{'vendor-dir'} );
145
145
  }
@@ -189,11 +189,11 @@ function load_command( $name ) {
189
189
  * var_dump($val);
190
190
  * }
191
191
  *
192
- * @param array|Iterator $it Either a plain array or another iterator.
193
- * @param callable ...$fns The function to apply to an element.
194
- * @return Iterator An iterator that applies the given callback(s).
192
+ * @param array|object $it Either a plain array or another iterator.
193
+ * @param callable $fn The function to apply to an element.
194
+ * @return object An iterator that applies the given callback(s).
195
195
  */
196
- function iterator_map( $it, ...$fns ) {
196
+ function iterator_map( $it, $fn ) {
197
197
  if ( is_array( $it ) ) {
198
198
  $it = new ArrayIterator( $it );
199
199
  }
@@ -202,62 +202,13 @@ function iterator_map( $it, ...$fns ) {
202
202
  $it = new Transform( $it );
203
203
  }
204
204
 
205
- foreach ( $fns as $fn ) {
206
- /**
207
- * @var Transform $it
208
- */
205
+ foreach ( array_slice( func_get_args(), 1 ) as $fn ) {
209
206
  $it->add_transform( $fn );
210
207
  }
211
208
 
212
209
  return $it;
213
210
  }
214
211
 
215
- /**
216
- * Check if a path is within open_basedir restrictions.
217
- *
218
- * This function compares paths using string operations to avoid triggering warnings
219
- * when checking paths that may be outside open_basedir restrictions.
220
- *
221
- * @param string $path The path to check (should be absolute).
222
- * @return bool True if the path is accessible (no open_basedir or within allowed paths), false otherwise.
223
- */
224
- function is_path_within_open_basedir( $path ) {
225
- $open_basedir = ini_get( 'open_basedir' );
226
- if ( empty( $open_basedir ) ) {
227
- return true;
228
- }
229
-
230
- // Normalize the path to check and remove trailing slashes.
231
- $path = Path::normalize( $path );
232
- $path = rtrim( $path, '/\\' );
233
-
234
- $allowed_paths = explode( PATH_SEPARATOR, $open_basedir );
235
- foreach ( $allowed_paths as $allowed ) {
236
- if ( empty( $allowed ) ) {
237
- continue;
238
- }
239
- // Normalize the allowed path using realpath (allowed paths should be accessible).
240
- $allowed = rtrim( $allowed, '/\\' );
241
- $real_allowed = realpath( $allowed );
242
- if ( false !== $real_allowed ) {
243
- $allowed = $real_allowed;
244
- }
245
- $allowed = Path::normalize( $allowed );
246
- $allowed = rtrim( $allowed, '/\\' );
247
- // Check if path starts with allowed directory.
248
- // On Windows, use case-insensitive comparison as filesystem paths are case-insensitive.
249
- $is_windows = is_windows();
250
- if ( $is_windows ) {
251
- if ( 0 === stripos( $path . '/', $allowed . '/' ) ) {
252
- return true;
253
- }
254
- } elseif ( 0 === strpos( $path . '/', $allowed . '/' ) ) {
255
- return true;
256
- }
257
- }
258
- return false;
259
- }
260
-
261
212
  /**
262
213
  * Search for file by walking up the directory tree until the first file is found or until $stop_check($dir) returns true.
263
214
  *
@@ -271,12 +222,7 @@ function find_file_upward( $files, $dir = null, $stop_check = null ) {
271
222
  if ( is_null( $dir ) ) {
272
223
  $dir = getcwd();
273
224
  }
274
- // Normalize the directory path using string operations to avoid filesystem access
275
- // that could trigger open_basedir warnings
276
- if ( false !== $dir ) {
277
- $dir = Path::normalize( $dir );
278
- }
279
- while ( $dir && is_path_within_open_basedir( $dir ) && is_readable( $dir ) ) {
225
+ while ( is_readable( $dir ) ) {
280
226
  // Stop walking up when the supplied callable returns true being passed the $dir
281
227
  if ( is_callable( $stop_check ) && call_user_func( $stop_check, $dir ) ) {
282
228
  return null;
@@ -300,55 +246,16 @@ function find_file_upward( $files, $dir = null, $stop_check = null ) {
300
246
 
301
247
  /**
302
248
  * Determine whether a path is absolute.
303
- *
304
- * @deprecated 2.13.0 Use Path::is_absolute() instead.
305
- *
306
249
  * @param string $path
307
250
  * @return bool
308
251
  */
309
252
  function is_path_absolute( $path ) {
310
- return Path::is_absolute( $path );
311
- }
312
-
313
- /**
314
- * Expand tilde (~) in path to home directory.
315
- *
316
- * Expands paths that start with ~ to the current user's home directory.
317
- * Only handles the current user's home directory (not ~username patterns).
318
- *
319
- * @deprecated 2.13.0 Use Path::expand_tilde() instead.
320
- *
321
- * @param string $path Path that may contain a tilde.
322
- * @return string Path with tilde expanded to home directory, or unchanged if tilde not at start or followed by username.
323
- */
324
- function expand_tilde_path( $path ) {
325
- return Path::expand_tilde( $path );
326
- }
327
-
328
- /**
329
- * Escape a shell argument while preserving tilde expansion.
330
- *
331
- * This function is useful when passing paths to remote shells (e.g., via SSH)
332
- * where tilde expansion should occur on the remote system. Unlike escapeshellarg(),
333
- * this function allows tilde at the start of a path to be expanded by the remote shell.
334
- *
335
- * For paths starting with ~/: returns ~/ followed by the escaped remainder.
336
- * For all other paths: returns the fully escaped path using escapeshellarg().
337
- *
338
- * @param string $arg The argument to escape.
339
- * @return string The escaped argument.
340
- */
341
- function escapeshellarg_preserve_tilde( $arg ) {
342
- // Check if argument starts with ~/
343
- if ( substr( $arg, 0, 2 ) === '~/' ) {
344
- // Extract everything after ~/
345
- $remainder = substr( $arg, 2 );
346
- // Return ~/ followed by the escaped remainder
347
- return '~/' . escapeshellarg( $remainder );
253
+ // Windows.
254
+ if ( isset( $path[1] ) && ':' === $path[1] ) {
255
+ return true;
348
256
  }
349
257
 
350
- // For all other cases, use standard escapeshellarg
351
- return escapeshellarg( $arg );
258
+ return isset( $path[0] ) && '/' === $path[0];
352
259
  }
353
260
 
354
261
  /**
@@ -358,17 +265,16 @@ function escapeshellarg_preserve_tilde( $arg ) {
358
265
  * @return string
359
266
  */
360
267
  function args_to_str( $args ) {
361
- return ' ' . implode( ' ', array_map( 'escapeshellarg', array_map( 'strval', $args ) ) );
268
+ return ' ' . implode( ' ', array_map( 'escapeshellarg', $args ) );
362
269
  }
363
270
 
364
271
  /**
365
272
  * Composes associative arguments into a command string.
366
273
  *
367
- * @param array<string, mixed> $assoc_args Associative arguments to compose.
368
- * @param array<string> $sensitive_args Optional. Array of argument keys that should be masked.
274
+ * @param array<string, string> $assoc_args Associative arguments to compose.
369
275
  * @return string
370
276
  */
371
- function assoc_args_to_str( $assoc_args, $sensitive_args = [] ) {
277
+ function assoc_args_to_str( $assoc_args ) {
372
278
  $str = '';
373
279
 
374
280
  foreach ( $assoc_args as $key => $value ) {
@@ -379,18 +285,11 @@ function assoc_args_to_str( $assoc_args, $sensitive_args = [] ) {
379
285
  $str .= assoc_args_to_str(
380
286
  [
381
287
  $key => $v,
382
- ],
383
- $sensitive_args
288
+ ]
384
289
  );
385
290
  }
386
- } elseif ( in_array( $key, $sensitive_args, true ) ) {
387
- // Mask the value if this is a sensitive argument
388
- $str .= " --$key=" . escapeshellarg( '[REDACTED]' );
389
291
  } else {
390
- /**
391
- * @var string|int $value
392
- */
393
- $str .= " --$key=" . escapeshellarg( (string) $value );
292
+ $str .= " --$key=" . escapeshellarg( $value );
394
293
  }
395
294
  }
396
295
 
@@ -401,14 +300,17 @@ function assoc_args_to_str( $assoc_args, $sensitive_args = [] ) {
401
300
  * Given a template string and an arbitrary number of arguments,
402
301
  * returns the final command, with the parameters escaped.
403
302
  *
404
- * @param string $cmd
405
- * @param string ...$args
303
+ * @param array<string> $cmd
406
304
  */
407
- function esc_cmd( $cmd, ...$args ) {
305
+ function esc_cmd( $cmd ) {
408
306
  if ( func_num_args() < 2 ) {
409
307
  trigger_error( 'esc_cmd() requires at least two arguments.', E_USER_WARNING );
410
308
  }
411
309
 
310
+ $args = func_get_args();
311
+
312
+ $cmd = array_shift( $args );
313
+
412
314
  return vsprintf( $cmd, array_map( 'escapeshellarg', $args ) );
413
315
  }
414
316
 
@@ -423,10 +325,8 @@ function locate_wp_config() {
423
325
  if ( null === $path ) {
424
326
  $path = false;
425
327
 
426
- $config_path = (string) getenv( 'WP_CONFIG_PATH' );
427
-
428
- if ( $config_path && file_exists( $config_path ) ) {
429
- $path = $config_path;
328
+ if ( getenv( 'WP_CONFIG_PATH' ) && file_exists( getenv( 'WP_CONFIG_PATH' ) ) ) {
329
+ $path = getenv( 'WP_CONFIG_PATH' );
430
330
  } elseif ( file_exists( ABSPATH . 'wp-config.php' ) ) {
431
331
  $path = ABSPATH . 'wp-config.php';
432
332
  } elseif ( file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
@@ -449,11 +349,7 @@ function locate_wp_config() {
449
349
  * @return bool
450
350
  */
451
351
  function wp_version_compare( $since, $operator ) {
452
- /**
453
- * @var string $wp_version
454
- */
455
- $wp_version = $GLOBALS['wp_version'];
456
- $wp_version = str_replace( '-src', '', $wp_version );
352
+ $wp_version = str_replace( '-src', '', $GLOBALS['wp_version'] );
457
353
  $since = str_replace( '-src', '', $since );
458
354
  return version_compare( $wp_version, $since, $operator );
459
355
  }
@@ -516,9 +412,9 @@ function format_items( $format, $items, $fields ) {
516
412
  *
517
413
  * @access public
518
414
  *
519
- * @param resource $fd File descriptor.
520
- * @param array<string[]>|iterable $rows Array of rows to output.
521
- * @param array<string> $headers List of CSV columns (optional).
415
+ * @param resource $fd File descriptor.
416
+ * @param array<string> $rows Array of rows to output.
417
+ * @param array<string> $headers List of CSV columns (optional).
522
418
  */
523
419
  function write_csv( $fd, $rows, $headers = [] ) {
524
420
  if ( ! empty( $headers ) ) {
@@ -526,21 +422,12 @@ function write_csv( $fd, $rows, $headers = [] ) {
526
422
  fputcsv( $fd, $headers, ',', '"', '\\' );
527
423
  }
528
424
 
529
- /**
530
- * @var string[] $row
531
- */
532
425
  foreach ( $rows as $row ) {
533
426
  if ( ! empty( $headers ) ) {
534
427
  $row = pick_fields( $row, $headers );
535
428
  }
536
429
 
537
- /**
538
- * @var string[] $row
539
- * @var callable $callback
540
- */
541
-
542
- $callback = __NAMESPACE__ . '\escape_csv_value';
543
- $row = array_map( $callback, $row );
430
+ $row = array_map( __NAMESPACE__ . '\escape_csv_value', $row );
544
431
  fputcsv( $fd, array_values( $row ), ',', '"', '\\' );
545
432
  }
546
433
  }
@@ -586,7 +473,7 @@ function launch_editor_for_input( $input, $title = 'WP-CLI', $ext = 'tmp' ) {
586
473
  $tmpdir = get_temp_dir();
587
474
 
588
475
  do {
589
- $tmpfile = Path::basename( $title );
476
+ $tmpfile = basename( $title );
590
477
  $tmpfile = preg_replace( '|\.[^.]*$|', '', $tmpfile );
591
478
  $tmpfile .= '-' . substr( md5( (string) mt_rand() ), 0, 6 ); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_mt_rand -- no crypto and WP not loaded.
592
479
  $tmpfile = $tmpdir . $tmpfile . '.' . $ext;
@@ -600,7 +487,6 @@ function launch_editor_for_input( $input, $title = 'WP-CLI', $ext = 'tmp' ) {
600
487
  }
601
488
  } while ( ! $tmpfile );
602
489
 
603
- // @phpstan-ignore booleanNot.alwaysFalse
604
490
  if ( ! $tmpfile ) {
605
491
  WP_CLI::error( 'Error creating temporary file.' );
606
492
  }
@@ -614,11 +500,9 @@ function launch_editor_for_input( $input, $title = 'WP-CLI', $ext = 'tmp' ) {
614
500
 
615
501
  $descriptorspec = [ STDIN, STDOUT, STDERR ];
616
502
  $process = proc_open_compat( "$editor " . escapeshellarg( $tmpfile ), $descriptorspec, $pipes );
617
- if ( $process ) {
618
- $r = proc_close( $process );
619
- if ( $r ) {
620
- exit( $r );
621
- }
503
+ $r = proc_close( $process );
504
+ if ( $r ) {
505
+ exit( $r );
622
506
  }
623
507
 
624
508
  $output = file_get_contents( $tmpfile );
@@ -671,7 +555,7 @@ function mysql_host_to_cli_args( $raw_host ) {
671
555
  * @since v2.5.0 Deprecated $descriptors argument.
672
556
  *
673
557
  * @param string $cmd Command to run.
674
- * @param array<string, string> $assoc_args Associative array of arguments to use.
558
+ * @param array<string, mixed> $assoc_args Associative array of arguments to use.
675
559
  * @param mixed $_ Deprecated. Former $descriptors argument.
676
560
  * @param bool $send_to_shell Optional. Whether to send STDOUT and STDERR
677
561
  * immediately to the shell. Defaults to true.
@@ -690,9 +574,6 @@ function mysql_host_to_cli_args( $raw_host ) {
690
574
  function run_mysql_command( $cmd, $assoc_args, $_ = null, $send_to_shell = true, $interactive = false ) {
691
575
  check_proc_available( 'run_mysql_command' );
692
576
 
693
- /**
694
- * @var array<resource> $descriptors
695
- */
696
577
  $descriptors = ( $interactive || $send_to_shell ) ?
697
578
  [
698
579
  0 => STDIN,
@@ -707,11 +588,7 @@ function run_mysql_command( $cmd, $assoc_args, $_ = null, $send_to_shell = true,
707
588
 
708
589
  $stdout = '';
709
590
  $stderr = '';
710
-
711
- /**
712
- * @var array<int, resource> $pipes
713
- */
714
- $pipes = [];
591
+ $pipes = [];
715
592
 
716
593
  if ( isset( $assoc_args['host'] ) ) {
717
594
  // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_host_to_cli_args -- Misidentified as PHP native MySQL function.
@@ -772,7 +649,7 @@ function mustache_render( $template_name, $data = [] ) {
772
649
  $template_name = WP_CLI_ROOT . "/templates/$template_name";
773
650
  }
774
651
 
775
- $template = (string) file_get_contents( $template_name );
652
+ $template = file_get_contents( $template_name );
776
653
 
777
654
  $mustache = new Mustache_Engine(
778
655
  [
@@ -839,11 +716,15 @@ function make_progress_bar( $message, $count, $interval = 100 ) {
839
716
  * component doesn't exist in the given URL; a string or - in the
840
717
  * case of PHP_URL_PORT - integer when it does. See parse_url()'s
841
718
  * return values.
842
- *
843
- * @phpstan-return ($component is non-negative-int ? string|null|int|false : array{scheme?: string, host?: string, port?: int, user?: string, pass?: string, query?: string, path?: string, fragment?: string})
844
719
  */
845
720
  function parse_url( $url, $component = - 1, $auto_add_scheme = true ) {
846
- if ( function_exists( 'wp_parse_url' ) ) {
721
+ if (
722
+ function_exists( 'wp_parse_url' )
723
+ && (
724
+ -1 === $component
725
+ || wp_version_compare( '4.7', '>=' )
726
+ )
727
+ ) {
847
728
  $url_parts = wp_parse_url( $url, $component );
848
729
  } else {
849
730
  // phpcs:ignore WordPress.WP.AlternativeFunctions.parse_url_parse_url -- Fallback.
@@ -875,14 +756,36 @@ function is_windows() {
875
756
  * Replaces the __FILE__ and __DIR__ magic constants with the values they are
876
757
  * supposed to represent at runtime.
877
758
  *
878
- * @deprecated 2.13.0 Use Path::replace_path_consts() instead.
879
- *
880
759
  * @param string $source The PHP code to manipulate.
881
760
  * @param string $path The path to use instead of the magic constants.
882
761
  * @return string Adapted PHP code.
883
762
  */
884
763
  function replace_path_consts( $source, $path ) {
885
- return Path::replace_path_consts( $source, $path );
764
+ // Solve issue with Windows allowing single quotes in account names.
765
+ $file = addslashes( $path );
766
+
767
+ if ( file_exists( $file ) ) {
768
+ $file = realpath( $file );
769
+ }
770
+
771
+ $dir = dirname( $file );
772
+
773
+ // Replace __FILE__ and __DIR__ constants with value of $file or $dir.
774
+ return preg_replace_callback(
775
+ FILE_DIR_PATTERN,
776
+ static function ( $matches ) use ( $file, $dir ) {
777
+ if ( ! empty( $matches['file'] ) ) {
778
+ return "'{$file}'";
779
+ }
780
+
781
+ if ( ! empty( $matches['dir'] ) ) {
782
+ return "'{$dir}'";
783
+ }
784
+
785
+ return $matches[0];
786
+ },
787
+ $source
788
+ );
886
789
  }
887
790
 
888
791
  /**
@@ -914,18 +817,14 @@ function replace_path_consts( $source, $path ) {
914
817
  * or string absolute path to CA cert to use.
915
818
  * Defaults to detected CA cert bundled with the Requests library.
916
819
  * @type bool $insecure Whether to retry automatically without certificate validation.
917
- * @type int $max_retries Maximum number of retries of failed requests. Default 3.
918
820
  * }
919
- * @return \Requests_Response|Response
821
+ * @return object
920
822
  * @throws RuntimeException If the request failed.
921
823
  * @throws ExitException If the request failed and $halt_on_error is true.
922
- *
923
- * @phpstan-param array{halt_on_error?: bool, verify?: bool|string, insecure?: bool} $options
924
824
  */
925
825
  function http_request( $method, $url, $data = null, $headers = [], $options = [] ) {
926
826
  $insecure = isset( $options['insecure'] ) && (bool) $options['insecure'];
927
827
  $halt_on_error = ! isset( $options['halt_on_error'] ) || (bool) $options['halt_on_error'];
928
- $max_retries = isset( $options['max_retries'] ) ? (int) $options['max_retries'] : 3;
929
828
  unset( $options['halt_on_error'] );
930
829
 
931
830
  if ( ! isset( $options['verify'] ) ) {
@@ -933,42 +832,21 @@ function http_request( $method, $url, $data = null, $headers = [], $options = []
933
832
  $options['verify'] = ! empty( ini_get( 'curl.cainfo' ) ) ? ini_get( 'curl.cainfo' ) : true;
934
833
  }
935
834
 
936
- /**
937
- * @var array{halt_on_error?: bool, verify: bool|string, insecure?: bool} $options
938
- */
939
- $options = WP_CLI::do_hook( 'http_request_options', $options, $method, $url, $data, $headers );
835
+ $options = WP_CLI::do_hook( 'http_request_options', $options );
940
836
 
941
837
  RequestsLibrary::register_autoloader();
942
838
 
943
- /**
944
- * @var callable $request_method
945
- */
946
839
  $request_method = [ RequestsLibrary::get_class_name(), 'request' ];
947
840
 
948
- $attempt = 0;
949
- $last_exception = null;
950
- $retry_after_delay = 1; // Start with 1 second delay.
951
-
952
- while ( $attempt < $max_retries ) {
953
- ++$attempt;
841
+ try {
954
842
  try {
955
- try {
956
- return $request_method( $url, $headers, $data, $method, $options );
957
- } catch ( \Requests_Exception | \WpOrg\Requests\Exception $exception ) {
958
- $curl_handle = $exception->getData();
959
- // Get curl error code safely - only if curl is available and handle is valid.
960
- $curl_errno = null;
961
- if ( function_exists( 'curl_errno' ) && ( is_resource( $curl_handle ) || ( is_object( $curl_handle ) && $curl_handle instanceof \CurlHandle ) ) ) {
962
- // @phpstan-ignore argument.type
963
- $curl_errno = curl_errno( $curl_handle );
964
- }
965
- // CURLE_SSL_CACERT = 60
966
- $is_ssl_cacert_error = null !== $curl_errno && 60 === $curl_errno;
967
-
843
+ return $request_method( $url, $headers, $data, $method, $options );
844
+ } catch ( Exception $exception ) {
845
+ if ( RequestsLibrary::is_requests_exception( $exception ) ) {
968
846
  if (
969
847
  true !== $options['verify']
970
848
  || 'curlerror' !== $exception->getType()
971
- || ! $is_ssl_cacert_error
849
+ || curl_errno( $exception->getData() ) !== CURLE_SSL_CACERT
972
850
  ) {
973
851
  throw $exception;
974
852
  }
@@ -977,43 +855,23 @@ function http_request( $method, $url, $data = null, $headers = [], $options = []
977
855
 
978
856
  return $request_method( $url, $headers, $data, $method, $options );
979
857
  }
980
- } catch ( \Requests_Exception | \WpOrg\Requests\Exception $exception ) {
981
- $curl_handle = $exception->getData();
982
- // Get curl error code safely - only if curl is available and handle is valid.
983
- $curl_errno = null;
984
- if ( function_exists( 'curl_errno' ) && ( is_resource( $curl_handle ) || ( is_object( $curl_handle ) && $curl_handle instanceof \CurlHandle ) ) ) {
985
- // @phpstan-ignore argument.type
986
- $curl_errno = curl_errno( $curl_handle );
987
- }
988
- // CURLE_SSL_CONNECT_ERROR = 35, CURLE_SSL_CERTPROBLEM = 58, CURLE_SSL_CACERT_BADFILE = 77
989
- $is_ssl_error = null !== $curl_errno && in_array( $curl_errno, [ 35, 58, 77 ], true );
990
-
991
- // CURLE_COULDNT_RESOLVE_HOST = 6, CURLE_COULDNT_CONNECT = 7, CURLE_PARTIAL_FILE = 18
992
- // CURLE_OPERATION_TIMEDOUT = 28, CURLE_GOT_NOTHING = 52, CURLE_SEND_ERROR = 55, CURLE_RECV_ERROR = 56
993
- $is_transient_error = null !== $curl_errno && in_array( $curl_errno, [ 6, 7, 18, 28, 52, 55, 56 ], true );
994
-
858
+ throw $exception;
859
+ }
860
+ } catch ( Exception $exception ) {
861
+ if ( RequestsLibrary::is_requests_exception( $exception ) ) {
862
+ // CURLE_SSL_CACERT_BADFILE only defined for PHP >= 7.
995
863
  if (
996
864
  ! $insecure
997
865
  ||
998
866
  'curlerror' !== $exception->getType()
999
867
  ||
1000
- ! $is_ssl_error
868
+ ! in_array( curl_errno( $exception->getData() ), [ CURLE_SSL_CONNECT_ERROR, CURLE_SSL_CERTPROBLEM, 77 /*CURLE_SSL_CACERT_BADFILE*/ ], true )
1001
869
  ) {
1002
- // Check if this is a transient error that should be retried.
1003
- if ( ! $is_transient_error || $attempt >= $max_retries ) {
1004
- $error_msg = sprintf( "Failed to get url '%s': %s.", $url, $exception->getMessage() );
1005
- if ( $halt_on_error ) {
1006
- WP_CLI::error( $error_msg );
1007
- }
1008
- throw new RuntimeException( $error_msg, 0, $exception );
870
+ $error_msg = sprintf( "Failed to get url '%s': %s.", $url, $exception->getMessage() );
871
+ if ( $halt_on_error ) {
872
+ WP_CLI::error( $error_msg );
1009
873
  }
1010
-
1011
- // Store exception and retry.
1012
- $last_exception = $exception;
1013
- WP_CLI::debug( sprintf( 'Retrying HTTP request to %s (retry %d/%d) after transient error: %s', $url, $attempt, $max_retries, $exception->getMessage() ), 'http' );
1014
- sleep( $retry_after_delay );
1015
- $retry_after_delay = min( $retry_after_delay * 2, 10 ); // Exponential backoff, max 10 seconds.
1016
- continue;
874
+ throw new RuntimeException( $error_msg, 0, $exception );
1017
875
  }
1018
876
 
1019
877
  $warning = sprintf(
@@ -1028,40 +886,19 @@ function http_request( $method, $url, $data = null, $headers = [], $options = []
1028
886
 
1029
887
  try {
1030
888
  return $request_method( $url, $headers, $data, $method, $options );
1031
- } catch ( \Requests_Exception | \WpOrg\Requests\Exception $retry_exception ) {
1032
- // Check if this is a transient error that should be retried.
1033
- $retry_curl_handle = $retry_exception->getData();
1034
- $retry_curl_errno = null;
1035
- if ( function_exists( 'curl_errno' ) && ( is_resource( $retry_curl_handle ) || ( is_object( $retry_curl_handle ) && $retry_curl_handle instanceof \CurlHandle ) ) ) {
1036
- // @phpstan-ignore argument.type
1037
- $retry_curl_errno = curl_errno( $retry_curl_handle );
1038
- }
1039
- $is_retry_transient = null !== $retry_curl_errno && in_array( $retry_curl_errno, [ 6, 7, 18, 28, 52, 55, 56 ], true );
1040
-
1041
- if ( $is_retry_transient && $attempt < $max_retries ) {
1042
- // Transient error, let the retry loop handle it.
1043
- $last_exception = $retry_exception;
1044
- WP_CLI::debug( sprintf( 'Retrying HTTP request to %s (retry %d/%d) after transient error: %s', $url, $attempt, $max_retries, $retry_exception->getMessage() ), 'http' );
1045
- sleep( $retry_after_delay );
1046
- $retry_after_delay = min( $retry_after_delay * 2, 10 ); // Exponential backoff, max 10 seconds.
1047
- continue;
1048
- }
1049
-
1050
- $error_msg = sprintf( "Failed to get non-verified url '%s' %s.", $url, $retry_exception->getMessage() );
1051
- if ( $halt_on_error ) {
1052
- WP_CLI::error( $error_msg );
889
+ } catch ( Exception $exception ) {
890
+ if ( RequestsLibrary::is_requests_exception( $exception ) ) {
891
+ $error_msg = sprintf( "Failed to get non-verified url '%s' %s.", $url, $exception->getMessage() );
892
+ if ( $halt_on_error ) {
893
+ WP_CLI::error( $error_msg );
894
+ }
895
+ throw new RuntimeException( $error_msg, 0, $exception );
1053
896
  }
1054
- throw new RuntimeException( $error_msg, 0, $retry_exception );
897
+ throw $exception;
1055
898
  }
1056
899
  }
900
+ throw $exception;
1057
901
  }
1058
-
1059
- // All retries exhausted, throw the last exception.
1060
- $error_msg = sprintf( "Failed to get url '%s' after %d attempts.", $url, $max_retries );
1061
- if ( $halt_on_error ) {
1062
- WP_CLI::error( $error_msg );
1063
- }
1064
- throw new RuntimeException( $error_msg, 0, $last_exception );
1065
902
  }
1066
903
 
1067
904
  /**
@@ -1076,7 +913,7 @@ function get_default_cacert( $halt_on_error = false ) {
1076
913
  $cert_path = RequestsLibrary::get_bundled_certificate_path();
1077
914
  $error_msg = 'Cannot find SSL certificate.';
1078
915
 
1079
- if ( Path::inside_phar( $cert_path ) ) {
916
+ if ( inside_phar( $cert_path ) ) {
1080
917
  // cURL can't read Phar archives.
1081
918
  return extract_from_phar( $cert_path );
1082
919
  }
@@ -1105,52 +942,45 @@ function get_default_cacert( $halt_on_error = false ) {
1105
942
  */
1106
943
  function increment_version( $current_version, $new_version ) {
1107
944
  // split version assuming the format is x.y.z-pre.
1108
- $_current_version = explode( '-', $current_version, 2 );
1109
- $_current_version[0] = explode( '.', $_current_version[0] );
945
+ $current_version = explode( '-', $current_version, 2 );
946
+ $current_version[0] = explode( '.', $current_version[0] );
1110
947
 
1111
- $_current_version = array_slice( $_current_version, 0, 2 );
1112
-
1113
- /**
1114
- * @var array{0: list<string>, 1?: string|list<string>|null} $_current_version
1115
- */
1116
- // @phpstan-ignore varTag.type
1117
948
  switch ( $new_version ) {
1118
949
  case 'same':
1119
950
  // do nothing.
1120
951
  break;
1121
952
 
1122
953
  case 'patch':
1123
- $_current_version[0][2] = (int) $_current_version[0][2] + 1;
954
+ ++$current_version[0][2];
1124
955
 
1125
- $_current_version = [ $_current_version[0] ]; // Drop possible pre-release info.
956
+ $current_version = [ $current_version[0] ]; // Drop possible pre-release info.
1126
957
  break;
1127
958
 
1128
959
  case 'minor':
1129
- $_current_version[0][1] = (int) $_current_version[0][1] + 1;
1130
- $_current_version[0][2] = 0;
960
+ ++$current_version[0][1];
961
+ $current_version[0][2] = 0;
1131
962
 
1132
- $_current_version = [ $_current_version[0] ]; // Drop possible pre-release info.
963
+ $current_version = [ $current_version[0] ]; // Drop possible pre-release info.
1133
964
  break;
1134
965
 
1135
966
  case 'major':
1136
- $_current_version[0][0] = (int) $_current_version[0][0] + 1;
1137
- $_current_version[0][1] = 0;
1138
- $_current_version[0][2] = 0;
967
+ ++$current_version[0][0];
968
+ $current_version[0][1] = 0;
969
+ $current_version[0][2] = 0;
1139
970
 
1140
- $_current_version = [ $_current_version[0] ]; // Drop possible pre-release info.
971
+ $current_version = [ $current_version[0] ]; // Drop possible pre-release info.
1141
972
  break;
1142
973
 
1143
974
  default: // not a keyword.
1144
- $_current_version = [ [ $new_version ] ];
975
+ $current_version = [ [ $new_version ] ];
1145
976
  break;
1146
977
  }
1147
978
 
1148
979
  // Reconstruct version string.
1149
- $_current_version[0] = implode( '.', $_current_version[0] );
1150
- // @phpstan-ignore argument.type
1151
- $_current_version = implode( '-', $_current_version );
980
+ $current_version[0] = implode( '.', $current_version[0] );
981
+ $current_version = implode( '-', $current_version );
1152
982
 
1153
- return $_current_version;
983
+ return $current_version;
1154
984
  }
1155
985
 
1156
986
  /**
@@ -1174,6 +1004,9 @@ function get_named_sem_ver( $new_version, $original_version ) {
1174
1004
  if ( isset( $bits[1] ) ) {
1175
1005
  $minor = $bits[1];
1176
1006
  }
1007
+ if ( isset( $bits[2] ) ) {
1008
+ $patch = $bits[2];
1009
+ }
1177
1010
 
1178
1011
  try {
1179
1012
  if ( isset( $minor ) && Semver::satisfies( $new_version, "{$major}.{$minor}.x" ) ) {
@@ -1200,10 +1033,10 @@ function get_named_sem_ver( $new_version, $original_version ) {
1200
1033
  * @access public
1201
1034
  * @category Input
1202
1035
  *
1203
- * @param array<string|int,string|bool> $assoc_args Arguments array.
1204
- * @param string|int $flag Flag to get the value.
1205
- * @param string|bool|int|null $default Default value for the flag. Default: NULL.
1206
- * @return string|bool|int|null
1036
+ * @param array<string,string|bool> $assoc_args Arguments array.
1037
+ * @param string $flag Flag to get the value.
1038
+ * @param mixed $default Default value for the flag. Default: NULL.
1039
+ * @return mixed
1207
1040
  */
1208
1041
  function get_flag_value( $assoc_args, $flag, $default = null ) {
1209
1042
  return isset( $assoc_args[ $flag ] ) ? $assoc_args[ $flag ] : $default;
@@ -1212,22 +1045,24 @@ function get_flag_value( $assoc_args, $flag, $default = null ) {
1212
1045
  /**
1213
1046
  * Get the home directory.
1214
1047
  *
1215
- * @deprecated 2.13.0 Use Path::get_home_dir() instead.
1216
- *
1217
1048
  * @access public
1218
1049
  * @category System
1219
1050
  *
1220
1051
  * @return string
1221
1052
  */
1222
1053
  function get_home_dir() {
1223
- return Path::get_home_dir();
1054
+ $home = getenv( 'HOME' );
1055
+ if ( ! $home ) {
1056
+ // In Windows $HOME may not be defined.
1057
+ $home = getenv( 'HOMEDRIVE' ) . getenv( 'HOMEPATH' );
1058
+ }
1059
+
1060
+ return rtrim( $home, '/\\' );
1224
1061
  }
1225
1062
 
1226
1063
  /**
1227
1064
  * Appends a trailing slash.
1228
1065
  *
1229
- * @deprecated 2.13.0 Use Path::trailingslashit() instead.
1230
- *
1231
1066
  * @access public
1232
1067
  * @category System
1233
1068
  *
@@ -1235,22 +1070,11 @@ function get_home_dir() {
1235
1070
  * @return string String with trailing slash added.
1236
1071
  */
1237
1072
  function trailingslashit( $string ) {
1238
- return Path::trailingslashit( $string );
1239
- }
1073
+ if ( ! is_string( $string ) ) {
1074
+ return '/';
1075
+ }
1240
1076
 
1241
- /**
1242
- * Check if a path is a PHP stream URL.
1243
- *
1244
- * @deprecated 2.13.0 Use Path::is_stream() instead.
1245
- *
1246
- * @access public
1247
- * @category System
1248
- *
1249
- * @param string $path The resource path or URL.
1250
- * @return bool True if the path is a PHP stream URL, false otherwise.
1251
- */
1252
- function is_stream( $path ) {
1253
- return Path::is_stream( $path );
1077
+ return rtrim( $string, '/\\' ) . '/';
1254
1078
  }
1255
1079
 
1256
1080
  /**
@@ -1261,9 +1085,6 @@ function is_stream( $path ) {
1261
1085
  * Allows for two leading slashes for Windows network shares, but
1262
1086
  * ensures that all other duplicate slashes are reduced to a single one.
1263
1087
  * Ensures upper-case drive letters on Windows systems.
1264
- * Allows for PHP file wrappers.
1265
- *
1266
- * @deprecated 2.13.0 Use Path::normalize() instead.
1267
1088
  *
1268
1089
  * @access public
1269
1090
  * @category System
@@ -1272,7 +1093,12 @@ function is_stream( $path ) {
1272
1093
  * @return string Normalized path.
1273
1094
  */
1274
1095
  function normalize_path( $path ) {
1275
- return Path::normalize( $path );
1096
+ $path = str_replace( '\\', '/', $path );
1097
+ $path = preg_replace( '|(?<=.)/+|', '/', $path );
1098
+ if ( ':' === substr( $path, 1, 1 ) ) {
1099
+ $path = ucfirst( $path );
1100
+ }
1101
+ return $path;
1276
1102
  }
1277
1103
 
1278
1104
 
@@ -1302,7 +1128,7 @@ function get_temp_dir() {
1302
1128
  }
1303
1129
 
1304
1130
  // `sys_get_temp_dir()` introduced PHP 5.2.1. Will always return something.
1305
- $temp = Path::trailingslashit( sys_get_temp_dir() );
1131
+ $temp = trailingslashit( sys_get_temp_dir() );
1306
1132
 
1307
1133
  if ( ! is_writable( $temp ) ) {
1308
1134
  WP_CLI::warning( "Temp directory isn't writable: {$temp}" );
@@ -1325,14 +1151,9 @@ function get_temp_dir() {
1325
1151
  * @param string $url
1326
1152
  * @param int $component
1327
1153
  * @return mixed
1328
- *
1329
- * @phpstan-return ($component is non-negative-int ? string|null : array{scheme?: string, user?: string, host?: string, port?: string, path?: string})
1330
1154
  */
1331
1155
  function parse_ssh_url( $url, $component = -1 ) {
1332
1156
  preg_match( '#^((docker|docker\-compose|docker\-compose\-run|ssh|vagrant):)?(([^@:]+)@)?([^:/~]+)(:([\d]*))?((/|~)(.+))?$#', $url, $matches );
1333
- /**
1334
- * @var array{scheme?: string, user?: string, host?: string, port?: string, path?: string} $bits
1335
- */
1336
1157
  $bits = [];
1337
1158
  foreach ( [
1338
1159
  2 => 'scheme',
@@ -1348,7 +1169,7 @@ function parse_ssh_url( $url, $component = -1 ) {
1348
1169
 
1349
1170
  // Find the hostname from `vagrant ssh-config` automatically.
1350
1171
  if ( preg_match( '/^vagrant:?/', $url ) ) {
1351
- if ( isset( $bits['host'] ) && 'vagrant' === $bits['host'] && empty( $bits['scheme'] ) ) {
1172
+ if ( 'vagrant' === $bits['host'] && empty( $bits['scheme'] ) ) {
1352
1173
  $bits['scheme'] = 'vagrant';
1353
1174
  $bits['host'] = '';
1354
1175
  }
@@ -1416,44 +1237,25 @@ function report_batch_operation_results( $noun, $verb, $total, $successes, $fail
1416
1237
  * @return array<string>
1417
1238
  */
1418
1239
  function parse_str_to_argv( $arguments ) {
1419
- preg_match_all( '/(?:--[^\s=]+=(["\'])((\\{2})*|(?:[^\1]+?[^\\\\](\\{2})*))\1|--[^\s=]+=[^\s]+|--[^\s=]+|(["\'])((\\{2})*|(?:[^\5]+?[^\\\\](\\{2})*))\5|[^\s]+)/', $arguments, $matches, PREG_SET_ORDER );
1420
- $argv = [];
1421
- foreach ( $matches as $match ) {
1422
- // Check if this is a quoted associative argument (--key="value" or --key='value').
1423
- // For associative args, groups 1 and 2 contain the quote char and value.
1424
- // For positional args, groups 5 and 6 contain the quote char and value, and group 1 is empty.
1425
- if ( isset( $match[1], $match[2] ) && 0 < strlen( $match[1] ) ) {
1426
- // Extract the key part (everything before the quote).
1427
- if ( preg_match( '/^(--[^=]+=)/', $match[0], $key_match ) ) {
1428
- $value = $match[2];
1429
- // Unescape the quote character that was used to wrap the value.
1430
- $quote_char = $match[1];
1431
- $value = str_replace( '\\' . $quote_char, $quote_char, $value );
1432
- // Reconstruct without the outer quotes.
1433
- $argv[] = $key_match[1] . $value;
1434
- } else {
1435
- $argv[] = $match[0];
1240
+ preg_match_all( '/(?:--[^\s=]+=(["\'])((\\{2})*|(?:[^\1]+?[^\\\\](\\{2})*))\1|--[^\s=]+=[^\s]+|--[^\s=]+|(["\'])((\\{2})*|(?:[^\5]+?[^\\\\](\\{2})*))\5|[^\s]+)/', $arguments, $matches );
1241
+ $argv = $matches[0];
1242
+ return array_map(
1243
+ static function ( $arg ) {
1244
+ foreach ( [ '"', "'" ] as $char ) {
1245
+ if ( substr( $arg, 0, 1 ) === $char && substr( $arg, -1 ) === $char ) {
1246
+ $arg = substr( $arg, 1, -1 );
1247
+ break;
1248
+ }
1436
1249
  }
1437
- } elseif ( isset( $match[5], $match[6] ) ) {
1438
- // This is a quoted positional argument.
1439
- $value = $match[6];
1440
- // Unescape the quote character that was used to wrap the value.
1441
- $quote_char = $match[5];
1442
- $value = str_replace( '\\' . $quote_char, $quote_char, $value );
1443
- $argv[] = $value;
1444
- } else {
1445
- // Unquoted argument.
1446
- $argv[] = $match[0];
1447
- }
1448
- }
1449
- return $argv;
1250
+ return $arg;
1251
+ },
1252
+ $argv
1253
+ );
1450
1254
  }
1451
1255
 
1452
1256
  /**
1453
1257
  * Locale-independent version of basename()
1454
1258
  *
1455
- * @deprecated 2.13.0 Use Path::basename() instead.
1456
- *
1457
1259
  * @access public
1458
1260
  *
1459
1261
  * @param string $path
@@ -1461,7 +1263,8 @@ function parse_str_to_argv( $arguments ) {
1461
1263
  * @return string
1462
1264
  */
1463
1265
  function basename( $path, $suffix = '' ) {
1464
- return Path::basename( $path, $suffix );
1266
+ // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode -- Format required by wordpress.org API.
1267
+ return urldecode( \basename( str_replace( [ '%2F', '%5C' ], '/', urlencode( $path ) ), $suffix ) );
1465
1268
  }
1466
1269
 
1467
1270
  /**
@@ -1525,9 +1328,6 @@ function expand_globs( $paths, $flags = 'default' ) {
1525
1328
  $matching = [ $path ];
1526
1329
 
1527
1330
  if ( preg_match( '/[' . preg_quote( '*?[]{}!', '/' ) . ']/', $path ) ) {
1528
- /**
1529
- * @var int $flags
1530
- */
1531
1331
  $matching = $glob_func( $path, $flags ) ?: [];
1532
1332
  }
1533
1333
  $expanded = array_merge( $expanded, $matching );
@@ -1582,10 +1382,7 @@ function glob_brace( $pattern, $dummy_flags = null ) { // phpcs:ignore Generic.C
1582
1382
 
1583
1383
  $length = strlen( $pattern );
1584
1384
 
1585
- $begin = 0;
1586
-
1587
1385
  // Find first opening brace.
1588
- // @phpstan-ignore for.variableOverwrite
1589
1386
  for ( $begin = 0; $begin < $length; $begin++ ) {
1590
1387
  if ( '\\' === $pattern[ $begin ] ) {
1591
1388
  ++$begin;
@@ -1597,8 +1394,7 @@ function glob_brace( $pattern, $dummy_flags = null ) { // phpcs:ignore Generic.C
1597
1394
  // Find comma or matching closing brace.
1598
1395
  $next = $next_brace_sub( $pattern, $begin + 1 );
1599
1396
  if ( null === $next ) {
1600
- $result = glob( $pattern );
1601
- return $result ?: [];
1397
+ return glob( $pattern );
1602
1398
  }
1603
1399
 
1604
1400
  $rest = $next;
@@ -1607,8 +1403,7 @@ function glob_brace( $pattern, $dummy_flags = null ) { // phpcs:ignore Generic.C
1607
1403
  while ( '}' !== $pattern[ $rest ] ) {
1608
1404
  $rest = $next_brace_sub( $pattern, $rest + 1 );
1609
1405
  if ( null === $rest ) {
1610
- $result = glob( $pattern );
1611
- return $result ?: [];
1406
+ return glob( $pattern );
1612
1407
  }
1613
1408
  }
1614
1409
 
@@ -1684,9 +1479,6 @@ function get_suggestion( $target, array $options, $threshold = 2 ) {
1684
1479
  if ( empty( $options ) ) {
1685
1480
  return '';
1686
1481
  }
1687
-
1688
- $levenshtein = [];
1689
-
1690
1482
  foreach ( $options as $option ) {
1691
1483
  $distance = levenshtein( $option, $target );
1692
1484
  $levenshtein[ $option ] = $distance;
@@ -1713,13 +1505,20 @@ function get_suggestion( $target, array $options, $threshold = 2 ) {
1713
1505
  *
1714
1506
  * Use the __FILE__ or __DIR__ constants as a starting point.
1715
1507
  *
1716
- * @deprecated 2.13.0 Use Path::phar_safe() instead.
1717
- *
1718
1508
  * @param string $path An absolute path that might be within a Phar.
1719
1509
  * @return string A Phar-safe version of the path.
1720
1510
  */
1721
1511
  function phar_safe_path( $path ) {
1722
- return Path::phar_safe( $path );
1512
+
1513
+ if ( ! inside_phar() ) {
1514
+ return $path;
1515
+ }
1516
+
1517
+ return str_replace(
1518
+ PHAR_STREAM_PREFIX . rtrim( WP_CLI_PHAR_PATH, '/' ) . '/',
1519
+ PHAR_STREAM_PREFIX,
1520
+ $path
1521
+ );
1723
1522
  }
1724
1523
 
1725
1524
  /**
@@ -1801,7 +1600,7 @@ function past_tense_verb( $verb ) {
1801
1600
  */
1802
1601
  function get_php_binary() {
1803
1602
  // Phar installs always use PHP_BINARY.
1804
- if ( Path::inside_phar() ) {
1603
+ if ( inside_phar() ) {
1805
1604
  return PHP_BINARY;
1806
1605
  }
1807
1606
 
@@ -1824,30 +1623,17 @@ function get_php_binary() {
1824
1623
  *
1825
1624
  * @access public
1826
1625
  *
1827
- * @param string $cmd Command to execute.
1828
- * @param array<int, list<string>|resource> $descriptorspec Indexed array of descriptor numbers and their values.
1829
- * @param array<int, resource> &$pipes Indexed array of file pointers that correspond to PHP's end of any pipes that are created.
1830
- * @param string $cwd Initial working directory for the command.
1831
- * @param array<string, string> $env Array of environment variables.
1832
- * @param array<string, bool>|null $other_options Array of additional options (Windows only).
1833
- * @return resource|false Command stripped of any environment variable settings, or false on failure.
1834
- *
1835
- * @param-out array<int, resource> $pipes
1626
+ * @param string $cmd Command to execute.
1627
+ * @param array<int, string> $descriptorspec Indexed array of descriptor numbers and their values.
1628
+ * @param array<int, string> &$pipes Indexed array of file pointers that correspond to PHP's end of any pipes that are created.
1629
+ * @param string $cwd Initial working directory for the command.
1630
+ * @param array<string, string> $env Array of environment variables.
1631
+ * @param array<string> $other_options Array of additional options (Windows only).
1632
+ * @return resource Command stripped of any environment variable settings.
1836
1633
  */
1837
1634
  function proc_open_compat( $cmd, $descriptorspec, &$pipes, $cwd = null, $env = null, $other_options = null ) {
1838
1635
  if ( is_windows() ) {
1839
- // @phpstan-ignore no.private.function
1840
1636
  $cmd = _proc_open_compat_win_env( $cmd, $env );
1841
-
1842
- // Normalize forward slashes in the executable name for Windows cmd.exe
1843
- if ( false !== strpos( $cmd, '/' ) ) {
1844
- if ( preg_match( '/^("[^"]*"|[^ ]+)/', $cmd, $matches ) ) {
1845
- $executable = $matches[0];
1846
- $rest = substr( $cmd, strlen( $executable ) );
1847
- $executable = str_replace( '/', '\\', $executable );
1848
- $cmd = $executable . $rest;
1849
- }
1850
- }
1851
1637
  }
1852
1638
  return proc_open( $cmd, $descriptorspec, $pipes, $cwd, $env, $other_options );
1853
1639
  }
@@ -1859,7 +1645,7 @@ function proc_open_compat( $cmd, $descriptorspec, &$pipes, $cwd = null, $env = n
1859
1645
  * @access private
1860
1646
  *
1861
1647
  * @param string $cmd Command to execute.
1862
- * @param array<string, string>|null &$env Array of existing environment variables. Will be modified if any settings in command.
1648
+ * @param array<string, string> &$env Array of existing environment variables. Will be modified if any settings in command.
1863
1649
  * @return string Command stripped of any environment variable settings.
1864
1650
  */
1865
1651
  function _proc_open_compat_win_env( $cmd, &$env ) {
@@ -1890,13 +1676,10 @@ function _proc_open_compat_win_env( $cmd, &$env ) {
1890
1676
  * or real_escape next.
1891
1677
  */
1892
1678
  function esc_like( $text ) {
1893
- /**
1894
- * @var null|\wpdb $wpdb
1895
- */
1896
1679
  global $wpdb;
1897
1680
 
1898
1681
  // Check if the esc_like() method exists on the global $wpdb object.
1899
- // We need to do this because to ensure compatibility layers like the
1682
+ // We need to do this because to ensure compatibilty layers like the
1900
1683
  // SQLite integration plugin still work.
1901
1684
  if ( null !== $wpdb && method_exists( $wpdb, 'esc_like' ) ) {
1902
1685
  return $wpdb->esc_like( $text );
@@ -1911,8 +1694,6 @@ function esc_like( $text ) {
1911
1694
  *
1912
1695
  * @param string|array<string> $idents A single identifier or an array of identifiers.
1913
1696
  * @return string|array<string> An escaped string if given a string, or an array of escaped strings if given an array of strings.
1914
- *
1915
- * @phpstan-return ($idents is string ? string : array<string>)
1916
1697
  */
1917
1698
  function esc_sql_ident( $idents ) {
1918
1699
  $backtick = static function ( $v ) {
@@ -1928,12 +1709,10 @@ function esc_sql_ident( $idents ) {
1928
1709
  /**
1929
1710
  * Check whether a given string is a valid JSON representation.
1930
1711
  *
1931
- * @param mixed $argument String to evaluate.
1712
+ * @param string $argument String to evaluate.
1932
1713
  * @param bool $ignore_scalars Optional. Whether to ignore scalar values.
1933
1714
  * Defaults to true.
1934
1715
  * @return bool Whether the provided string is a valid JSON representation.
1935
- *
1936
- * @phpstan-assert-if-true =non-empty-string $argument
1937
1716
  */
1938
1717
  function is_json( $argument, $ignore_scalars = true ) {
1939
1718
  if ( ! is_string( $argument ) || '' === $argument ) {
@@ -1955,7 +1734,7 @@ function is_json( $argument, $ignore_scalars = true ) {
1955
1734
  * @param array<string, string> $assoc_args Associative array of arguments.
1956
1735
  * @param array<string> $array_arguments Array of argument keys that should receive an
1957
1736
  * array through the shell.
1958
- * @return array<string, mixed>
1737
+ * @return array<string, string>
1959
1738
  */
1960
1739
  function parse_shell_arrays( $assoc_args, $array_arguments ) {
1961
1740
  if ( empty( $assoc_args ) || empty( $array_arguments ) ) {
@@ -1964,8 +1743,7 @@ function parse_shell_arrays( $assoc_args, $array_arguments ) {
1964
1743
 
1965
1744
  foreach ( $array_arguments as $key ) {
1966
1745
  if ( array_key_exists( $key, $assoc_args ) && is_json( $assoc_args[ $key ] ) ) {
1967
- // @phpstan-ignore cast.useless
1968
- $assoc_args[ $key ] = json_decode( (string) $assoc_args[ $key ], $assoc = true );
1746
+ $assoc_args[ $key ] = json_decode( $assoc_args[ $key ], $assoc = true );
1969
1747
  }
1970
1748
  }
1971
1749
 
@@ -1987,17 +1765,15 @@ function describe_callable( $callable ) {
1987
1765
  }
1988
1766
 
1989
1767
  if ( is_array( $callable ) ) {
1990
- /** @var array{0: object|string, 1: string} $callable */
1991
-
1992
1768
  if ( is_object( $callable[0] ) ) {
1993
1769
  return sprintf(
1994
1770
  '%s->%s()',
1995
1771
  get_class( $callable[0] ),
1996
- (string) $callable[1]
1772
+ $callable[1]
1997
1773
  );
1998
1774
  }
1999
1775
 
2000
- return sprintf( '%s::%s()', (string) $callable[0], (string) $callable[1] );
1776
+ return sprintf( '%s::%s()', $callable[0], $callable[1] );
2001
1777
  }
2002
1778
 
2003
1779
  return gettype( $callable );
@@ -2012,7 +1788,7 @@ function describe_callable( $callable ) {
2012
1788
  * This accommodates changes to `is_callable()` in PHP 8 that mean an array of a
2013
1789
  * classname and instance method is no longer callable.
2014
1790
  *
2015
- * @param array $pair The class and method pair to check.
1791
+ * @param array<string> $pair The class and method pair to check.
2016
1792
  * @return bool
2017
1793
  */
2018
1794
  function is_valid_class_and_method_pair( $pair ) {
@@ -2142,14 +1918,14 @@ function get_mysql_version() {
2142
1918
  return $version;
2143
1919
  }
2144
1920
 
2145
- $version = '';
2146
-
2147
1921
  $db_type = get_db_type();
2148
1922
 
2149
1923
  if ( 'sqlite' !== $db_type ) {
2150
1924
  $result = Process::create( "/usr/bin/env $db_type --version", null, null )->run();
2151
1925
 
2152
- if ( 0 === $result->return_code ) {
1926
+ if ( 0 !== $result->return_code ) {
1927
+ $version = '';
1928
+ } else {
2153
1929
  $version = trim( $result->stdout );
2154
1930
  }
2155
1931
  }
@@ -2198,11 +1974,10 @@ function get_sql_modes() {
2198
1974
  if ( 0 !== $result->return_code ) {
2199
1975
  $sql_modes = [];
2200
1976
  } else {
2201
- $split_lines = preg_split( "/\r\n|\n|\r/", $result->stdout );
2202
- $sql_modes = array_filter(
1977
+ $sql_modes = array_filter(
2203
1978
  array_map(
2204
1979
  'trim',
2205
- $split_lines ?: []
1980
+ preg_split( "/\r\n|\n|\r/", $result->stdout )
2206
1981
  )
2207
1982
  );
2208
1983
  }
@@ -2211,40 +1986,14 @@ function get_sql_modes() {
2211
1986
  return $sql_modes;
2212
1987
  }
2213
1988
 
2214
- /**
2215
- * Get an environment variable value, with config file fallback.
2216
- *
2217
- * Checks the actual environment variable first, then falls back to
2218
- * values defined in the 'env' configuration key in wp-cli.yml.
2219
- *
2220
- * @param string $name Environment variable name.
2221
- * @return string|false The value of the environment variable, or false if not set.
2222
- */
2223
- function get_env_or_config( $name ) {
2224
- $env_value = getenv( $name );
2225
- if ( false !== $env_value ) {
2226
- return $env_value;
2227
- }
2228
-
2229
- // Try to get from config file
2230
- $runner = WP_CLI::get_runner();
2231
- if ( $runner && isset( $runner->extra_config['env'] ) && is_array( $runner->extra_config['env'] ) && isset( $runner->extra_config['env'][ $name ] ) ) {
2232
- // @phpstan-ignore cast.string
2233
- return (string) $runner->extra_config['env'][ $name ];
2234
- }
2235
-
2236
- return false;
2237
- }
2238
-
2239
1989
  /**
2240
1990
  * Get the WP-CLI cache directory.
2241
1991
  *
2242
1992
  * @return string
2243
1993
  */
2244
1994
  function get_cache_dir() {
2245
- $home = Path::get_home_dir();
2246
- $cache_dir = get_env_or_config( 'WP_CLI_CACHE_DIR' );
2247
- return $cache_dir ? : "$home/.wp-cli/cache";
1995
+ $home = get_home_dir();
1996
+ return getenv( 'WP_CLI_CACHE_DIR' ) ? : "$home/.wp-cli/cache";
2248
1997
  }
2249
1998
 
2250
1999
  /**
@@ -2253,34 +2002,11 @@ function get_cache_dir() {
2253
2002
  * @return bool
2254
2003
  */
2255
2004
  function has_stdin() {
2256
- // Use fstat() to detect character devices (S_IFCHR), which includes
2257
- // both interactive terminals (TTY) and /dev/null. In non-interactive
2258
- // environments (cron, atd, puppet exec), STDIN is often connected to
2259
- // /dev/null, which stream_select() incorrectly reports as readable
2260
- // (since EOF is immediately available). For the purposes of this
2261
- // helper, character devices are treated as "no stdin" to avoid
2262
- // blocking on interactive input or misdetecting /dev/null as input.
2263
- $stat = fstat( STDIN );
2264
- if ( false !== $stat ) {
2265
- // S_IFMT (0170000): bitmask to extract the POSIX file type.
2266
- // S_IFCHR (0020000): file type constant for character devices.
2267
- // Character devices include both interactive terminals (TTY) and
2268
- // /dev/null, all of which are treated as not providing stdin here.
2269
- if ( 0020000 === ( $stat['mode'] & 0170000 ) ) {
2270
- return false;
2271
- }
2272
- }
2273
-
2274
- $handle = fopen( 'php://stdin', 'r' );
2275
- if ( ! $handle ) {
2276
- return false;
2277
- }
2278
-
2005
+ $handle = fopen( 'php://stdin', 'r' );
2279
2006
  $read = array( $handle );
2280
2007
  $write = null;
2281
2008
  $except = null;
2282
2009
  $streams = stream_select( $read, $write, $except, 0 );
2283
-
2284
2010
  fclose( $handle );
2285
2011
 
2286
2012
  return 1 === $streams;
@@ -2338,41 +2064,3 @@ function escape_csv_value( $value ) {
2338
2064
 
2339
2065
  return $value;
2340
2066
  }
2341
-
2342
- /**
2343
- * Convert a size in bytes to a human-readable format.
2344
- *
2345
- * @param int|float $bytes Size in bytes.
2346
- * @param int $decimals Optional. Number of decimal places to round to. Default 0.
2347
- * @param string $unit Optional. Specific unit to use. Default is auto-detect.
2348
- * @return string Human-readable size.
2349
- */
2350
- function format_bytes_string( $bytes, $decimals = 0, $unit = '' ) {
2351
- if ( 0 === (int) $bytes ) {
2352
- return '0 B';
2353
- }
2354
-
2355
- $sizes = [ 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ];
2356
-
2357
- // Use absolute value for calculating log exponent metrics cleanly.
2358
- $abs_bytes = abs( (float) $bytes );
2359
-
2360
- // Resolve the specific target unit manually.
2361
- $size_key = false;
2362
- if ( ! empty( $unit ) ) {
2363
- $unit = strtoupper( $unit );
2364
- $size_key = array_search( $unit, $sizes, true );
2365
- }
2366
-
2367
- // Calculate and bound the auto-detect unit size string if no valid unit was requested.
2368
- if ( false === $size_key ) {
2369
- $size_key = (int) floor( log( $abs_bytes ) / log( 1000 ) );
2370
- $size_key = min( $size_key, count( $sizes ) - 1 ); // Prevent out of bounds
2371
-
2372
- $unit = $sizes[ $size_key ];
2373
- }
2374
-
2375
- $divisor = pow( 1000, $size_key );
2376
-
2377
- return round( $bytes / $divisor, $decimals ) . ' ' . $unit;
2378
- }