Export Events problem - creating empty files...

Forum for questions and support relating to the 1.24.x releases only.
Locked
Flasheart
Posts: 342
Joined: Thu Jul 06, 2006 2:27 pm

Export Events problem - creating empty files...

Post by Flasheart »

v1.24.2, Debian testing.

The data hard drive is dying and I would like to export the archived events before I install a replacement. Either in jpg or video, don't mind.

I select all the archive pics from the filter view, the thumbnails appear and I click 'Export' at the bottom.

I then tick all the boxes in the "Export Options" box and choose Tar as format. Click Export.

I get "Export Succeeded - Download", click download and receive a .tgz file.

Unfortunately, it's empty. Filesize of 54 bytes, just the tgz wrapper with no files inside it.

I've ensured /var/cache/zoneminder/temp is world-writeable, and it's creating two files in there ok;

cradle:/var/cache/zoneminder/temp# ls -l
total 4
-rw-r--r-- 1 www-data www-data 45 2010-08-19 12:12 zmExport.tar.gz
-rw-r--r-- 1 www-data www-data 0 2010-08-19 12:12 zmFileList.txt

But as you can see, zmFileList.txt is empty, suggesting something went wrong before tar and gzip got to work.

Can't find anything useful in the logs.

What have I missed?

(Tested same process on another server running 1.22.3 and that works fine)
Flasheart
Posts: 342
Joined: Thu Jul 06, 2006 2:27 pm

Post by Flasheart »

Ahh, found this is apache's error_log

Code: Select all

[Thu Aug 19 12:24:51 2010] [error] [client 10.0.0.242] PHP Warning:  array_merge(): Argument #1 is not an array in /                                                 usr/share/zoneminder/skins/classic/includes/export_functions.php on line 255, referer: http://10.0.3.10/zm/index.php                                                 ?view=export&eids[]=226962&eids[]=226959&eids[]=226955&eids[]=226952&eids[]=224012&eids[]=224010&eids[]=224003&eids[                                                 ]=223999&eids[]=223993&eids[]=220351&eids[]=220341&eids[]=220230&eids[]=220226&eids[]=220220&eids[]=212598&eids[]=21                                                 2572&eids[]=212535&eids[]=212453&eids[]=211699&eids[]=211698&eids[]=211695&eids[]=211696&eids[]=211681&eids[]=211589                                                 &eids[]=211514&eids[]=203878&eids[]=60110&eids[]=60109&eids[]=60103&eids[]=60100&eids[]=60092&eids[]=60088&eids[]=60                                                 083&eids[]=60077&eids[]=60071&eids[]=60061&eids[]=60058&eids[]=60049&eids[]=60052&eids[]=60044&eids[]=60041&eids[]=6                                                 0035&eids[]=43909&eids[]=41838&eids[]=41832&eids[]=34998&eids[]=34730&eids[]=34121&eids[]=30652&eids[]=30645&eids[]=                                                 30634&eids[]=30629&exportFile=undefined&generated=0

Flasheart
Posts: 342
Joined: Thu Jul 06, 2006 2:27 pm

Post by Flasheart »

The problem is that the behavior of array_merge changed in PHP5. Zoneminder's export function breaks.

The line in question is in /usr/share/zoneminder/skins/classic/includes/export_functions.php

$exportFileList = array_merge( $exportFileList, exportFileList( $eid ), $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc );

Various howtos suggest adding (array) before the variables. I've tried that and it fails for but not being a php coder I'm a bit hit and miss here.

Anyone fancy fixing this line to adhere to the php5 standards?
Flasheart
Posts: 342
Joined: Thu Jul 06, 2006 2:27 pm

Post by Flasheart »

Single event export was broken too - in a different way. I've fixed that by some quick hackery;

Line 161 of /usr/share/zoneminder/skins/classic/includes/export_functions.php

Code: Select all

       $eventPath = getEventPath( $event );
	to
       $eventPath = '/data/' . getEventPath( $event );
Because /data/ is my zoneminder root path and for some reason this wasn't being prepended by the export function so it couldn't find the files.

After error_log entries of

PHP Warning: opendir(events/6/60109): failed to open dir: No such file or directory in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 163, referer:


Multiple exports are still broken for me as above, though.
User avatar
kingofkya
Posts: 1110
Joined: Mon Mar 26, 2007 6:07 am
Location: Las Vegas, Nevada

Post by kingofkya »

hers what i would do.

install new drive(same size) leaving failing one in pc.
boot a live cd

run this dd if=/dev/olddrive of=/dev/newdrive

reboot

remove old drive and you should be good to go.

dd is a bit for bit low level copy.
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

Aye, although the disk size is different and a cp does the job too - but with 2tb drives this takes quite a while copying 99% of events that aren't needed.

Good thinking, but I would quite like to get exports running properly :)
amppjunior
Posts: 7
Joined: Sun Nov 27, 2005 11:56 am

Export Failed from Multiple Events Fixed

Post by amppjunior »

Hi, I had the same problem and have it fixed. Just modify line 255 from the file zm/skins/classic/includes/export_functions.php from:
$exportFileList = array_merge( $exportFileList, exportFileList( $eid ), $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc );
to:
$exportFileList = array_merge( $exportFileList, exportFileList( $eid , $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc ));

Good luck!
User avatar
mmi
Posts: 111
Joined: Wed Jun 27, 2007 12:54 am

thanks

Post by mmi »

thanks amppjunior works for me too
alleninmt
Posts: 7
Joined: Sat Jun 04, 2011 7:35 pm

Re: Export Events problem - creating empty files...

Post by alleninmt »

I'm now having this same problem when exporting a single event. The tar file downloads fine but it is empty.

Here is my apache2 error log. Had to remove some paths because the forum thought they were links.

Code: Select all

[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Warning:  Missing argument 2 for exportFileList(), called in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 255 and defined in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 153, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Warning:  Missing argument 3 for exportFileList(), called in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 255 and defined in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 153, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Warning:  Missing argument 4 for exportFileList(), called in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 255 and defined in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 153, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Warning:  Missing argument 5 for exportFileList(), called in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 255 and defined in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 153, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Warning:  Missing argument 6 for exportFileList(), called in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 255 and defined in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 153, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Notice:  Undefined variable: exportDetail in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 178, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Notice:  Undefined variable: exportFrames in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 189, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Notice:  Undefined variable: exportImages in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 200, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Notice:  Undefined variable: exportVideo in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 216, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Notice:  Undefined variable: exportMisc in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 232, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Warning:  array_merge(): Argument #3 is not an array in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 255, referer: index.php?view=export&eids[]=24
[Tue Jun 07 15:50:08 2011] [error] [client 192.168.57.8] PHP Warning:  Invalid argument supplied for foreach() in /usr/share/zoneminder/skins/classic/includes/export_functions.php on line 269, referer: index.php?view=export&eids[]=24
I am checking all of the boxes and selecting tar format in the export window.
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: Export Failed from Multiple Events Fixed

Post by mastertheknife »

amppjunior wrote:Hi, I had the same problem and have it fixed. Just modify line 255 from the file zm/skins/classic/includes/export_functions.php from:
$exportFileList = array_merge( $exportFileList, exportFileList( $eid ), $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc );
to:
$exportFileList = array_merge( $exportFileList, exportFileList( $eid , $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc ));

Good luck!
Is this fixed in ZoneMinder 1.24.4?

mastertheknife
Kfir Itzhak.
Locked