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.
- package/README.md +54 -1
- package/assets/demo.gif +0 -0
- package/dist/cli/{_events-BRGCap7g.mjs → _events-C2dFSpKE.mjs} +2 -2
- package/dist/cli/{certificate-manager-Dd4zv2_k.mjs → certificate-manager-BMngpL-s.mjs} +12 -4
- package/dist/cli/{index-9Oz-0bqF.mjs → index-CkFXAp-n.mjs} +5 -5
- package/dist/cli/{index-CT4S2538.mjs → index-odShRBgM.mjs} +171 -117
- package/dist/cli/{login-D4E3GoXe.mjs → login-BeT1uKwW.mjs} +2 -2
- package/dist/cli/{logout-DE-RoshK.mjs → logout-BFQJBJD0.mjs} +2 -2
- package/dist/cli/main.mjs +3 -2
- package/dist/cli/proxy-daemon.mjs +1 -1
- package/dist/cli/{resume-DLoXmzNG.mjs → resume-D_K0QEl5.mjs} +1 -1
- package/dist/cli/{set-B8YYUENH.mjs → set-C5l116L7.mjs} +2 -2
- package/dist/cli/{set-B0L-QiXT.mjs → set-DzcR6sFr.mjs} +2 -2
- package/dist/cli/{status-DEOAA0yx.mjs → status-CbXnAskz.mjs} +1 -1
- package/dist/cli/{wp-CobSX6C6.mjs → wp-CUKyZNTP.mjs} +1 -1
- package/dist/cli/wp-files/latest/available-site-translations.json +1 -1
- package/dist/cli/wp-files/latest/languages/admin-de_DE.l10n.php +2 -2
- package/dist/cli/wp-files/latest/languages/admin-network-de_DE.l10n.php +1 -1
- package/dist/cli/wp-files/latest/languages/admin-pl_PL.l10n.php +2 -2
- package/dist/cli/wp-files/latest/languages/de_DE-0cc31205f20441b3df1d1b46100f6b8d.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-0ce75ad2f775d1cac9696967d484808c.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-0eebe503220d4a00341eb011b92769b4.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-17179a5f2930647c89151e365f843b6e.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-1780a2033cf98d69ce13c2e5c8510004.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-1a0cd6a7128913b15c1a10dd68951869.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-1bba9045bb07c89671c88a3f328548e8.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-1c4303f02ff93b290e9faad991eeb06f.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-1d17475f620f63a92e2c5d2681c51ee8.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-2617ce121227a46077ede6c69aa9fcb5.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-270d72d1cff17227d37f3244759cbecb.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-28b3c3d595952907e08d98287077426c.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-2b390f85a3048c5b4255fb45960b6514.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-2c5d274ea625dd91556554ad82901529.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-320f4ad9792aaa6dedb1e71cbdf85d57.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-440127dd25bde48a531ded36f33e927b.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-49c6d4acf36cf3aca9f0b2a77617304f.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-4a38fe1c0c45989e44682ba6109d9f46.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-4bfa11da57ff2600004bb500368247f4.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-50278328b502f4eb3f2b8b7ab49324a1.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-5251f7623766a714c8207c7edb938628.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-529362903a5a05b34b06b5e793fb4cf8.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-569e85ef168299eb8c8f24d8ef8c8a78.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-6025add6bde16aaeb12787d250f9b414.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-60d06fac6f98e8e8f0ec5a945738b660.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-68f2cec7514bf8563c723a4d675fcfe6.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-7233008897033de5ee0d14f86a42a65a.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-7289286ed59e90a8f36ae797df62220b.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-7436b7ee9e4f11ac0d618d8cc886eb66.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-77fdfadaf2e1ca3a027d1956b910bc50.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-7b74c8457eaa7fcc50db41b431f8a003.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-7c90cd4398ee2d9d3628c387a87a70e5.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-7d5ca435e60d92f024d46c9257aaa0f7.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-7f13c36c641b114bf18cd0bcc9ecc7e0.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-803bf1ce2131e13efc590c1bc47851fc.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-81c889563f09dd13de1701135dc62941.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-81d6f084cb273e02e15b01bd9ece87f7.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-8240df461220d1d3a028a9a4c5652a5b.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-8860e58c20c6a2ab5876a0f07be43bd9.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-93882e8f9976382d7f724ac595ed7151.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-947c76bb5095da30e16668eec15406b2.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-9b256ea9cd54df92095e04c76758ceb0.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-9c3519f4870fac83dc0dbf18cb6bd4c4.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-9d47a87c240c1d10701cd6a02b28aa1b.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-a25d1cc7bf7ca0b4e114f6bea64943f4.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-a2796e57f680e25d84c4b352ee6d7280.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-a9dc201dcd011fe71849743133052619.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-aabfce98c410957228848dc581e3c420.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-ac23eee47530ac63a1178c827db28087.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-bf0f094965d3d4a95b47babcb35fc136.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-bf23b24175490c2e46aaf92ff6a0c70f.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-c31d5f185753910c14afebc6deb2ce24.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-ca28138671823450e87dfd354f7afc6b.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-daeb084aab42199d26393a56c3465bc0.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-e2791ba830489d23043be8650a22a22b.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-e2e4c4b80f3adf2c70b431bfdb1b4872.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-e53526243551a102928735ec9eed4edf.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-f575f481034e90e21d832e415fd95fcf.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-f70806bf0c7d62f2908bd5a1c3fe4efc.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE-f8f49d9fc4a9cf7d78ec99285417bd9c.json +1 -1
- package/dist/cli/wp-files/latest/languages/de_DE.l10n.php +27 -27
- package/dist/cli/wp-files/latest/languages/pl_PL-0cc31205f20441b3df1d1b46100f6b8d.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-0eebe503220d4a00341eb011b92769b4.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-1c4303f02ff93b290e9faad991eeb06f.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-1d17475f620f63a92e2c5d2681c51ee8.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-2b390f85a3048c5b4255fb45960b6514.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-4a38fe1c0c45989e44682ba6109d9f46.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-4bfa11da57ff2600004bb500368247f4.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-50278328b502f4eb3f2b8b7ab49324a1.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-5251f7623766a714c8207c7edb938628.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-529362903a5a05b34b06b5e793fb4cf8.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-569e85ef168299eb8c8f24d8ef8c8a78.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-6025add6bde16aaeb12787d250f9b414.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-7436b7ee9e4f11ac0d618d8cc886eb66.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-77fdfadaf2e1ca3a027d1956b910bc50.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-7b74c8457eaa7fcc50db41b431f8a003.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-7d5ca435e60d92f024d46c9257aaa0f7.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-81d6f084cb273e02e15b01bd9ece87f7.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-8240df461220d1d3a028a9a4c5652a5b.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-9b256ea9cd54df92095e04c76758ceb0.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-9c3519f4870fac83dc0dbf18cb6bd4c4.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-9d47a87c240c1d10701cd6a02b28aa1b.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-a9dc201dcd011fe71849743133052619.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-aabfce98c410957228848dc581e3c420.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-ca28138671823450e87dfd354f7afc6b.json +1 -1
- package/dist/cli/wp-files/latest/languages/pl_PL-e2e4c4b80f3adf2c70b431bfdb1b4872.json +1 -1
- package/dist/cli/wp-files/sqlite-command/composer.json +4 -3
- package/dist/cli/wp-files/sqlite-command/composer.lock +132 -80
- package/dist/cli/wp-files/sqlite-command/vendor/autoload.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_classmap.php +58 -70
- package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_namespaces.php +1 -0
- package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_psr4.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_real.php +5 -5
- package/dist/cli/wp-files/sqlite-command/vendor/composer/autoload_static.php +78 -80
- package/dist/cli/wp-files/sqlite-command/vendor/composer/installed.json +104 -49
- package/dist/cli/wp-files/sqlite-command/vendor/composer/installed.php +29 -16
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/CHANGELOG.md +103 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Comparator/Comparator.php +62 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Comparator/DateComparator.php +50 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Comparator/NumberComparator.php +78 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Exception/AccessDeniedException.php +19 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Exception/DirectoryNotFoundException.php +19 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Finder.php +851 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Gitignore.php +91 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Glob.php +116 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/CustomFilterIterator.php +61 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php +58 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php +48 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php +110 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php +51 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/FilecontentFilterIterator.php +58 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/FilenameFilterIterator.php +45 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/LazyIterator.php +32 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php +107 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/PathFilterIterator.php +56 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php +134 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php +57 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/SortableIterator.php +115 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php +173 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/LICENSE +19 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/README.md +14 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/SplFileInfo.php +80 -0
- package/dist/cli/wp-files/sqlite-command/vendor/symfony/finder/composer.json +31 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/mustache/.gitattributes +8 -0
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache → wp-cli}/mustache/LICENSE +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/mustache/README.md +76 -0
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache → wp-cli}/mustache/composer.json +6 -16
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/mustache/src/Mustache/Autoloader.php +88 -0
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Cache/AbstractCache.php +7 -15
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Cache/FilesystemCache.php +15 -20
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Cache/NoopCache.php +4 -8
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Cache.php +7 -10
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Compiler.php +87 -144
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Context.php +19 -23
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Engine.php +134 -251
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/InvalidArgumentException.php +2 -6
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/LogicException.php +2 -6
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/RuntimeException.php +2 -6
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/SyntaxException.php +8 -7
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/UnknownFilterException.php +7 -7
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/UnknownHelperException.php +7 -7
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception/UnknownTemplateException.php +7 -7
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Exception.php +5 -4
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/HelperCollection.php +17 -22
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/LambdaHelper.php +8 -28
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/ArrayLoader.php +9 -12
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/CascadingLoader.php +15 -18
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/FilesystemLoader.php +18 -24
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/InlineLoader.php +13 -19
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/MutableLoader.php +7 -4
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/ProductionFilesystemLoader.php +16 -23
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader/StringLoader.php +4 -8
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Loader.php +7 -8
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Logger/AbstractLogger.php +26 -22
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Logger/StreamLogger.php +20 -25
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Logger.php +37 -13
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Parser.php +93 -100
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Source/FilesystemSource.php +7 -11
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Source.php +5 -4
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Template.php +32 -39
- package/dist/cli/wp-files/sqlite-command/vendor/{mustache/mustache/src → wp-cli/mustache/src/Mustache}/Tokenizer.php +29 -33
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/.actrc +3 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/.gitattributes +6 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/.mailmap +234 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/README.md +4 -4
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/VERSION +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/CHANGELOG.md +0 -65
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/README.md +1 -2
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/certificates/cacert.pem +372 -315
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/certificates/cacert.pem.sha256 +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/composer.json +5 -7
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Iri.php +18 -20
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Requests.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Response/Headers.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Transport/Curl.php +1 -5
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Transport/Fsockopen.php +0 -2
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Utility/CaseInsensitiveDictionary.php +0 -12
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/src/Utility/FilteredIterator.php +2 -2
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/composer.json +13 -30
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/dependencies.yml +6 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/manifest.json +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Autoloader.php +2 -4
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/AutoloaderStep.php +1 -10
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/CheckRoot.php +2 -20
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/DefineProtectedCommands.php +3 -3
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/IncludeFrameworkAutoloader.php +4 -3
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/IncludeRequestsAutoloader.php +3 -4
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/InitializeContexts.php +0 -3
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/InitializeLogger.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php +3 -6
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/{RegisterShutdownHandler.php → LoadDispatcher.php} +4 -6
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LoadRequiredCommand.php +5 -9
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LoadUtilityFunctions.php +0 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Completions.php +6 -149
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Configurator.php +49 -202
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Admin.php +21 -113
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Auto.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Cli.php +1 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Context/Frontend.php +1 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php +26 -63
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php +9 -19
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php +19 -284
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/DocParser.php +5 -17
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Exception/NonExistentKeyException.php +3 -6
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Extractor.php +54 -30
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Base.php +3 -7
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Comment.php +2 -4
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Post.php +3 -8
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Signup.php +1 -3
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/Site.php +4 -12
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Fetchers/User.php +1 -3
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/FileCache.php +33 -135
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Formatter.php +57 -221
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Inflector.php +4 -4
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/CSV.php +1 -6
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/Query.php +1 -3
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/Table.php +1 -7
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Iterators/Transform.php +0 -2
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Loggers/Base.php +0 -15
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Loggers/Quiet.php +3 -2
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Loggers/Regular.php +3 -4
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/NoOp.php +0 -4
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Process.php +7 -40
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/RequestsLibrary.php +1 -4
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php +234 -795
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/SynopsisParser.php +26 -116
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/SynopsisValidator.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Traverser/RecursiveDataStructureTraverser.php +26 -69
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/UpgraderSkin.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/WpHttpCacheManager.php +5 -67
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/WpOrgApi.php +3 -3
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/boot-fs.php +2 -2
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/bootstrap.php +2 -5
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/class-wp-cli.php +62 -311
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/commands/src/CLI_Alias_Command.php +60 -292
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/commands/src/CLI_Cache_Command.php +1 -1
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/commands/src/CLI_Command.php +31 -191
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/commands/src/Help_Command.php +35 -177
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/config-spec.php +4 -28
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/utils-wp.php +47 -81
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/utils.php +200 -512
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/wp-cli.php +2 -2
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/wp-settings-cli.php +465 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/templates/man-params.mustache +4 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/templates/man.mustache +0 -8
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/ArgValidationTest.php +74 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/CommandFactoryTest.php +420 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/ConfiguratorTest.php +87 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/DocParserTest.php +213 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/ExtractorTest.php +293 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/FileCacheTest.php +207 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/HelpTest.php +119 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/InflectorTest.php +37 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/LoggingTest.php +124 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/ProcessTest.php +30 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/SynopsisParserTest.php +194 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/UtilsTest.php +1092 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WPCLITest.php +16 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WP_CLI/Iterators/CSVTest.php +109 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WP_CLI/Traversers/RecursiveDataStructureTraverserTest.php +151 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WP_CLI/WpOrgApiTest.php +166 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/WpVersionCompareTest.php +78 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/bootstrap.php +17 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/commandfactory-doc_comment-class-win.php +70 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/commandfactory-doc_comment-class.php +70 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/commandfactory-doc_comment-function-win.php +19 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/commandfactory-doc_comment-function.php +19 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/bar.ab2 +0 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/baz.ab1 +0 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/baz.ac1 +0 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/baz.efg2 +0 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/foo.ab1 +0 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/foo.ab2 +0 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/foo.efg1 +0 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/data/expand_globs/foo.efg2 +0 -0
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/tests/mock-requests-transport.php +34 -0
- package/dist/cli/wp-files/sqlite-command/version +1 -1
- package/package.json +4 -3
- package/patches/archiver+7.0.1.patch +14 -0
- package/dist/cli/wp-files/sqlite-command/vendor/mustache/mustache/.php-cs-fixer.php +0 -20
- package/dist/cli/wp-files/sqlite-command/vendor/mustache/mustache/README.md +0 -94
- package/dist/cli/wp-files/sqlite-command/vendor/mustache/mustache/src/RenderedString.php +0 -51
- package/dist/cli/wp-files/sqlite-command/vendor/mustache/mustache/src/compat.php +0 -282
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/.typos.toml +0 -14
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/AGENTS.md +0 -121
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/scripts/proxy/proxy.py +0 -5
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/scripts/proxy/start.sh +0 -19
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/bundle/rmccue/requests/scripts/proxy/stop.sh +0 -10
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/Path.php +0 -260
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/php/WP_CLI/ShutdownHandler.php +0 -329
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/schemas/wp-cli-config.json +0 -218
- package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/schemas/wp-cli.example.yml +0 -55
- /package/dist/cli/wp-files/sqlite-command/vendor/wp-cli/wp-cli/{codecov.yml → tests/data/expand_globs/bar.ab1} +0 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use WP_CLI\DocParser;
|
|
4
|
+
use WP_CLI\Tests\TestCase;
|
|
5
|
+
|
|
6
|
+
class DocParserTest extends TestCase {
|
|
7
|
+
|
|
8
|
+
public function test_empty() {
|
|
9
|
+
$doc = new DocParser( '' );
|
|
10
|
+
|
|
11
|
+
$this->assertEquals( '', $doc->get_shortdesc() );
|
|
12
|
+
$this->assertEquals( '', $doc->get_longdesc() );
|
|
13
|
+
$this->assertEquals( '', $doc->get_synopsis() );
|
|
14
|
+
$this->assertEquals( '', $doc->get_tag( 'alias' ) );
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public function test_only_tags() {
|
|
18
|
+
$doc = new DocParser(
|
|
19
|
+
<<<EOB
|
|
20
|
+
/**
|
|
21
|
+
* @alias rock-on
|
|
22
|
+
* @subcommand revoke-md5-passwords
|
|
23
|
+
*/
|
|
24
|
+
EOB
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
$this->assertEquals( '', $doc->get_shortdesc() );
|
|
28
|
+
$this->assertEquals( '', $doc->get_longdesc() );
|
|
29
|
+
$this->assertEquals( '', $doc->get_synopsis() );
|
|
30
|
+
$this->assertEquals( '', $doc->get_tag( 'foo' ) );
|
|
31
|
+
$this->assertEquals( 'rock-on', $doc->get_tag( 'alias' ) );
|
|
32
|
+
$this->assertEquals( 'revoke-md5-passwords', $doc->get_tag( 'subcommand' ) );
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public function test_no_longdesc() {
|
|
36
|
+
$doc = new DocParser(
|
|
37
|
+
<<<EOB
|
|
38
|
+
/**
|
|
39
|
+
* Rock and roll!
|
|
40
|
+
* @alias rock-on
|
|
41
|
+
*/
|
|
42
|
+
EOB
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
$this->assertEquals( 'Rock and roll!', $doc->get_shortdesc() );
|
|
46
|
+
$this->assertEquals( '', $doc->get_longdesc() );
|
|
47
|
+
$this->assertEquals( '', $doc->get_synopsis() );
|
|
48
|
+
$this->assertEquals( 'rock-on', $doc->get_tag( 'alias' ) );
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public function test_complete() {
|
|
52
|
+
$doc = new DocParser(
|
|
53
|
+
<<<EOB
|
|
54
|
+
/**
|
|
55
|
+
* Rock and roll!
|
|
56
|
+
*
|
|
57
|
+
* ## OPTIONS
|
|
58
|
+
*
|
|
59
|
+
* <genre>...
|
|
60
|
+
* : Start with one or more genres.
|
|
61
|
+
*
|
|
62
|
+
* --volume=<number>
|
|
63
|
+
* : Sets the volume.
|
|
64
|
+
*
|
|
65
|
+
* --artist=<artist-name>
|
|
66
|
+
* : Limit to a specific artist.
|
|
67
|
+
*
|
|
68
|
+
* ## EXAMPLES
|
|
69
|
+
*
|
|
70
|
+
* wp rock-on --volume=11
|
|
71
|
+
*
|
|
72
|
+
* @synopsis [--volume=<number>]
|
|
73
|
+
* @alias rock-on
|
|
74
|
+
*/
|
|
75
|
+
EOB
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
$this->assertEquals( 'Rock and roll!', $doc->get_shortdesc() );
|
|
79
|
+
$this->assertEquals( '[--volume=<number>]', $doc->get_synopsis() );
|
|
80
|
+
$this->assertEquals( 'Start with one or more genres.', $doc->get_arg_desc( 'genre' ) );
|
|
81
|
+
$this->assertEquals( 'Sets the volume.', $doc->get_param_desc( 'volume' ) );
|
|
82
|
+
$this->assertEquals( 'rock-on', $doc->get_tag( 'alias' ) );
|
|
83
|
+
|
|
84
|
+
$longdesc = <<<EOB
|
|
85
|
+
## OPTIONS
|
|
86
|
+
|
|
87
|
+
<genre>...
|
|
88
|
+
: Start with one or more genres.
|
|
89
|
+
|
|
90
|
+
--volume=<number>
|
|
91
|
+
: Sets the volume.
|
|
92
|
+
|
|
93
|
+
--artist=<artist-name>
|
|
94
|
+
: Limit to a specific artist.
|
|
95
|
+
|
|
96
|
+
## EXAMPLES
|
|
97
|
+
|
|
98
|
+
wp rock-on --volume=11
|
|
99
|
+
EOB;
|
|
100
|
+
$this->assertEquals( $longdesc, $doc->get_longdesc() );
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public function test_desc_parses_yaml() {
|
|
104
|
+
$longdesc = <<<EOB
|
|
105
|
+
Play some music loudly
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
# Here's an example of how you might run the command
|
|
109
|
+
wp rock-on electronic --volume=11
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## OPTIONS
|
|
113
|
+
|
|
114
|
+
<genre>...
|
|
115
|
+
: Start with one or more genres.
|
|
116
|
+
---
|
|
117
|
+
options:
|
|
118
|
+
- rock
|
|
119
|
+
- electronic
|
|
120
|
+
default: rock
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
--volume=<number>
|
|
124
|
+
: Sets the volume.
|
|
125
|
+
---
|
|
126
|
+
default: 10
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
--artist=<artist-name>
|
|
130
|
+
: Limit to a specific artist.
|
|
131
|
+
|
|
132
|
+
## EXAMPLES
|
|
133
|
+
|
|
134
|
+
wp rock-on electronic --volume=11
|
|
135
|
+
|
|
136
|
+
EOB;
|
|
137
|
+
|
|
138
|
+
$doc = new DocParser( $longdesc );
|
|
139
|
+
$this->assertEquals( 'Start with one or more genres.', $doc->get_arg_desc( 'genre' ) );
|
|
140
|
+
$this->assertEquals( 'Sets the volume.', $doc->get_param_desc( 'volume' ) );
|
|
141
|
+
|
|
142
|
+
$expected = [
|
|
143
|
+
'options' => [ 'rock', 'electronic' ],
|
|
144
|
+
'default' => 'rock',
|
|
145
|
+
];
|
|
146
|
+
$this->assertEquals( $expected, $doc->get_arg_args( 'genre' ) );
|
|
147
|
+
|
|
148
|
+
$expected = [
|
|
149
|
+
'default' => 10,
|
|
150
|
+
];
|
|
151
|
+
$this->assertEquals( $expected, $doc->get_param_args( 'volume' ) );
|
|
152
|
+
|
|
153
|
+
$this->assertNull( $doc->get_param_args( 'artist' ) );
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
public function test_desc_doesnt_parse_far_params_yaml() {
|
|
157
|
+
$longdesc = <<<EOB
|
|
158
|
+
## OPTIONS
|
|
159
|
+
|
|
160
|
+
<hook>
|
|
161
|
+
: The name of the action or filter.
|
|
162
|
+
|
|
163
|
+
[--format=<format>]
|
|
164
|
+
: List callbacks as a table, JSON, CSV, or YAML.
|
|
165
|
+
---
|
|
166
|
+
default: table
|
|
167
|
+
options:
|
|
168
|
+
- table
|
|
169
|
+
- json
|
|
170
|
+
- csv
|
|
171
|
+
- yaml
|
|
172
|
+
---
|
|
173
|
+
EOB;
|
|
174
|
+
|
|
175
|
+
$doc = new DocParser( $longdesc );
|
|
176
|
+
|
|
177
|
+
$expected = [
|
|
178
|
+
'default' => 'table',
|
|
179
|
+
'options' => [ 'table', 'json', 'csv', 'yaml' ],
|
|
180
|
+
];
|
|
181
|
+
$this->assertEquals( $expected, $doc->get_param_args( 'format' ) );
|
|
182
|
+
$this->assertNull( $doc->get_arg_args( 'hook' ) );
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public function test_desc_doesnt_parse_far_args_yaml() {
|
|
186
|
+
$longdesc = <<<EOB
|
|
187
|
+
## OPTIONS
|
|
188
|
+
|
|
189
|
+
<hook>
|
|
190
|
+
: The name of the action or filter.
|
|
191
|
+
|
|
192
|
+
<format>
|
|
193
|
+
: List callbacks as a table, JSON, CSV, or YAML.
|
|
194
|
+
---
|
|
195
|
+
default: table
|
|
196
|
+
options:
|
|
197
|
+
- table
|
|
198
|
+
- json
|
|
199
|
+
- csv
|
|
200
|
+
- yaml
|
|
201
|
+
---
|
|
202
|
+
EOB;
|
|
203
|
+
|
|
204
|
+
$doc = new DocParser( $longdesc );
|
|
205
|
+
|
|
206
|
+
$expected = [
|
|
207
|
+
'default' => 'table',
|
|
208
|
+
'options' => [ 'table', 'json', 'csv', 'yaml' ],
|
|
209
|
+
];
|
|
210
|
+
$this->assertEquals( $expected, $doc->get_arg_args( 'format' ) );
|
|
211
|
+
$this->assertNull( $doc->get_arg_args( 'hook' ) );
|
|
212
|
+
}
|
|
213
|
+
}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use WP_CLI\Extractor;
|
|
4
|
+
use WP_CLI\Loggers;
|
|
5
|
+
use WP_CLI\Tests\TestCase;
|
|
6
|
+
use WP_CLI\Utils;
|
|
7
|
+
|
|
8
|
+
class ExtractorTest extends TestCase {
|
|
9
|
+
|
|
10
|
+
public static $copy_overwrite_files_prefix = 'wp-cli-test-utils-copy-overwrite-files-';
|
|
11
|
+
|
|
12
|
+
public static $expected_wp = [
|
|
13
|
+
'index1.php',
|
|
14
|
+
'license2.php',
|
|
15
|
+
'wp-admin/',
|
|
16
|
+
'wp-admin/about3.php',
|
|
17
|
+
'wp-admin/includes/',
|
|
18
|
+
'wp-admin/includes/file4.php',
|
|
19
|
+
'wp-admin/widgets5.php',
|
|
20
|
+
'wp-config6.php',
|
|
21
|
+
'wp-includes/',
|
|
22
|
+
'wp-includes/file7.php',
|
|
23
|
+
'xmlrpc8.php',
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
public static $logger = null;
|
|
27
|
+
public static $prev_logger = null;
|
|
28
|
+
|
|
29
|
+
public function set_up() {
|
|
30
|
+
parent::set_up();
|
|
31
|
+
|
|
32
|
+
self::$prev_logger = WP_CLI::get_logger();
|
|
33
|
+
|
|
34
|
+
self::$logger = new Loggers\Execution();
|
|
35
|
+
WP_CLI::set_logger( self::$logger );
|
|
36
|
+
|
|
37
|
+
// Remove any failed tests detritus.
|
|
38
|
+
$temp_dirs = Utils\get_temp_dir() . self::$copy_overwrite_files_prefix . '*';
|
|
39
|
+
foreach ( glob( $temp_dirs ) as $temp_dir ) {
|
|
40
|
+
Extractor::rmdir( $temp_dir );
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public function tear_down() {
|
|
45
|
+
// Restore logger.
|
|
46
|
+
WP_CLI::set_logger( self::$prev_logger );
|
|
47
|
+
|
|
48
|
+
parent::tear_down();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public function test_rmdir() {
|
|
52
|
+
list( $temp_dir, $src_dir, $wp_dir ) = self::create_test_directory_structure();
|
|
53
|
+
|
|
54
|
+
$this->assertTrue( is_dir( $wp_dir ) );
|
|
55
|
+
Extractor::rmdir( $wp_dir );
|
|
56
|
+
$this->assertFalse( file_exists( $wp_dir ) );
|
|
57
|
+
|
|
58
|
+
$this->assertTrue( is_dir( $temp_dir ) );
|
|
59
|
+
Extractor::rmdir( $temp_dir );
|
|
60
|
+
$this->assertFalse( file_exists( $temp_dir ) );
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public function test_err_rmdir() {
|
|
64
|
+
$msg = '';
|
|
65
|
+
try {
|
|
66
|
+
Extractor::rmdir( 'no-such-dir' );
|
|
67
|
+
} catch ( \Exception $e ) {
|
|
68
|
+
$msg = $e->getMessage();
|
|
69
|
+
}
|
|
70
|
+
$this->assertTrue( false !== strpos( $msg, 'no-such-dir' ) );
|
|
71
|
+
$this->assertTrue( empty( self::$logger->stderr ) );
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public function test_copy_overwrite_files() {
|
|
75
|
+
list( $temp_dir, $src_dir, $wp_dir ) = self::create_test_directory_structure();
|
|
76
|
+
|
|
77
|
+
$dest_dir = $temp_dir . '/dest';
|
|
78
|
+
|
|
79
|
+
Extractor::copy_overwrite_files( $wp_dir, $dest_dir );
|
|
80
|
+
|
|
81
|
+
$files = self::recursive_scandir( $dest_dir );
|
|
82
|
+
|
|
83
|
+
$this->assertSame( self::$expected_wp, $files );
|
|
84
|
+
$this->assertTrue( empty( self::$logger->stderr ) );
|
|
85
|
+
|
|
86
|
+
// Clean up.
|
|
87
|
+
Extractor::rmdir( $temp_dir );
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public function test_err_copy_overwrite_files() {
|
|
91
|
+
$msg = '';
|
|
92
|
+
try {
|
|
93
|
+
Extractor::copy_overwrite_files( 'no-such-dir', 'dest-dir' );
|
|
94
|
+
} catch ( \Exception $e ) {
|
|
95
|
+
$msg = $e->getMessage();
|
|
96
|
+
}
|
|
97
|
+
$this->assertTrue( false !== strpos( $msg, 'no-such-dir' ) );
|
|
98
|
+
$this->assertTrue( empty( self::$logger->stderr ) );
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public function test_extract_tarball() {
|
|
102
|
+
if ( ! exec( 'tar --version' ) ) {
|
|
103
|
+
$this->markTestSkipped( 'tar not installed.' );
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
list( $temp_dir, $src_dir, $wp_dir ) = self::create_test_directory_structure();
|
|
107
|
+
|
|
108
|
+
$tarball = $temp_dir . '/test.tar.gz';
|
|
109
|
+
$dest_dir = $temp_dir . '/dest';
|
|
110
|
+
|
|
111
|
+
// Create test tarball.
|
|
112
|
+
$output = [];
|
|
113
|
+
$return_var = -1;
|
|
114
|
+
// Need --force-local for Windows to avoid "C:" being interpreted as being on remote machine, and redirect for Mac as outputs verbosely on STDERR.
|
|
115
|
+
$cmd = 'tar czvf %1$s' . ( Utils\is_windows() ? ' --force-local' : '' ) . ' --directory=%2$s/src wordpress 2>&1';
|
|
116
|
+
exec( Utils\esc_cmd( $cmd, $tarball, $temp_dir ), $output, $return_var );
|
|
117
|
+
$this->assertSame( 0, $return_var );
|
|
118
|
+
$this->assertFalse( empty( $output ) );
|
|
119
|
+
|
|
120
|
+
// Normalize (Mac) output.
|
|
121
|
+
$normalize = function ( $v ) {
|
|
122
|
+
if ( 'a ' === substr( $v, 0, 2 ) ) {
|
|
123
|
+
$v = substr( $v, 2 );
|
|
124
|
+
}
|
|
125
|
+
if ( '/' !== substr( $v, -1 ) && false === strpos( $v, '.' ) ) {
|
|
126
|
+
$v .= '/';
|
|
127
|
+
}
|
|
128
|
+
return $v;
|
|
129
|
+
};
|
|
130
|
+
$output = array_map( $normalize, $output );
|
|
131
|
+
sort( $output );
|
|
132
|
+
|
|
133
|
+
$this->assertSame( self::recursive_scandir( $src_dir ), $output );
|
|
134
|
+
|
|
135
|
+
// Test.
|
|
136
|
+
Extractor::extract( $tarball, $dest_dir );
|
|
137
|
+
|
|
138
|
+
$files = self::recursive_scandir( $dest_dir );
|
|
139
|
+
$this->assertSame( self::$expected_wp, $files );
|
|
140
|
+
$this->assertTrue( empty( self::$logger->stderr ) );
|
|
141
|
+
|
|
142
|
+
// Clean up.
|
|
143
|
+
Extractor::rmdir( $temp_dir );
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public function test_err_extract_tarball() {
|
|
147
|
+
// Non-existent.
|
|
148
|
+
$msg = '';
|
|
149
|
+
try {
|
|
150
|
+
Extractor::extract( 'no-such-tar.tar.gz', 'dest-dir' );
|
|
151
|
+
} catch ( \Exception $e ) {
|
|
152
|
+
$msg = $e->getMessage();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
$this->assertTrue( false !== strpos( $msg, 'no-such-tar' ) );
|
|
156
|
+
$this->assertTrue( 0 === strpos( self::$logger->stderr, 'Warning: PharData failed' ) );
|
|
157
|
+
$this->assertTrue( false !== strpos( self::$logger->stderr, 'no-such-tar' ) );
|
|
158
|
+
|
|
159
|
+
// Reset logger.
|
|
160
|
+
self::$logger->stderr = '';
|
|
161
|
+
self::$logger->stdout = '';
|
|
162
|
+
|
|
163
|
+
// Zero-length.
|
|
164
|
+
$zero_tar = Utils\get_temp_dir() . 'zero-tar.tar.gz';
|
|
165
|
+
touch( $zero_tar );
|
|
166
|
+
$msg = '';
|
|
167
|
+
try {
|
|
168
|
+
Extractor::extract( $zero_tar, 'dest-dir' );
|
|
169
|
+
} catch ( \Exception $e ) {
|
|
170
|
+
$msg = $e->getMessage();
|
|
171
|
+
}
|
|
172
|
+
unlink( $zero_tar );
|
|
173
|
+
|
|
174
|
+
$this->assertTrue( false !== strpos( $msg, 'zero-tar' ) );
|
|
175
|
+
$this->assertTrue( 0 === strpos( self::$logger->stderr, 'Warning: PharData failed' ) );
|
|
176
|
+
$this->assertTrue( false !== strpos( self::$logger->stderr, 'zero-tar' ) );
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
public function test_extract_zip() {
|
|
180
|
+
if ( ! class_exists( 'ZipArchive' ) ) {
|
|
181
|
+
$this->markTestSkipped( 'ZipArchive not installed.' );
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
list( $temp_dir, $src_dir, $wp_dir ) = self::create_test_directory_structure();
|
|
185
|
+
|
|
186
|
+
$zipfile = $temp_dir . '/test.zip';
|
|
187
|
+
$dest_dir = $temp_dir . '/dest';
|
|
188
|
+
|
|
189
|
+
// Create test zip.
|
|
190
|
+
$zip = new ZipArchive();
|
|
191
|
+
$result = $zip->open( $zipfile, ZipArchive::CREATE );
|
|
192
|
+
$this->assertTrue( $result );
|
|
193
|
+
$files = self::recursive_scandir( $src_dir );
|
|
194
|
+
foreach ( $files as $file ) {
|
|
195
|
+
if ( 0 === substr_compare( $file, '/', -1 ) ) {
|
|
196
|
+
$result = $zip->addEmptyDir( $file );
|
|
197
|
+
} else {
|
|
198
|
+
$result = $zip->addFile( $src_dir . '/' . $file, $file );
|
|
199
|
+
}
|
|
200
|
+
$this->assertTrue( $result );
|
|
201
|
+
}
|
|
202
|
+
$result = $zip->close();
|
|
203
|
+
$this->assertTrue( $result );
|
|
204
|
+
|
|
205
|
+
// Test.
|
|
206
|
+
Extractor::extract( $zipfile, $dest_dir );
|
|
207
|
+
|
|
208
|
+
$files = self::recursive_scandir( $dest_dir );
|
|
209
|
+
$this->assertSame( self::$expected_wp, $files );
|
|
210
|
+
$this->assertTrue( empty( self::$logger->stderr ) );
|
|
211
|
+
|
|
212
|
+
// Clean up.
|
|
213
|
+
Extractor::rmdir( $temp_dir );
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
public function test_err_extract_zip() {
|
|
217
|
+
if ( ! class_exists( 'ZipArchive' ) ) {
|
|
218
|
+
$this->markTestSkipped( 'ZipArchive not installed.' );
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Non-existent.
|
|
222
|
+
$msg = '';
|
|
223
|
+
try {
|
|
224
|
+
Extractor::extract( 'no-such-zip.zip', 'dest-dir' );
|
|
225
|
+
} catch ( \Exception $e ) {
|
|
226
|
+
$msg = $e->getMessage();
|
|
227
|
+
}
|
|
228
|
+
$this->assertTrue( false !== strpos( $msg, 'no-such-zip' ) );
|
|
229
|
+
$this->assertTrue( empty( self::$logger->stderr ) );
|
|
230
|
+
|
|
231
|
+
// Reset logger.
|
|
232
|
+
self::$logger->stderr = '';
|
|
233
|
+
self::$logger->stdout = '';
|
|
234
|
+
|
|
235
|
+
// Zero-length.
|
|
236
|
+
$zero_zip = Utils\get_temp_dir() . 'zero-zip.zip';
|
|
237
|
+
touch( $zero_zip );
|
|
238
|
+
$msg = '';
|
|
239
|
+
try {
|
|
240
|
+
Extractor::extract( $zero_zip, 'dest-dir' );
|
|
241
|
+
} catch ( \Exception $e ) {
|
|
242
|
+
$msg = $e->getMessage();
|
|
243
|
+
}
|
|
244
|
+
unlink( $zero_zip );
|
|
245
|
+
$this->assertTrue( false !== strpos( $msg, 'zero-zip' ) );
|
|
246
|
+
$this->assertTrue( empty( self::$logger->stderr ) );
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
public function test_err_extract() {
|
|
250
|
+
$msg = '';
|
|
251
|
+
try {
|
|
252
|
+
Extractor::extract( 'not-supported.tar.xz', 'dest-dir' );
|
|
253
|
+
} catch ( \Exception $e ) {
|
|
254
|
+
$msg = $e->getMessage();
|
|
255
|
+
}
|
|
256
|
+
$this->assertSame( "Extraction only supported for '.zip' and '.tar.gz' file types.", $msg );
|
|
257
|
+
$this->assertTrue( empty( self::$logger->stderr ) );
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
private static function create_test_directory_structure() {
|
|
261
|
+
$temp_dir = Utils\get_temp_dir() . uniqid( self::$copy_overwrite_files_prefix, true );
|
|
262
|
+
mkdir( $temp_dir );
|
|
263
|
+
|
|
264
|
+
$src_dir = $temp_dir . '/src';
|
|
265
|
+
mkdir( $src_dir );
|
|
266
|
+
|
|
267
|
+
$wp_dir = $src_dir . '/wordpress';
|
|
268
|
+
mkdir( $wp_dir );
|
|
269
|
+
|
|
270
|
+
foreach ( self::$expected_wp as $file ) {
|
|
271
|
+
if ( 0 === substr_compare( $file, '/', -1 ) ) {
|
|
272
|
+
mkdir( $wp_dir . '/' . $file );
|
|
273
|
+
} else {
|
|
274
|
+
touch( $wp_dir . '/' . $file );
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return [ $temp_dir, $src_dir, $wp_dir ];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private static function recursive_scandir( $dir, $prefix_dir = '' ) {
|
|
282
|
+
$ret = [];
|
|
283
|
+
foreach ( array_diff( scandir( $dir ), [ '.', '..' ] ) as $file ) {
|
|
284
|
+
if ( is_dir( $dir . '/' . $file ) ) {
|
|
285
|
+
$ret[] = ( $prefix_dir ? ( $prefix_dir . '/' . $file ) : $file ) . '/';
|
|
286
|
+
$ret = array_merge( $ret, self::recursive_scandir( $dir . '/' . $file, $prefix_dir ? ( $prefix_dir . '/' . $file ) : $file ) );
|
|
287
|
+
} else {
|
|
288
|
+
$ret[] = $prefix_dir ? ( $prefix_dir . '/' . $file ) : $file;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return $ret;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use WP_CLI\FileCache;
|
|
4
|
+
use WP_CLI\Loggers;
|
|
5
|
+
use WP_CLI\Tests\TestCase;
|
|
6
|
+
use WP_CLI\Utils;
|
|
7
|
+
|
|
8
|
+
class FileCacheTest extends TestCase {
|
|
9
|
+
|
|
10
|
+
public static function set_up_before_class() {
|
|
11
|
+
require_once dirname( __DIR__ ) . '/php/class-wp-cli.php';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Test get_root() deals with backslashed directory.
|
|
16
|
+
*/
|
|
17
|
+
public function testGetRoot() {
|
|
18
|
+
$max_size = 32;
|
|
19
|
+
$ttl = 60;
|
|
20
|
+
|
|
21
|
+
$cache_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache', true );
|
|
22
|
+
|
|
23
|
+
$cache = new FileCache( $cache_dir, $ttl, $max_size );
|
|
24
|
+
$this->assertSame( $cache_dir . '/', $cache->get_root() );
|
|
25
|
+
unset( $cache );
|
|
26
|
+
|
|
27
|
+
$cache = new FileCache( $cache_dir . '/', $ttl, $max_size );
|
|
28
|
+
$this->assertSame( $cache_dir . '/', $cache->get_root() );
|
|
29
|
+
unset( $cache );
|
|
30
|
+
|
|
31
|
+
$cache = new FileCache( $cache_dir . '\\', $ttl, $max_size );
|
|
32
|
+
$this->assertSame( $cache_dir . '/', $cache->get_root() );
|
|
33
|
+
unset( $cache );
|
|
34
|
+
|
|
35
|
+
rmdir( $cache_dir );
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public function test_ensure_dir_exists() {
|
|
39
|
+
$prev_logger = WP_CLI::get_logger();
|
|
40
|
+
|
|
41
|
+
$logger = new Loggers\Execution();
|
|
42
|
+
WP_CLI::set_logger( $logger );
|
|
43
|
+
|
|
44
|
+
$max_size = 32;
|
|
45
|
+
$ttl = 60;
|
|
46
|
+
$cache_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache', true );
|
|
47
|
+
|
|
48
|
+
$cache = new FileCache( $cache_dir, $ttl, $max_size );
|
|
49
|
+
$test_class = new ReflectionClass( $cache );
|
|
50
|
+
$method = $test_class->getMethod( 'ensure_dir_exists' );
|
|
51
|
+
$method->setAccessible( true );
|
|
52
|
+
|
|
53
|
+
// Cache directory should be created.
|
|
54
|
+
$result = $method->invokeArgs( $cache, [ $cache_dir . '/test1' ] );
|
|
55
|
+
$this->assertTrue( $result );
|
|
56
|
+
$this->assertTrue( is_dir( $cache_dir . '/test1' ) );
|
|
57
|
+
|
|
58
|
+
// Try to create the same directory again. it should return true.
|
|
59
|
+
$result = $method->invokeArgs( $cache, [ $cache_dir . '/test1' ] );
|
|
60
|
+
$this->assertTrue( $result );
|
|
61
|
+
|
|
62
|
+
// `chmod()` doesn't work on Windows.
|
|
63
|
+
if ( ! Utils\is_windows() ) {
|
|
64
|
+
// It should be failed because permission denied.
|
|
65
|
+
$logger->stderr = '';
|
|
66
|
+
chmod( $cache_dir . '/test1', 0000 );
|
|
67
|
+
$result = $method->invokeArgs( $cache, [ $cache_dir . '/test1/error' ] );
|
|
68
|
+
$expected = "/^Warning: Failed to create directory '.+': mkdir\(\): Permission denied\.$/";
|
|
69
|
+
$this->assertMatchesRegularExpression( $expected, $logger->stderr );
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// It should be failed because file exists.
|
|
73
|
+
$logger->stderr = '';
|
|
74
|
+
file_put_contents( $cache_dir . '/test2', '' );
|
|
75
|
+
$result = $method->invokeArgs( $cache, [ $cache_dir . '/test2' ] );
|
|
76
|
+
$expected = "/^Warning: Failed to create directory '.+': mkdir\(\): File exists\.$/";
|
|
77
|
+
$this->assertMatchesRegularExpression( $expected, $logger->stderr );
|
|
78
|
+
|
|
79
|
+
// Restore.
|
|
80
|
+
chmod( $cache_dir . '/test1', 0755 );
|
|
81
|
+
rmdir( $cache_dir . '/test1' );
|
|
82
|
+
unlink( $cache_dir . '/test2' );
|
|
83
|
+
rmdir( $cache_dir );
|
|
84
|
+
WP_CLI::set_logger( $prev_logger );
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public function test_export() {
|
|
88
|
+
$max_size = 32;
|
|
89
|
+
$ttl = 60;
|
|
90
|
+
$cache_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache', true );
|
|
91
|
+
$target_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache-export/nonexistant-subdirectory', true );
|
|
92
|
+
$target = $target_dir . '/foo';
|
|
93
|
+
$key = 'foo';
|
|
94
|
+
$contents = 'bar';
|
|
95
|
+
$cache = new FileCache( $cache_dir, $ttl, $max_size );
|
|
96
|
+
|
|
97
|
+
// Assert subdirectory is created.
|
|
98
|
+
$cache->write( $key, $contents );
|
|
99
|
+
$cache->export( $key, $target );
|
|
100
|
+
$this->assertEquals( $contents, file_get_contents( $target ) );
|
|
101
|
+
|
|
102
|
+
// Clean up.
|
|
103
|
+
$cache->clear();
|
|
104
|
+
unlink( $target );
|
|
105
|
+
rmdir( $target_dir );
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public function test_import() {
|
|
109
|
+
$max_size = 32;
|
|
110
|
+
$ttl = 60;
|
|
111
|
+
$cache_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache', true );
|
|
112
|
+
$cache = new FileCache( $cache_dir, $ttl, $max_size );
|
|
113
|
+
|
|
114
|
+
$tmp_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache-import', true );
|
|
115
|
+
mkdir( $tmp_dir );
|
|
116
|
+
|
|
117
|
+
// "$group/$slug-$version.$ext";
|
|
118
|
+
$key = 'plugin/my-fixture-plugin-1.0.0.zip';
|
|
119
|
+
$fixture_filepath = $tmp_dir . '/my-downloaded-fixture-plugin-1.0.0.zip';
|
|
120
|
+
|
|
121
|
+
$zip = new ZipArchive();
|
|
122
|
+
$zip->open( $fixture_filepath, ZIPARCHIVE::CREATE );
|
|
123
|
+
$zip->addFile( __FILE__ );
|
|
124
|
+
$zip->close();
|
|
125
|
+
|
|
126
|
+
$result = $cache->import( $key, $fixture_filepath );
|
|
127
|
+
|
|
128
|
+
// Assert file is imported.
|
|
129
|
+
$this->assertTrue( $result );
|
|
130
|
+
$this->assertFileExists( "{$cache_dir}/{$key}" );
|
|
131
|
+
|
|
132
|
+
// Clean up.
|
|
133
|
+
$cache->clear();
|
|
134
|
+
unlink( $fixture_filepath );
|
|
135
|
+
rmdir( $tmp_dir );
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @see https://github.com/wp-cli/wp-cli/pull/5947
|
|
140
|
+
*/
|
|
141
|
+
public function test_import_do_not_use_cache_file_cannot_be_read() {
|
|
142
|
+
$max_size = 32;
|
|
143
|
+
$ttl = 60;
|
|
144
|
+
$cache_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache', true );
|
|
145
|
+
$cache = new FileCache( $cache_dir, $ttl, $max_size );
|
|
146
|
+
|
|
147
|
+
$tmp_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache-import', true );
|
|
148
|
+
mkdir( $tmp_dir );
|
|
149
|
+
|
|
150
|
+
$key = 'plugin/my-fixture-plugin-1.0.0.zip';
|
|
151
|
+
$fixture_filepath = $tmp_dir . '/my-bad-permissions-fixture-plugin-1.0.0.zip';
|
|
152
|
+
|
|
153
|
+
$zip = new ZipArchive();
|
|
154
|
+
$zip->open( $fixture_filepath, ZIPARCHIVE::CREATE );
|
|
155
|
+
$zip->addFile( __FILE__ );
|
|
156
|
+
$zip->close();
|
|
157
|
+
|
|
158
|
+
chmod( $fixture_filepath, 0000 );
|
|
159
|
+
|
|
160
|
+
// "Warning: copy(-.): Failed to open stream: Permission denied".
|
|
161
|
+
$error = null;
|
|
162
|
+
set_error_handler(
|
|
163
|
+
function ( $errno, $errstr ) use ( &$error ) {
|
|
164
|
+
$error = $errstr;
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
$result = $cache->import( $key, $fixture_filepath );
|
|
169
|
+
|
|
170
|
+
restore_error_handler();
|
|
171
|
+
|
|
172
|
+
$this->assertNull( $error );
|
|
173
|
+
$this->assertFalse( $result );
|
|
174
|
+
|
|
175
|
+
// Clean up.
|
|
176
|
+
$cache->clear();
|
|
177
|
+
unlink( $fixture_filepath );
|
|
178
|
+
rmdir( $tmp_dir );
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Windows filenames cannot end in periods.
|
|
183
|
+
*
|
|
184
|
+
* @covers \WP_CLI\FileCache::validate_key
|
|
185
|
+
*
|
|
186
|
+
* @see https://github.com/wp-cli/wp-cli/pull/5947
|
|
187
|
+
* @see https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
|
188
|
+
*/
|
|
189
|
+
public function test_validate_key_ending_in_period() {
|
|
190
|
+
$max_size = 32;
|
|
191
|
+
$ttl = 60;
|
|
192
|
+
$cache_dir = Utils\get_temp_dir() . uniqid( 'wp-cli-test-file-cache', true );
|
|
193
|
+
$cache = new FileCache( $cache_dir, $ttl, $max_size );
|
|
194
|
+
|
|
195
|
+
$key = 'plugin/advanced-sidebar-menu-pro-9.5.7.';
|
|
196
|
+
|
|
197
|
+
$reflection = new ReflectionClass( $cache );
|
|
198
|
+
|
|
199
|
+
$method = $reflection->getMethod( 'validate_key' );
|
|
200
|
+
$method->setAccessible( true );
|
|
201
|
+
|
|
202
|
+
$result = $method->invoke( $cache, $key );
|
|
203
|
+
|
|
204
|
+
$this->assertStringEndsNotWith( '.', $result );
|
|
205
|
+
$this->assertSame( 'plugin/advanced-sidebar-menu-pro-9.5.7', $result );
|
|
206
|
+
}
|
|
207
|
+
}
|