- Enables check for writable export file
This commit is contained in:
@@ -148,7 +148,7 @@ define(
|
|||||||
.done(function (response) {
|
.done(function (response) {
|
||||||
MailPoet.Modal.loading(false);
|
MailPoet.Modal.loading(false);
|
||||||
if (response.result === false) {
|
if (response.result === false) {
|
||||||
MailPoet.Notice.error(response.error);
|
MailPoet.Notice.error(response.errors);
|
||||||
} else {
|
} else {
|
||||||
resultMessage = MailPoetI18n.exportMessage
|
resultMessage = MailPoetI18n.exportMessage
|
||||||
.replace('%1$s', '<strong>' + response.data.totalExported + '</strong>')
|
.replace('%1$s', '<strong>' + response.data.totalExported + '</strong>')
|
||||||
|
@@ -41,6 +41,9 @@ class Export {
|
|||||||
$subscriber_custom_fields
|
$subscriber_custom_fields
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
|
if(is_writable($this->export_file)) {
|
||||||
|
throw new \Exception(__("Couldn't save export file on the server."));
|
||||||
|
}
|
||||||
if($this->export_format_option === 'csv') {
|
if($this->export_format_option === 'csv') {
|
||||||
$CSV_file = fopen($this->export_file, 'w');
|
$CSV_file = fopen($this->export_file, 'w');
|
||||||
$format_CSV = function($row) {
|
$format_CSV = function($row) {
|
||||||
|
@@ -211,6 +211,13 @@ class ExportCest {
|
|||||||
expect(count($subscribers))->equals(2);
|
expect(count($subscribers))->equals(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function itRequiresWritableExportFile() {
|
||||||
|
$this->export->export_file = '/dev/random';
|
||||||
|
$result = $this->export->process();
|
||||||
|
expect($result['errors'][0])
|
||||||
|
->equals("Couldn't save export file on the server.");
|
||||||
|
}
|
||||||
|
|
||||||
function itCanProcess() {
|
function itCanProcess() {
|
||||||
$this->export->export_file = $this->export->getExportFile('csv');
|
$this->export->export_file = $this->export->getExportFile('csv');
|
||||||
$this->export->export_format_option = 'csv';
|
$this->export->export_format_option = 'csv';
|
||||||
|
Reference in New Issue
Block a user