Mo create script update, phpstan fixes, document updates

create_mo:
set auto base folder bases on current location so we do not need do
adjust paths in script

phpstan fixes:
edit_base.php
CoreLibs/Basci.php
CoreLibs/DB/SQL/PgSQL.php

Update documentation in method headers
CoreLibs/Combined/DateTime.php
This commit is contained in:
Clemens Schwaighofer
2022-10-12 09:48:22 +09:00
parent d15618cde4
commit e48a86985a
6 changed files with 23 additions and 17 deletions

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env bash
base_folder='/var/www/html/developers/clemens/core_data/php_libraries/trunk/www/';
BASE_FOLDER=$(dirname $(readlink -f $0))"/";
# Assume script is in 4dev/bin
base_folder="${BASE_FOLDER}../../www/";
# locale gettext po to mo translator master
for file in $(ls -1 ${base_folder}../4dev/locale/*.po); do

View File

@@ -457,6 +457,8 @@ if ($form->my_page_name == 'edit_order') {
$pathinfo = pathinfo($output_file);
if (!empty($pathinfo['dirname'])) {
$pathinfo['dirname'] .= DIRECTORY_SEPARATOR;
} else {
$pathinfo['dirname'] = '';
}
if ($t_q) {
$t_q .= ', ';

View File

@@ -1387,6 +1387,8 @@ function createNavMenu(nav_menu, header_id = 'mainHeader') // eslint-disable-lin
}
});
$('#menuRow').html(content.join(''));
} else {
$('#menuRow').hide();
}
}

View File

@@ -66,7 +66,7 @@ class Basic
// logging interface, Debug\Logging class
/** @var \CoreLibs\Debug\Logging */
public $log;
/** @var\CoreLibs\Create\Session */
/** @var \CoreLibs\Create\Session */
public $session;
// email valid checks

View File

@@ -312,16 +312,17 @@ class DateTime
}
/**
* plits & checks date, wrap around for check_date function
* returns int in:
* -1 if the first date is smaller the last
* 0 if both are equal
* 1 if the first date is bigger than the last
* false (bool): error
* compares two dates, tries to convert them via strtotime to timestamps
* returns int/bool in:
* -1 if the first date is smaller the last
* 0 if both are equal
* 1 if the first date is bigger than the last
* false if date validation/conversion failed
*
* @param string $start_date start date string in YYYY-MM-DD
* @param string $end_date end date string in YYYY-MM-DD
* @return int|bool false on error, or int -1/0/1 as difference
* @return int|bool false on error
* or int -1 (s<e)/0 (s=e)/1 (s>e) as difference
*/
public static function compareDate($start_date, $end_date)
{
@@ -354,16 +355,17 @@ class DateTime
/**
* compares the two dates + times. if seconds missing in one set,
* add :00, converts / to -
* adds :00, converts date + times via strtotime to timestamps
* returns int/bool in:
* -1 if the first date is smaller the last
* 0 if both are equal
* 1 if the first date is bigger than the last
* false if no valid date/times chould be found
* -1 if the first date is smaller the last
* 0 if both are equal
* 1 if the first date is bigger than the last
* false if date/times validation/conversion failed
*
* @param string $start_datetime start date/time in YYYY-MM-DD HH:mm:ss
* @param string $end_datetime end date/time in YYYY-MM-DD HH:mm:ss
* @return int|bool false for error or -1/0/1 as difference
* @return int|bool false for error
* or -1 (s<e)/0 (s=e)/1 (s>e) as difference
*/
public static function compareDateTime($start_datetime, $end_datetime)
{

View File

@@ -779,7 +779,6 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
}
// get result
$db_schema = $this->__dbFetchArray($cursor, PGSQL_ASSOC);
/** @phpstan-ignore-next-line Cannot access offset string on array|bool */
return $db_schema[$show_string] ?? '';
}
@@ -806,7 +805,6 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
}
// check if schema does not exists
$row = $this->__dbFetchArray($cursor, PGSQL_ASSOC);
/** @phpstan-ignore-next-line */
if (empty($row['exists']) || $row['exists'] == 'f') {
return 2;
}