mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-12-02 14:24:10 +01:00
Disable FS proxy on file_put_contents/file_get_contents
owncloud/contacts#174
This commit is contained in:
parent
972babf63d
commit
2ae6f1ff32
@ -74,7 +74,10 @@ class ImportController extends BaseController {
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
$content = file_get_contents($tmpname);
|
$content = file_get_contents($tmpname);
|
||||||
|
$proxyStatus = \OC_FileProxy::$enabled;
|
||||||
|
\OC_FileProxy::$enabled = false;
|
||||||
if($view->file_put_contents('/imports/'.$filename, $content)) {
|
if($view->file_put_contents('/imports/'.$filename, $content)) {
|
||||||
|
\OC_FileProxy::$enabled = $proxyStatus;
|
||||||
$count = substr_count($content, 'BEGIN:');
|
$count = substr_count($content, 'BEGIN:');
|
||||||
$progresskey = 'contacts-import-' . rand();
|
$progresskey = 'contacts-import-' . rand();
|
||||||
$response->setParams(
|
$response->setParams(
|
||||||
@ -88,6 +91,7 @@ class ImportController extends BaseController {
|
|||||||
);
|
);
|
||||||
\OC_Cache::set($progresskey, '10', 300);
|
\OC_Cache::set($progresskey, '10', 300);
|
||||||
} else {
|
} else {
|
||||||
|
\OC_FileProxy::$enabled = $proxyStatus;
|
||||||
$response->bailOut(App::$l10n->t('Error uploading contacts to storage.'));
|
$response->bailOut(App::$l10n->t('Error uploading contacts to storage.'));
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@ -136,7 +140,10 @@ class ImportController extends BaseController {
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
$view = \OCP\Files::getStorage('contacts');
|
$view = \OCP\Files::getStorage('contacts');
|
||||||
|
$proxyStatus = \OC_FileProxy::$enabled;
|
||||||
|
\OC_FileProxy::$enabled = false;
|
||||||
$file = $view->file_get_contents('/imports/' . $filename);
|
$file = $view->file_get_contents('/imports/' . $filename);
|
||||||
|
\OC_FileProxy::$enabled = $proxyStatus;
|
||||||
|
|
||||||
$writeProgress = function($pct) use ($progresskey) {
|
$writeProgress = function($pct) use ($progresskey) {
|
||||||
\OC_Cache::set($progresskey, $pct, 300);
|
\OC_Cache::set($progresskey, $pct, 300);
|
||||||
|
Loading…
Reference in New Issue
Block a user