Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
4be69b42
Commit
4be69b42
authored
17 years ago
by
Alexandre Bourget
Browse files
Options
Downloads
Patches
Plain Diff
Add function to include the asciidoc.conf file while compiling.
parent
6b46ac68
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
www/sflphone.funcs.php
+40
-24
40 additions, 24 deletions
www/sflphone.funcs.php
with
40 additions
and
24 deletions
www/sflphone.funcs.php
+
40
−
24
View file @
4be69b42
...
...
@@ -87,18 +87,32 @@ function check_cache_path() {
* @return mixed NULL or the content of the cache
*/
function
get_cache_hash
(
$hash
)
{
$fn
=
get_cache_hash_filename
(
$hash
);
if
(
$fn
)
{
return
file_get_contents
(
$fn
);
}
return
NULL
;
}
/**
* Return the local filename (.cache) in the cache path if it exists
*
* @return string/null Filename of the locally cached file.
*/
function
get_cache_hash_filename
(
$hash
)
{
global
$CACHE_PATH
;
$fn
=
$CACHE_PATH
.
'/'
.
$hash
.
'.cache'
;
if
(
file_exists
(
$fn
))
{
return
file_get_contents
(
$fn
)
;
return
$fn
;
}
return
NULL
;
}
/**
* Write content to cache (identified by $hash)
*/
...
...
@@ -119,12 +133,16 @@ function put_cache_hash($hash, $content) {
* @return string Content of the compiled page.
*/
function
compile_page
(
$hash
,
$page
)
{
global
$GIT_REPOS
;
global
$GIT_REPOS
,
$CACHE_PATH
;
$output
=
''
;
// Grab the asciidoc.conf file, and put it into cache.
// keep return the hash
$fnconf
=
bring_local_file
(
'asciidoc.conf'
);
// -d book so we can render H1s
$p
=
popen
(
"GIT_DIR="
.
$GIT_REPOS
.
" git-show
$hash
| asciidoc -d book --no-header-footer -"
,
'r'
);
$p
=
popen
(
"GIT_DIR="
.
$GIT_REPOS
.
" git-show
$hash
| asciidoc
-f
\"
"
.
$fnconf
.
"
\"
-d book --no-header-footer -"
,
'r'
);
if
(
!
$p
)
{
return
"Unable to compile file:
$page
(
$hash
)
\n
"
;
...
...
@@ -140,34 +158,32 @@ function compile_page($hash, $page) {
/**
* Retrieve the page (without compilation)
* Bring a file in the .git repository into a local .cache file
* and return the filename (as $CACHE_PATH/hash.cache)
*
* This function
is just like compile_page(), but it doesn't call asciidoc on it.
*
@param hash The hash for the required content
* @param file
The
filename
(only for error reporting
)
* @return string
Original content
of th
e
file
.
* This function
will prepend the PREFIX to the given git filename ($gitfile)
*
* @param
string Git
file
is a
filename
in the repository (without the PREFIX
)
* @return string
Filename of the local copy
of th
at
file
(cache/lsakdjflakdj.cache)
*/
/*
//DUPLICATES get_git_file_content()
function retr_file($hash, $file) {
global $GIT_REPOS;
$output = '';
function
bring_local_file
(
$gitfile
)
{
$
p = popen("GIT_DIR=".$GIT_REPOS." git-show $hash", 'r'
);
$
hash
=
get_git_hash
(
$gitfile
);
if (!$p) {
return "Unable to retrieve: $file ($hash)\n";
}
$fn
=
get_cache_hash_filename
(
$hash
);
while (!feof($p)) {
$output .= fread($p, 1024);
if
(
!
$fn
)
{
$cnt
=
get_git_hash_content
(
$hash
);
put_cache_hash
(
$hash
,
$cnt
);
// Might return an error, but that's all we can do.
return
get_cache_hash_filename
(
$hash
);
}
pclose($p);
return $
output
;
return
$
fn
;
}
*/
/**
* Retrieve file from git's object-ocean
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment