Fix file:// paths being mishandled on windows.
While I don't think its feasible to fix all the cases reported in #7275
as certain paths have different meaning in windows, we can fix file://
not working.
Refs #7275
In case the path passed to the File class doesn't exists, this will
cause File::$path to be set to a partial path, that is the filename
of the passed path with a slash prepended, ex with
$file = new File('/non/existent/file');
calling $file->pwd() will return/set /file, possibly causing that
file in the root to be accessed.
This statement does not serve a purpose anymore.
In a long forgotten world it indicated the main version number of PHP which the code in the file was compatible to.
http://pear.php.net/manual/en/standards.sample.php
But since PHP 5.1 and later this is only marginally true.
Thus I propose to remove it from CakePHP.
- Changes double quotes to single quotes.
- Documents and tests array-based string replace.
- Rewrites test case.
Rewrites the test case because the tests didn't work as well as
they should be. The test file copied itself to the tmp directory,
did some string replace stuff on it and then loaded the data to
test its contents. However in those contents were also the
expectations, so assertContains() would always see the string in
the file... even if the replacing didn't work.
Closes#1665.
Added File::replace()
Searches for a given text and replaces the text if found
Renamed File::replace() to File::replaceText()
Updated the replaceText() method to utilize File Locking
Updated File::replaceText()
1. Method now checks if the lock is not identical to null
2. Since the method uses File::read() to get the contents of the file,
there is no need for a temporary file. Removed the temporary file
creation
File::replaceText() update
Opening file with r+ mode
umask(0) causes all files to be created with 666 permission.
After input from jrbasso and AD7six, this was found to be an
additional code to support caching using file engine.
FileEngine has since moved to SplFile since 2.x and thus umask
juggling is not required anymore.
Refs: f9f1c4df5
Cherrypicked from 2.2 branch.
umask(0) causes all files to be created with 666 permission.
After input from jrbasso and AD7six, this was found to be an
additional code to support caching using file engine.
FileEngine has since moved to SplFile since 2.x and thus umask
juggling is not required anymore.
Refs: f9f1c4df5