includes/destinations.filesource.inc appears to incorrectly "include 'Tar.php';" when it should "include 'Archive/Tar.php';" - the former does not work for me, the latter does.

Maybe I'm doing something wrong? I'm not a PEAR expert, but that's what works using the default PEAR setups on both Cygwin and CentOS (with different PEAR and Archive::Tar versions on each platform) so I don't think it's a quirk of my installation. In neither case does the original code work for me without patching this.

Comments

justintime’s picture

I confirm seeing the same bug and fix on Ubuntu Karmic.

fietserwin’s picture

Same on Windows. Installing PEAR sets the include_path to the base PEAR directory. So when you want to include a file that is in a subdirectory of that, prepend that subdirectory in your include statement.

Moreover when doing a restore, you require Tar.php specifically from your includes directory, leading to this error message (on a further blank screen, thus no graceful error handling):

warning: require_once(./sites/all/modules/backup_migrate_files/includes/Tar.php) [function.require-once]: failed to open stream: No such file or directory in D:\Projects\test\sites\all\modules\backup_migrate_files\includes\destinations.filesource.inc on line 118.

Even after I copied Tar.php from the PEAR install to this directory! So apparently the current directory is not as expected.

To cater for both backup and restore and for both situations where one has a proper PEAR install or where one has just added the necessary files to your includes directory (hosting provider without PEAR installed) you better use check_libs in both places and in this function test for both places.

I'll try to provide an implementation shortly.

fietserwin’s picture

I changed the code to incorporate the suggested changes. It turned out that restore already called check_libs(), but after that, did an include on its own once more. I attached a patch file as well as the resulting file.

I ran some tests on Tar.php being in the includes directory or being in the PEAR/Archive subdirectory. This was on a Windows (Vista) system. Can others test this on their system?

sillygwailo’s picture

The patch seems to work on my CentOS system. Administer → Content → Backup & Migrate, then Quick Backup, and selecting Backup from [Files Directory] to [Manual Backups Directory] using [Default Settings].

Without patch (CVS/HEAD): nasty red error with "Archive_Tar is not installed correctly." and so forth. Archive_Tar was indeed installed.
After patch: "Files Directory backed up successfully to" and so on. File correctly backed up, with successful extraction from the resulting file.

sean_a’s picture

Confirmed that changing "include 'Tar.php';" to "include 'Archive/Tar.php';" works on a shared host account (Debian Linux).

mbria’s picture

Tar installed with PEAR installer with ubuntu server with backup_migrate_files-6.x.1.x.dev but patched file didn't fix the issue.
Datestamp of the module "1251245007".

Apache logs are empty and the only output is from the module:

* warning: include(Tar.php) [function.include]: failed to open stream: No such file or directory in /var/www/atrium-1-0-beta3-2/sites/all/modules/backup/backup_migrate_files/includes/destinations.filesource.inc on line 174.
* warning: include() [function.include]: Failed opening 'Tar.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/atrium-1-0-beta3-2/sites/all/modules/backup/backup_migrate_files/includes/destinations.filesource.inc on line 174.
* Archive_Tar is not installed correctly. See the README.txt file in the backup_migrate_files module directory for help.
* Could not complete the backup.

Is there any body with same problem? Alternative fixing?

fietserwin’s picture

I guess that the patch hasn't been incorporated in the dev version yet. Your error message (include on line 174) shows that you are using the unpatched version. My patch uses an include_once on line 181.

mbria’s picture

Status: Active » Closed (fixed)

Thanks a lot fietserwin,

You were right. Although I thought I did... my destinations.filesource.inc wasn't patched.

Now everything works like a charm.

Thanks for your help,

m.

mbria’s picture

Status: Closed (fixed) » Fixed

Sorry, status need to be fixed instead of closed.

ankur’s picture

Status: Fixed » Reviewed & tested by the community

The patch worked for me as well on an Ubuntu server, 9.04.

I think the patch is supposed to be marked as RTBC or "needs review" until we get something actually committed.

catbird’s picture

Confirmed that changing "include 'Tar.php';" to "include 'Archive/Tar.php';" works on a shared host account (Debian Linux).

found the same solution without reading this topic...

works on debian lenny

roderik’s picture

StatusFileSize
new2.88 KB

RTBC +1.

Here's a real context diff for who wants, which the 'patch' file in #3 is not.
It's the same as #3 (except a few space characters), so still RTBC.

joostvdl’s picture

Patch form #12 works fine.

auTONYmous’s picture

agree...#12 works fine here also.

ronan’s picture

Status: Reviewed & tested by the community » Fixed

#12 worked in my environment so I cleaned up the style a little and committed. Please let me know if this causes issues on anybody else's setup.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.