Skip to content

Commit 468130d

Browse files
authored
Merge pull request #5742 from christianbeeznest/rna-21895-2
Internal: Improve user creation and update logic for CSV sync script - refs BT#21895
2 parents af5bae4 + 1614fe3 commit 468130d

File tree

6 files changed

+252
-125
lines changed

6 files changed

+252
-125
lines changed

public/main/inc/global.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@
142142
define('DEFAULT_DOCUMENT_QUOTA', 100000000);
143143
} catch (Exception $e) {
144144
$controller = new ExceptionController();
145-
$controller->showAction($e);
145+
$controller->show($e);
146146
}

public/main/inc/lib/import.lib.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,15 @@ public static function csv_reader($path, $setFirstRowAsHeader = true)
4141
*
4242
* @return array returns an array (in the system encoding) that contains all data from the CSV-file
4343
*/
44-
public static function csvToArray($filename)
44+
public static function csvToArray($filename, $delimiter = ';'): array
4545
{
4646
if (empty($filename)) {
4747
return [];
4848
}
4949

5050
$reader = Reader::createFromPath($filename, 'r');
5151
if ($reader) {
52-
$reader->setDelimiter(';');
53-
//$reader->stripBom(true);
54-
/*$contents = $reader->__toString();
55-
if (!Utf8::isUtf8($contents)) {
56-
// If file is not in utf8 try converting to ISO-8859-15
57-
if ($reader->getStreamFilterMode() == 1) {
58-
$reader->appendStreamFilter('convert.iconv.ISO-8859-15/UTF-8');
59-
}
60-
}*/
52+
$reader->setDelimiter($delimiter);
6153
$reader->setHeaderOffset(0);
6254
$iterator = $reader->getRecords();
6355

src/CoreBundle/EventListener/LegacyListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ public function __invoke(RequestEvent $event): void
148148
$session->set('cid_reset', false);
149149
}
150150

151-
$session->set(
152-
'access_url_id',
153-
$this->accessUrlHelper->getCurrent()->getId()
154-
);
151+
$currentAccessUrl = $this->accessUrlHelper->getCurrent();
152+
if (null !== $currentAccessUrl) {
153+
$session->set('access_url_id', $currentAccessUrl->getId());
154+
}
155155
}
156156
}

src/CoreBundle/ServiceHelper/AccessUrlHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ public function isMultiple(): bool
2929
return $accessUrlEnabled;
3030
}
3131

32-
public function getFirstAccessUrl(): AccessUrl
32+
public function getFirstAccessUrl(): ?AccessUrl
3333
{
3434
$urlId = $this->accessUrlRepository->getFirstId();
3535

36-
return $this->accessUrlRepository->find($urlId);
36+
return $this->accessUrlRepository->find($urlId) ?: null;
3737
}
3838

39-
public function getCurrent(): AccessUrl
39+
public function getCurrent(): ?AccessUrl
4040
{
4141
static $accessUrl;
4242

src/CoreBundle/ServiceHelper/ThemeHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public function __construct(
3939
*/
4040
public function getVisualTheme(): string
4141
{
42+
if ('cli' === PHP_SAPI) {
43+
return '';
44+
}
45+
4246
static $visualTheme;
4347

4448
global $lp_theme_css;

0 commit comments

Comments
 (0)