\apex\app\pkgpackage

Handles all package functions -- create, compile, download, install, remove.

Summary

Methods
Properties
Constants
insert()
create()
validate_alias()
compile()
publish()
install()
download()
install_from_dir()
remove()
compile_core()
reset()
reinstall_components()
No public properties found
No constants found
install_copy_files()
No protected properties found
N/A
add_file()
update_github_repo()
$tmp_dir
$toc
$file_num
$pkg_alias
N/A

Properties

$tmp_dir

$tmp_dir :

Type

$toc

$toc :

Type

$file_num

$file_num :

Type

$pkg_alias

$pkg_alias :

Type

Methods

insert()

insert(integer  $repo_id,string  $pkg_alias,string  $name,string  $access = 'public',string  $version = '1.0.0')

Insert a new package into the database

Parameters

integer $repo_id

The ID# of the repo the package belongs to

string $pkg_alias

The alias of the package

string $name

The full name of the package

string $access

Access level of the package (public / private), defaults to 'public'

string $version

The version of the package, defaults to 1.0.0

create()

create(integer  $repo_id,string  $pkg_alias,string  $name,string  $access = 'public',string  $version = '1.0.0'): integer

Create a new package for development.

Parameters

integer $repo_id

The ID# of the repo the package belongs to

string $pkg_alias

The alias of the package

string $name

The full name of the package

string $access

Access level of the package (public / private), defaults to 'public'

string $version

The version of the package, defaults to 1.0.0

Returns

integer —

The ID# of the newly created package

validate_alias()

validate_alias(string  $pkg_alias): boolean

Validate a package alias for proper format, and ensure it does not already exist in the system.

Parameters

string $pkg_alias

The package alias to validate

Returns

boolean —

Whether or not the alias is valid

compile()

compile(string  $pkg_alias): string

Compile package

Gathers all files and components on the package, and compiles as necessary to ready for publication to repository.

Parameters

string $pkg_alias

The alias of the package to compile.

Returns

string —

The filename or the created archive file,

publish()

publish(string  $pkg_alias,string  $version = ''): boolean

Compiles a package, and uploads it to the appropriate repository.

Parameters

string $pkg_alias

The alias of the package to publish.

string $version

The version of the package being published (eg. 1.0.4)

Returns

boolean —

Whther or not the operation was successful.

install()

install(string  $pkg_alias,integer  $repo_id)

Fully install a package. Downoads the package from the appropriate repository, unpacks it, and installed it.

Parameters

string $pkg_alias

The alias of the packagte to install

integer $repo_id

Optional ID# of repo to download from. If not specified, all repos are searched.

download()

download(string  $pkg_alias,integer  $repo_id): string

Download a package from a repository, and unpack it into the tmp system directory

Parameters

string $pkg_alias

The alias of the package to download

integer $repo_id

Optional ID# of repo to download from. If not specified, all repos are searched.

Returns

string —

Directory path of where the package was unpacked at

install_from_dir()

install_from_dir(string  $pkg_alias,string  $tmp_dir,integer  $is_git)

Install package from directory

Install a package from a directory. This assumes the package has already been downloaded, unpacked on the server, and added to the database

Parameters

string $pkg_alias

The alias of the package being installed

string $tmp_dir

The directory where the package is currently unpacked

integer $is_git

A 1/0 whether or not it's from a git repo.

remove()

remove(string  $pkg_alias)

Remove a package

Parameters

string $pkg_alias

The alias of the package to remove

compile_core()

compile_core()

Compile Apex core framework

Compiles the core Apex framework into a temporary directory. Gnerally only used by Apex to generate the necessary directory / file structure for the Github repo.

reset()

reset(string  $pkg_alias)

Reset a package. Executes any SQL file at /etc/PKG_ALIAS/reset.sql, and executes any reset() function within the package.php file.

Parameters

string $pkg_alias

The alias of the package to reset.

reinstall_components()

reinstall_components(string  $pkg_alias)

Reinstall components. Deletes all existing components of a packagew from the database, and re-installs them using the /etc/PACKAGE/components.json file.

Parameters

string $pkg_alias

The alias of the package to re-install components for.

install_copy_files()

install_copy_files(string  $pkg_alias,string  $tmp_dir)

Copy over files

Parameters

string $pkg_alias

The alias of the package we're installing.

string $tmp_dir

The temp directyory holding the package files.

add_file()

add_file(string  $filename)

Adds a file to an archive,, and is used while compiling a package.

Parameters

string $filename

The filename to add, relative to the / installation directory.

update_github_repo()

update_github_repo()

Update the Github repo hosted locally