Support

UNiTE, Remote CLI, eXtract Wizard

#25076 Unite restorations deleting .htaccess file

Posted in ‘UNiTE and Remote CLI’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

PHP version
n/a
Tool
UNiTE
Tool version
n/a

butlero
 Hi, this is a follow up on the #24692 ticket I previously submitted. It has the same name as this one.

I have UNITE in a folder called "unite" parallel to the public_html folder and restoring a site into the public_html folder.

A couple of issues,

1) The restoration only runs if I set permissions to the configuration.php to 644, which are not the ideal permissions if I understand correctly. I think they should be 444. I would like to run it without overwriting the configuration file, since that does not change anyway.

2) The most important issue is that the process deletes the .htaccess file and does not replace it upon completion. I get success emails, but when I go to the website, the homepage looks fine, but if I click on any links, they are all broken because the .htaccess file enables the URL rewrite and it is no longer there. So I had to reupload a local copy.

Based on the response to my last ticket, I was advised to remove "stealth" from the list of jobs in the 01_default.ini file. I did that, and I also removed configupdate. The process ran and sent an email saying it was successful but again, the .htaccess file was no longer there.

Your help is greatly appreciated.

Thank you,

Tanya

tampe125
Akeeba Staff
Hello Tanya,

  1. I just tried and even if the permissions of your file are set to 444, UNiTE is able to rewrite it. UNiTE is using Kickstart under the hood, and it tries very hard to write the files. Usually if a file is not writable, we try to change its permissions before continuing. Does your current user have enough privileges to chmod a file?
    Anyway, if you don't want to overwrite the configuration.php file, the correct behavior is to exclude it from the backup, not from the restore. You should setup a specific backup profile that does not include such file
  2. There was a bug, indeed. The .htaccess file was always deleted, even if the stealth one wasn't created. I just fixed it, I hope a new dev release will be available soon.
    Thank you for your report!

Davide Tampellini

Developer and Support Staff

🇮🇹Italian: native 🇬🇧English: good • 🕐 My time zone is Europe / Rome (UTC +1)
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

butlero
Thanks for fixing the bug. However, regarding the configuration file, I did not include the file in the backup, but during the restoration process, it seems like it's taking the information from the xml file like site name and email etc to update the site's Global Configuration. When I had my configuration file set to 444, the run would not complete.

I would get a log that ended with the following:

Running configupdate
Retrieving configuration.php...
Trying to retrieve configuration.php using direct access
Updating site's Global Configuration
Saving configuration.php...
Trying to retrieve libraries/bitfolge/feedcreator.php using direct access
Trying to retrieve libraries/joomla/form/form.php using direct access
Trying to retrieve libraries/cms/captcha/captcha.php using direct access
Trying to retrieve libraries/cms/ucm/base.php using direct access
Saving configuration.php failed: unable to copy Invalid setState argument ### Finished job #0 ###

===============================================================================
UNITE finished its run cycle
Total definitions found : 1
Total definitions executed successfuly : 0
Total definitions failed to run : 1

--
I'm on a typical shared host, using Inmotion. I can update permissions in the Cpanel and via ftp. How can the restoration skip the configupdate part of the cycle since I don't need it to do that anyway.

Thanks,


tampe125
Akeeba Staff
Well, if you don't want to update your configuration, you can simply remove the configupdate step from the scripting file, in the same you did with the stealth one.

Davide Tampellini

Developer and Support Staff

🇮🇹Italian: native 🇬🇧English: good • 🕐 My time zone is Europe / Rome (UTC +1)
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

butlero
Yes, I did actually do that, which I mentioned in my ticket.

"Based on the response to my last ticket, I was advised to remove "stealth" from the list of jobs in the 01_default.ini file. I did that, and I also removed configupdate. "

But the process never completed until I changed the permissions of the configuration file from 444 to 644.

butlero
Okay I misspoke. When I removed stealth and configupdate, I did so in a renamed file called 03_nostealth.ini which I was also advised to do in a previous ticket. I referenced this file in the xml file. For some reason the changes to this file did not affect the process. So I made the changes directly to 01_default.ini and it did take effect.

In the log, you could see that the cleanup step has an "undo stealth" portion. So in engine > step > cleanup.php I removed this:

----
UUtilLogger::WriteLog("\t\t\tRemoving stealth .htaccess and restoring the original");
$sitePath = $this->siteDef['siteInfo']['absolutepath'];
@unlink($sitePath . '/.htaccess');
@rename($sitePath . '/htaccess.bak', $sitePath . '/.htaccess');
---

And now it works.

Support Information

Working hours: Typically we work Monday to Friday, 9am to 7pm Cyprus timezone (EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets, but we cannot respond to them, outside of our working hours.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!

Summer vacations: Our support will be closed for replies and new tickets from August 6th to August 21st, 2022 due to summer vacations.