initial commit

This commit is contained in:
Matthieu Bessat 2024-01-19 16:39:49 +01:00
commit 5ebc506921
975 changed files with 154341 additions and 0 deletions

81
build/windows/Makefile Normal file
View file

@ -0,0 +1,81 @@
.PHONY := php installer clean publish
PHP_ARCHIVE := https://windows.php.net/downloads/releases/php-8.2.10-nts-Win32-vs16-x64.zip
all: installer
php.zip:
wget ${PHP_ARCHIVE} -O php.zip
php: php.zip
mkdir -p install_dir/php
unzip -o php.zip -d install_dir/php > /dev/null
# Remove unused files
@cd install_dir/php && rm -rf \
phpdbg.exe \
php8phpdbg.dll \
php8embed.lib \
php-cgi.exe \
php.ini-* \
dev \
phar* \
nghttp2.dll \
libpq.dll \
libenchant
# Remove unused extensions
@cd install_dir/php/ext && rm -f \
php_bz2.dll \
php_com_dotnet.dll \
php_curl.dll \
php_dba.dll \
php_dl_test.dll \
php_enchant.dll \
php_exif.dll \
php_ffi.dll \
php_ftp.dll \
php_gmp.dll \
php_imap.dll \
php_ldap.dll \
php_mysqli.dll \
php_oci8_19.dll \
php_odbc.dll \
php_opcache.dll \
php_pdo_firebird.dll \
php_pdo_mysql.dll \
php_pdo_oci.dll \
php_pdo_odbc.dll \
php_pdo_pgsql.dll \
php_pdo_sqlite.dll \
php_pgsql.dll \
php_shmop.dll \
php_snmp.dll \
php_soap.dll \
php_sysvshm.dll \
php_xsl.dll \
php_zend_test.dll
du -hs install_dir/php
installer: clean php
$(eval VERSION=$(shell cat ../../src/VERSION))
# NSIS only accepts numbers as version
$(eval NSIS_VERSION=$(shell sed -E 's/-(alpha|beta|rc)[0-9]+//' ../../src/VERSION))
mkdir -p install_dir
cp ../paheko-${VERSION}.tar.gz install_dir/
cd install_dir && tar xzf paheko-${VERSION}.tar.gz && mv paheko-${VERSION} paheko
cp config.local.php install_dir/paheko/
cp php.ini install_dir/php
cp launch.bat install_dir
cp paheko.ico install_dir
rm -f install_dir/paheko-${VERSION}.tar.gz
makensis -V3 -DNVERSION=${NSIS_VERSION} -DVERSION=${VERSION} paheko.nsis
clean:
rm -rf install_dir
publish:
$(eval VERSION=$(shell cat ../../src/VERSION))
fossil uv ls | grep '^paheko-.*\.exe' | xargs fossil uv rm
fossil uv add paheko-${VERSION}.exe
fossil uv sync

5
build/windows/README.md Normal file
View file

@ -0,0 +1,5 @@
# Paheko Windows build
## Requirements
NSIS: `apt install nsis`

View file

@ -0,0 +1,34 @@
<?php
namespace Paheko;
if (!empty(getenv('LOCALAPPDATA'))) {
// Store data in user AppData directory
define('Paheko\DATA_ROOT', trim(getenv('LOCALAPPDATA'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'Paheko');
if (!file_exists(DATA_ROOT)) {
@mkdir(DATA_ROOT, 0700, true);
}
}
define('Paheko\PLUGINS_ROOT', __DIR__ . '/data/plugins');
// Store secret key in user directory
if (!defined('Paheko\SECRET_KEY')) {
if (file_exists(DATA_ROOT . '/key')) {
define('Paheko\SECRET_KEY', trim(file_get_contents(DATA_ROOT . '/key')));
}
else {
define('Paheko\SECRET_KEY', base64_encode(random_bytes(16)));
file_put_contents(DATA_ROOT . '/key', SECRET_KEY);
}
}
// Always log in as admin user
const LOCAL_LOGIN = -1;
// Disable PDF export
const PDF_COMMAND = null;
// Disable e-mails as Windows is not able to send e-mails
const DISABLE_EMAIL = true;

15
build/windows/launch.bat Normal file
View file

@ -0,0 +1,15 @@
@start "" http://127.0.0.1:8082/
@echo =================================================
@echo.
@echo Demarrage du serveur PHP de Paheko.
@echo.
@echo Paheko est disponible a l'adresse suivante :
@echo http://127.0.0.1:8082/
@echo.
@echo Fermer cette fenetre pour arreter le serveur.
@echo.
@echo =================================================
@echo.
php\php.exe -S 127.0.0.1:8082 -t paheko/www paheko/www/_route.php 2> NUL

BIN
build/windows/paheko.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

175
build/windows/paheko.nsis Normal file
View file

@ -0,0 +1,175 @@
# From https://www.conjur.org/blog/building-a-windows-installer-from-a-linux-ci-pipeline/
!define APP_NAME "Paheko"
!define COMP_NAME "Paheko.cloud"
#!define WEB_SITE "https://paheko.cloud/"
#!define VERSION "0.0.0.1"
!define COPYRIGHT "Paheko"
!define DESCRIPTION "Gestion d'association simple et efficace"
!define INSTALLER_NAME "paheko-${VERSION}.exe"
!define MAIN_APP_EXE "launch.bat"
!define ICON "paheko.ico"
#!define BANNER "[CHANGEME Installer Banner Filename .bmp]"
#!define LICENSE_TXT "[CHANGEME License Text Document]"
!define INSTALL_DIR "$PROGRAMFILES64\${APP_NAME}"
!define INSTALL_TYPE "SetShellVarContext all"
!define REG_ROOT "HKLM"
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
!define REG_START_MENU "Start Menu Folder"
var SM_Folder
######################################################################
VIProductVersion "${NVERSION}.0"
VIAddVersionKey "ProductName" "${APP_NAME}"
VIAddVersionKey "CompanyName" "${COMP_NAME}"
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
VIAddVersionKey "FileDescription" "${DESCRIPTION}"
VIAddVersionKey "FileVersion" "${VERSION}"
######################################################################
SetCompressor /SOLID Lzma
Name "${APP_NAME}"
Caption "${APP_NAME}"
OutFile "${INSTALLER_NAME}"
BrandingText "${APP_NAME}"
#InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" ""
InstallDir "${INSTALL_DIR}"
######################################################################
!define MUI_ICON "${ICON}"
!define MUI_UNICON "${ICON}"
Icon "${ICON}"
!ifdef BANNER
!define MUI_WELCOMEFINISHPAGE_BITMAP "${BANNER}"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${BANNER}"
!endif
######################################################################
!include "MUI2.nsh"
!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!ifdef LICENSE_TXT
!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}"
!endif
!insertmacro MUI_PAGE_DIRECTORY
!ifdef REG_START_MENU
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${APP_NAME}"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}"
!insertmacro MUI_PAGE_STARTMENU Application $SM_Folder
!endif
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "French"
######################################################################
Section -MainProgram
${INSTALL_TYPE}
SetOverwrite ifnewer
SetOutPath "$INSTDIR"
File /r "install_dir\\"
SectionEnd
######################################################################
Section -Icons_Reg
SetOutPath "$INSTDIR"
WriteUninstaller "$INSTDIR\uninstall.exe"
!ifdef REG_START_MENU
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$SM_Folder"
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "$INSTDIR\paheko.ico"
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "$INSTDIR\paheko.ico"
CreateShortCut "$SMPROGRAMS\$SM_Folder\Desinstaller ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
!ifdef WEB_SITE
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
!endif
!insertmacro MUI_STARTMENU_WRITE_END
!endif
!ifndef REG_START_MENU
CreateDirectory "$SMPROGRAMS\${APP_NAME}"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "$INSTDIR\paheko.ico"
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "$INSTDIR\paheko.ico"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\Desinstaller ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
!ifdef WEB_SITE
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
!endif
!endif
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\paheko.ico"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
!ifdef WEB_SITE
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}"
!endif
SectionEnd
######################################################################
Section Uninstall
${INSTALL_TYPE}
RmDir /r "$INSTDIR"
!ifdef REG_START_MENU
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\$SM_Folder\Desinstaller ${APP_NAME}.lnk"
!ifdef WEB_SITE
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk"
!endif
Delete "$DESKTOP\${APP_NAME}.lnk"
RmDir "$SMPROGRAMS\$SM_Folder"
!endif
!ifndef REG_START_MENU
Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\${APP_NAME}\Desinstaller ${APP_NAME}.lnk"
!ifdef WEB_SITE
Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Website.lnk"
!endif
Delete "$DESKTOP\${APP_NAME}.lnk"
RmDir "$SMPROGRAMS\${APP_NAME}"
!endif
DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}"
DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}"
SectionEnd

95
build/windows/php.ini Normal file
View file

@ -0,0 +1,95 @@
[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions =
disable_classes =
zend.enable_gc = On
zend.exception_ignore_args = Off
zend.exception_string_param_max_len = 15
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 256M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
extension_dir = "ext"
enable_dl = Off
file_uploads = On
upload_max_filesize = 256M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
extension=fileinfo
extension=gd
extension=gettext
extension=intl
extension=mbstring
extension=openssl
extension=sodium
extension=sqlite3
extension=tidy
[CLI Server]
cli_server.color = On
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = Off
[bcmath]
bcmath.scale = 0
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.cookie_samesite =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.sid_length = 26
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.sid_bits_per_character = 5
[Assertion]
zend.assertions = -1
[Tidy]
tidy.clean_output = Off