Skip to content

Internal: Improve user creation and update logic for CSV sync script - refs BT#21895 #5742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/main/inc/global.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@
define('DEFAULT_DOCUMENT_QUOTA', 100000000);
} catch (Exception $e) {
$controller = new ExceptionController();
$controller->showAction($e);
$controller->show($e);
}
12 changes: 2 additions & 10 deletions public/main/inc/lib/import.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,15 @@ public static function csv_reader($path, $setFirstRowAsHeader = true)
*
* @return array returns an array (in the system encoding) that contains all data from the CSV-file
*/
public static function csvToArray($filename)
public static function csvToArray($filename, $delimiter = ';'): array
{
if (empty($filename)) {
return [];
}

$reader = Reader::createFromPath($filename, 'r');
if ($reader) {
$reader->setDelimiter(';');
//$reader->stripBom(true);
/*$contents = $reader->__toString();
if (!Utf8::isUtf8($contents)) {
// If file is not in utf8 try converting to ISO-8859-15
if ($reader->getStreamFilterMode() == 1) {
$reader->appendStreamFilter('convert.iconv.ISO-8859-15/UTF-8');
}
}*/
$reader->setDelimiter($delimiter);
$reader->setHeaderOffset(0);
$iterator = $reader->getRecords();

Expand Down
8 changes: 4 additions & 4 deletions src/CoreBundle/EventListener/LegacyListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ public function __invoke(RequestEvent $event): void
$session->set('cid_reset', false);
}

$session->set(
'access_url_id',
$this->accessUrlHelper->getCurrent()->getId()
);
$currentAccessUrl = $this->accessUrlHelper->getCurrent();
if (null !== $currentAccessUrl) {
$session->set('access_url_id', $currentAccessUrl->getId());
}
}
}
6 changes: 3 additions & 3 deletions src/CoreBundle/ServiceHelper/AccessUrlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public function isMultiple(): bool
return $accessUrlEnabled;
}

public function getFirstAccessUrl(): AccessUrl
public function getFirstAccessUrl(): ?AccessUrl

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function doc comment

{
$urlId = $this->accessUrlRepository->getFirstId();

return $this->accessUrlRepository->find($urlId);
return $this->accessUrlRepository->find($urlId) ?: null;
}

public function getCurrent(): AccessUrl
public function getCurrent(): ?AccessUrl

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function doc comment

{
static $accessUrl;

Expand Down
4 changes: 4 additions & 0 deletions src/CoreBundle/ServiceHelper/ThemeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public function __construct(
*/
public function getVisualTheme(): string
{
if ('cli' === PHP_SAPI) {
return '';
}

static $visualTheme;

global $lp_theme_css;
Expand Down
Loading
Loading