Req #51369 [NEW]: add getFileByInode() function
| From: | opi88 at web dot de | Date: | Tue, 23 Mar 2010 17:52:21 +0000 |
| Subject: | Req #51369 [NEW]: add getFileByInode() function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-148903@lists.php.net to get a copy of this message | ||
From:
Operating system: ALL
PHP version: Irrelevant
Package: *Directory/Filesystem functions
Bug Type: Feature/Change Request
Bug description:add getFileByInode() function
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 bug report at http://bugs.php.net/bug.php?id=51369&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51369&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51369&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51369&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51369&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51369&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51369&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51369&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51369&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51369&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51369&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51369&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51369&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51369&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51369&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51369&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51369&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51369&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51369&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51369&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51369&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51369&r=mysqlcfg