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

fix stubGenerator #23762

Closed
wants to merge 9 commits into from
Closed

fix stubGenerator #23762

wants to merge 9 commits into from

Conversation

alikon
Copy link
Contributor

@alikon alikon commented Feb 4, 2019

Pull Request for Issue #23725 .

Summary of Changes

renamed file libraries/src/Filesystem/Support/Stringcontroller.php to libraries/src/Filesystem/Support/StringController.php

Testing Instructions

run: php build/stubGenerator.php

Expected result

file written

Actual result

Error: Failed to start application: Class Joomla\CMS\Filesystem\Support\StringController does not exist

@Bakual
Copy link
Contributor

Bakual commented Feb 4, 2019

You renamed it to StringcController.php. There is a c to much in there 😄

@alikon
Copy link
Contributor Author

alikon commented Feb 4, 2019

yes ,fixed thanks

@brianteeman
Copy link
Contributor

Its not that easy :(

Changing filename case on a windows system on upgrade is a PIA

We've had this before although right now I forget exactly what the file was - perhaps @mbabker remembers

@Bakual
Copy link
Contributor

Bakual commented Feb 4, 2019

Brian is right.
Windows is actually fine. It's Linux where you get an issue because they count as different files and you end up with two files.
Now we can add the old file to be deleted into the admin script, which would work on Linux. But it would fail on Windows since it would delete the new file (it ignores case).
So there is no simple solution. You would need a script which checks OS or if the file is there twice and only then delete it.
I think last time we had that issue we just moved the file to another location, then it's simple.

@mbabker
Copy link
Contributor

mbabker commented Feb 4, 2019

I think last time we had that issue we just moved the file to another location, then it's simple.

Which means deprecating yet another class and renaming it something else when talking about any file that contains a PHP class following an autoloading convention.

@mbabker
Copy link
Contributor

mbabker commented Feb 4, 2019

We've had this before although right now I forget exactly what the file was - perhaps @mbabker remembers

IIRC that was when the JClassLoader file was at the root of the libraries directory with a camel cased filename or something like that and we just shoved it into the libraries/cms directory following the normal file convention.

@Bakual
Copy link
Contributor

Bakual commented Feb 4, 2019

Which means deprecating yet another class and renaming it something else when talking about any file that contains a PHP class following an autoloading convention.

Yep exactly. Not a nice way, but the easiest one.

@HLeithner
Copy link
Member

We could fix the deletion process at https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/script.php#L2257-L2263

if we use realpath to get the real filename we also get the correct case

something like this (just a idea)

if (JFile::exists(JPATH_ROOT . $file) && realpath(JPATH_ROOT . $file) === JPATH_ROOT . $file && !JFile::delete(JPATH_ROOT . $file))

@alikon
Copy link
Contributor Author

alikon commented Feb 12, 2019

...could be

@HLeithner
Copy link
Member

Maybe I didn't explained it correct but the reason to use realpath is to match the filename with case on disk with the filename we want to delete.

if you use this code you gain nothing, you have to compare the result auf realpath with the filestring we want to delete.
JFile::exists uses is_file and this is case insensitive, the same is true for unlink used by JFile::delete

btw I think JFile::exists can be omitted because JFile::delete does this anyway

memo: don't write code on train

Co-Authored-By: alikon <[email protected]>
@alikon
Copy link
Contributor Author

alikon commented Feb 12, 2019

no it's me on the train 😄

@HLeithner
Copy link
Member

hmm this will not work if your webserver access the site with a symlink... So we need more magic here

@HLeithner
Copy link
Member

@mbabker do you have a idea? Maybe testing realpath(JPATH) and realpath($PATH) seperated?

@ghost ghost added J3 Issue and removed J3 Issue labels Apr 5, 2019
@ghost ghost removed the J3 Issue label Apr 19, 2019
@ghost
Copy link

ghost commented Apr 24, 2019

@Orgoth please retest (test comment in #23725 was in february) and mark your test as successfully > https://docs.joomla.org/Testing_Joomla!_patches#Recording_test_results

@Orgoth
Copy link

Orgoth commented Apr 24, 2019

I have tested this item ✅ successfully on d6f533e

isley@isley:~/repos/test/joomla$ php build/stubGenerator.php
Stubs file written

File was created and looks good so far.

-rw-rw-r--  1 isley isley  54439 Apr 24 14:15 stubs.php

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23762.

@HLeithner HLeithner added this to the Joomla 3.9.7 milestone Apr 25, 2019
@gwsdesk
Copy link

gwsdesk commented Apr 27, 2019

I have tested this item ✅ successfully on 8ff8935


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23762.

@gwsdesk
Copy link

gwsdesk commented Apr 27, 2019

@Orgoth can you please post your successful test at the Tracker? We can merge it than since we have 2 successful tests

@HLeithner
Copy link
Member

It would be great if testers add the operating system to the test node, because this could lead to problems on different Systems.

@Orgoth
Copy link

Orgoth commented Apr 29, 2019

I have tested this item ✅ successfully on 8ff8935

### Details:
System Kubuntu 18.04 LTS
PHP Built On Linux isley.lc 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64
Database Type mysql
Database Version 8.0.15-5
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_0900_ai_ci
PHP Version 7.1.28-1+ubuntu18.04.1+deb.sury.org+3
Web Server Apache/2.4.39 (Ubuntu)
WebServer to PHP Interface fpm-fcgi


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23762.

@HLeithner
Copy link
Member

A windows test would be awesome.

@Orgoth
Copy link

Orgoth commented Apr 29, 2019

I am very sorry, but I only develop under Linux.
Maybe @gwsdesk has the possibility to test under Windows.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23762.

@brianteeman
Copy link
Contributor

stubgenerator runs fine no matter the case of that file on windows

@HLeithner
Copy link
Member

thx @brianteeman did you tested it with already existing files, lower and uppercase before and after upgrade?

@brianteeman
Copy link
Contributor

I ran the script before renaming the file and after renaming the file - it ran correctly in both cases

@bembelimen
Copy link
Contributor

bembelimen commented Apr 29, 2019

I have tested this item 🔴 unsuccessfully on a0538dc

In windows this PR breaks the whole deletion process, because realpath converts all slashes to \, so it's always not true (and the JFile::delete will never be called).

Additional there will not be 2 files in windows, so the deletion process (if it works) would delete the whole file without replacement.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23762.

@HLeithner
Copy link
Member

Ok so we have to find another solution, I would suggest an own function for renaming files, before calling the delete function.

@alikon alikon closed this May 1, 2019
@alikon alikon deleted the patch-112 branch May 1, 2019 09:11
@HLeithner HLeithner removed this from the Joomla 3.9.7 milestone May 1, 2019
@Orgoth Orgoth mentioned this pull request Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants