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

Renames tasks directory to Tasks during upgrade #7939

Closed

Conversation

Sesquipedalian
Copy link
Member

@Sesquipedalian Sesquipedalian commented Dec 4, 2023

Fixes #7932

if (is_dir(Config::$tasksdir) && is_writable(Config::$tasksdir) && is_writable(dirname(Config::$tasksdir))) {
rename(Config::$tasksdir, dirname(Config::$tasksdir) . DIRECTORY_SEPARATOR . 'Tasks_temp');
rename(dirname(Config::$tasksdir) . DIRECTORY_SEPARATOR . 'Tasks_temp', dirname(Config::$tasksdir) . DIRECTORY_SEPARATOR . 'Tasks');
$changes['tasksdir'] = dirname(Config::$tasksdir) . '/Tasks';
Copy link
Member

Choose a reason for hiding this comment

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

I assume this should be $sourcedir?

Copy link
Member Author

Choose a reason for hiding this comment

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

In 99.999% of cases, dirname(Config::$tasksdir) will be the same as Config::$sourcedir, yes. But in theory someone might have moved it, so it's best to use dirname(Config::$tasksdir) to be sure.

Copy link
Member

Choose a reason for hiding this comment

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

I missed the dirname() call.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah. Got it. Easy enough to overlook. 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Only thing I would suggest is maybe we check if we need to rename it or not. I wonder if realpath check would suffice. realpath($taskdir) != realpath(dirname($taskdir) . '/Tasks')?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah. Yes, now I see what you mean. Hm... that does pose a bit of a problem, doesn't it? Got any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure yet. Windows doesn't care, it sees it as the same. Linux will see this as if they where named 2 different things. PHP we can use strcasecmp to check them. Maybe strcasecmp($taskdir) != strcasecmp(dirname($taskdir) . '/Tasks');?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I figured out a way to consistently handle all cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, wait, nope. I thought realpath() would report the true case of the dir's name on case insensitive file systems. Apparently that was wrong, which means I need to think about this further. Ugh.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it now. This is exactly what inodes are for.

@Sesquipedalian Sesquipedalian force-pushed the tasks_uprader branch 2 times, most recently from f72abdf to a5c49db Compare December 5, 2023 01:19
@jdarwood007
Copy link
Member

Honestly, just thinking on this. Do we really need to specify $tasksdir? Can we just eliminate this as a option for 3.0? Tasks will always be $sourcedir . '/Tasks'. The entire issue goes away completely. To add to this, why don't we make Actions directory a config option, Unicode? Cache? Db? Graphics? Where does it end.

@Sesquipedalian
Copy link
Member Author

That's not a bad argument. But in that case, we need to add logic to the upgrader to move a custom tasks dir back to the standard location.

@Sesquipedalian
Copy link
Member Author

At any rate, such a change would be Alpha 2, not Alpha 1.

@Sesquipedalian
Copy link
Member Author

Ugh, I see this got closed. Apparently that happens automatically if you rename the branch that you want to merge. I'll open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrader does not fix $tasksdir
2 participants