Giter VIP home page Giter VIP logo

filesystem's People

Contributors

achal-aggarwal avatar brianteeman avatar dongilbert avatar eddieajau avatar escopecz avatar fanno avatar hackwar avatar hleithner avatar ianmacl avatar joomla-jenkins avatar mbabker avatar nibra avatar pborreli avatar philetaylor avatar realityking avatar rvalitov avatar sharkykz avatar snipersister avatar wilsonge avatar zero-24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filesystem's Issues

Remove Patcher class

The Patcher class does not seem to be used by anything in our project and this file could be removed as well: meta/language/en-GB/en-GB.lib_joomla_filesystem_patcher.ini
I also believe that this class is not really usefull either, since there are better classes for this out there. It seems to just be old, unnecessary code...

Error logs on deleting files should contain path information

Steps to reproduce the issue

See CMS issue joomla/joomla-cms#43105 .

Expected result

The error logs here https://github.com/joomla-framework/filesystem/blob/3.x-dev/src/File.php#L163 and here https://github.com/joomla-framework/filesystem/blob/3.x-dev/src/File.php#L173 should contain information about the path to the file (with the Joomla root cleared out as implemented with PR #44 ) and not only the name of the file as that name can be used for several files.

Actual result

The error logs do not tell anything about the path to the file.

System information (as much as possible)

Joomla 5.0.3.

Additional comments

None.

Delete function throws error when it can't chmod

Steps to reproduce the issue

  • Create a Joomla package installable file
  • Install package on CMS with extension:install command using joomla 4 cli

Expected result

  • Joomla package to install successfully

Actual result

  • Installer fails with an error like below:
    err: Joomla\Filesystem\File::delete: Failed deleting inaccessible file FILENAME.tar.gz

System information (as much as possible)

  • Ubuntu 18.04
  • Joomla 4.4
  • PHP8.2
  • nginx 1.14.0

Additional comments

My server infrastructure uses bindfs to ensure certain permissions on all files and folders at all times within the webroot. This prevents certain actions, like chmod from being performed. The error is thrown because the file it is looking to delete cannot be chmod'd technically I suppose. The problem code is here.

I was able to comment out line 136 in my Joomla install and confirmed the error is gone now and the file deletes as it should. This was not a problem for me until I updated to Joomla 4.4. I believe it might be similar to this issue.

Joomla\Filesystem\Path::clean() failed to check for non-empty path as expected

Steps to reproduce the issue

Uses Joomla\Filesystem\Path::clean() to check for an empty path

Expected result

It should throw \InvalidArgumentException

Actual result

No thrown exception

System information (as much as possible)

We discovered this issue with Joomla 5 when it uses Joomla\Filesystem\Path instead of the old one Joomla\CMS\Filesystem\Path (which worked well)

Additional comments

Copy fails when src and dest are the same

Steps to reproduce the issue

Joomla\Filesystem\File::copy(JPATH_SITE . '/README.txt', JPATH_SITE . '/README.txt');

failed

I know that this doesn't makes sense when we boil it down to the statement here. But the original issue was a result of a script, see joomla/joomla-cms#18352

Expected result

I am not sure if this should fail or not, at least when we just go over it, it will not hurt.

Actual result

Error

System information (as much as possible)

latest version of joomla

Additional comments

[RFC] OpCode Cache purge on delete, copy, move, etc

Request For Comments

Hi!

As we all know, php 7.x ships with opcache. It would be nice if the filesystem library invalidates the opcache files whenever there is an operation that changes the op code cached content.

I personaly don't like opcache_reset since AFAIK it resets the cache for all php instance (which can have multiple sites/application hosted), so probably the opcache_invalidate (and alternatives caching) could be a better alternative.

This process actually happens in joomla core restore part https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_joomlaupdate/restore.php#L8315 but AFAIK does exist in joomla as a whole.

Unless i'm missing something (which is probable ...) adding a method like this to the filesystem framework package and purging the opcache on php file overwrite would allow for a more agressive opcahing server config with joomla, and thus better joomla performance.

Example of more agressive opcaching:

opcache.validate_timestamps = 0		; Default value "1" | 0 for no timestamp validation
opcache.revalidate_freq	    = 60	; Default value "2" | 0 for always revalidate | x for seconds
opcache.revalidate_path     = 0		; Default value "0" | 1 for always revalidate

http://php.net/manual/en/opcache.configuration.php

So, something like this called at every changed php file, maybe could do the job:

public function purgeFileFromOpCodeCache(string $filePath)
{
	if (function_exists('opcache_invalidate'))
	{
		return opcache_invalidate($filePath);
	}

	if (function_exists('apc_compile_file'))
	{
		return apc_compile_file($filePath);
	}

	if (function_exists('wincache_refresh_if_changed'))
	{
		return wincache_refresh_if_changed([$filePath]);
	}

	if (function_exists('xcache_asm'))
	{
		return (bool) xcache_asm($filePath);
	}

	return false;
}

Invalid Security Fix

Do with this whatever you want, but the security fix stripping JPATH_ROOT from exception messages is invalid. Exception messages are for developers, stripping critical information from them is an invalid fix 100% of the time.

The true problem is that the CMS, with its amateur developer skill level, has next to zero exception handling and a lot of thrown exceptions go unhandled and rendered in the browser. Exception handling is a first-year developer skill, maybe it should be taught how to handle them in a project with nearly 20 years of technical debt.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.