Commit graph

83 commits

Author SHA1 Message Date
ndm2
87d86aaed9 Fix/tighten Folder::inPath() checks.
The current checks are way too relaxed, and are more like testing
for a substring, which makes it easy for invalid paths to slip
trough, for example `/foo/var/www` is falsely tested to reside in
`/var/www`.

Passing an empty path never worked properly, it was triggering a
warning, didn't worked on Windows, and the behavior that the current
top level directory would be assumed for empty paths wasn't
documented.

Similar is true for relative paths. While they did match at one point,
this was incorrect behavior, and matching actual path fragments seems
out of scope for this method.

This change makes the `$path` argument required, requires it to be an
absolute path, and throws an exception in case a non-absolute path is
being passed.
2016-08-26 13:45:45 +02:00
Steampilot
723ed96fd6 Added sorting by modified time in Folder util 2016-05-12 16:28:04 +02:00
mark_story
7d052bdbc1 Backport 5714cf14a9ca4b439b872aaf3ad6e5bfddda46ad to 2.x
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
2015-12-24 16:19:57 -05:00
Mark Scherer
52e79987a2 Replacing self with static due to PHP5.3+. Following #7040. 2015-07-21 10:22:53 +02:00
Marc Würth
4a131bdcbf Capitalize Windows, the OS 2015-07-09 15:54:03 +02:00
euromark
41c646c5a1 Simplification of return types. No need to return more mixed than necessary. 2014-11-08 20:07:47 +01:00
mark_story
579b16d90b Merge branch 'master' into 2.6 2014-10-30 21:20:53 -04:00
mark_story
d228d83b1e Relative paths should be created relative to pwd.
If create() is called with a relative directory and the path does not
exist, it should be created inside of the folder->pwd() and not inside
the process' cwd.

Refs #4990
2014-10-27 21:32:28 -04:00
mark_story
2ee0827161 Fix PHPCS errors. 2014-10-01 20:34:33 -04:00
ADmad
3fb252ad2f Merge branch 'master' into 2.6 2014-09-13 00:37:16 +05:30
euromark
a6df3300b9 Wording. 2014-09-10 17:57:26 +02:00
euromark
eedefb9dec Clarify octal input instead. 2014-09-10 17:56:02 +02:00
euromark
3e25282d4c Fix PHP flaw around intval with custom base. 2014-09-10 17:40:01 +02:00
mark_story
86bc7f1861 Add tests for #4521 and reformat code.
Add a regression test for #4521 as the original author didn't have one.
Reformat a long line since I was nearby already.

Closes #4521
2014-09-09 21:33:17 -04:00
Angel S. Moreno
29570e1d99 Fixed overwriting of files when Folder::SKIP is set 2014-09-06 18:32:45 -04:00
mark_story
2bcd817367 Merge branch 'master' into 2.6 2014-07-03 11:13:06 -04:00
euromark
974ca851c2 Correct doc blocks according to cs guidelines.
Remove superfluous empty lines.
2014-07-03 15:36:42 +02:00
ADmad
9a1a965b1c Update isAbsolute() to recognize stream wrapper paths.
This has the benefit that the realpath() method is not applied to a
registered stream wrapper in the constructor of the Folder class.
Using the realpath() method will break the stream.

Thank "davalb" for the original patch.
2014-06-22 13:43:14 +05:30
ADmad
d466e00644 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Datasource/DboSource.php
	lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
	lib/Cake/Utility/Folder.php
	lib/Cake/VERSION.txt
2014-05-04 14:35:36 +05:30
euromark
7a287a6942 More coding standard corrections. 2014-04-29 14:19:33 +02:00
euromark
0ece694a75 microptimize options and default merge and other string key array merges 2014-04-08 01:25:14 +02:00
ADmad
9de3418079 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Permission.php
2014-02-11 18:17:59 +05:30
Eric Martins
2793dca671 Fix ApiGen errors 2014-02-07 18:29:54 -02:00
Bryan Crowe
0cffcd1eca Added missing semi-colon in return 2013-10-02 22:55:09 -04:00
Bryan Crowe
b9003e5f7c Allow Folder::addPathElement() to accept arrays, also corrected docblock 2013-10-02 22:45:22 -04:00
euromark
a90cb29c0f simplify else cases 2013-07-03 01:14:41 +02:00
Marc Würth
4c9f0414cb Improved the DocBlocks and other code cleanup
Fixed @license tag, url comes first
Whitespace and other minor code cleanup
Added some docblocks
2013-05-31 00:11:19 +02:00
euromark
111366d5c8 == to === and != to !== where applicable 2013-02-12 03:38:08 +01:00
Graham Weldon
66d856d883 Added extra line for referencing license file for copyright 2013-02-08 21:22:51 +09:00
Graham Weldon
7b860debe4 This commit is dedicated to Mark Story, who has put in much dedicated time and effort into CakePHP over the years.
I just wanted to ruin his evening, because this change needs to be merged into CakePHP 3.0.
2013-02-08 20:59:49 +09:00
Ceeram
3f4d24bfc0 remove unused local variables and a few improvements 2012-12-23 13:53:13 +01:00
euromark
18fb132d41 some doc block corrections as well a !! to (bool) convertion
remove nonsense default value
2012-11-22 14:28:09 +01:00
mark_story
27d7e2865e Merge branch 'master' into 2.3
Conflicts:
	lib/Cake/Console/Command/ConsoleShell.php
	lib/Cake/Network/CakeSocket.php
	lib/Cake/Network/Http/HttpResponse.php
	lib/Cake/Utility/Folder.php
	lib/Cake/View/MediaView.php
	lib/Cake/basics.php
2012-11-20 23:02:33 -05:00
Ceeram
56225bcca3 fix all warnings except TODO warnings 2012-11-14 12:56:10 +01:00
dogmatic69
641ba9f3e6 Merge branch '2.3' into type-checks
Conflicts:
	lib/Cake/Error/ExceptionRenderer.php
	lib/Cake/Routing/Dispatcher.php
2012-10-24 19:03:44 +01:00
euromark
7383298410 making messages() and errors() reset themselves by default 2012-10-01 14:20:53 +02:00
dogmatic69
408e619c9f Merge branch '2.3' into type-checks
Conflicts:
	lib/Cake/Console/Command/Task/ModelTask.php
	lib/Cake/Controller/Component/RequestHandlerComponent.php
	lib/Cake/Model/Datasource/Database/Mysql.php
	lib/Cake/Utility/CakeNumber.php
2012-10-01 02:08:00 +01:00
Jose Lorenzo Rodriguez
d5c9d97dc1 Merge remote-tracking branch 'origin/master' into 2.3
Conflicts:
	lib/Cake/Model/Behavior/TranslateBehavior.php
	lib/Cake/Model/CakeSchema.php
	lib/Cake/Utility/CakeTime.php
	lib/Cake/Utility/ClassRegistry.php
	lib/Cake/View/MediaView.php
2012-09-25 16:36:03 +02:00
dogmatic69
cf8fccae96 converting $foo == null / $foo == false to !$foo 2012-09-14 18:26:30 +01:00
mark_story
c13ed3366b Fix whitespace errors. 2012-09-13 21:06:14 -04:00
euromark
2d9d400ecb correct spelling 2012-09-10 23:08:14 +02:00
euromark
37068539bd allow Folder to merge recursivly and add scheme option 2012-09-10 10:23:52 +02:00
Kyle Robinson Young
bc40ac7d3f Remove unused variables and code 2012-09-05 17:19:13 -07:00
Jelle Henkens
f7ce5262b7 Updating mixed @param documentation to seperate list of accepted types 2012-05-21 21:55:10 +01:00
Kyle Robinson Young
deb5a57cb9 Add test/doc for reverse Folder::inPath() 2012-03-27 11:55:13 -07:00
Juan Basso
3b1bd90ad6 Updated copyright to 2012. 2012-03-12 22:46:07 -04:00
mark_story
9d325fe46e Fixing most coding standard issues in Utility/ 2012-03-03 17:31:47 -05:00
Majna
c40d132f81 Fix Folder::tree() when excluding dot files or folders.
When 'exclude' param is array('.') files/folders are not skipped. Added test.
2012-02-17 20:46:52 +01:00
ADmad
d61b6dc7d3 Removed constant available only in php 5.3 and changed exception type to fix errors on php 5.2. Fixes #2487 2012-01-20 04:05:40 +05:30
ADmad
bcab3d0cb9 Made default value and behavior of param $exceptions for Folder::tree() identical to same param in Folder::read() 2011-12-22 03:29:21 +05:30