Edit report at http://bugs.php.net/bug.php?id=51369&edit=1
ID: 51369 Updated by: [email protected] Reported by: opi88 at web dot de Summary: add getFileByInode() function -Status: Open +Status: Bogus Type: Feature/Change Request Package: *Directory/Filesystem functions Operating System: ALL PHP Version: Irrelevant New Comment: The inode is handled by the filesystem and we can't rely in anyway on it. It is only exposed as away to help debugging some issues. Many filesystems don't offer a reliable way to locate files by their inode. Previous Comments: ------------------------------------------------------------------------ [2010-03-23 18:52:20] opi88 at web dot de Description: ------------ Imagine a CMS (or similar system) that links a picture to a text. When the picture is moved to a different location, the system cannot find and include the picture anymore. There are two options for solving this issue: (1) Update each database entry containing the picture path. Depending on where, how and how many times the picture is included, this can be very tedious. (2) Provided there is a database (table) containing all files linked to and their paths, you have to update this db / table with the new picture path. But why use an extra database (table) in (2) when there already is a database for files: The filesystem!? And both methods require you to execute the update manually. With PHP, you can get a file's Inode, but you can't get a file (path) by providing an Inode. If you could, you'll might just link an Inode in your database instead of a path and you'll always have the correct picture path. Thus, I request a getFileByInode() function, or extend the fileinode() function to be able to return a path on integer input. Test script: --------------- <?php $inode = fileinode('/path/to/file.ext'); $path = fileinode((int) $inode); // returns '/path/to/file.ext' ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51369&edit=1
