Compare commits
19 commits
Author | SHA1 | Date | |
---|---|---|---|
ec9a181a51 | |||
6909790de6 | |||
db631bd778 | |||
1b8b3f8ad7 | |||
ccb1ef6971 | |||
ead20f7924 | |||
487eb70b0b | |||
1e45b47f0f | |||
d861998f4f | |||
![]() |
d57666b40d | ||
![]() |
05882205f0 | ||
![]() |
2bd78a1d79 | ||
![]() |
81894af835 | ||
![]() |
b975508d07 | ||
![]() |
1ef96c3c4c | ||
![]() |
2dad5133bd | ||
![]() |
544d4ebdf6 | ||
![]() |
41947069be | ||
![]() |
11aaa39eaa |
12
.github/workflows/ci.yml
vendored
Normal file → Executable file
|
@ -50,7 +50,7 @@ jobs:
|
|||
run: echo "NCC_DIR=$(find build/ -type d -name 'ncc_*' | head -n 1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload NCC build directory
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ncc-build
|
||||
path: ${{ env.NCC_DIR }}
|
||||
|
@ -59,7 +59,7 @@ jobs:
|
|||
run: zip -r redist.zip ${{ env.NCC_DIR }}
|
||||
|
||||
- name: Upload redist.zip
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: redist-zip
|
||||
path: redist.zip
|
||||
|
@ -72,7 +72,7 @@ jobs:
|
|||
run: echo "DEB_FILE=$(find build/ -type f -name '*.deb' | head -n 1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload Debian package
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ncc-deb
|
||||
path: ${{ env.DEB_FILE }}
|
||||
|
@ -83,7 +83,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Download NCC build directory
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ncc-build
|
||||
path: build
|
||||
|
@ -107,13 +107,13 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Download redist.zip
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: redist-zip
|
||||
path: .
|
||||
|
||||
- name: Download Debian package
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ncc-deb
|
||||
path: .
|
||||
|
|
1
.gitignore
vendored
Normal file → Executable file
|
@ -31,3 +31,4 @@ tests/example_project/ncc
|
|||
tests/example_project/build
|
||||
/.phpunit.result.cache
|
||||
/.idea/php-test-framework.xml
|
||||
/.idea/gbrowser_project.xml
|
||||
|
|
0
.gitlab-ci.yml
Normal file → Executable file
0
.idea/.gitignore
generated
vendored
Normal file → Executable file
0
.idea/.name
generated
Normal file → Executable file
0
.idea/Nosial Code Compiler.iml
generated
Normal file → Executable file
0
.idea/codeStyles/Project.xml
generated
Normal file → Executable file
0
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file → Executable file
0
.idea/copyright/Nosial.xml
generated
Normal file → Executable file
0
.idea/copyright/profiles_settings.xml
generated
Normal file → Executable file
0
.idea/encodings.xml
generated
Normal file → Executable file
0
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file → Executable file
0
.idea/modules.xml
generated
Normal file → Executable file
0
.idea/php-inspections-ea-ultimate.xml
generated
Normal file → Executable file
0
.idea/php.xml
generated
Normal file → Executable file
0
.idea/runConfigurations/Build_Redist.xml
generated
Normal file → Executable file
0
.idea/runConfigurations/Rebuild_Autoloaders.xml
generated
Normal file → Executable file
0
.idea/scopes/Autoloaders.xml
generated
Normal file → Executable file
0
.idea/scopes/Installer_Source_files.xml
generated
Normal file → Executable file
0
.idea/scopes/NCC_Source_files.xml
generated
Normal file → Executable file
0
.idea/scopes/Symfony_Filesystem.xml
generated
Normal file → Executable file
0
.idea/scopes/Symfony_Process.xml
generated
Normal file → Executable file
0
.idea/scopes/Symfony_Uid.xml
generated
Normal file → Executable file
0
.idea/scopes/Symfony_Yaml.xml
generated
Normal file → Executable file
0
.idea/scopes/Symfony_polyfill_ctype.xml
generated
Normal file → Executable file
0
.idea/scopes/Symfony_polyfill_mbstring.xml
generated
Normal file → Executable file
0
.idea/scopes/Symfony_polyfill_uuid.xml
generated
Normal file → Executable file
0
.idea/scopes/Third_Party_Source_Files.xml
generated
Normal file → Executable file
0
.idea/scopes/defuse.xml
generated
Normal file → Executable file
0
.idea/scopes/defuse_php_encryption.xml
generated
Normal file → Executable file
0
.idea/scopes/jelix.xml
generated
Normal file → Executable file
0
.idea/scopes/jelix_version.xml
generated
Normal file → Executable file
0
.idea/scopes/nikic.xml
generated
Normal file → Executable file
0
.idea/scopes/nikic_PhpParser.xml
generated
Normal file → Executable file
0
.idea/scopes/theseer.xml
generated
Normal file → Executable file
0
.idea/scopes/theseer_Autoload.xml
generated
Normal file → Executable file
0
.idea/scopes/theseer_DirectoryScanner.xml
generated
Normal file → Executable file
0
.idea/vcs.xml
generated
Normal file → Executable file
0
.idea/webResources.xml
generated
Normal file → Executable file
35
CHANGELOG.md
Normal file → Executable file
|
@ -5,6 +5,41 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.1.8] - 2025-03-17
|
||||
|
||||
This update introduces a temporary fix
|
||||
|
||||
### Fixed
|
||||
- (Temporary) removed the ability to delete cache files because it's deleting important files that are needed.
|
||||
|
||||
|
||||
## [2.1.7] - 2025-03-17
|
||||
|
||||
This update introduces a quality of life improvement
|
||||
|
||||
### Changed
|
||||
- Refactor variable names for consistency and clarity in ShutdownHandler and PackageWriter classes
|
||||
- Improve error handling in ShutdownHandler by logging warnings for cleanup failures
|
||||
|
||||
### Fixed
|
||||
- Fixed issue in ArchiveExctractor where close() may be called on a already closed resource
|
||||
|
||||
|
||||
## [2.1.6] - 2024-10-29
|
||||
|
||||
This update introduces critical bug fixes
|
||||
|
||||
### Fixed
|
||||
- Validate package instance before checking execution policy
|
||||
|
||||
|
||||
|
||||
## [2.1.5] - 2024-10-14
|
||||
|
||||
This update introduces a critical bug fix
|
||||
|
||||
|
||||
|
||||
## [2.1.4] - 2024-10-13
|
||||
|
||||
This update introduces minor bug fixes & improvements
|
||||
|
|
0
CODE_OF_CONDUCT.md
Normal file → Executable file
0
CONTRIBUTING.md
Normal file → Executable file
2
DOCUMENTATION.md
Normal file → Executable file
|
@ -62,7 +62,7 @@ basic usage, standards, and much more.
|
|||
* [Package Metadata (metadata)](#package-metadata-metadata)
|
||||
* [Assembly Information (assembly)](#assembly-information-assembly)
|
||||
* [Package Dependencies (dependencies)](#package-dependencies-dependencies)
|
||||
* [Execution Units (execution_units)](#execution-units-executionunits)
|
||||
* [Execution Units (execution_units)](#execution-units-execution_units)
|
||||
* [Building Projects (build)](#building-projects-build)
|
||||
* [Execute (exec)](#execute-exec)
|
||||
* [Project Configuration (package.json)](#project-configuration-packagejson)
|
||||
|
|
0
Dockerfile
Normal file → Executable file
0
Dockerfile.debian
Normal file → Executable file
0
LICENSE
Normal file → Executable file
42
Makefile
Normal file → Executable file
|
@ -18,23 +18,23 @@ DEBIAN_PACKAGE_BUILD_PATH := $(BUILD_PATH)/ncc_$(BUILD_VERSION)_all.deb
|
|||
|
||||
# List of paths for autoloading
|
||||
AUTOLOAD_PATHS := $(addprefix $(SRC_PATH)/ncc/ThirdParty/, \
|
||||
composer/Semver \
|
||||
defuse/php-encryption \
|
||||
jelix/version \
|
||||
nikic/PhpParser \
|
||||
Symfony/polyfill_ctype \
|
||||
Symfony/polyfill_mbstring \
|
||||
Symfony/polyfill_uuid \
|
||||
Symfony/Process \
|
||||
Symfony/Uid \
|
||||
Symfony/Filesystem \
|
||||
Symfony/Yaml \
|
||||
theseer/DirectoryScanner \
|
||||
composer/Semver \
|
||||
defuse/php-encryption \
|
||||
jelix/version \
|
||||
nikic/PhpParser \
|
||||
Symfony/polyfill_ctype \
|
||||
Symfony/polyfill_mbstring \
|
||||
Symfony/polyfill_uuid \
|
||||
Symfony/Process \
|
||||
Symfony/Uid \
|
||||
Symfony/Filesystem \
|
||||
Symfony/Yaml \
|
||||
theseer/DirectoryScanner \
|
||||
)
|
||||
|
||||
# Check for necessary binaries
|
||||
ifndef PHPCC
|
||||
$(error "PHP binary not found. Please install PHP or check your PATH")
|
||||
$(error "PHP binary not found. Please install PHP or check your PATH")
|
||||
endif
|
||||
|
||||
# Check if phpab is installed
|
||||
|
@ -153,13 +153,13 @@ clean:
|
|||
.PHONY: help
|
||||
help:
|
||||
@echo "Available commands:"
|
||||
@echo " make autoload - Generate autoload files"
|
||||
@echo " make redist - Prepare the project for redistribution"
|
||||
@echo " make install - Installs ncc on the system (requires root privileges & php)"
|
||||
@echo " make tar - Package the project into a tarball (Generic installer, requires php)"
|
||||
@echo " make deb - Package the project into a Debian package"
|
||||
@echo " make docker-debian - Build a Debian Docker image"
|
||||
@echo " make autoload - Generate autoload files"
|
||||
@echo " make redist - Prepare the project for redistribution"
|
||||
@echo " make install - Installs ncc on the system (requires root privileges & php)"
|
||||
@echo " make tar - Package the project into a tarball (Generic installer, requires php)"
|
||||
@echo " make deb - Package the project into a Debian package"
|
||||
@echo " make docker-debian - Build a Debian Docker image"
|
||||
@echo " make docker-debian-run - Run the Debian Docker image"
|
||||
@echo " make docker-alpine - Build an Alpine Docker image"
|
||||
@echo " make docker-alpine - Build an Alpine Docker image"
|
||||
@echo " make docker-alpine-run - Run the Alpine Docker image"
|
||||
@echo " make clean - Clean the build artifacts"
|
||||
@echo " make clean - Clean the build artifacts"
|
13
README.md
Normal file → Executable file
|
@ -6,6 +6,19 @@ Nosial Code Compiler is a package compiler, manager & installer for PHP. Allowin
|
|||
versions of php packages on your system that your PHP programs/projects can share and use. Additionally, ncc also allows
|
||||
you to create a redistributable package of your PHP program/project in the form of a `.ncc` binary package file.
|
||||
|
||||
## Community
|
||||
|
||||
This project and many others from Nosial are available on multiple publicly available and free git repositories at
|
||||
|
||||
- [n64](https://git.n64.cc/nosial/ncc)
|
||||
- [GitHub](https://github.com/nosial/ncc)
|
||||
- [Codeberg](https://codeberg.org/nosial/ncc)
|
||||
|
||||
Issues & Pull Requests are frequently checked and to be referenced accordingly in commits and changes, Nosial remains
|
||||
dedicated to keep these repositories up to date when possible.
|
||||
|
||||
For questions & discussions see the public Telegram community at [@NosialDiscussions](https://t.me/NosialDiscussions).
|
||||
We do encourage community support and discussions, please be respectful and follow the rules of the community.
|
||||
|
||||
## Features
|
||||
|
||||
|
|
0
assets/compiler_process.png
Normal file → Executable file
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
0
assets/data_structure.png
Normal file → Executable file
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
0
assets/execution_process.png
Normal file → Executable file
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
0
assets/header_structure.png
Normal file → Executable file
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
0
assets/icon/ncc.svg
Normal file → Executable file
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 683 B |
0
assets/icon/ncc@1024px.png
Normal file → Executable file
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
0
assets/icon/ncc@128px.png
Normal file → Executable file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
assets/icon/ncc@16px.png
Normal file → Executable file
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
0
assets/icon/ncc@256px.png
Normal file → Executable file
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
0
assets/icon/ncc@32px.png
Normal file → Executable file
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 504 B |
0
assets/icon/ncc@512px.png
Normal file → Executable file
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
0
assets/icon/ncc@64px.png
Normal file → Executable file
Before Width: | Height: | Size: 820 B After Width: | Height: | Size: 820 B |
0
assets/package_structure.png
Normal file → Executable file
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
0
bootstrap.php
Normal file → Executable file
0
old_docker/Dockerfile
Normal file → Executable file
0
old_docker/Dockerfile.debian
Normal file → Executable file
0
old_docker/note.txt
Normal file → Executable file
0
phpunit.xml
Normal file → Executable file
0
src/autoload/autoload.php
Normal file → Executable file
0
src/config/default_repositories.json
Normal file → Executable file
0
src/config/ncc.yaml
Normal file → Executable file
0
src/debian/control
Normal file → Executable file
0
src/debian/copyright
Normal file → Executable file
0
src/debian/postinst
Normal file → Executable file
0
src/debian/postrm
Normal file → Executable file
0
src/installer/generate_build_files.php
Normal file → Executable file
0
src/installer/hash_check.php
Normal file → Executable file
0
src/installer/installer
Normal file → Executable file
0
src/installer/ncc-package.xml
Normal file → Executable file
0
src/installer/ncc.desktop
Normal file → Executable file
0
src/ncc/CLI/Commands/BuildCommand.php
Normal file → Executable file
0
src/ncc/CLI/Commands/ExecCommand.php
Normal file → Executable file
0
src/ncc/CLI/Commands/PackageInspectorCommand.php
Normal file → Executable file
0
src/ncc/CLI/Commands/SetupCommand.php
Normal file → Executable file
0
src/ncc/CLI/HelpMenu.php
Normal file → Executable file
0
src/ncc/CLI/Main.php
Normal file → Executable file
0
src/ncc/CLI/Management/ConfigMenu.php
Normal file → Executable file
0
src/ncc/CLI/Management/CredentialMenu.php
Normal file → Executable file
0
src/ncc/CLI/Management/PackageManagerMenu.php
Normal file → Executable file
0
src/ncc/CLI/Management/ProjectMenu.php
Normal file → Executable file
0
src/ncc/CLI/Management/RepositoryMenu.php
Normal file → Executable file
10
src/ncc/Classes/ArchiveExtractor.php
Normal file → Executable file
|
@ -29,6 +29,7 @@
|
|||
use ncc\Utilities\Console;
|
||||
use PharData;
|
||||
use RuntimeException;
|
||||
use ValueError;
|
||||
use ZipArchive;
|
||||
|
||||
class ArchiveExtractor
|
||||
|
@ -126,6 +127,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
$zip_archive->close();
|
||||
try
|
||||
{
|
||||
$zip_archive->close();
|
||||
}
|
||||
catch(ValueError $e)
|
||||
{
|
||||
Console::outWarning('An error occurred while closing the zip archive, ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
0
src/ncc/Classes/BashExtension/BashRunner.php
Normal file → Executable file
0
src/ncc/Classes/ExecutionUnitRunner.php
Normal file → Executable file
0
src/ncc/Classes/GiteaExtension/GiteaRepository.php
Normal file → Executable file
0
src/ncc/Classes/GithubExtension/GithubRepository.php
Normal file → Executable file
0
src/ncc/Classes/GitlabExtension/GitlabRepository.php
Normal file → Executable file
0
src/ncc/Classes/LuaExtension/LuaRunner.php
Normal file → Executable file
0
src/ncc/Classes/NccExtension/ConstantCompiler.php
Normal file → Executable file
0
src/ncc/Classes/NccExtension/NccCompiler.php
Normal file → Executable file
144
src/ncc/Classes/PackageReader.php
Normal file → Executable file
|
@ -47,32 +47,32 @@
|
|||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $package_offset;
|
||||
private $packageOffset;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $package_length;
|
||||
private $packageLength;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $header_offset;
|
||||
private $headerOffset;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $header_length;
|
||||
private $headerLength;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $data_offset;
|
||||
private $dataOffset;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $data_length;
|
||||
private $dataLength;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
@ -82,12 +82,12 @@
|
|||
/**
|
||||
* @var resource
|
||||
*/
|
||||
private $package_file;
|
||||
private $packageFile;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $package_path;
|
||||
private $packagePath;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
@ -107,10 +107,10 @@
|
|||
throw new IOException(sprintf('File \'%s\' does not exist', $file_path));
|
||||
}
|
||||
|
||||
$this->package_path = $file_path;
|
||||
$this->package_file = fopen($file_path, 'rb');
|
||||
$this->packagePath = $file_path;
|
||||
$this->packageFile = fopen($file_path, 'rb');
|
||||
|
||||
if($this->package_file === false)
|
||||
if($this->packageFile === false)
|
||||
{
|
||||
throw new IOException(sprintf('Failed to open file \'%s\'', $file_path));
|
||||
}
|
||||
|
@ -122,41 +122,41 @@
|
|||
// End of data: \xFF\xAA\x55\xF0
|
||||
|
||||
// First find the offset of the package by searching for the magic bytes "ncc_pkg"
|
||||
$this->package_offset = 0;
|
||||
while(!feof($this->package_file))
|
||||
$this->packageOffset = 0;
|
||||
while(!feof($this->packageFile))
|
||||
{
|
||||
$buffer = fread($this->package_file, 1024);
|
||||
$buffer = fread($this->packageFile, 1024);
|
||||
$buffer_length = strlen($buffer);
|
||||
$this->package_offset += $buffer_length;
|
||||
$this->packageOffset += $buffer_length;
|
||||
|
||||
if (($position = strpos($buffer, "ncc_pkg")) !== false)
|
||||
{
|
||||
$this->package_offset -= $buffer_length - $position;
|
||||
$this->package_length = 7; // ncc_pkg
|
||||
$this->header_offset = $this->package_offset + 7;
|
||||
$this->packageOffset -= $buffer_length - $position;
|
||||
$this->packageLength = 7; // ncc_pkg
|
||||
$this->headerOffset = $this->packageOffset + 7;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for sanity reasons
|
||||
if($this->package_offset === null || $this->package_length === null)
|
||||
if($this->packageOffset === null || $this->packageLength === null)
|
||||
{
|
||||
throw new IOException(sprintf('File \'%s\' is not a valid package file (missing magic bytes)', $file_path));
|
||||
}
|
||||
|
||||
// Seek the header until the end of headers byte sequence (1F 1F 1F 1F)
|
||||
fseek($this->package_file, $this->header_offset);
|
||||
while (!feof($this->package_file))
|
||||
fseek($this->packageFile, $this->headerOffset);
|
||||
while (!feof($this->packageFile))
|
||||
{
|
||||
$this->headers .= fread($this->package_file, 1024);
|
||||
$this->headers .= fread($this->packageFile, 1024);
|
||||
|
||||
// Search for the position of "1F 1F 1F 1F" within the buffer
|
||||
if (($position = strpos($this->headers, "\x1F\x1F\x1F\x1F")) !== false)
|
||||
{
|
||||
$this->headers = substr($this->headers, 0, $position);
|
||||
$this->header_length = strlen($this->headers);
|
||||
$this->package_length += $this->header_length + 4;
|
||||
$this->data_offset = $this->header_offset + $this->header_length + 4;
|
||||
$this->headerLength = strlen($this->headers);
|
||||
$this->packageLength += $this->headerLength + 4;
|
||||
$this->dataOffset = $this->headerOffset + $this->headerLength + 4;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -181,19 +181,19 @@
|
|||
}
|
||||
|
||||
// Seek the data until the end of the package (FF AA 55 F0)
|
||||
fseek($this->package_file, $this->data_offset);
|
||||
fseek($this->packageFile, $this->dataOffset);
|
||||
$buffer = '';
|
||||
while(!feof($this->package_file))
|
||||
while(!feof($this->packageFile))
|
||||
{
|
||||
$current_chunk = fread($this->package_file, 1024);
|
||||
$this->data_length += strlen($current_chunk);
|
||||
$current_chunk = fread($this->packageFile, 1024);
|
||||
$this->dataLength += strlen($current_chunk);
|
||||
$buffer .= $current_chunk;
|
||||
|
||||
// If we detect the end-of-data byte sequence
|
||||
if (($position = strpos($buffer, "\xFF\xAA\x55\xF0")) !== false)
|
||||
{
|
||||
$this->data_length -= strlen($buffer) - $position;
|
||||
$this->package_length += $this->data_length + 4;
|
||||
$this->dataLength -= strlen($buffer) - $position;
|
||||
$this->packageLength += $this->dataLength + 4;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@
|
|||
|
||||
}
|
||||
|
||||
if($this->data_length === null || $this->data_length === 0)
|
||||
if($this->dataLength === null || $this->dataLength === 0)
|
||||
{
|
||||
throw new IOException(sprintf('File \'%s\' is not a valid package file (missing end of package)', $file_path));
|
||||
}
|
||||
|
@ -275,18 +275,18 @@
|
|||
{
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$name]))
|
||||
{
|
||||
throw new RuntimeException(sprintf('File \'%s\' not found in package \'%s\'', $name, $this->package_path));
|
||||
throw new RuntimeException(sprintf('File \'%s\' not found in package \'%s\'', $name, $this->packagePath));
|
||||
}
|
||||
|
||||
$location = explode(':', $this->headers[PackageStructure::DIRECTORY->value][$name]);
|
||||
fseek($this->package_file, ($this->data_offset + (int)$location[0]));
|
||||
fseek($this->packageFile, ($this->dataOffset + (int)$location[0]));
|
||||
|
||||
if(in_array(PackageFlags::COMPRESSION->value, $this->headers[PackageStructure::FLAGS->value], true))
|
||||
{
|
||||
return gzuncompress(fread($this->package_file, (int)$location[1]));
|
||||
return gzuncompress(fread($this->packageFile, (int)$location[1]));
|
||||
}
|
||||
|
||||
return fread($this->package_file, (int)$location[1]);
|
||||
return fread($this->packageFile, (int)$location[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -299,7 +299,7 @@
|
|||
{
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$name]))
|
||||
{
|
||||
throw new RuntimeException(sprintf('Resource \'%s\' not found in package \'%s\'', $name, $this->package_path));
|
||||
throw new RuntimeException(sprintf('Resource \'%s\' not found in package \'%s\'', $name, $this->packagePath));
|
||||
}
|
||||
|
||||
$location = explode(':', $this->headers[PackageStructure::DIRECTORY->value][$name]);
|
||||
|
@ -326,8 +326,8 @@
|
|||
*/
|
||||
public function getByPointer(int $pointer, int $length): string
|
||||
{
|
||||
fseek($this->package_file, ($this->header_length + $pointer));
|
||||
return fread($this->package_file, $length);
|
||||
fseek($this->packageFile, ($this->headerLength + $pointer));
|
||||
return fread($this->packageFile, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -348,7 +348,7 @@
|
|||
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$directory]))
|
||||
{
|
||||
throw new ConfigurationException(sprintf('Assembly object not found in package \'%s\'', $this->package_path));
|
||||
throw new ConfigurationException(sprintf('Assembly object not found in package \'%s\'', $this->packagePath));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -357,7 +357,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode assembly from package \'%s\' using ZiProto: %s', $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode assembly from package \'%s\' using ZiProto: %s', $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
|
||||
$this->cache[$directory] = $assembly;
|
||||
|
@ -382,7 +382,7 @@
|
|||
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$directory]))
|
||||
{
|
||||
throw new ConfigurationException(sprintf('Metadata object not found in package \'%s\'', $this->package_path));
|
||||
throw new ConfigurationException(sprintf('Metadata object not found in package \'%s\'', $this->packagePath));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -391,7 +391,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode metadata from package \'%s\' using ZiProto: %s', $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode metadata from package \'%s\' using ZiProto: %s', $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
|
||||
foreach($this->getFlags() as $flag)
|
||||
|
@ -429,7 +429,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode installer from package \'%s\' using ZiProto: %s', $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode installer from package \'%s\' using ZiProto: %s', $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
|
||||
$this->cache[$directory] = $installer;
|
||||
|
@ -470,7 +470,7 @@
|
|||
$dependency_name = sprintf('@%s:%s', PackageDirectory::DEPENDENCIES->value, $name);
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$dependency_name]))
|
||||
{
|
||||
throw new ConfigurationException(sprintf('Dependency \'%s\' not found in package \'%s\'', $name, $this->package_path));
|
||||
throw new ConfigurationException(sprintf('Dependency \'%s\' not found in package \'%s\'', $name, $this->packagePath));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -479,7 +479,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode dependency \'%s\' from package \'%s\' using ZiProto: %s', $name, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode dependency \'%s\' from package \'%s\' using ZiProto: %s', $name, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode dependency from pointer \'%s\' with length \'%s\' from package \'%s\' using ZiProto: %s', $pointer, $length, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode dependency from pointer \'%s\' with length \'%s\' from package \'%s\' using ZiProto: %s', $pointer, $length, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@
|
|||
$execution_unit_name = sprintf('@%s:%s', PackageDirectory::EXECUTION_UNITS->value, $name);
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$execution_unit_name]))
|
||||
{
|
||||
throw new ConfigurationException(sprintf('Execution unit \'%s\' not found in package \'%s\'', $name, $this->package_path));
|
||||
throw new ConfigurationException(sprintf('Execution unit \'%s\' not found in package \'%s\'', $name, $this->packagePath));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -546,7 +546,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode execution unit \'%s\' from package file \'%s\' using ZiProto: %s', $name, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode execution unit \'%s\' from package file \'%s\' using ZiProto: %s', $name, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode execution unit from pointer \'%s\' with length \'%s\' from package \'%s\' using ZiProto: %s', $pointer, $length, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode execution unit from pointer \'%s\' with length \'%s\' from package \'%s\' using ZiProto: %s', $pointer, $length, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,7 +636,7 @@
|
|||
$component_name = sprintf('@%s:%s', PackageDirectory::COMPONENTS->value, $name);
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$component_name]))
|
||||
{
|
||||
throw new ConfigurationException(sprintf('Component \'%s\' not found in package \'%s\'', $name, $this->package_path));
|
||||
throw new ConfigurationException(sprintf('Component \'%s\' not found in package \'%s\'', $name, $this->packagePath));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -645,7 +645,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode component \'%s\' from package \'%s\' using ZiProto: %s', $name, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode component \'%s\' from package \'%s\' using ZiProto: %s', $name, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode component from pointer \'%s\' with length \'%s\' from package \'%s\' using ZiProto: %s', $pointer, $length, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode component from pointer \'%s\' with length \'%s\' from package \'%s\' using ZiProto: %s', $pointer, $length, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@
|
|||
$class_name = sprintf('@%s:%s', PackageDirectory::CLASS_POINTER->value, $class);
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$class_name]))
|
||||
{
|
||||
throw new ConfigurationException(sprintf('Class map \'%s\' not found in package \'%s\'', $class, $this->package_path));
|
||||
throw new ConfigurationException(sprintf('Class map \'%s\' not found in package \'%s\'', $class, $this->packagePath));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -691,7 +691,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode component from class pointer \'%s\' from package \'%s\' using ZiProto: %s', $class, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode component from class pointer \'%s\' from package \'%s\' using ZiProto: %s', $class, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -729,7 +729,7 @@
|
|||
$resource_name = sprintf('@%s:%s', PackageDirectory::RESOURCES->value, $name);
|
||||
if(!isset($this->headers[PackageStructure::DIRECTORY->value][$resource_name]))
|
||||
{
|
||||
throw new ConfigurationException(sprintf('Resource \'%s\' not found in package \'%s\'', $name, $this->package_path));
|
||||
throw new ConfigurationException(sprintf('Resource \'%s\' not found in package \'%s\'', $name, $this->packagePath));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -738,7 +738,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode resource \'%s\' from package \'%s\' using ZiProto: %s', $name, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode resource \'%s\' from package \'%s\' using ZiProto: %s', $name, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -758,7 +758,7 @@
|
|||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
throw new IntegrityException(sprintf('Failed to decode resource from pointer \'%s\' with length \'%s\' from package \'%s\' using ZiProto: %s', $pointer, $length, $this->package_path, $e->getMessage()), $e);
|
||||
throw new IntegrityException(sprintf('Failed to decode resource from pointer \'%s\' with length \'%s\' from package \'%s\' using ZiProto: %s', $pointer, $length, $this->packagePath, $e->getMessage()), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@
|
|||
*/
|
||||
public function getPackageOffset(): int
|
||||
{
|
||||
return $this->package_offset;
|
||||
return $this->packageOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -796,7 +796,7 @@
|
|||
*/
|
||||
public function getPackageLength(): int
|
||||
{
|
||||
return $this->package_length;
|
||||
return $this->packageLength;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -804,7 +804,7 @@
|
|||
*/
|
||||
public function getHeaderOffset(): int
|
||||
{
|
||||
return $this->header_offset;
|
||||
return $this->headerOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -812,7 +812,7 @@
|
|||
*/
|
||||
public function getHeaderLength(): int
|
||||
{
|
||||
return $this->header_length;
|
||||
return $this->headerLength;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -820,7 +820,7 @@
|
|||
*/
|
||||
public function getDataOffset(): int
|
||||
{
|
||||
return $this->data_offset;
|
||||
return $this->dataOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -828,7 +828,7 @@
|
|||
*/
|
||||
public function getDataLength(): int
|
||||
{
|
||||
return $this->data_length;
|
||||
return $this->dataLength;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -842,12 +842,12 @@
|
|||
{
|
||||
$checksum = hash($hash, '', $binary);
|
||||
|
||||
fseek($this->package_file, $this->package_offset);
|
||||
$bytes_left = $this->package_length;
|
||||
fseek($this->packageFile, $this->packageOffset);
|
||||
$bytes_left = $this->packageLength;
|
||||
|
||||
while ($bytes_left > 0)
|
||||
{
|
||||
$buffer = fread($this->package_file, min(1024, $bytes_left));
|
||||
$buffer = fread($this->packageFile, min(1024, $bytes_left));
|
||||
$buffer_length = strlen($buffer);
|
||||
$bytes_left -= $buffer_length;
|
||||
$checksum = hash($hash, ($checksum . $buffer), $binary);
|
||||
|
@ -875,13 +875,13 @@
|
|||
throw new IOException(sprintf('Failed to open file \'%s\'', $path));
|
||||
}
|
||||
|
||||
fseek($this->package_file, $this->package_offset);
|
||||
$remaining_bytes = $this->package_length;
|
||||
fseek($this->packageFile, $this->packageOffset);
|
||||
$remaining_bytes = $this->packageLength;
|
||||
|
||||
while($remaining_bytes > 0)
|
||||
{
|
||||
$bytes_to_read = min($remaining_bytes, 4096);
|
||||
$data = fread($this->package_file, $bytes_to_read);
|
||||
$data = fread($this->packageFile, $bytes_to_read);
|
||||
|
||||
if ($data === false)
|
||||
{
|
||||
|
@ -911,9 +911,9 @@
|
|||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if(is_resource($this->package_file))
|
||||
if(is_resource($this->packageFile))
|
||||
{
|
||||
fclose($this->package_file);
|
||||
fclose($this->packageFile);
|
||||
}
|
||||
}
|
||||
}
|
94
src/ncc/Classes/PackageWriter.php
Normal file → Executable file
|
@ -53,70 +53,70 @@
|
|||
/**
|
||||
* @var resource
|
||||
*/
|
||||
private $temp_file;
|
||||
private $tempFile;
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
private $package_file;
|
||||
private $packageFile;
|
||||
|
||||
/**
|
||||
* @var string;
|
||||
*/
|
||||
private $temporary_path;
|
||||
private $temporaryPath;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $data_written;
|
||||
private $dataWritten;
|
||||
|
||||
/**
|
||||
* PackageWriter constructor.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public function __construct(string $file_path, bool $overwrite=true)
|
||||
public function __construct(string $filePath, bool $overwrite=true)
|
||||
{
|
||||
if(!$overwrite && is_file($file_path))
|
||||
if(!$overwrite && is_file($filePath))
|
||||
{
|
||||
throw new IOException(sprintf('File \'%s\' already exists', $file_path));
|
||||
throw new IOException(sprintf('File \'%s\' already exists', $filePath));
|
||||
}
|
||||
|
||||
if(is_file($file_path))
|
||||
if(is_file($filePath))
|
||||
{
|
||||
unlink($file_path);
|
||||
unlink($filePath);
|
||||
}
|
||||
|
||||
if(is_file($file_path . '.tmp'))
|
||||
if(is_file($filePath . '.tmp'))
|
||||
{
|
||||
unlink($file_path . '.tmp');
|
||||
unlink($filePath . '.tmp');
|
||||
}
|
||||
|
||||
// Create the parent directory if it doesn't exist
|
||||
if(!is_dir(dirname($file_path)))
|
||||
if(!is_dir(dirname($filePath)))
|
||||
{
|
||||
if (!mkdir($concurrentDirectory = dirname($file_path), 0777, true) && !is_dir($concurrentDirectory))
|
||||
if (!mkdir($concurrentDirectory = dirname($filePath), 0777, true) && !is_dir($concurrentDirectory))
|
||||
{
|
||||
throw new IOException(sprintf('Directory "%s" was not created', $concurrentDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
touch($file_path);
|
||||
touch($file_path . '.tmp');
|
||||
touch($filePath);
|
||||
touch($filePath . '.tmp');
|
||||
|
||||
$this->data_written = false;
|
||||
$this->temporary_path = $file_path . '.tmp';
|
||||
$this->temp_file = @fopen($this->temporary_path, 'wb'); // Create a temporary data file
|
||||
$this->package_file = @fopen($file_path, 'wb');
|
||||
$this->dataWritten = false;
|
||||
$this->temporaryPath = $filePath . '.tmp';
|
||||
$this->tempFile = @fopen($this->temporaryPath, 'wb'); // Create a temporary data file
|
||||
$this->packageFile = @fopen($filePath, 'wb');
|
||||
$this->headers = [
|
||||
PackageStructure::FILE_VERSION->value => PackageStructureVersions::_2_0->value,
|
||||
PackageStructure::FLAGS->value => [],
|
||||
PackageStructure::DIRECTORY->value => []
|
||||
];
|
||||
|
||||
if($this->temp_file === false || $this->package_file === false)
|
||||
if($this->tempFile === false || $this->packageFile === false)
|
||||
{
|
||||
throw new IOException(sprintf('Failed to open file \'%s\'', $file_path));
|
||||
throw new IOException(sprintf('Failed to open file \'%s\'', $filePath));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@
|
|||
*/
|
||||
public function setFlags(array $flags): void
|
||||
{
|
||||
if($this->data_written)
|
||||
if($this->dataWritten)
|
||||
{
|
||||
throw new IOException('Cannot set flags after data has been written to the package');
|
||||
}
|
||||
|
@ -198,7 +198,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if($this->data_written)
|
||||
if($this->dataWritten)
|
||||
{
|
||||
throw new IOException('Cannot add a flag after data has been written to the package');
|
||||
}
|
||||
|
@ -227,7 +227,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if($this->data_written)
|
||||
if($this->dataWritten)
|
||||
{
|
||||
throw new IOException('Cannot remove a flag after data has been written to the package');
|
||||
}
|
||||
|
@ -269,10 +269,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
$pointer = sprintf("%d:%d", ftell($this->temp_file), strlen($data));
|
||||
$pointer = sprintf("%d:%d", ftell($this->tempFile), strlen($data));
|
||||
$this->headers[PackageStructure::DIRECTORY->value][$name] = $pointer;
|
||||
$this->data_written = true;
|
||||
fwrite($this->temp_file, $data);
|
||||
$this->dataWritten = true;
|
||||
fwrite($this->tempFile, $data);
|
||||
|
||||
return explode(':', $pointer);
|
||||
}
|
||||
|
@ -395,7 +395,7 @@
|
|||
public function merge(PackageReader $reader): void
|
||||
{
|
||||
$progress_bar = new ConsoleProgressBar(sprintf('Merging %s', $reader->getAssembly()->getPackage()), count($reader->getDirectory()));
|
||||
$processed_resources = [];
|
||||
$processedResources = [];
|
||||
|
||||
foreach($reader->getDirectory() as $name => $pointer)
|
||||
{
|
||||
|
@ -411,15 +411,15 @@
|
|||
break;
|
||||
|
||||
default:
|
||||
if(isset($processed_resources[$pointer]))
|
||||
if(isset($processedResources[$pointer]))
|
||||
{
|
||||
Console::outDebug(sprintf('Merging %s as a pointer', $name));
|
||||
$this->addPointer($name, (int)$processed_resources[$pointer][0], (int)$processed_resources[$pointer][1]);
|
||||
$this->addPointer($name, (int)$processedResources[$pointer][0], (int)$processedResources[$pointer][1]);
|
||||
break;
|
||||
}
|
||||
|
||||
Console::outDebug(sprintf('Merging %s', $name));
|
||||
$processed_resources[$pointer] = $this->add($name, $reader->get($name));
|
||||
$processedResources[$pointer] = $this->add($name, $reader->get($name));
|
||||
}
|
||||
|
||||
$progress_bar->increaseValue(1, true);
|
||||
|
@ -437,34 +437,34 @@
|
|||
*/
|
||||
public function close(): void
|
||||
{
|
||||
if(!is_resource($this->package_file) || !is_resource($this->temp_file))
|
||||
if(!is_resource($this->packageFile) || !is_resource($this->tempFile))
|
||||
{
|
||||
throw new IOException('Package is already closed');
|
||||
}
|
||||
|
||||
// Close the temporary data file
|
||||
fclose($this->temp_file);
|
||||
fclose($this->tempFile);
|
||||
|
||||
// Write the magic bytes "ncc_pkg" to the package and the header
|
||||
fwrite($this->package_file, 'ncc_pkg');
|
||||
fwrite($this->package_file, ZiProto::encode($this->headers));
|
||||
fwrite($this->package_file, "\x1F\x1F\x1F\x1F");
|
||||
fwrite($this->packageFile, 'ncc_pkg');
|
||||
fwrite($this->packageFile, ZiProto::encode($this->headers));
|
||||
fwrite($this->packageFile, "\x1F\x1F\x1F\x1F");
|
||||
|
||||
// Copy the temporary data file to the package
|
||||
$temp_file = fopen($this->temporary_path, 'rb');
|
||||
stream_copy_to_stream($temp_file, $this->package_file);
|
||||
$temp_file = fopen($this->temporaryPath, 'rb');
|
||||
stream_copy_to_stream($temp_file, $this->packageFile);
|
||||
|
||||
// End the package by writing the end-of-package delimiter (0xFFAA55F0)
|
||||
fwrite($this->package_file, "\xFF\xAA\x55\xF0");
|
||||
fwrite($this->packageFile, "\xFF\xAA\x55\xF0");
|
||||
|
||||
// Close the file handles
|
||||
fclose($this->package_file);
|
||||
fclose($this->packageFile);
|
||||
fclose($temp_file);
|
||||
|
||||
unlink($this->temporary_path);
|
||||
unlink($this->temporaryPath);
|
||||
|
||||
$this->package_file = null;
|
||||
$this->temp_file = null;
|
||||
$this->packageFile = null;
|
||||
$this->tempFile = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -482,14 +482,14 @@
|
|||
}
|
||||
finally
|
||||
{
|
||||
if(is_resource($this->package_file))
|
||||
if(is_resource($this->packageFile))
|
||||
{
|
||||
fclose($this->package_file);
|
||||
fclose($this->packageFile);
|
||||
}
|
||||
|
||||
if(is_resource($this->temp_file))
|
||||
if(is_resource($this->tempFile))
|
||||
{
|
||||
fclose($this->temp_file);
|
||||
fclose($this->tempFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|