Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/13697] Moving filesystem related functions to filesystem service #3487

Merged
merged 1 commit into from
Apr 16, 2015

Conversation

CHItA
Copy link
Member

@CHItA CHItA commented Mar 12, 2015

https://tracker.phpbb.com/browse/PHPBB3-13697

  • Moving filesystem service to \phpbb\filesystem namespace
  • Wraping Symfony's Filesystem component
  • Moving filesystem related functions from includes/functions.php
    into \phpbb\filesystem\filesystem
    Functions moved (and deprecated):
    • phpbb_chmod
    • phpbb_is_writable
    • phpbb_is_absolute
    • phpbb_own_realpath
    • phpbb_realpath
  • Adding interface for filesystem service

PHPBB3-13697

@bantu
Copy link
Collaborator

bantu commented Mar 13, 2015

I am not sure adding an interface for a helper class is all that useful.

@bantu
Copy link
Collaborator

bantu commented Mar 13, 2015

Furthermore, I don't think it is particularly useful to have methods that just call into symfony and then do exception conversion. Why not just call into symfony in the first place?

@CHItA
Copy link
Member Author

CHItA commented Mar 13, 2015

Exception wraping is because symfony throws hardcoded exceptions so language independency. Also we only meed to add one dependency for filesystem. The interface exists because IRC discussion with @Nicofuma

@CHItA
Copy link
Member Author

CHItA commented Mar 14, 2015

@bantu I looked at IRC log, and the filesystem interface was mentioned, but @Nicofuma was unsure if it is necessary or not. So should it stay or should it go?

@CHItA CHItA force-pushed the ticket/13697 branch 3 times, most recently from 4ba6942 to a23449d Compare March 15, 2015 16:16
/**
* A class with various functions that are related to paths, files and the filesystem
*/
class filesystem
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep an empty and deprecated class extending \phpbb\filesystem\filesystem (to be removed: 3.3) for BC purpose

@Nicofuma
Copy link
Member

Well, as @MateBartus said we need to wrap the methods if we want to make the exception translatable. And by the way adding an interface could be a good idea because it allows us to change the real filesystem transparently (to store the avatars on AWS per example)

@CHItA
Copy link
Member Author

CHItA commented Mar 15, 2015

@bantu is the interface okay with you then?

Also please double check phpbb_own_realpath and resolve_path functions as they were rewritten from scratch, and basically impossible to properly unit test them, I did my best to check if they work correctly.

}

// Use directory permissions on symlinks as well
if (is_dir($file) || is_link($file))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if chmoding is a good idea, it works on macs for sure, but most linux systems will result in error as links only allowed with 0777.

@CHItA CHItA force-pushed the ticket/13697 branch 5 times, most recently from 98d6799 to a027ae9 Compare March 16, 2015 22:18

if ($is_absolute_path)
{
if (strpos(strtolower(PHP_OS), 'win') !== false)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone knows what is the best way to replace this? defined('PHP_WINDOWS_VERSION_MAJOR')?

@CHItA CHItA force-pushed the ticket/13697 branch 4 times, most recently from 1478432 to dfd1257 Compare March 17, 2015 18:19
@Nicofuma
Copy link
Member

Nicofuma commented Apr 2, 2015

please rebase

@@ -184,7 +184,7 @@ static public function methods()
}

/**
* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier M�ller, Lo�c Chapeaux,
* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier M�ller, Lo�c Chapeaux,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert and make sure to save as UTF8 without bom

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@CHItA CHItA force-pushed the ticket/13697 branch 2 times, most recently from e6821fb to c2186e7 Compare April 3, 2015 17:26
@@ -184,7 +184,7 @@ static public function methods()
}

/**
* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier M�ller, Lo�c Chapeaux,
* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still not the same line

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually it seems to be a github issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably yes, the file is UTF-8 encoded for sure

 * Moving filesystem service to \phpbb\filesystem namespace
 * Wraping Symfony's Filesystem component
 * Moving filesystem related functions from includes/functions.php
   into \phpbb\filesystem\filesystem
   Functions moved (and deprecated):
     - phpbb_chmod
     - phpbb_is_writable
     - phpbb_is_absolute
     - phpbb_own_realpath
     - phpbb_realpath
 * Adding interface for filesystem service

PHPBB3-13697
@CHItA
Copy link
Member Author

CHItA commented Apr 16, 2015

As far as I'm concerned every above mentioned issue is resolved now.

@Nicofuma Nicofuma merged commit 4bdef6f into phpbb:master Apr 16, 2015
Nicofuma pushed a commit that referenced this pull request Apr 16, 2015
[ticket/13697] Moving filesystem related functions to filesystem service
@CHItA CHItA deleted the ticket/13697 branch May 29, 2015 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants