Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

StaticExporter still working?


Reply


2 Posts   1086 Views

Avatar
x75

Community Member, 42 Posts

13 January 2011 at 1:27am

Hi,

I tried to use StaticExporter to export several Silverstripe sites. I tried pages based on 2.4.0, 2.4.2 and 2.4.3. They all just return empty "mysite.tar.gz" files when I call http://domain.tld/StaticExporter/export. Is there anything I'm missing, or does Static Exporter not work in 2.4?

Thanks
Johannes

Avatar
x75

Community Member, 42 Posts

15 January 2011 at 3:00am

Ok, little update.

My first problem was, that shell_exec was disabled in the php.ini.
The exporter starts working now, but fails at the end before packing and sending the file to the browser. If I check in the silverstripe-cache dir, the export is there...

[Warning] copy(/var/www/silverstripe-cache/static-export/mysite/home/index.html): failed to open stream: No such file or directory
GET /StaticExporter/export

Line 93 in /var/www/cms/code/StaticExporter.php
Source

84
85          // Write to file
86          if($fh = fopen($contentfile, 'w')) {
87             fwrite($fh, $response->getBody());
88             fclose($fh);
89          }
90       }
91
92       // copy homepage (URLSegment: "home") to webroot
93       copy("$tmpFolder/home/index.html", "$tmpFolder/index.html");         
94       
95       // archive all generated files
96       `cd $tmpBaseFolder; tar -czhf $baseFolderName.tar.gz $baseFolderName`;
97       $archiveContent = file_get_contents("$tmpBaseFolder/$baseFolderName.tar.gz");
98       
99       // remove temporary files and folder

Trace

* copy(/var/www/silverstripe-cache/static-export/mysite/home/index.html,/var/www/silverstripe-cache/static-export/mysite/index.html)
Line 93 of StaticExporter.php
* StaticExporter->export(SS_HTTPRequest)
Line 193 of Controller.php
* Controller->handleAction(SS_HTTPRequest)
Line 137 of RequestHandler.php
* RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
* Controller->handleRequest(SS_HTTPRequest)
Line 281 of Director.php
* Director::handleRequest(SS_HTTPRequest,Session)
Line 124 of Director.php
* Director::direct(/StaticExporter/export)
Line 127 of main.php

Any idea?

Thanks
Johannes