Changeset 277311 in webkit
- Timestamp:
- May 10, 2021, 5:41:50 PM (5 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 2 deleted
- 1 edited
- 1 moved
-
ChangeLog (modified) (1 diff)
-
http/tests/resources/dir-helpers.php (deleted)
-
http/tests/resources/portabilityLayer.php (deleted)
-
media/content/create-id3-db (moved) (moved from trunk/LayoutTests/http/tests/media/resources/create-id3-db.php ) (5 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r277308 r277311 1 2021-05-10 Chris Gambrell <cgambrell@apple.com> 2 3 [LayoutTests] Decouple http/tests/media/resources/create-id3-db.php from webserver 4 https://bugs.webkit.org/show_bug.cgi?id=224561 5 <rdar://problem/76653054> 6 7 Reviewed by Jonathan Bedard. 8 9 Replacing the creation of metadata.db with JSON into a new file named metadata.json. This standalone script remains in PHP to be able to still use getid3. 10 11 * http/tests/media/resources/create-id3-db.php: Removed. 12 * http/tests/resources/dir-helpers.php: Removed. 13 * http/tests/resources/portabilityLayer.php: Removed. 14 * media/content/create-id3-db: Copied from LayoutTests/http/tests/media/resources/create-id3-db.php. 15 1 16 2021-05-10 Amir Mark Jr <amir_mark@apple.com> 2 17 -
trunk/LayoutTests/media/content/create-id3-db
-
Property svn:executable
set to
*
r277309 r277311 1 #!/usr/bin/env php 2 1 3 <?php 2 4 … … 7 9 8 10 9 // This script creates, overwriting if needed, the "metadata. db"11 // This script creates, overwriting if needed, the "metadata.json" 10 12 // file used by scripts such as "serve-video.py". 11 13 // 12 // For creating or updating an existing file you have to run the 13 // http server used by the tests with: 14 // 15 // $ Tools/Scripts/run-webkit-httpd 16 // 17 // Then you will just have to use a browser to open an URL of the 18 // type: 19 // 20 // http://127.0.0.1:8000/media/resources/create-id3-db.php?name=../../../../media/content/silence.wav 21 // 22 // With this, a new "metadaba.db" file will be create in the 14 // For creating or updating an existing file you have to run 15 // the file as an executable, passing a single argument which 16 // is the name of the file we are accessing to get the media 17 // directory 18 // 19 // With this, a new "metadaba.json" file will be create in the 23 20 // directory containing the referred file. In this example, the 24 21 // database will be created at: 25 22 // 26 // $ LayoutTests/media/content/metadata.db 27 28 29 require_once '../../resources/portabilityLayer.php'; 30 require_once '../../resources/dir-helpers.php'; 23 // $ LayoutTests/media/content/metadata.json 24 25 26 function tmpdir($dir=FALSE, $prefix='php') 27 { 28 if ($dir) { 29 $tmpFile = tempnam($dir, $prefix); 30 } else { 31 if (!sys_get_temp_dir()) 32 return FALSE; 33 $tmpFile = tempnam(sys_get_temp_dir(), $prefix); 34 } 35 36 if (!file_exists($tmpFile)) 37 return FALSE; 38 unlink($tmpFile); 39 mkdir($tmpFile); 40 if (!is_dir($tmpFile)) 41 return FALSE; 42 43 return $tmpFile; 44 } 45 46 47 function rrmdir($dir) 48 { 49 if (is_dir($dir)) { 50 $objects = array_diff(scandir($dir), array(".", "..")); 51 foreach ($objects as $object) 52 (is_dir($dir . "/" . $object)) ? rrmdir($dir . "/" . $object) : unlink($dir . "/" . $object); 53 reset($objects); 54 rmdir($dir); 55 } 56 } 57 58 59 function rcopy($src, $dst) 60 { 61 if (file_exists($dst)) 62 rrmdir($dst); 63 if (is_dir($src)) { 64 mkdir($dst); 65 $files = array_diff(scandir($src), array(".", "..")); 66 foreach ($files as $file) 67 rcopy("$src/$file", "$dst/$file"); 68 } else if (file_exists($src)) { 69 copy($src, $dst); 70 } 71 } 72 73 74 function first_dir($name, $dir=FALSE) 75 { 76 $result = FALSE; 77 $root = $dir ? $dir : "./"; 78 $queue = array(realpath($root)); 79 80 while (sizeof($queue)) { 81 $vertex = array_pop($queue); 82 $objects = array_diff(scandir($vertex), array(".", "..")); 83 foreach ($objects as $object) { 84 $fullPath = $vertex . "/" . $object; 85 if (is_dir($fullPath)) { 86 if ($name == basename($fullPath)) { 87 $result = $fullPath; 88 return $result; 89 } else { 90 array_unshift($queue, $fullPath); 91 } 92 } 93 } 94 } 95 } 96 31 97 32 98 // 500 on errors … … 34 100 $htmlMessage = ""; 35 101 36 if ( !array_key_exists("name", $_GET)) {102 if (sizeof($argv) < 2) { 37 103 trigger_error("You have not specified a 'name' parameter.", E_USER_WARNING); 38 104 goto answering; 39 105 } 40 $mediaDirectory = dirname($ _GET["name"]);106 $mediaDirectory = dirname($argv[1]); 41 107 42 108 if (!is_dir($mediaDirectory)) { … … 44 110 goto answering; 45 111 } 46 $databaseFile = realpath($mediaDirectory) . "/metadata. db";112 $databaseFile = realpath($mediaDirectory) . "/metadata.json"; 47 113 48 114 if (file_exists($databaseFile)) { … … 139 205 } 140 206 141 if (!file_put_contents($databaseFile, serialize($playFiles))) {207 if (!file_put_contents($databaseFile, json_decode($playFiles))) { 142 208 trigger_error("Impossible to write the getid3 db.", E_USER_WARNING); 143 209 goto answering; -
Property svn:executable
set to
Note:
See TracChangeset
for help on using the changeset viewer.