Skip to content

Commit

Permalink
pogolib - Helper for finding script location
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Dec 3, 2019
1 parent 84f690c commit 33b6011
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ You may find it easier to use `pogo` for micro-services in async environments, a

### The examples are mostly single-page scripts/apps. Does it work with includes?

Yes... `include`, `require`, `include_once`, and `require_once` still work as normal.
Yes... `include`, `require`, `include_once`, and `require_once` still work.

But no... dependencies are not determined transitively through included files. The
scanner currently has no specific support for multi-file projects.

Note: For the main script, the content of `__DIR__` will depend in on the runner. Use `pogo_script_dir()` if you need a consistent value across all runners.

### Why does it redownload dependencies after a week?

That's a security precaution - to make sure we don't run stale libraries.
Expand Down
8 changes: 8 additions & 0 deletions templates/pogolib.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ function pogo_script() {
return pogo_clean_script(file_get_contents(getenv('POGO_SCRIPT')));
}

/**
* @return string
* The folder in which the script was originally stored
*/
function pogo_script_dir() {
return dirname(getenv('POGO_SCRIPT'));
}

/**
* @param string $c
* PHP code, which may begin with a shebang
Expand Down

0 comments on commit 33b6011

Please sign in to comment.