Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
6d72afb4
Commit
6d72afb4
authored
Sep 06, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
INitial entry.
parent
f63efd96
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
482 additions
and
0 deletions
+482
-0
actions.class.php
...te/apps/frontend/modules/manual/actions/actions.class.php
+331
-0
indexSuccess.php
...e/apps/frontend/modules/manual/templates/indexSuccess.php
+17
-0
xhtml.tpl.php
website/apps/frontend/modules/manual/templates/xhtml.tpl.php
+62
-0
blog_post.yml
website/config/doctrine/blog_post.yml
+22
-0
BlogPost.class.php
website/lib/model/doctrine/BlogPost.class.php
+10
-0
BlogPostTable.class.php
website/lib/model/doctrine/BlogPostTable.class.php
+10
-0
BaseBlogPost.class.php
website/lib/model/doctrine/generated/BaseBlogPost.class.php
+30
-0
No files found.
website/apps/frontend/modules/manual/actions/actions.class.php
0 → 100644
View file @
6d72afb4
<?php
/**
* A generic autoload function
*
* Filename is generated from class name by replacing underscores with
* directory separators and by adding a '.php' extension.
*
* Then the filename is searched from include paths, and if found it is
* included with require_once().
*
* @param $class string class name to be loaded
* @return bool true if a class was loaded, false otherwise
*/
function
autoload
(
$class
)
{
if
(
class_exists
(
$class
,
false
))
{
return
false
;
}
$paths
=
explode
(
PATH_SEPARATOR
,
get_include_path
());
$filename
=
str_replace
(
'_'
,
DIRECTORY_SEPARATOR
,
$class
)
.
'.php'
;
foreach
(
$paths
as
$path
)
{
if
(
file_exists
(
$path
.
DIRECTORY_SEPARATOR
.
$filename
))
{
require_once
(
$filename
);
return
true
;
}
}
return
false
;
}
/**
* Returns the revision of a SVN controlled file.
*
* The revision is acquired by executing the 'svn info' command for the file and
* parsing the last changed revision from the output.
*
* @param $file string filename
* @return int|false revision of the file, or false on failure
*/
function
getSvnRevision
(
$file
)
{
$cmd
=
'HOME=/tmp /usr/bin/svn info '
.
escapeshellarg
(
$file
);
exec
(
$cmd
,
$output
);
foreach
(
$output
as
$line
)
{
if
(
preg_match
(
'/^Last Changed Rev: ([0-9]+)$/'
,
$line
,
$matches
))
{
return
$matches
[
1
];
}
}
return
false
;
}
/**
* Wraps a Doctrine_Cache_Db and suppresses all exceptions thrown by caching
* operations. Uses Sqlite as database backend.
*/
class
Cache
{
protected
$_cache
=
null
;
/**
* Constructs a cache object.
*
* If cache table does not exist, creates one.
*
* @param $cacheFile string filename of the sqlite database
*/
public
function
__construct
(
$cacheFile
)
{
try
{
$dsn
=
'sqlite:'
.
$cacheFile
;
$dbh
=
new
PDO
(
$dsn
);
$conn
=
Doctrine_Manager
::
connection
(
$dbh
);
$options
=
array
(
'connection'
=>
$conn
,
'tableName'
=>
'cache'
);
$this
->
_cache
=
new
Doctrine_Cache_Db
(
$options
);
try
{
$this
->
_cache
->
createTable
();
}
catch
(
Doctrine_Connection_Exception
$e
)
{
if
(
$e
->
getPortableCode
()
!==
Doctrine
::
ERR_ALREADY_EXISTS
)
{
$this
->
_cache
=
null
;
}
}
}
catch
(
Exception
$e
)
{
$this
->
_cache
=
null
;
}
}
/**
* Fetches a cache record from cache.
*
* @param $id string the id of the cache record
* @return string fetched cache record, or false on failure
*/
public
function
fetch
(
$id
)
{
if
(
$this
->
_cache
!==
null
)
{
try
{
return
$this
->
_cache
->
fetch
(
$id
);
}
catch
(
Exception
$e
)
{
return
false
;
}
}
return
false
;
}
/**
* Saves a cache record to cache.
*
* @param $data mixed the data to be saved to cache
* @param $id string the id of the cache record
* @return bool True on success, false on failure
*/
public
function
save
(
$data
,
$id
)
{
if
(
$this
->
_cache
!==
null
)
{
try
{
return
$this
->
_cache
->
save
(
$data
,
$id
);
}
catch
(
Exception
$e
)
{
return
false
;
}
}
return
false
;
}
/**
* Deletes all cached records from cache.
*
* @return True on success, false on failure
*/
public
function
deleteAll
()
{
if
(
$this
->
_cache
!==
null
)
{
try
{
return
$this
->
_cache
->
deleteAll
();
}
catch
(
Exception
$e
)
{
return
false
;
}
}
return
false
;
}
}
/**
* manual actions.
*
* @package doctrine_website
* @subpackage manual
* @author Your name here
* @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
*/
class
manualActions
extends
sfActions
{
/**
* Executes index action
*
*/
public
function
executeIndex
()
{
error_reporting
(
E_ALL
);
$trunk
=
dirname
(
dirname
(
dirname
(
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
)))))));
$vendorPath
=
$trunk
.
DIRECTORY_SEPARATOR
.
'vendor'
;
$manualPath
=
$trunk
.
DIRECTORY_SEPARATOR
.
'manual'
;
$doctrinePath
=
$trunk
.
DIRECTORY_SEPARATOR
.
'lib'
;
$includePath
=
$doctrinePath
.
PATH_SEPARATOR
.
$vendorPath
.
PATH_SEPARATOR
.
$manualPath
.
DIRECTORY_SEPARATOR
.
'new'
.
DIRECTORY_SEPARATOR
.
'lib'
;
set_include_path
(
$includePath
);
require_once
(
'Sensei/Sensei.php'
);
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
spl_autoload_register
(
array
(
'Sensei'
,
'autoload'
));
spl_autoload_register
(
'autoload'
);
// Temporary directory used by cache and LaTeX to Pdf conversion
$tempDir
=
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'tmp'
;
// The file where cached data is saved
$cacheFile
=
$tempDir
.
DIRECTORY_SEPARATOR
.
'cache.sq3'
;
$cache
=
new
Cache
(
$cacheFile
);
// Fetch the revision of cached data
$cacheRev
=
$cache
->
fetch
(
'revision'
);
// Check the revision of documentation files
$revision
=
getSvnRevision
(
'.'
);
// Is current SVN revision greater than the revision of cached data?
if
(
$revision
>
$cacheRev
)
{
$cache
->
deleteAll
();
// cached data is not valid anymore
$cache
->
save
(
$revision
,
'revision'
);
}
// Load table of contents from cache
$this
->
toc
=
$cache
->
fetch
(
'toc'
);
// If table of contents was not cached, parse it from documentation files
if
(
!
$this
->
toc
instanceof
Sensei_Doc_Toc
)
{
$this
->
toc
=
new
Sensei_Doc_Toc
(
$manualPath
.
'/new/docs/en.txt'
);
$cache
->
save
(
$this
->
toc
,
'toc'
);
}
// Which format to output docs
if
(
isset
(
$_GET
[
'format'
]))
{
$format
=
ucfirst
(
strtolower
(
$_GET
[
'format'
]));
switch
(
$format
)
{
case
'Xhtml'
:
case
'Latex'
:
case
'Pdf'
:
break
;
default
:
$format
=
'Xhtml'
;
// default if invalid format is specified
break
;
}
}
else
{
$format
=
'Xhtml'
;
// default if no format is specified
}
$this
->
rendererClass
=
'Sensei_Doc_Renderer_'
.
$format
;
$this
->
renderer
=
new
$this
->
rendererClass
(
$this
->
toc
);
$this
->
renderer
->
setOptions
(
array
(
'title'
=>
'Doctrine Manual'
,
'author'
=>
'Konsta Vesterinen'
,
'version'
=>
'Rev. '
.
$revision
,
'subject'
=>
'Object relational mapping'
,
'keywords'
=>
'PHP, ORM, object relational mapping, Doctrine, database'
));
$cacheId
=
$format
;
switch
(
$format
)
{
case
'Latex'
:
$this
->
renderer
->
setOption
(
'template'
,
file_get_contents
(
$manualPath
.
'/new/templates/latex.tpl.php'
));
$headers
=
array
(
'Content-Type: application/latex'
,
'Content-Disposition: attachment; filename=doctrine-manual.tex'
);
break
;
case
'Pdf'
:
$this
->
renderer
->
setOption
(
'template'
,
file_get_contents
(
$manualPath
.
'/new/templates/latex.tpl.php'
));
$this
->
renderer
->
setOptions
(
array
(
'temp_dir'
=>
$tempDir
,
'pdflatex_path'
=>
'/usr/bin/pdflatex'
,
'lock'
=>
true
));
$headers
=
array
(
'Content-Type: application/pdf'
,
'Content-Disposition: attachment; filename=doctrine-manual.pdf'
);
break
;
case
'Xhtml'
:
default
:
$viewIndex
=
true
;
if
(
isset
(
$_GET
[
'one-page'
]))
{
$viewIndex
=
false
;
}
if
(
isset
(
$_GET
[
'chapter'
]))
{
$section
=
$this
->
toc
->
findByPath
(
$_GET
[
'chapter'
]);
if
(
$section
&&
$section
->
getLevel
()
===
1
)
{
$title
=
$this
->
renderer
->
getOption
(
'title'
)
.
' - Chapter '
.
$section
->
getIndex
()
.
' '
.
$section
->
getName
();
$this
->
renderer
->
setOptions
(
array
(
'section'
=>
$section
,
'url_prefix'
=>
'?chapter='
,
'title'
=>
$title
));
$cacheId
.=
'-'
.
$section
->
getPath
();
$viewIndex
=
false
;
}
}
break
;
}
if
(
isset
(
$viewIndex
)
&&
$viewIndex
)
{
$title
=
$this
->
renderer
->
getOption
(
'title'
);
$this
->
title
=
$title
;
}
else
{
$this
->
output
=
$cache
->
fetch
(
$cacheId
);
if
(
$this
->
output
===
false
)
{
try
{
$this
->
output
=
$this
->
renderer
->
render
();
}
catch
(
Exception
$e
)
{
die
(
$e
->
getMessage
());
}
$cache
->
save
(
$this
->
output
,
$cacheId
);
}
if
(
isset
(
$headers
))
{
foreach
(
$headers
as
$header
)
{
header
(
$header
);
}
}
}
if
(
$format
==
'Latex'
OR
$format
==
'Pdf'
)
{
echo
$this
->
output
;
exit
;
}
}
}
website/apps/frontend/modules/manual/templates/indexSuccess.php
0 → 100644
View file @
6d72afb4
<h1>
Doctrine Manual
</h1>
<p>
There are several different versions of this manual available online:
<ul>
<li>
View as
<a
href=
"?one-page"
>
all chapters in one page
</a>
.
</li>
<li>
View as
<a
href=
"?chapter=
<?php
echo
$toc
->
findByIndex
(
'1.'
)
->
getPath
();
?>
"
>
one chapter per page
</a>
.
</li>
<li>
Download the
<a
href=
"?format=pdf"
>
PDF version
</a>
.
</li>
</ul>
</p>
<?php
if
(
isset
(
$output
)
)
:
?>
<?php
echo
$output
;
?>
<?php
endif
;
?>
<?php
slot
(
'right'
);
?>
<?php
echo
$renderer
->
renderToc
();
?>
<?php
end_slot
();
?>
\ No newline at end of file
website/apps/frontend/modules/manual/templates/xhtml.tpl.php
0 → 100644
View file @
6d72afb4
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xml:lang=
"en"
lang=
"en"
>
<head>
<title>
%TITLE%
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"description"
content=
"%SUBJECT%"
/>
<meta
name=
"keywords"
content=
"%KEYWORDS"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"styles/basic.css"
media=
"screen"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"styles/print.css"
media=
"print"
/>
<!--[if gte IE 5.5]>
<![if lt IE 7]>
<link rel="stylesheet" type="text/css" href="styles/iefix.css"/>
<![endif]>
<![endif]-->
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
var
tocHideText
=
"
hide
"
;
var
tocShowText
=
"
show
"
;
var
tocStickyText
=
"
sticky
"
;
var
tocUnstickyText
=
'
unstick
'
;
//]]>
</script>
<script
type=
"text/javascript"
src=
"scripts/mootools.v1.11.js"
></script>
<script
type=
"text/javascript"
src=
"scripts/tree.js"
></script>
<script
type=
"text/javascript"
src=
"scripts/toc.js"
></script>
</head>
<body>
<div
id=
"wrap"
>
<div
id=
"sidebar"
>
<div
id=
"table-of-contents"
>
<h1>
Table of Contents
</h1>
%TOC%
<p><a
href=
"."
>
Index
</a></p>
</div>
</div>
<div
id=
"content"
>
%CONTENT%
</div>
</div>
</body>
</html>
website/config/doctrine/blog_post.yml
0 → 100644
View file @
6d72afb4
---
BlogPost
:
tableName
:
blog_post
columns
:
id
:
type
:
integer
size
:
4
primary
:
true
autoincrement
:
true
created_at
:
type
:
timestamp
updated_at
:
type
:
timestamp
name
:
type
:
string
size
:
255
slug
:
type
:
string
size
:
255
unique
:
true
body
:
type
:
clob
\ No newline at end of file
website/lib/model/doctrine/BlogPost.class.php
0 → 100644
View file @
6d72afb4
<?php
/*
* Edit this file to customise your model class
*
* auto-generated by the sfDoctrine plugin
*/
class
BlogPost
extends
BaseBlogPost
{
}
website/lib/model/doctrine/BlogPostTable.class.php
0 → 100644
View file @
6d72afb4
<?php
/*
* Edit this file to customise your model table
*
* auto-generated by the sfDoctrine plugin
*/
class
BlogPostTable
extends
Doctrine_Table
{
}
website/lib/model/doctrine/generated/BaseBlogPost.class.php
0 → 100644
View file @
6d72afb4
<?php
/*
* Base class; DO NOT EDIT
*
* auto-generated by the sfDoctrine plugin
*/
class
BaseBlogPost
extends
sfDoctrineRecord
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'blog_post'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,));
$this
->
hasColumn
(
'created_at'
,
'timestamp'
,
null
,
array
());
$this
->
hasColumn
(
'updated_at'
,
'timestamp'
,
null
,
array
());
$this
->
hasColumn
(
'name'
,
'string'
,
255
,
array
());
$this
->
hasColumn
(
'slug'
,
'string'
,
255
,
array
(
'unique'
=>
true
,));
$this
->
hasColumn
(
'body'
,
'clob'
,
null
,
array
());
}
public
function
setUp
()
{
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment