44 asort ($ a );
55 return $ a ;
66}, (new Finder ('./docs ' ))
7+
78 ->includeName ('*.md ' )
9+ ->excludeName ('new_in_doc.md ' )//TMP
810 ->excludeWholeName ('./docs/release_notes/* ' )//TMP
911 ->excludeWholeName ('./docs/snippets/* ' )//TMP
10- ->find ());
12+ ->excludeWholeName ('./docs/update_and_migration/* ' )//TMP
13+
14+ //->includeName('*.html') // Memory issues
15+ ->includeWholeName ('./**/php_api_reference/index.html ' ) // Should be enough
16+
17+ ->find (),
18+ );
1119
1220$ resourceFiles = call_user_func (function (array $ a ): array {
1321 asort ($ a );
1826 ->includeName ('*.png ' )
1927 ->includeName ('*.jpg ' )
2028 ->excludeWholeName ('./docs/release_notes/img/* ' )//TMP
29+ ->excludeWholeName ('./docs/update_and_migration/img/* ' )//TMP
30+ ->excludeWholeName ('./docs/api/php_api/php_api_reference/images/* ' )//TMP
2131 ->find (),
2232);
2333
@@ -36,21 +46,30 @@ function (string $url, ?string $file = null): bool {
3646 || str_starts_with ($ url , 'http://ibexa.co/namespaces/ ' ) // 301
3747 || str_starts_with ($ url , 'http://ibexa.co/xmlns/ ' ) // 301
3848 || str_starts_with ($ url , 'http://ez.no/namespaces/ ' ) //301
49+ //|| str_starts_with($url, 'http://ez.no/xmlns/') //301
3950 || str_starts_with ($ url , 'https://api.cloud.ibexa.co ' ) // 301, PLATFORMSH_CLI_API_URL
4051 //|| str_starts_with($url, 'https://admin.perso.ibexa.co/api/') // 400
4152 || str_starts_with ($ url , 'https://admin.perso.ibexa.co/ ' ) // 404
4253 || str_starts_with ($ url , 'https://event.perso.ibexa.co/api/ ' ) // 400
4354 || str_starts_with ($ url , 'https://event.perso.ibexa.co/ebl/ ' ) // 404
4455 || str_starts_with ($ url , 'https://import.perso.ibexa.co/api/ ' ) // 400
4556 || str_starts_with ($ url , 'https://reco.perso.ibexa.co ' ) // 403
57+ || str_starts_with ($ url , 'https://admin.yoochoose.net ' ) // 400
58+ || str_starts_with ($ url , 'https://event.yoochoose.net/api/ ' ) // 400
59+ || str_starts_with ($ url , 'https://event.yoochoose.net/ebl/ ' ) // 404
60+ || str_starts_with ($ url , 'https://event.yoochoose.net/ ' ) // 404
61+ || str_starts_with ($ url , 'https://reco.yoochoose.net ' ) // 403
62+ || str_starts_with ($ url , 'https://tracker.ibexa.co/ ' ) // 999 Could not resolve host
4663 ;
4764 },
4865 function (string $ url , ?string $ file = null ): bool {
4966 // Third parties APIs, namespaces, etc.
5067 return str_starts_with ($ url , 'https://api.fastly.com ' ) // 301 or 403
5168 || str_starts_with ($ url , 'https://unsplash.com ' ) // 405
5269 || str_starts_with ($ url , 'http://docbook.org/ns/ ' ) // 301
70+ || str_starts_with ($ url , 'http://schema.org/ListItem ' ) // 301 → https
5371 || str_starts_with ($ url , 'http://www.w3.org/1999/xlink ' ) // 301 → https
72+ || str_starts_with ($ url , 'https://www.google.com/recaptcha/admin ' ) // 302 → https://accounts.google.com/ServiceLogin
5473 ;
5574 },
5675 function (string $ url , ?string $ file = null ): bool {
@@ -70,8 +89,11 @@ function (string $url, ?string $file = null): bool {
7089 || str_contains ($ url , '//user:password@host ' )
7190 || str_contains ($ url , '//user:pass@localhost ' )
7291 || str_contains ($ url , '//elasticsearch:9200 ' )
92+ || str_contains ($ url , '//solr:8983 ' )
7393 || str_contains ($ url , '//varnish:80 ' )
7494 || str_contains ($ url , '//my.varnish.server ' )
95+ ||
str_contains (
$ url,
'//myuser:[email protected] ' )
96+ || str_contains ($ url , 'platformsh.site ' )
7597 ;
7698 },
7799 function (string $ url , ?string $ file = null ): bool {
@@ -100,13 +122,20 @@ function (string $url, ?string $file = null): bool {
100122 return str_ends_with ($ file , '/file_url_handling.md ' )
101123 && (str_contains ($ url , 'http://` ' ) || str_contains ($ url , 'ftp://` ' ));
102124 },
125+ function (string $ url , ?string $ file = null ): bool {
126+ if (str_ends_with ($ file , '/php_api_reference/index.html ' )) {
127+ return str_contains ($ url , '/namespaces/symfony-contracts ' ) || str_contains ($ url , '/classes/Symfony-Contracts ' );
128+ }
129+ return false ;
130+ },
131+
103132 ],
104133 'location ' => [
105134 function (string $ url , string $ location , ?string $ file = null ): bool {
106135 return str_starts_with ($ url , 'https://issues.ibexa.co/ ' ) && str_starts_with ($ location , 'https://issues.ibexa.co/login.jsp ' );
107136 },
108137 function (string $ url , string $ location , ?string $ file = null ): bool {
109- return $ url === $ location && str_starts_with ($ url , 'https://twitter .com/ ' );
138+ return str_starts_with ( $ url, ' https://symfony.com/doc/7.3/ ' ) && str_starts_with ($ location , 'https://symfony .com/doc/current / ' );
110139 },
111140 function (string $ url , string $ location , ?string $ file = null ): bool {
112141 return str_starts_with ($ url , 'https://youtu.be/ ' ) && explode ('/ ' , $ url )[3 ] . '&feature=youtu.be ' === explode ('?v= ' , $ location )[1 ];
@@ -121,7 +150,9 @@ function (string $url, string $location, ?string $file = null): bool {
121150 return $ url === 'https://console.aws.amazon.com/iam/home#/users '
122151 && preg_match ('@https://[a-z0-9-]+\.console\.aws\.amazon\.com/iam/home#/users@ ' , $ location );
123152 },
124-
153+ function (string $ url , string $ location , ?string $ file = null ): bool {
154+ return 'https://www.paypal.com/bizsignup/#/singlePageSignup ' === $ url && str_starts_with ($ location , 'https://www.paypal.com/unifiedonboarding/entry ' );
155+ },
125156 ],
126157 'fragment ' => [
127158 /*function (string $url, ?string $file = null): bool {
@@ -146,11 +177,26 @@ function (string $url, ?string $file = null): bool {
146177 function (string $ url , ?string $ file = null ): bool {
147178 return str_starts_with ($ url , 'https://docs.aws.amazon.com/ ' );
148179 },
180+ function (string $ url , ?string $ file = null ): bool {
181+ return str_starts_with ($ url , 'https://semver.org/ ' );
182+ },
183+ function (string $ url , ?string $ file = null ): bool {
184+ return str_starts_with ($ url , 'https://cdn.jsdelivr.net/npm/ ' );
185+ },
149186];
150187
151- $ replacements = [//TODO Get from mkdocs.yml
152- '[[= symfony_doc =]] ' => 'https://symfony.com/doc/5.4 ' ,
153- '[[= user_doc =]] ' => 'https://doc.ibexa.co/projects/userguide/en/master ' ,
154- ];
188+ $ mkdocs = yaml_parse_file ('mkdocs.yml ' );
189+
190+ $ replacements = [];
191+ foreach ($ mkdocs ['extra ' ] as $ key => $ value ) {
192+ if (is_string ($ value )) {
193+ $ replacements ['[[= ' . $ key . ' =]] ' ] = $ value ;
194+ }
195+ }
196+
197+ $ absoluteLinks = $ mkdocs ['validation ' ]['links ' ]['absolute_links ' ] ?? $ mkdocs ['validation ' ]['absolute_links ' ] ?? 'info ' ;
198+ if ('relative_to_docs ' === $ absoluteLinks ) {
199+ //TODO
200+ }
155201
156- $ find = './docs/*/ ' ;
202+ $ find = './docs ' ;
0 commit comments