Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
blog folder rename failure issue #49
I am using pulse v51b3 and b4. pulse is installed as a subdirectory in the root dir, and functions as expected.
In Admin >> Blog, I want to manage two sub folders named "draft" and "hide" so that I can start a new blog in the draft folder, work on it, and then move out into the main blog folder so that it is seen in public. Also, I want to be able to move blogs into hide folder to hide them from view without having to delete them.
I create the folders and they seem to serve the purpose well. However, when I try to re- name these folders I created, pulse gives me error "Unknown extension detected". The only way to change the name seem to be to delete and create a new folder with the changed name....?
Is this a bug or these folders are designed not to be renamed?
I just tried again. First creating a blog directory named "test". Then I choose it to rename "test2", but pulse says "Unknown extension detected" and refuse to change.
The more I look at it the odder it seems!
The install is in /home3/mathgame/public_html/ymb/pulse/ but the logs show errors from /home3/mathgame/public_html/ymb/media/index.php
So there are some Pulse includes in that.
The actual rename code only shows the error "unknown extension detected" for files which don't have extensions in the allowed image types. This isn't an error that should be seen when renaming a blog folder.
Let us know!
I think you are looking at the earlier log entries. To be clear on that, let me try to create an empty folder named "lala" in "blocks" (not "blog"), then immediately rename it to "gaga", on my local machine. (pulse51b4 installed on OSX, as a sub-dir to root).
To be sure, I generate the debug log (will call "before") before I try this, and then generate another (will call "after") after I try this.
There are no files involved. Here are the steps I take:
BTW, what's the real purpose of creating a subfolder inside the "blog" directory other as far as blog management is concerned? As I understand it, there is no obvious way to manage multiple blogs for a site, right?
I am stymied that it is not re-produceable on your part... I downloaded the fresh 5.1b4, and to simplify things, uncompressed it on my OSX desktop, started MAMP, and let it point to the pulse folder as the root directory. From then on, followed the simple pulse start instruction - running the install.php.
Then, went localhost:8888/admin, created a new dir in blocks, and then try to rename that empty folder. Always get the same error. Tried various names. There is no chance that a naming conflict is the issue...
Creating a new file in and out of these test folders has no problem. Renaming the files work fine. It is just renaming the folders (same problem in blocks, blogs, media). I can change the folder name using my ftp client, and for now, that seems to be the only way to rename folder. It is not comforting that pulse gives me trouble at this very basic level. All the more so if it is only my system....!
(I also repeated the same on the official pulse5 package, not the beta 4. Interface interaction seems slightly different, but still the same issue.)
I am no expert on php, but I located the code (rename.php) that outputs the error message. I modified that line to give out a bit more information, namely outputting also the $new and $old. It turns out that the code added "." at the end of each, (which shouldn't since they are both directories?)
Here is the modified code:
When I try to change the dir name from "sryu" to "sryunew", it spelled out the following message:
Note that "." is attached to the end of either string which in this case were meant to be directory names. And that should have been caught as error here.
I also think that \is_dir() function does not work. It probably cannot distinguish btwn a file with no extension and just a plain directory...? --- that's probably why in the original code, providing a directory name just fell through the crack, leading to the error.
Here is my proposed solution in the rename.php:
Seems to work fine now, at least for me. Hope this or better solution fixes the issue in the next version.
Thanks for the info.
I think this is a weird bug. The "." is appearing at the end of the directory names. It still renames as expected though on our side. I suspect if this was broken we'd have seen lots of other bug reports. Odds are it might be something Mac related or something else (although tested on mac and pc)
We cleaned up the code a little for this issue and this will be in 5.1B5. The fix basically removes the trailing dot for directory renames (an empty file extension).
PHP is_dir does test for directories properly http://php.net/manual/en/function.is-dir.php Files and directories are different on the file system.
Unix does treat just about everything as files. The trick is that a directory is a kind of file, so there are other operations attached to it. https://www.mkompf.com/cplus/posixlist.html#files_and_directories
Let’s close this for now and if still occurs on 5.1B5 then we’ll have to re-open it and look for a fix for 5.2 but this should be all good now :)